[FFmpeg-cvslog] options: simplify av_find_opt by using av_next_option.

Anton Khirnov git at videolan.org
Sun May 1 00:27:05 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Apr 14 09:10:54 2011 +0200| [5a43bd5e2609705ee8b834c789fe93399588ca85] | committer: Anton Khirnov

options: simplify av_find_opt by using av_next_option.

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

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

diff --git a/libavutil/opt.c b/libavutil/opt.c
index f08ed8f..da71601 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -33,10 +33,9 @@
 //FIXME order them and do a bin search
 const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mask, int flags)
 {
-    AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass
-    const AVOption *o= c->option;
+    const AVOption *o = NULL;
 
-    for (; o && o->name; o++) {
+    while ((o = av_next_option(v, o))) {
         if (!strcmp(o->name, name) && (!unit || (o->unit && !strcmp(o->unit, unit))) && (o->flags & mask) == flags)
             return o;
     }



More information about the ffmpeg-cvslog mailing list