| 3214 | } |
| 3215 | |
| 3216 | int ffmpeg_parse_options(int argc, char **argv) |
| 3217 | { |
| 3218 | OptionParseContext octx; |
| 3219 | uint8_t error[128]; |
| 3220 | int ret; |
| 3221 | |
| 3222 | memset(&octx, 0, sizeof(octx)); |
| 3223 | |
| 3224 | /* split the commandline into an internal representation */ |
| 3225 | ret = split_commandline(&octx, argc, argv, options, groups, |
| 3226 | FF_ARRAY_ELEMS(groups)); |
| 3227 | if (ret < 0) { |
| 3228 | av_log(NULL, AV_LOG_FATAL, "Error splitting the argument list: "); |
| 3229 | goto fail; |
| 3230 | } |
| 3231 | |
| 3232 | /* apply global options */ |
| 3233 | ret = parse_optgroup(NULL, &octx.global_opts); |
| 3234 | if (ret < 0) { |
| 3235 | av_log(NULL, AV_LOG_FATAL, "Error parsing global options: "); |
| 3236 | goto fail; |
| 3237 | } |
| 3238 | |
| 3239 | /* configure terminal and setup signal handlers */ |
| 3240 | term_init(); |
| 3241 | |
| 3242 | /* open input files */ |
| 3243 | ret = open_files(&octx.groups[GROUP_INFILE], "input", open_input_file); |
| 3244 | if (ret < 0) { |
| 3245 | av_log(NULL, AV_LOG_FATAL, "Error opening input files: "); |
| 3246 | goto fail; |
| 3247 | } |
| 3248 | |
| 3249 | /* create the complex filtergraphs */ |
| 3250 | ret = init_complex_filters(); |
| 3251 | if (ret < 0) { |
| 3252 | av_log(NULL, AV_LOG_FATAL, "Error initializing complex filters.\n"); |
| 3253 | goto fail; |
| 3254 | } |
| 3255 | |
| 3256 | /* open output files */ |
| 3257 | ret = open_files(&octx.groups[GROUP_OUTFILE], "output", open_output_file); |
| 3258 | if (ret < 0) { |
| 3259 | av_log(NULL, AV_LOG_FATAL, "Error opening output files: "); |
| 3260 | goto fail; |
| 3261 | } |
| 3262 | |
| 3263 | check_filter_outputs(); |
| 3264 | |
| 3265 | fail: |
| 3266 | uninit_parse_context(&octx); |
| 3267 | if (ret < 0) { |
| 3268 | av_strerror(ret, error, sizeof(error)); |
| 3269 | av_log(NULL, AV_LOG_FATAL, "%s\n", error); |
| 3270 | } |
| 3271 | return ret; |
| 3272 | } |
| 3273 |
no test coverage detected