bool SimpleV4L2::setStandard(const QString& name) { // must be in the list return by standards() QList<SimpleV4L2::StandardInfo> stdList = standards(); foreach(SimpleV4L2::StandardInfo item, stdList) if(item.name == name) { setStandard(item); return true; } return false; }
int main(int argc, char *argv[]) { if((argc < 4)|(argc > 5)) { printf(MSG_PARAMETER); return 1; } Parameter *params; if((params = (Parameter*) calloc(1, sizeof(Parameter))) == NULL) { printf(MSG_OOM); return 2; } setStandard(params, strtof(argv[1],NULL), strtof(argv[2],NULL)); if(argc == 5) { readConfig(argv[4], params); } else { printf(MSG_CONFIG); } char *bmp_name = argv[3]; int **points; if(params->v_speed <= 0) { printf(MSG_SPEED); return 4; } if((points = (int **) malloc(sizeof(int) * 20)) == NULL) { printf(MSG_OOM); return 2; } if((points[0] = (int *)realloc(NULL, sizeof(int)*10)) == NULL) { printf(MSG_OOM); return 2; } if((points[1] = (int *)realloc(NULL, sizeof(int)*10)) == NULL) { printf(MSG_OOM); return 2; } points[0][0] = params->width / 2; points[1][0] = params->height / 2; int counter = 0; if(calculation(points, &counter, params) == 2) return 2; int drawreturn = 0; if((drawreturn = drawBitMap(bmp_name, points, &counter, params)) == 3) return 3; else if(drawreturn == 2) return 2; free(points); return 0; }