diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-08-28 00:12:18 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-08-28 00:25:13 +0200 |
commit | 70106e73c5b4157fcaed131907ed10ab2de83f5d (patch) | |
tree | 44bece35ff530da492fabaf511c98d3a35da4b0e | |
parent | 16c3ed5837884e2b60cf40e762be6c58b13d7ba6 (diff) | |
download | ffmpeg-70106e73c5b4157fcaed131907ed10ab2de83f5d.tar.gz |
cmdutils: Filter non user AVOptions out from what can be set over the command line.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | cmdutils.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/cmdutils.c b/cmdutils.c index b1d831d325..ccb2b98b2d 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -497,6 +497,15 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options) } } +static const AVOption *opt_find(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags) +{ + AVOption *o = av_opt_find(obj, name, unit, opt_flags, search_flags); + if(o && !o->flags) + return NULL; + return o; +} + #define FLAGS (o->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0 int opt_default(void *optctx, const char *opt, const char *arg) { @@ -517,14 +526,14 @@ int opt_default(void *optctx, const char *opt, const char *arg) p = opt + strlen(opt); av_strlcpy(opt_stripped, opt, FFMIN(sizeof(opt_stripped), p - opt + 1)); - if ((o = av_opt_find(&cc, opt_stripped, NULL, 0, + if ((o = opt_find(&cc, opt_stripped, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) || ((opt[0] == 'v' || opt[0] == 'a' || opt[0] == 's') && - (o = av_opt_find(&cc, opt + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ)))) { + (o = opt_find(&cc, opt + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ)))) { av_dict_set(&codec_opts, opt, arg, FLAGS); consumed = 1; } - if ((o = av_opt_find(&fc, opt, NULL, 0, + if ((o = opt_find(&fc, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) { av_dict_set(&format_opts, opt, arg, FLAGS); if (consumed) @@ -533,7 +542,7 @@ int opt_default(void *optctx, const char *opt, const char *arg) } #if CONFIG_SWSCALE sc = sws_get_class(); - if (!consumed && av_opt_find(&sc, opt, NULL, 0, + if (!consumed && opt_find(&sc, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) { // XXX we only support sws_flags, not arbitrary sws options int ret = av_opt_set(sws_opts, opt, arg, 0); @@ -546,7 +555,7 @@ int opt_default(void *optctx, const char *opt, const char *arg) #endif #if CONFIG_SWRESAMPLE swr_class = swr_get_class(); - if (!consumed && (o=av_opt_find(&swr_class, opt, NULL, 0, + if (!consumed && (o=opt_find(&swr_class, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) { struct SwrContext *swr = swr_alloc(); int ret = av_opt_set(swr, opt, arg, 0); @@ -560,7 +569,7 @@ int opt_default(void *optctx, const char *opt, const char *arg) } #endif #if CONFIG_AVRESAMPLE - if ((o=av_opt_find(&rc, opt, NULL, 0, + if ((o=opt_find(&rc, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) { av_dict_set(&resample_opts, opt, arg, FLAGS); consumed = 1; |