[FFmpeg-devel] [PATCH 31/92] Vulkan patchset part 1 - common code changes

Anton Khirnov anton at khirnov.net
Mon Apr 17 12:46:43 EEST 2023


Quoting Lynne (2023-03-14 07:33:43)
> From e37330cf6a1f768c733ca6d0b23b9e5847a5fe4f Mon Sep 17 00:00:00 2001
> From: Lynne <dev at lynne.ee>
> Date: Thu, 10 Mar 2022 18:03:05 +0100
> Subject: [PATCH 25/92] avcodec: add AVHWAccel.free_frame_priv callback
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index d1ba7f167f..c4630ce275 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -1685,3 +1685,22 @@ int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
>      }
>      return 0;
>  }
> +
> +AVBufferRef *ff_alloc_hwaccel_frame_priv_data(AVCodecContext *avctx,

Sane-endian naming please. ff_hwaccel_frame_priv_alloc().

> +                                              const AVHWAccel *hwaccel)
> +{
> +    AVBufferRef *ref;
> +    uint8_t *data = av_mallocz(hwaccel->frame_priv_data_size);
> +    if (!data)
> +        return NULL;
> +
> +    ref = av_buffer_create(data, hwaccel->frame_priv_data_size,
> +                           (void (*)(void *, uint8_t *))hwaccel->free_frame_priv,

I believe the cast is UB and you should convert the arguments in the
function itself, or add a trivial wrapper here.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list