summaryrefslogtreecommitdiffstats
path: root/libavcodec/internal.h
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2019-08-30 11:37:25 -0300
committerJames Almer <jamrial@gmail.com>2019-09-04 10:07:12 -0300
commit9ea6d2149e25d68885a24894bb911077b05388c4 (patch)
treed302ed27dd814bea2189537f62c4120f69ecb669 /libavcodec/internal.h
parent39f129593756e3e270ed3881ca076627f30e1eb7 (diff)
downloadffmpeg-streaming-9ea6d2149e25d68885a24894bb911077b05388c4.zip
ffmpeg-streaming-9ea6d2149e25d68885a24894bb911077b05388c4.tar.gz
avcodec/decode: add a flags parameter to ff_reget_buffer()
Some decoders may not need a writable buffer in some specific cases, but only a reference to the existing buffer with updated frame properties instead, for the purpose of returning duplicate frames. For this, the FF_REGET_BUFFER_FLAG_READONLY flag is added, which will prevent potential allocations and buffer copies when they are not needed. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/internal.h')
-rw-r--r--libavcodec/internal.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 5f96414..9db3d36 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -320,11 +320,12 @@ static av_always_inline float ff_exp2fi(int x) {
*/
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags);
+#define FF_REGET_BUFFER_FLAG_READONLY 1 ///< the returned buffer does not need to be writable
/**
- * Identical in function to av_frame_make_writable(), except it uses
- * ff_get_buffer() to allocate the buffer when needed.
+ * Identical in function to ff_get_buffer(), except it reuses the existing buffer
+ * if available.
*/
-int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame);
+int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags);
int ff_thread_can_start_frame(AVCodecContext *avctx);
OpenPOWER on IntegriCloud