aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/decode.c
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2022-03-10 18:03:05 +0100
committerLynne <dev@lynne.ee>2023-05-29 00:41:56 +0200
commitbe07145109074e128bd7a8255d81a2b9fdcdf10b (patch)
tree30e5c99fd5e7b71a747a5d4a9443f528e7dfc1b5 /libavcodec/decode.c
parent09dc9193ea527f32e473456433c4e0c317a8f513 (diff)
downloadffmpeg-be07145109074e128bd7a8255d81a2b9fdcdf10b.tar.gz
avcodec: add AVHWAccel.free_frame_priv callback
Diffstat (limited to 'libavcodec/decode.c')
-rw-r--r--libavcodec/decode.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 9ff132a15c..a7c130207c 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1718,3 +1718,23 @@ int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
}
return 0;
}
+
+AVBufferRef *ff_hwaccel_frame_priv_alloc(AVCodecContext *avctx,
+ const AVHWAccel *hwaccel)
+{
+ AVBufferRef *ref;
+ AVHWFramesContext *frames_ctx = (AVHWFramesContext *)avctx->hw_frames_ctx->data;
+ uint8_t *data = av_mallocz(hwaccel->frame_priv_data_size);
+ if (!data)
+ return NULL;
+
+ ref = av_buffer_create(data, hwaccel->frame_priv_data_size,
+ hwaccel->free_frame_priv,
+ frames_ctx->device_ctx, 0);
+ if (!ref) {
+ av_free(data);
+ return NULL;
+ }
+
+ return ref;
+}