mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
cmdutils: Filter non user AVOptions out from what can be set over the command line.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
16c3ed5837
commit
70106e73c5
21
cmdutils.c
21
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;
|
||||
|
Loading…
Reference in New Issue
Block a user