[FFmpeg-cvslog] avutil/opt: add opt_size()
Michael Niedermayer
git at videolan.org
Sun Jun 1 21:16:08 CEST 2014
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri May 30 21:02:07 2014 +0200| [f028b7af7b785d8c69732b09cbddca61f641435a] | committer: Michael Niedermayer
avutil/opt: add opt_size()
If people want, this could be exported as av_opt_size()
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f028b7af7b785d8c69732b09cbddca61f641435a
---
libavutil/opt.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 199eadb..b4dd0fd 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1517,6 +1517,28 @@ void *av_opt_ptr(const AVClass *class, void *obj, const char *name)
return (uint8_t*)obj + opt->offset;
}
+static int opt_size(enum AVOptionType type)
+{
+ switch(type) {
+ case AV_OPT_TYPE_INT:
+ case AV_OPT_TYPE_FLAGS: return sizeof(int);
+ case AV_OPT_TYPE_DURATION:
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ case AV_OPT_TYPE_INT64: return sizeof(int64_t);
+ case AV_OPT_TYPE_DOUBLE: return sizeof(double);
+ case AV_OPT_TYPE_FLOAT: return sizeof(float);
+ case AV_OPT_TYPE_STRING: return sizeof(uint8_t*);
+ case AV_OPT_TYPE_VIDEO_RATE:
+ case AV_OPT_TYPE_RATIONAL: return sizeof(AVRational);
+ case AV_OPT_TYPE_BINARY: return sizeof(uint8_t*) + sizeof(int);
+ case AV_OPT_TYPE_IMAGE_SIZE:return sizeof(int[2]);
+ case AV_OPT_TYPE_PIXEL_FMT: return sizeof(enum AVPixelFormat);
+ case AV_OPT_TYPE_SAMPLE_FMT:return sizeof(enum AVSampleFormat);
+ case AV_OPT_TYPE_COLOR: return 4;
+ }
+ return 0;
+}
+
int av_opt_query_ranges(AVOptionRanges **ranges_arg, void *obj, const char *key, int flags)
{
int ret;
More information about the ffmpeg-cvslog
mailing list