From patchwork Fri May 20 11:59:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: avoptions: Support getting flag values using av_get_int X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 3248 Message-Id: <1305892787-56165-1-git-send-email-martin@martin.st> To: libav-devel@libav.org Date: Fri, 20 May 2011 14:59:47 +0300 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= List-Id: libav development --- libavutil/opt.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index 57e3248..9ff0a9a 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -262,7 +262,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; @@ -278,6 +278,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;