summaryrefslogtreecommitdiff
path: root/libavutil/opt.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-26 22:37:37 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-26 22:37:37 +0200
commit53ce9905134e042516ddd7a4476dc668c0b094c4 (patch)
tree05e80abb4ef8b78c7c93bc920b32fb34ac268cc7 /libavutil/opt.c
parenta48b890392aa22033f182421ba9e3f3b3256461d (diff)
parent154486f9adc621e620dacd76d78c30a02cc1dcd3 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: opt: Add av_opt_set_bin() avconv: Display the error returned by avformat_write_header rtpenc_chain: Return an error code instead of just a plain pointer rtpenc_chain: Free the URLContext on failure rtpenc: Expose the ssrc as an avoption avprobe: display the codec profile in show_stream() avprobe: fix function prototype cosmetics: Fix indentation avprobe: changelog entry avprobe: update documentation avprobe: provide JSON output avprobe: output proper INI format avprobe: improve formatting rtmp: fix url parsing fate: document TARGET_EXEC and its usage Conflicts: doc/APIchanges doc/fate.texi doc/ffprobe.texi ffprobe.c libavformat/version.h libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r--libavutil/opt.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 3f4a5fe957..956edf5ce7 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -323,6 +323,35 @@ int av_opt_set_q(void *obj, const char *name, AVRational val, int search_flags)
return set_number(obj, name, val.num, val.den, 1, search_flags);
}
+int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int search_flags)
+{
+ void *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+ uint8_t *ptr;
+ uint8_t **dst;
+ int *lendst;
+
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+
+ if (o->type != AV_OPT_TYPE_BINARY)
+ return AVERROR(EINVAL);
+
+ ptr = av_malloc(len);
+ if (!ptr)
+ return AVERROR(ENOMEM);
+
+ dst = (uint8_t **)(((uint8_t *)target_obj) + o->offset);
+ lendst = (int *)(dst + 1);
+
+ av_free(*dst);
+ *dst = ptr;
+ *lendst = len;
+ memcpy(ptr, val, len);
+
+ return 0;
+}
+
#if FF_API_OLD_AVOPTIONS
/**
*