[FFmpeg-cvslog] avoptions: Support getting flag values using av_get_int
Martin Storsjö
git at videolan.org
Sat May 21 03:44:36 CEST 2011
ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Fri May 20 14:59:47 2011 +0300| [0eed5016a27ec2f6990c426e79eb28fbf370f613] | committer: Michael Niedermayer
avoptions: Support getting flag values using av_get_int
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0eed5016a27ec2f6990c426e79eb28fbf370f613
---
libavutil/opt.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 720ad99..5976c33 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -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;
More information about the ffmpeg-cvslog
mailing list