Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v4 15/16] FFHWAccel: add buffer_ref argument to start_frame
Date: Thu, 13 Mar 2025 23:08:25 +0100
Message-ID: <AS8P250MB074433BA3F1574B364006D978FD32@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20250313170355.92290-16-dev@lynne.ee>

Lynne:
> This commit adds a reference to the buffer as an argument to
> start_frame, and adapts all existing code.
> 
> This allows for asynchronous hardware accelerators to skip
> copying packet data by referencing it.
> ---
>  libavcodec/av1dec.c           |  3 ++-
>  libavcodec/d3d12va_av1.c      |  5 ++++-
>  libavcodec/d3d12va_h264.c     |  5 +++--
>  libavcodec/d3d12va_hevc.c     |  5 ++++-
>  libavcodec/d3d12va_mpeg2.c    |  5 ++++-
>  libavcodec/d3d12va_vc1.c      |  5 ++++-
>  libavcodec/d3d12va_vp9.c      |  5 ++++-
>  libavcodec/dxva2_av1.c        |  1 +
>  libavcodec/dxva2_h264.c       |  1 +
>  libavcodec/dxva2_hevc.c       |  1 +
>  libavcodec/dxva2_mpeg2.c      |  1 +
>  libavcodec/dxva2_vc1.c        |  1 +
>  libavcodec/dxva2_vp9.c        |  1 +
>  libavcodec/ffv1dec.c          |  2 +-
>  libavcodec/h263dec.c          |  2 +-
>  libavcodec/h264dec.c          |  8 +++++---
>  libavcodec/hevc/hevcdec.c     |  5 ++++-
>  libavcodec/hwaccel_internal.h |  4 +++-
>  libavcodec/mjpegdec.c         |  2 +-
>  libavcodec/mpeg12dec.c        |  2 +-
>  libavcodec/nvdec_av1.c        |  4 +++-
>  libavcodec/nvdec_h264.c       |  1 +
>  libavcodec/nvdec_hevc.c       |  1 +
>  libavcodec/nvdec_mjpeg.c      |  4 +++-
>  libavcodec/nvdec_mpeg12.c     |  3 ++-
>  libavcodec/nvdec_mpeg4.c      |  3 ++-
>  libavcodec/nvdec_vc1.c        |  3 ++-
>  libavcodec/nvdec_vp8.c        |  3 ++-
>  libavcodec/nvdec_vp9.c        |  3 ++-
>  libavcodec/proresdec.c        |  2 +-
>  libavcodec/vaapi_av1.c        |  1 +
>  libavcodec/vaapi_h264.c       |  1 +
>  libavcodec/vaapi_hevc.c       |  1 +
>  libavcodec/vaapi_mjpeg.c      |  1 +
>  libavcodec/vaapi_mpeg2.c      |  5 ++++-
>  libavcodec/vaapi_mpeg4.c      |  5 ++++-
>  libavcodec/vaapi_vc1.c        |  5 ++++-
>  libavcodec/vaapi_vp8.c        |  1 +
>  libavcodec/vaapi_vp9.c        |  1 +
>  libavcodec/vaapi_vvc.c        |  1 +
>  libavcodec/vc1dec.c           |  6 +++---
>  libavcodec/vdpau_av1.c        |  3 ++-
>  libavcodec/vdpau_h264.c       |  1 +
>  libavcodec/vdpau_hevc.c       |  1 +
>  libavcodec/vdpau_mpeg12.c     |  1 +
>  libavcodec/vdpau_mpeg4.c      |  1 +
>  libavcodec/vdpau_vc1.c        |  1 +
>  libavcodec/vdpau_vp9.c        |  3 ++-
>  libavcodec/videotoolbox.c     |  8 ++++++--
>  libavcodec/videotoolbox_av1.c |  1 +
>  libavcodec/videotoolbox_vp9.c |  1 +
>  libavcodec/vp8.c              |  2 +-
>  libavcodec/vp9.c              |  2 +-
>  libavcodec/vt_internal.h      |  1 +
>  libavcodec/vulkan_av1.c       |  1 +
>  libavcodec/vulkan_h264.c      |  1 +
>  libavcodec/vulkan_hevc.c      |  1 +
>  libavcodec/vvc/dec.c          | 12 +++++++-----
>  58 files changed, 118 insertions(+), 42 deletions(-)
> 
> diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
> index ed504ace85..baa9dea0f7 100644
> --- a/libavcodec/av1dec.c
> +++ b/libavcodec/av1dec.c
> @@ -1380,7 +1380,8 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
>              s->cur_frame.temporal_id = header->temporal_id;
>  
>              if (avctx->hwaccel && s->cur_frame.f) {
> -                ret = FF_HW_CALL(avctx, start_frame, unit->data, unit->data_size);
> +                ret = FF_HW_CALL(avctx, start_frame, s->pkt->buf,
> +                                 unit->data, unit->data_size);
>                  if (ret < 0) {
>                      av_log(avctx, AV_LOG_ERROR, "HW accel start frame fail.\n");
>                      goto end;
> diff --git a/libavcodec/d3d12va_av1.c b/libavcodec/d3d12va_av1.c
> index 4a4d207b4f..230ca243fd 100644
> --- a/libavcodec/d3d12va_av1.c
> +++ b/libavcodec/d3d12va_av1.c
> @@ -45,7 +45,10 @@ typedef struct AV1DecodePictureContext {
>      unsigned            bitstream_size;
>  } AV1DecodePictureContext;
>  
> -static int d3d12va_av1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer,  av_unused uint32_t size)
> +static int d3d12va_av1_start_frame(AVCodecContext *avctx,
> +                                   av_unused AVBufferRef *buffer_ref,
> +                                   av_unused const uint8_t *buffer,
> +                                   av_unused uint32_t size)
>  {
>      const AV1DecContext     *h       = avctx->priv_data;
>      AV1DecodePictureContext *ctx_pic = h->cur_frame.hwaccel_picture_private;
> diff --git a/libavcodec/d3d12va_h264.c b/libavcodec/d3d12va_h264.c
> index b2fe2955c8..80a1034fa5 100644
> --- a/libavcodec/d3d12va_h264.c
> +++ b/libavcodec/d3d12va_h264.c
> @@ -50,8 +50,9 @@ static void fill_slice_short(DXVA_Slice_H264_Short *slice,
>  }
>  
>  static int d3d12va_h264_start_frame(AVCodecContext *avctx,
> -                                  av_unused const uint8_t *buffer,
> -                                  av_unused uint32_t size)
> +                                    av_unused AVBufferRef *buffer_ref,
> +                                    av_unused const uint8_t *buffer,
> +                                    av_unused uint32_t size)
>  {
>      const H264Context        *h       = avctx->priv_data;
>      H264DecodePictureContext *ctx_pic = h->cur_pic_ptr->hwaccel_picture_private;
> diff --git a/libavcodec/d3d12va_hevc.c b/libavcodec/d3d12va_hevc.c
> index 7686f0eb6c..a8c80c65d9 100644
> --- a/libavcodec/d3d12va_hevc.c
> +++ b/libavcodec/d3d12va_hevc.c
> @@ -49,7 +49,10 @@ static void fill_slice_short(DXVA_Slice_HEVC_Short *slice, unsigned position, un
>      slice->wBadSliceChopping     = 0;
>  }
>  
> -static int d3d12va_hevc_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
> +static int d3d12va_hevc_start_frame(AVCodecContext *avctx,
> +                                    av_unused AVBufferRef *buffer_ref,
> +                                    av_unused const uint8_t *buffer,
> +                                    av_unused uint32_t size)
>  {
>      const HEVCContext        *h       = avctx->priv_data;
>      D3D12VADecodeContext     *ctx     = D3D12VA_DECODE_CONTEXT(avctx);
> diff --git a/libavcodec/d3d12va_mpeg2.c b/libavcodec/d3d12va_mpeg2.c
> index 86a7d97b34..2172827fd0 100644
> --- a/libavcodec/d3d12va_mpeg2.c
> +++ b/libavcodec/d3d12va_mpeg2.c
> @@ -40,7 +40,10 @@ typedef struct D3D12DecodePictureContext {
>      unsigned                bitstream_size;
>  } D3D12DecodePictureContext;
>  
> -static int d3d12va_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer,  av_unused uint32_t size)
> +static int d3d12va_mpeg2_start_frame(AVCodecContext *avctx,
> +                                     av_unused AVBufferRef *buffer_ref,
> +                                     av_unused const uint8_t *buffer,
> +                                     av_unused uint32_t size)
>  {
>      const MpegEncContext      *s       = avctx->priv_data;
>      D3D12VADecodeContext      *ctx     = D3D12VA_DECODE_CONTEXT(avctx);
> diff --git a/libavcodec/d3d12va_vc1.c b/libavcodec/d3d12va_vc1.c
> index dccc0fbffa..3fe28b3c4d 100644
> --- a/libavcodec/d3d12va_vc1.c
> +++ b/libavcodec/d3d12va_vc1.c
> @@ -41,7 +41,10 @@ typedef struct D3D12DecodePictureContext {
>      unsigned               bitstream_size;
>  } D3D12DecodePictureContext;
>  
> -static int d3d12va_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer,  av_unused uint32_t size)
> +static int d3d12va_vc1_start_frame(AVCodecContext *avctx,
> +                                   av_unused AVBufferRef *buffer_ref,
> +                                   av_unused const uint8_t *buffer,
> +                                   av_unused uint32_t size)
>  {
>      const VC1Context          *v       = avctx->priv_data;
>      D3D12VADecodeContext      *ctx     = D3D12VA_DECODE_CONTEXT(avctx);
> diff --git a/libavcodec/d3d12va_vp9.c b/libavcodec/d3d12va_vp9.c
> index 3476768e61..c10f6aec13 100644
> --- a/libavcodec/d3d12va_vp9.c
> +++ b/libavcodec/d3d12va_vp9.c
> @@ -45,7 +45,10 @@ static void fill_slice_short(DXVA_Slice_VPx_Short *slice, unsigned position, uns
>      slice->wBadSliceChopping     = 0;
>  }
>  
> -static int d3d12va_vp9_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
> +static int d3d12va_vp9_start_frame(AVCodecContext *avctx,
> +                                   av_unused AVBufferRef *buffer_ref,
> +                                   av_unused const uint8_t *buffer,
> +                                   av_unused uint32_t size)
>  {
>      const VP9SharedContext  *h       = avctx->priv_data;
>      D3D12VADecodeContext     *ctx     = D3D12VA_DECODE_CONTEXT(avctx);
> diff --git a/libavcodec/dxva2_av1.c b/libavcodec/dxva2_av1.c
> index ea97fcb87e..48569982c3 100644
> --- a/libavcodec/dxva2_av1.c
> +++ b/libavcodec/dxva2_av1.c
> @@ -272,6 +272,7 @@ int ff_dxva2_av1_fill_picture_parameters(const AVCodecContext *avctx, AVDXVACont
>  }
>  
>  static int dxva2_av1_start_frame(AVCodecContext *avctx,
> +                                 av_unused AVBufferRef *buffer_ref,
>                                   av_unused const uint8_t *buffer,
>                                   av_unused uint32_t size)
>  {
> diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
> index 0fe4152625..65b59384bc 100644
> --- a/libavcodec/dxva2_h264.c
> +++ b/libavcodec/dxva2_h264.c
> @@ -444,6 +444,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
>  
>  
>  static int dxva2_h264_start_frame(AVCodecContext *avctx,
> +                                  av_unused AVBufferRef *buffer_ref,
>                                    av_unused const uint8_t *buffer,
>                                    av_unused uint32_t size)
>  {
> diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c
> index d01d1e76e8..4f985d5927 100644
> --- a/libavcodec/dxva2_hevc.c
> +++ b/libavcodec/dxva2_hevc.c
> @@ -363,6 +363,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
>  
>  
>  static int dxva2_hevc_start_frame(AVCodecContext *avctx,
> +                                  av_unused AVBufferRef *buffer_ref,
>                                    av_unused const uint8_t *buffer,
>                                    av_unused uint32_t size)
>  {
> diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
> index d88e782414..0b30f69cac 100644
> --- a/libavcodec/dxva2_mpeg2.c
> +++ b/libavcodec/dxva2_mpeg2.c
> @@ -257,6 +257,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
>  }
>  
>  static int dxva2_mpeg2_start_frame(AVCodecContext *avctx,
> +                                   av_unused AVBufferRef *buffer_ref,
>                                     av_unused const uint8_t *buffer,
>                                     av_unused uint32_t size)
>  {
> diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c
> index a7b440c0d9..38499ebf39 100644
> --- a/libavcodec/dxva2_vc1.c
> +++ b/libavcodec/dxva2_vc1.c
> @@ -315,6 +315,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
>  }
>  
>  static int dxva2_vc1_start_frame(AVCodecContext *avctx,
> +                                 av_unused AVBufferRef *buffer_ref,
>                                   av_unused const uint8_t *buffer,
>                                   av_unused uint32_t size)
>  {
> diff --git a/libavcodec/dxva2_vp9.c b/libavcodec/dxva2_vp9.c
> index f4ab91c580..cbf0263c87 100644
> --- a/libavcodec/dxva2_vp9.c
> +++ b/libavcodec/dxva2_vp9.c
> @@ -254,6 +254,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
>  
>  
>  static int dxva2_vp9_start_frame(AVCodecContext *avctx,
> +                                 av_unused AVBufferRef *buffer_ref,
>                                   av_unused const uint8_t *buffer,
>                                   av_unused uint32_t size)
>  {
> diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
> index 387fedc79c..523b9139d8 100644
> --- a/libavcodec/ffv1dec.c
> +++ b/libavcodec/ffv1dec.c
> @@ -738,7 +738,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
>  
>      /* Start */
>      if (hwaccel) {
> -        ret = hwaccel->start_frame(avctx, avpkt->data, avpkt->size);
> +        ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size);
>          if (ret < 0)
>              return ret;
>      }
> diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
> index 982a56ae05..11f9322db8 100644
> --- a/libavcodec/h263dec.c
> +++ b/libavcodec/h263dec.c
> @@ -561,7 +561,7 @@ retry:
>          ff_thread_finish_setup(avctx);
>  
>      if (avctx->hwaccel) {
> -        ret = FF_HW_CALL(avctx, start_frame,
> +        ret = FF_HW_CALL(avctx, start_frame, avpkt->buf,

This is wrong, as the data here need not be contained in the AVPacket;
it can be data from an earlier frame in case of packed bframes. Just
pass NULL.

>                           s->gb.buffer, s->gb.buffer_end - s->gb.buffer);
>          if (ret < 0 )
>              return ret;
> diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
> index fd401027d6..d6ba55e76b 100644
> --- a/libavcodec/h264dec.c
> +++ b/libavcodec/h264dec.c
> @@ -587,7 +587,8 @@ static void debug_green_metadata(const H264SEIGreenMetaData *gm, void *logctx)
>      }
>  }
>  
> -static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
> +static int decode_nal_units(H264Context *h, AVBufferRef *buf_ref,
> +                            const uint8_t *buf, int buf_size)
>  {
>      AVCodecContext *const avctx = h->avctx;
>      int nals_needed = 0; ///< number of NALs that need decoding before the next frame thread starts
> @@ -668,7 +669,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
>                  }
>  
>                  if (h->avctx->hwaccel &&
> -                    (ret = FF_HW_CALL(h->avctx, start_frame, buf, buf_size)) < 0)
> +                    (ret = FF_HW_CALL(h->avctx, start_frame, buf_ref,
> +                                      buf, buf_size)) < 0)
>                      goto end;
>              }
>  
> @@ -1053,7 +1055,7 @@ static int h264_decode_frame(AVCodecContext *avctx, AVFrame *pict,
>                                              avctx->err_recognition, avctx);
>      }
>  
> -    buf_index = decode_nal_units(h, buf, buf_size);
> +    buf_index = decode_nal_units(h, avpkt->buf, buf, buf_size);
>      if (buf_index < 0)
>          return AVERROR_INVALIDDATA;
>  
> diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
> index da8fdc5935..20ef821819 100644
> --- a/libavcodec/hevc/hevcdec.c
> +++ b/libavcodec/hevc/hevcdec.c
> @@ -3401,7 +3401,10 @@ static int hevc_frame_start(HEVCContext *s, HEVCLayerContext *l,
>          goto fail;
>  
>      if (s->avctx->hwaccel) {
> -        ret = FF_HW_CALL(s->avctx, start_frame, NULL, 0);
> +        AVCodecInternal *avci = s->avctx->internal;
> +        AVPacket *avpkt = avci->in_pkt;
> +        ret = FF_HW_CALL(s->avctx, start_frame,
> +                         avpkt->buf, NULL, 0);
>          if (ret < 0)
>              goto fail;
>      }
> diff --git a/libavcodec/hwaccel_internal.h b/libavcodec/hwaccel_internal.h
> index 77df4e0904..4eb74f0b34 100644
> --- a/libavcodec/hwaccel_internal.h
> +++ b/libavcodec/hwaccel_internal.h
> @@ -52,11 +52,13 @@ typedef struct FFHWAccel {
>       * Otherwise, this means the whole frame is available at this point.
>       *
>       * @param avctx the codec context
> +     * @param buf_ref the frame data buffer reference (optional)
>       * @param buf the frame data buffer base
>       * @param buf_size the size of the frame in bytes
>       * @return zero if successful, a negative value otherwise
>       */
> -    int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
> +    int (*start_frame)(AVCodecContext *avctx, AVBufferRef *buf_ref,

const AVBufferRef*, we are not passing ownership

Why did you not make this the last parameter (given that only very few
hwaccels will access it)?

> +                       const uint8_t *buf, uint32_t buf_size);
>  
>      /**
>       * Callback for parameter data (SPS/PPS/VPS etc).
> diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
> index bd1b502e50..f3d940671e 100644
> --- a/libavcodec/mjpegdec.c
> +++ b/libavcodec/mjpegdec.c
> @@ -808,7 +808,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
>          if (!s->hwaccel_picture_private)
>              return AVERROR(ENOMEM);
>  
> -        ret = hwaccel->start_frame(s->avctx, s->raw_image_buffer,
> +        ret = hwaccel->start_frame(s->avctx, NULL, s->raw_image_buffer,
>                                     s->raw_image_buffer_size);
>          if (ret < 0)
>              return ret;
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index ffe0710470..c21f220680 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -1361,7 +1361,7 @@ static int mpeg_field_start(Mpeg1Context *s1, const uint8_t *buf, int buf_size)
>      }
>  
>      if (avctx->hwaccel) {
> -        if ((ret = FF_HW_CALL(avctx, start_frame, buf, buf_size)) < 0)
> +        if ((ret = FF_HW_CALL(avctx, start_frame, NULL, buf, buf_size)) < 0)
>              return ret;
>      } else if (s->codec_tag == MKTAG('V', 'C', 'R', '2')) {
>          // Exchange UV
> diff --git a/libavcodec/nvdec_av1.c b/libavcodec/nvdec_av1.c
> index 6b408edb87..9b9be702d5 100644
> --- a/libavcodec/nvdec_av1.c
> +++ b/libavcodec/nvdec_av1.c
> @@ -39,7 +39,9 @@ static int get_bit_depth_from_seq(const AV1RawSequenceHeader *seq)
>          return 8;
>  }
>  
> -static int nvdec_av1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
> +static int nvdec_av1_start_frame(AVCodecContext *avctx,
> +                                 AVBufferRef *buffer_ref,
> +                                 const uint8_t *buffer, uint32_t size)
>  {
>      const AV1DecContext *s = avctx->priv_data;
>      const AV1RawSequenceHeader *seq = s->raw_seq;
> diff --git a/libavcodec/nvdec_h264.c b/libavcodec/nvdec_h264.c
> index 1ae3dfd032..b11688c638 100644
> --- a/libavcodec/nvdec_h264.c
> +++ b/libavcodec/nvdec_h264.c
> @@ -47,6 +47,7 @@ static void dpb_add(const H264Context *h, CUVIDH264DPBENTRY *dst, const H264Pict
>  }
>  
>  static int nvdec_h264_start_frame(AVCodecContext *avctx,
> +                                  AVBufferRef *buffer_ref,
>                                    const uint8_t *buffer, uint32_t size)
>  {
>      const H264Context *h = avctx->priv_data;
> diff --git a/libavcodec/nvdec_hevc.c b/libavcodec/nvdec_hevc.c
> index e01ce4c782..0de8d7b494 100644
> --- a/libavcodec/nvdec_hevc.c
> +++ b/libavcodec/nvdec_hevc.c
> @@ -70,6 +70,7 @@ static void fill_scaling_lists(CUVIDHEVCPICPARAMS *ppc, const HEVCContext *s)
>  }
>  
>  static int nvdec_hevc_start_frame(AVCodecContext *avctx,
> +                                  AVBufferRef *buffer_ref,
>                                    const uint8_t *buffer, uint32_t size)
>  {
>      const HEVCContext *s = avctx->priv_data;
> diff --git a/libavcodec/nvdec_mjpeg.c b/libavcodec/nvdec_mjpeg.c
> index 850634bf1a..6239264956 100644
> --- a/libavcodec/nvdec_mjpeg.c
> +++ b/libavcodec/nvdec_mjpeg.c
> @@ -27,7 +27,9 @@
>  #include "decode.h"
>  #include "hwaccel_internal.h"
>  
> -static int nvdec_mjpeg_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
> +static int nvdec_mjpeg_start_frame(AVCodecContext *avctx,
> +                                   AVBufferRef *buffer_ref,
> +                                   const uint8_t *buffer, uint32_t size)
>  {
>      MJpegDecodeContext *s = avctx->priv_data;
>  
> diff --git a/libavcodec/nvdec_mpeg12.c b/libavcodec/nvdec_mpeg12.c
> index 99b2b14f1f..f393756df3 100644
> --- a/libavcodec/nvdec_mpeg12.c
> +++ b/libavcodec/nvdec_mpeg12.c
> @@ -30,7 +30,8 @@
>  #include "nvdec.h"
>  #include "decode.h"
>  
> -static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
> +static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, AVBufferRef *buffer_ref,
> +                                    const uint8_t *buffer, uint32_t size)
>  {
>      MpegEncContext *s = avctx->priv_data;
>  
> diff --git a/libavcodec/nvdec_mpeg4.c b/libavcodec/nvdec_mpeg4.c
> index 80da11b5b1..bda4e4eb24 100644
> --- a/libavcodec/nvdec_mpeg4.c
> +++ b/libavcodec/nvdec_mpeg4.c
> @@ -28,7 +28,8 @@
>  #include "decode.h"
>  #include "hwaccel_internal.h"
>  
> -static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
> +static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, AVBufferRef *buffer_ref,
> +                                   const uint8_t *buffer, uint32_t size)
>  {
>      Mpeg4DecContext *m = avctx->priv_data;
>      MpegEncContext *s = &m->m;
> diff --git a/libavcodec/nvdec_vc1.c b/libavcodec/nvdec_vc1.c
> index fbfba1ecb4..25eb0afb04 100644
> --- a/libavcodec/nvdec_vc1.c
> +++ b/libavcodec/nvdec_vc1.c
> @@ -29,7 +29,8 @@
>  #include "decode.h"
>  #include "vc1.h"
>  
> -static int nvdec_vc1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
> +static int nvdec_vc1_start_frame(AVCodecContext *avctx, AVBufferRef *buffer_ref,
> +                                 const uint8_t *buffer, uint32_t size)
>  {
>      VC1Context *v = avctx->priv_data;
>      MpegEncContext *s = &v->s;
> diff --git a/libavcodec/nvdec_vp8.c b/libavcodec/nvdec_vp8.c
> index ff3b3f259c..ab9dbac7dd 100644
> --- a/libavcodec/nvdec_vp8.c
> +++ b/libavcodec/nvdec_vp8.c
> @@ -32,7 +32,8 @@ static unsigned char safe_get_ref_idx(VP8Frame *frame)
>      return frame ? ff_nvdec_get_ref_idx(frame->tf.f) : 255;
>  }
>  
> -static int nvdec_vp8_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
> +static int nvdec_vp8_start_frame(AVCodecContext *avctx, AVBufferRef *buffer_ref,
> +                                 const uint8_t *buffer, uint32_t size)
>  {
>      VP8Context *h = avctx->priv_data;
>  
> diff --git a/libavcodec/nvdec_vp9.c b/libavcodec/nvdec_vp9.c
> index e196391c6d..0070a90410 100644
> --- a/libavcodec/nvdec_vp9.c
> +++ b/libavcodec/nvdec_vp9.c
> @@ -29,7 +29,8 @@
>  #include "internal.h"
>  #include "vp9shared.h"
>  
> -static int nvdec_vp9_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
> +static int nvdec_vp9_start_frame(AVCodecContext *avctx, AVBufferRef *buffer_ref,
> +                                 const uint8_t *buffer, uint32_t size)
>  {
>      VP9SharedContext *h = avctx->priv_data;
>      const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(avctx->sw_pix_fmt);
> diff --git a/libavcodec/proresdec.c b/libavcodec/proresdec.c
> index 01caa611a0..edc46e1442 100644
> --- a/libavcodec/proresdec.c
> +++ b/libavcodec/proresdec.c
> @@ -793,7 +793,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
>  
>      if (HWACCEL_MAX && avctx->hwaccel) {
>          const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel);
> -        ret = hwaccel->start_frame(avctx, NULL, 0);
> +        ret = hwaccel->start_frame(avctx, avpkt->buf, NULL, 0);

Passing an AVBufferRef for NULL data seems fishy.

>          if (ret < 0)
>              return ret;
>          ret = hwaccel->decode_slice(avctx, avpkt->data, avpkt->size);
> diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
> index 5451b6055b..67cf479973 100644
> --- a/libavcodec/vaapi_av1.c
> +++ b/libavcodec/vaapi_av1.c
> @@ -108,6 +108,7 @@ static int vaapi_av1_decode_uninit(AVCodecContext *avctx)
>  
>  
>  static int vaapi_av1_start_frame(AVCodecContext *avctx,
> +                                 av_unused AVBufferRef *buffer_ref,
>                                   av_unused const uint8_t *buffer,
>                                   av_unused uint32_t size)
>  {
> diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
> index 398e92568c..265cec01a4 100644
> --- a/libavcodec/vaapi_h264.c
> +++ b/libavcodec/vaapi_h264.c
> @@ -232,6 +232,7 @@ static void fill_vaapi_plain_pred_weight_table(const H264Context *h,
>  
>  /** Initialize and start decoding a frame with VA API. */
>  static int vaapi_h264_start_frame(AVCodecContext          *avctx,
> +                                  av_unused AVBufferRef   *buffer_ref,
>                                    av_unused const uint8_t *buffer,
>                                    av_unused uint32_t       size)
>  {
> diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
> index 0c5a829220..cb3f41f49c 100644
> --- a/libavcodec/vaapi_hevc.c
> +++ b/libavcodec/vaapi_hevc.c
> @@ -122,6 +122,7 @@ static void fill_vaapi_reference_frames(const HEVCContext *h, const HEVCLayerCon
>  }
>  
>  static int vaapi_hevc_start_frame(AVCodecContext          *avctx,
> +                                  av_unused AVBufferRef   *buffer_ref,
>                                    av_unused const uint8_t *buffer,
>                                    av_unused uint32_t       size)
>  {
> diff --git a/libavcodec/vaapi_mjpeg.c b/libavcodec/vaapi_mjpeg.c
> index 9557cf5f9b..acc278fa36 100644
> --- a/libavcodec/vaapi_mjpeg.c
> +++ b/libavcodec/vaapi_mjpeg.c
> @@ -24,6 +24,7 @@
>  #include "mjpegdec.h"
>  
>  static int vaapi_mjpeg_start_frame(AVCodecContext          *avctx,
> +                                   av_unused AVBufferRef   *buffer_ref,
>                                     av_unused const uint8_t *buffer,
>                                     av_unused uint32_t       size)
>  {
> diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
> index d4304dfdd1..46c8476366 100644
> --- a/libavcodec/vaapi_mpeg2.c
> +++ b/libavcodec/vaapi_mpeg2.c
> @@ -39,7 +39,10 @@ static inline int mpeg2_get_is_frame_start(const MpegEncContext *s)
>      return s->first_field || s->picture_structure == PICT_FRAME;
>  }
>  
> -static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
> +static int vaapi_mpeg2_start_frame(AVCodecContext *avctx,
> +                                   av_unused AVBufferRef *buffer_ref,
> +                                   av_unused const uint8_t *buffer,
> +                                   av_unused uint32_t size)
>  {
>      const MpegEncContext *s = avctx->priv_data;
>      VAAPIDecodePicture *pic = s->cur_pic.ptr->hwaccel_picture_private;
> diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
> index 2c9dfbe42f..9aebabfe02 100644
> --- a/libavcodec/vaapi_mpeg4.c
> +++ b/libavcodec/vaapi_mpeg4.c
> @@ -45,7 +45,10 @@ static int mpeg4_get_intra_dc_vlc_thr(Mpeg4DecContext *s)
>      return 0;
>  }
>  
> -static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
> +static int vaapi_mpeg4_start_frame(AVCodecContext *avctx,
> +                                   av_unused AVBufferRef *buffer_ref,
> +                                   av_unused const uint8_t *buffer,
> +                                   av_unused uint32_t size)
>  {
>      Mpeg4DecContext *ctx = avctx->priv_data;
>      MpegEncContext *s = &ctx->m;
> diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
> index 7d001882fd..52d5d40e78 100644
> --- a/libavcodec/vaapi_vc1.c
> +++ b/libavcodec/vaapi_vc1.c
> @@ -249,7 +249,10 @@ static inline void vc1_pack_bitplanes(uint8_t *bitplane, int n, const uint8_t *f
>      bitplane[bitplane_index] = (bitplane[bitplane_index] << 4) | v;
>  }
>  
> -static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
> +static int vaapi_vc1_start_frame(AVCodecContext *avctx,
> +                                 av_unused AVBufferRef *buffer_ref,
> +                                 av_unused const uint8_t *buffer,
> +                                 av_unused uint32_t size)
>  {
>      const VC1Context *v = avctx->priv_data;
>      const MpegEncContext *s = &v->s;
> diff --git a/libavcodec/vaapi_vp8.c b/libavcodec/vaapi_vp8.c
> index 66fdde1f39..cac95b0f1a 100644
> --- a/libavcodec/vaapi_vp8.c
> +++ b/libavcodec/vaapi_vp8.c
> @@ -32,6 +32,7 @@ static VASurfaceID vaapi_vp8_surface_id(VP8Frame *vf)
>  }
>  
>  static int vaapi_vp8_start_frame(AVCodecContext          *avctx,
> +                                 av_unused AVBufferRef   *buffer_ref,
>                                   av_unused const uint8_t *buffer,
>                                   av_unused uint32_t       size)
>  {
> diff --git a/libavcodec/vaapi_vp9.c b/libavcodec/vaapi_vp9.c
> index a28fc75a59..7b2f56f6bf 100644
> --- a/libavcodec/vaapi_vp9.c
> +++ b/libavcodec/vaapi_vp9.c
> @@ -35,6 +35,7 @@ static VASurfaceID vaapi_vp9_surface_id(const VP9Frame *vf)
>  }
>  
>  static int vaapi_vp9_start_frame(AVCodecContext          *avctx,
> +                                 av_unused AVBufferRef   *buffer_ref,
>                                   av_unused const uint8_t *buffer,
>                                   av_unused uint32_t       size)
>  {
> diff --git a/libavcodec/vaapi_vvc.c b/libavcodec/vaapi_vvc.c
> index 310b56e5a4..d3986081c1 100644
> --- a/libavcodec/vaapi_vvc.c
> +++ b/libavcodec/vaapi_vvc.c
> @@ -80,6 +80,7 @@ static void fill_vaapi_reference_frames(const VVCFrameContext *h, VAPictureParam
>  }
>  
>  static int vaapi_vvc_start_frame(AVCodecContext          *avctx,
> +                                 av_unused AVBufferRef   *buffer_ref,
>                                   av_unused const uint8_t *buffer,
>                                   av_unused uint32_t       size)
>  {
> diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
> index d92a7da8ab..76a6f5f304 100644
> --- a/libavcodec/vc1dec.c
> +++ b/libavcodec/vc1dec.c
> @@ -1088,7 +1088,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict,
>          if (v->field_mode && buf_start_second_field) {
>              // decode first field
>              s->picture_structure = PICT_BOTTOM_FIELD - v->tff;
> -            ret = hwaccel->start_frame(avctx, buf_start,
> +            ret = hwaccel->start_frame(avctx, avpkt->buf, buf_start,
>                                         buf_start_second_field - buf_start);
>              if (ret < 0)
>                  goto err;
> @@ -1143,7 +1143,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict,
>              }
>              v->s.cur_pic.ptr->f->pict_type = v->s.pict_type;
>  
> -            ret = hwaccel->start_frame(avctx, buf_start_second_field,
> +            ret = hwaccel->start_frame(avctx, avpkt->buf, buf_start_second_field,
>                                         (buf + buf_size) - buf_start_second_field);
>              if (ret < 0)
>                  goto err;
> @@ -1186,7 +1186,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict,
>                  goto err;
>          } else {
>              s->picture_structure = PICT_FRAME;
> -            ret = hwaccel->start_frame(avctx, buf_start,
> +            ret = hwaccel->start_frame(avctx, avpkt->buf, buf_start,
>                                         (buf + buf_size) - buf_start);
>              if (ret < 0)
>                  goto err;
> diff --git a/libavcodec/vdpau_av1.c b/libavcodec/vdpau_av1.c
> index a1aff79bb7..2474312808 100644
> --- a/libavcodec/vdpau_av1.c
> +++ b/libavcodec/vdpau_av1.c
> @@ -41,7 +41,8 @@ static int get_bit_depth_from_seq(const AV1RawSequenceHeader *seq)
>  }
>  
>  static int vdpau_av1_start_frame(AVCodecContext *avctx,
> -                                  const uint8_t *buffer, uint32_t size)
> +                                 AVBufferRef *buffer_ref,
> +                                 const uint8_t *buffer, uint32_t size)
>  {
>      AV1DecContext *s = avctx->priv_data;
>      const AV1RawSequenceHeader *seq = s->raw_seq;
> diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c
> index 9c08e4048c..859d3c1424 100644
> --- a/libavcodec/vdpau_h264.c
> +++ b/libavcodec/vdpau_h264.c
> @@ -118,6 +118,7 @@ static void vdpau_h264_set_reference_frames(AVCodecContext *avctx)
>  }
>  
>  static int vdpau_h264_start_frame(AVCodecContext *avctx,
> +                                  AVBufferRef *buffer_ref,
>                                    const uint8_t *buffer, uint32_t size)
>  {
>      H264Context * const h = avctx->priv_data;
> diff --git a/libavcodec/vdpau_hevc.c b/libavcodec/vdpau_hevc.c
> index 0ddcafd897..0e3b721f0d 100644
> --- a/libavcodec/vdpau_hevc.c
> +++ b/libavcodec/vdpau_hevc.c
> @@ -32,6 +32,7 @@
>  
>  
>  static int vdpau_hevc_start_frame(AVCodecContext *avctx,
> +                                  AVBufferRef *buffer_ref,
>                                    const uint8_t *buffer, uint32_t size)
>  {
>      HEVCContext *h = avctx->priv_data;
> diff --git a/libavcodec/vdpau_mpeg12.c b/libavcodec/vdpau_mpeg12.c
> index 1ce0bfaa07..8b62edf38a 100644
> --- a/libavcodec/vdpau_mpeg12.c
> +++ b/libavcodec/vdpau_mpeg12.c
> @@ -32,6 +32,7 @@
>  #include "vdpau_internal.h"
>  
>  static int vdpau_mpeg_start_frame(AVCodecContext *avctx,
> +                                  AVBufferRef *buffer_ref,
>                                    const uint8_t *buffer, uint32_t size)
>  {
>      MpegEncContext * const s = avctx->priv_data;
> diff --git a/libavcodec/vdpau_mpeg4.c b/libavcodec/vdpau_mpeg4.c
> index 40af8655cc..f73a71bf29 100644
> --- a/libavcodec/vdpau_mpeg4.c
> +++ b/libavcodec/vdpau_mpeg4.c
> @@ -30,6 +30,7 @@
>  #include "vdpau_internal.h"
>  
>  static int vdpau_mpeg4_start_frame(AVCodecContext *avctx,
> +                                   AVBufferRef *buffer_ref,
>                                     const uint8_t *buffer, uint32_t size)
>  {
>      Mpeg4DecContext *ctx = avctx->priv_data;
> diff --git a/libavcodec/vdpau_vc1.c b/libavcodec/vdpau_vc1.c
> index 20208c6dbc..17f60949be 100644
> --- a/libavcodec/vdpau_vc1.c
> +++ b/libavcodec/vdpau_vc1.c
> @@ -32,6 +32,7 @@
>  #include "vdpau_internal.h"
>  
>  static int vdpau_vc1_start_frame(AVCodecContext *avctx,
> +                                 AVBufferRef *buffer_ref,
>                                   const uint8_t *buffer, uint32_t size)
>  {
>      VC1Context * const v  = avctx->priv_data;
> diff --git a/libavcodec/vdpau_vp9.c b/libavcodec/vdpau_vp9.c
> index 424e2e60fb..a89b325e39 100644
> --- a/libavcodec/vdpau_vp9.c
> +++ b/libavcodec/vdpau_vp9.c
> @@ -29,7 +29,8 @@
>  #include "vdpau_internal.h"
>  
>  static int vdpau_vp9_start_frame(AVCodecContext *avctx,
> -                                  const uint8_t *buffer, uint32_t size)
> +                                 AVBufferRef *buffer_ref,
> +                                 const uint8_t *buffer, uint32_t size)
>  {
>      VP9Context *s = avctx->priv_data;
>      VP9SharedContext *h = &(s->s);
> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> index a606c29ded..a8a0bd3e18 100644
> --- a/libavcodec/videotoolbox.c
> +++ b/libavcodec/videotoolbox.c
> @@ -415,6 +415,7 @@ CFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx)
>  }
>  
>  int ff_videotoolbox_h264_start_frame(AVCodecContext *avctx,
> +                                     AVBufferRef *buffer_ref,
>                                       const uint8_t *buffer,
>                                       uint32_t size)
>  {
> @@ -1084,6 +1085,7 @@ static int videotoolbox_h264_end_frame(AVCodecContext *avctx)
>  }
>  
>  static int videotoolbox_hevc_start_frame(AVCodecContext *avctx,
> +                                         AVBufferRef *buffer_ref,
>                                           const uint8_t *buffer,
>                                           uint32_t size)
>  {
> @@ -1127,6 +1129,7 @@ static int videotoolbox_hevc_end_frame(AVCodecContext *avctx)
>  }
>  
>  static int videotoolbox_mpeg_start_frame(AVCodecContext *avctx,
> +                                         AVBufferRef *buffer_ref,
>                                           const uint8_t *buffer,
>                                           uint32_t size)
>  {
> @@ -1151,8 +1154,9 @@ static int videotoolbox_mpeg_end_frame(AVCodecContext *avctx)
>  }
>  
>  static int videotoolbox_prores_start_frame(AVCodecContext *avctx,
> -                                         const uint8_t *buffer,
> -                                         uint32_t size)
> +                                           AVBufferRef *buffer_ref,
> +                                           const uint8_t *buffer,
> +                                           uint32_t size)
>  {
>      return 0;
>  }
> diff --git a/libavcodec/videotoolbox_av1.c b/libavcodec/videotoolbox_av1.c
> index b4d39194d5..db360cf596 100644
> --- a/libavcodec/videotoolbox_av1.c
> +++ b/libavcodec/videotoolbox_av1.c
> @@ -63,6 +63,7 @@ CFDataRef ff_videotoolbox_av1c_extradata_create(AVCodecContext *avctx)
>  
>  
>  static int videotoolbox_av1_start_frame(AVCodecContext *avctx,
> +                                        AVBufferRef *buffer_ref,
>                                          const uint8_t *buffer,
>                                          uint32_t size)
>  {
> diff --git a/libavcodec/videotoolbox_vp9.c b/libavcodec/videotoolbox_vp9.c
> index da94ff4e54..0dc1142fca 100644
> --- a/libavcodec/videotoolbox_vp9.c
> +++ b/libavcodec/videotoolbox_vp9.c
> @@ -104,6 +104,7 @@ CFDataRef ff_videotoolbox_vpcc_extradata_create(AVCodecContext *avctx)
>  }
>  
>  static int videotoolbox_vp9_start_frame(AVCodecContext *avctx,
> +                                        AVBufferRef *buffer_ref,
>                                          const uint8_t *buffer,
>                                          uint32_t size)
>  {
> diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
> index 348744efd6..c42170519f 100644
> --- a/libavcodec/vp8.c
> +++ b/libavcodec/vp8.c
> @@ -2729,7 +2729,7 @@ int vp78_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame,
>  
>      if (!is_vp7 && avctx->hwaccel) {
>          const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel);
> -        ret = hwaccel->start_frame(avctx, avpkt->data, avpkt->size);
> +        ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size);
>          if (ret < 0)
>              goto err;
>  
> diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
> index 83cd8a1565..b9ff3dcebd 100644
> --- a/libavcodec/vp9.c
> +++ b/libavcodec/vp9.c
> @@ -1618,7 +1618,7 @@ static int vp9_decode_frame(AVCodecContext *avctx, AVFrame *frame,
>  
>      if (avctx->hwaccel) {
>          const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel);
> -        ret = hwaccel->start_frame(avctx, NULL, 0);
> +        ret = hwaccel->start_frame(avctx, pkt->buf, NULL, 0);
>          if (ret < 0)
>              return ret;
>          ret = hwaccel->decode_slice(avctx, pkt->data, pkt->size);
> diff --git a/libavcodec/vt_internal.h b/libavcodec/vt_internal.h
> index effa96fc15..7fa5ebf2d5 100644
> --- a/libavcodec/vt_internal.h
> +++ b/libavcodec/vt_internal.h
> @@ -61,6 +61,7 @@ int ff_videotoolbox_buffer_append(VTContext *vtctx,
>                                    uint32_t size);
>  int ff_videotoolbox_uninit(AVCodecContext *avctx);
>  int ff_videotoolbox_h264_start_frame(AVCodecContext *avctx,
> +                                     AVBufferRef *buffer_ref,
>                                       const uint8_t *buffer,
>                                       uint32_t size);
>  int ff_videotoolbox_h264_decode_slice(AVCodecContext *avctx,
> diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c
> index 7dd7b204d7..33bb60a164 100644
> --- a/libavcodec/vulkan_av1.c
> +++ b/libavcodec/vulkan_av1.c
> @@ -236,6 +236,7 @@ static int vk_av1_create_params(AVCodecContext *avctx, AVBufferRef **buf)
>  }
>  
>  static int vk_av1_start_frame(AVCodecContext          *avctx,
> +                              av_unused AVBufferRef   *buffer_ref,
>                                av_unused const uint8_t *buffer,
>                                av_unused uint32_t       size)
>  {
> diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c
> index 71cf2c3ad7..f50f76e680 100644
> --- a/libavcodec/vulkan_h264.c
> +++ b/libavcodec/vulkan_h264.c
> @@ -359,6 +359,7 @@ static int vk_h264_create_params(AVCodecContext *avctx, AVBufferRef **buf)
>  }
>  
>  static int vk_h264_start_frame(AVCodecContext          *avctx,
> +                               av_unused AVBufferRef   *buffer_ref,
>                                 av_unused const uint8_t *buffer,
>                                 av_unused uint32_t       size)
>  {
> diff --git a/libavcodec/vulkan_hevc.c b/libavcodec/vulkan_hevc.c
> index a5bcd88e2d..bbc36dc657 100644
> --- a/libavcodec/vulkan_hevc.c
> +++ b/libavcodec/vulkan_hevc.c
> @@ -709,6 +709,7 @@ static int vk_hevc_create_params(AVCodecContext *avctx, AVBufferRef **buf)
>  }
>  
>  static int vk_hevc_start_frame(AVCodecContext          *avctx,
> +                               av_unused AVBufferRef   *buffer_ref,
>                                 av_unused const uint8_t *buffer,
>                                 av_unused uint32_t       size)
>  {
> diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
> index f860e116ab..0b6443a112 100644
> --- a/libavcodec/vvc/dec.c
> +++ b/libavcodec/vvc/dec.c
> @@ -831,7 +831,8 @@ static int frame_setup(VVCFrameContext *fc, VVCContext *s)
>      return 0;
>  }
>  
> -static int decode_slice(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, const CodedBitstreamUnit *unit)
> +static int decode_slice(VVCContext *s, VVCFrameContext *fc, AVBufferRef *buf_ref,
> +                        const H2645NAL *nal, const CodedBitstreamUnit *unit)
>  {
>      int ret;
>      SliceContext *sc;
> @@ -860,7 +861,7 @@ static int decode_slice(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal,
>  
>      if (s->avctx->hwaccel) {
>          if (is_first_slice) {
> -            ret = FF_HW_CALL(s->avctx, start_frame, NULL, 0);
> +            ret = FF_HW_CALL(s->avctx, start_frame, buf_ref, NULL, 0);
>              if (ret < 0)
>                  return ret;
>          }
> @@ -876,7 +877,8 @@ static int decode_slice(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal,
>      return 0;
>  }
>  
> -static int decode_nal_unit(VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, const CodedBitstreamUnit *unit)
> +static int decode_nal_unit(VVCContext *s, VVCFrameContext *fc, AVBufferRef *buf_ref,
> +                           const H2645NAL *nal, const CodedBitstreamUnit *unit)
>  {
>      int  ret;
>  
> @@ -902,7 +904,7 @@ static int decode_nal_unit(VVCContext *s, VVCFrameContext *fc, const H2645NAL *n
>      case VVC_IDR_N_LP:
>      case VVC_CRA_NUT:
>      case VVC_GDR_NUT:
> -        ret = decode_slice(s, fc, nal, unit);
> +        ret = decode_slice(s, fc, buf_ref, nal, unit);
>          if (ret < 0)
>              return ret;
>          break;
> @@ -940,7 +942,7 @@ static int decode_nal_units(VVCContext *s, VVCFrameContext *fc, AVPacket *avpkt)
>          if (unit->type == VVC_EOB_NUT || unit->type == VVC_EOS_NUT) {
>              s->last_eos = 1;
>          } else {
> -            ret = decode_nal_unit(s, fc, nal, unit);
> +            ret = decode_nal_unit(s, fc, avpkt->buf, nal, unit);
>              if (ret < 0) {
>                  av_log(s->avctx, AV_LOG_WARNING,
>                          "Error parsing NAL unit #%d.\n", i);

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2025-03-13 22:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13 17:03 [FFmpeg-devel] [PATCH v4 00/16] Add a Vulkan compute based FFv1 hwaccel Lynne
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 01/16] pixfmt: add AV_PIX_FMT_GBRAP32 Lynne
2025-03-14 15:13   ` Michael Niedermayer
2025-03-14 15:59     ` Lynne
2025-03-14 18:34       ` Marton Balint
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 02/16] vulkan: rename ff_vk_set_descriptor_image to ff_vk_shader_update_img Lynne
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 03/16] vulkan: add ff_vk_create_imageview Lynne
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 04/16] vulkan: copy host-mapping buffer code from hwcontext Lynne
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 05/16] hwcontext_vulkan: use the common host map function to map frame data Lynne
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 06/16] vulkan: workaround BGR storage image undefined behaviour Lynne
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 07/16] vulkan_decode: support software-defined decoders Lynne
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 08/16] vulkan_decode: support multiple image views Lynne
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 09/16] vulkan_decode: adjust number of async contexts created Lynne
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 10/16] ffv1enc_vulkan: refactor shaders slightly to support sharing Lynne
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 11/16] vulkan: unify handling of BGR and simplify ffv1_rct Lynne
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 12/16] vulkan: add ff_vk_exec_add_dep_wait_sem() Lynne
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 13/16] vulkan: add support for AV_PIX_FMT_GBRAP32 Lynne
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 14/16] ffv1dec: add support for hwaccels Lynne
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 15/16] FFHWAccel: add buffer_ref argument to start_frame Lynne
2025-03-13 22:08   ` Andreas Rheinhardt [this message]
2025-03-13 23:03     ` Lynne
2025-03-14  2:23       ` Lynne
2025-03-13 17:03 ` [FFmpeg-devel] [PATCH v4 16/16] ffv1: add a Vulkan-based decoder Lynne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB074433BA3F1574B364006D978FD32@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git