Commit a726d7fd authored by Anton Khirnov's avatar Anton Khirnov

AVOptions: in av_opt_find() don't return named constants unless unit is specified.

That is, unless the caller explicitly asks for them.

Prevents conflict between e.g. the 'loop' option in img2 demuxer and
'loop' flag in AVCodecContext.
parent ce558c8f
......@@ -573,8 +573,9 @@ const AVOption *av_opt_find(void *obj, const char *name, const char *unit,
return o;
while (o = av_next_option(obj, o)) {
if (!strcmp(o->name, name) && (!unit || (o->unit && !strcmp(o->unit, unit))) &&
(o->flags & opt_flags) == opt_flags)
if (!strcmp(o->name, name) && (o->flags & opt_flags) == opt_flags &&
((!unit && o->type != FF_OPT_TYPE_CONST) ||
(unit && o->unit && !strcmp(o->unit, unit))))
return o;
}
return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment