diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-12-03 21:16:46 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-12-05 03:22:04 +0100 |
commit | dff97be8084594a0bd900782ca91612680c77bbc (patch) | |
tree | 66b447cd6f534eb84a036cbc0807621e8cb23a16 /libavutil/opt.c | |
parent | 618fb9cc062c6ca1146cc90911daab5a2317b25f (diff) | |
download | ffmpeg-dff97be8084594a0bd900782ca91612680c77bbc.tar.gz |
av_opt: add av_opt_ptr() to return a pointer to a field of a object based on
an AVClass
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r-- | libavutil/opt.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c index 1d7ef38f1a..f0b5deb4f0 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -806,6 +806,14 @@ const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *pre return NULL; } +void *av_opt_ptr(const AVClass *class, void *obj, const char *name) +{ + AVOption *opt= av_opt_find2(&class, name, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ, NULL); + if(!opt) + return NULL; + return (uint8_t*)obj + opt->offset; +} + #ifdef TEST #undef printf |