mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2026-04-24 08:36:01 +08:00
avcodec: add AVHWAccel.free_frame_priv callback
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user