]> git.sesse.net Git - ffmpeg/commitdiff
avoptions: Support getting flag values using av_get_int
authorMartin Storsjö <martin@martin.st>
Fri, 20 May 2011 11:59:47 +0000 (14:59 +0300)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 21 May 2011 01:37:43 +0000 (03:37 +0200)
libavutil/opt.c

index 720ad99e8eb5691f02a3325ac8b02d6d990ddeea..5976c3377e1423db41fa324002d6b2967ff08a3a 100644 (file)
@@ -261,7 +261,7 @@ static int av_get_number(void *obj, const char *name, const AVOption **o_out, do
 {
     const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
     void *dst;
-    if (!o || o->offset<=0)
+    if (!o || (o->offset<=0 && o->type != FF_OPT_TYPE_CONST))
         goto error;
 
     dst= ((uint8_t*)obj) + o->offset;
@@ -277,6 +277,7 @@ static int av_get_number(void *obj, const char *name, const AVOption **o_out, do
     case FF_OPT_TYPE_RATIONAL:  *intnum= ((AVRational*)dst)->num;
                                 *den   = ((AVRational*)dst)->den;
                                                         return 0;
+    case FF_OPT_TYPE_CONST:     *intnum= o->default_val.dbl;return 0;
     }
 error:
     *den=*intnum=0;