diff options
author | Lukasz Marek <lukasz.m.luki@gmail.com> | 2014-02-23 23:19:23 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-02-25 01:38:52 +0100 |
commit | 3144440004941aa22ffea9933f5e5dfe826df654 (patch) | |
tree | 2a9ad89a5f6a7ddb3b4c3151f6fa6150842dc746 /libavutil/buffer.h | |
parent | 774239be717150909219ad2c0696bfb6a50cf2cb (diff) | |
download | ffmpeg-3144440004941aa22ffea9933f5e5dfe826df654.tar.gz |
lavu/buffer: add release function
new function allows to unref buffer and obtain its data.
Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/buffer.h')
-rw-r--r-- | libavutil/buffer.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libavutil/buffer.h b/libavutil/buffer.h index b4399fd39f..8cf2cbf302 100644 --- a/libavutil/buffer.h +++ b/libavutil/buffer.h @@ -155,6 +155,18 @@ AVBufferRef *av_buffer_ref(AVBufferRef *buf); void av_buffer_unref(AVBufferRef **buf); /** + * Free a given reference and pass underlaying data to user provided pointer. + * If there is more than one reference then data is copied. + * + * @param buf the reference to be released. The pointer is set to NULL on return. + * @param data pointer to be passed with underlaying data. + * @return 0 on success, a negative AVERROR on failure. + * + * @note on error buffer is properly released and *data is set to NULL. + */ +int av_buffer_release(AVBufferRef **buf, uint8_t **data); + +/** * @return 1 if the caller may write to the data referred to by buf (which is * true if and only if buf is the only reference to the underlying AVBuffer). * Return 0 otherwise. |