MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / parse_option

Function parse_option

fftools/cmdutils.c:380–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378}
379
380int parse_option(void *optctx, const char *opt, const char *arg,
381 const OptionDef *options)
382{
383 static const OptionDef opt_avoptions = {
384 .name = "AVOption passthrough",
385 .type = OPT_TYPE_FUNC,
386 .flags = OPT_FUNC_ARG,
387 .u.func_arg = opt_default,
388 };
389
390 const OptionDef *po;
391 int ret;
392
393 po = find_option(options, opt);
394 if (!po->name && opt[0] == 'n' && opt[1] == 'o') {
395 /* handle 'no' bool option */
396 po = find_option(options, opt + 2);
397 if ((po->name && po->type == OPT_TYPE_BOOL))
398 arg = "0";
399 } else if (po->type == OPT_TYPE_BOOL)
400 arg = "1";
401
402 if (!po->name)
403 po = &opt_avoptions;
404 if (!po->name) {
405 av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt);
406 return AVERROR(EINVAL);
407 }
408 if (opt_has_arg(po) && !arg) {
409 av_log(NULL, AV_LOG_ERROR, "Missing argument for option '%s'\n", opt);
410 return AVERROR(EINVAL);
411 }
412
413 ret = write_option(optctx, po, opt, arg, options);
414 if (ret < 0)
415 return ret;
416
417 return opt_has_arg(po);
418}
419
420int parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
421 int (*parse_arg_function)(void *, const char*))

Callers 15

opt_audio_codecFunction · 0.85
opt_video_codecFunction · 0.85
opt_subtitle_codecFunction · 0.85
opt_data_codecFunction · 0.85
opt_recording_timestampFunction · 0.85
opt_targetFunction · 0.85
opt_video_framesFunction · 0.85
opt_audio_framesFunction · 0.85
opt_data_framesFunction · 0.85
opt_presetFunction · 0.85
opt_old2newFunction · 0.85
opt_qscaleFunction · 0.85

Calls 4

find_optionFunction · 0.85
av_logFunction · 0.85
opt_has_argFunction · 0.85
write_optionFunction · 0.85

Tested by

no test coverage detected