diff options
author | Lynne <dev@lynne.ee> | 2022-03-10 18:03:05 +0100 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2023-05-29 00:41:56 +0200 |
commit | be07145109074e128bd7a8255d81a2b9fdcdf10b (patch) | |
tree | 30e5c99fd5e7b71a747a5d4a9443f528e7dfc1b5 /libavcodec/decode.c | |
parent | 09dc9193ea527f32e473456433c4e0c317a8f513 (diff) | |
download | ffmpeg-be07145109074e128bd7a8255d81a2b9fdcdf10b.tar.gz |
avcodec: add AVHWAccel.free_frame_priv callback
Diffstat (limited to 'libavcodec/decode.c')
-rw-r--r-- | libavcodec/decode.c | 20 |
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; +} |