[FFmpeg-cvslog] options: stop after option is found.
Clément Bœsch
git at videolan.org
Mon Jun 4 07:47:48 CEST 2012
ffmpeg | branch: master | Clément Bœsch <clement.boesch at smartjog.com> | Wed May 30 14:40:28 2012 +0200| [e00b2d284e492e4f40dcf41392518b7a7d652901] | committer: Clément Bœsch
options: stop after option is found.
This reverts 78da04384a6c22820518706d84631006d31a85ea; it is not
required anymore since the previous commit (these extended checks were
for the -timecode option in both muxers and encoders), and reduces the
diff with the fork.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e00b2d284e492e4f40dcf41392518b7a7d652901
---
cmdutils.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/cmdutils.c b/cmdutils.c
index 95fa901..bedc15b 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -422,10 +422,10 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options)
}
}
-#define FLAGS(o) ((o)->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0
+#define FLAGS (o->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0
int opt_default(const char *opt, const char *arg)
{
- const AVOption *oc, *of, *os, *oswr = NULL;
+ const AVOption *o;
char opt_stripped[128];
const char *p;
const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class(), *sc, *swr_class;
@@ -434,18 +434,18 @@ int opt_default(const char *opt, const char *arg)
p = opt + strlen(opt);
av_strlcpy(opt_stripped, opt, FFMIN(sizeof(opt_stripped), p - opt + 1));
- if ((oc = av_opt_find(&cc, opt_stripped, NULL, 0,
+ if ((o = av_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') &&
- (oc = av_opt_find(&cc, opt + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ))))
- av_dict_set(&codec_opts, opt, arg, FLAGS(oc));
- if ((of = av_opt_find(&fc, opt, NULL, 0,
- AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)))
- av_dict_set(&format_opts, opt, arg, FLAGS(of));
+ (o = av_opt_find(&cc, opt + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ))))
+ av_dict_set(&codec_opts, opt, arg, FLAGS);
+ else if ((o = av_opt_find(&fc, opt, NULL, 0,
+ AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)))
+ av_dict_set(&format_opts, opt, arg, FLAGS);
#if CONFIG_SWSCALE
sc = sws_get_class();
- if ((os = av_opt_find(&sc, opt, NULL, 0,
- AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
+ if (!o && (o = av_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);
if (ret < 0) {
@@ -456,8 +456,8 @@ int opt_default(const char *opt, const char *arg)
#endif
#if CONFIG_SWRESAMPLE
swr_class = swr_get_class();
- if (!oc && !of && !os && (oswr = av_opt_find(&swr_class, opt, NULL, 0,
- AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
+ if (!o && (o = av_opt_find(&swr_class, opt, NULL, 0,
+ AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
int ret = av_opt_set(swr_opts, opt, arg, 0);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt);
@@ -466,7 +466,7 @@ int opt_default(const char *opt, const char *arg)
}
#endif
- if (oc || of || os || oswr)
+ if (o)
return 0;
av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt);
return AVERROR_OPTION_NOT_FOUND;
More information about the ffmpeg-cvslog
mailing list