[FFmpeg-cvslog] AVOptions: in av_opt_find() don' t return named constants unless unit is specified.

Anton Khirnov git at videolan.org
Sat Jul 9 02:09:51 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Jul  6 19:56:58 2011 +0200| [a726d7fd4e0b112b276678ea9da9c9b3097e8b8f] | committer: 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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a726d7fd4e0b112b276678ea9da9c9b3097e8b8f
---

 libavutil/opt.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 65e0213..9c601a2 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -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;



More information about the ffmpeg-cvslog mailing list