From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTPS id A1B174E6B0
	for <ffmpegdev@gitmailbox.com>; Thu, 13 Mar 2025 22:08:41 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E36CD68E619;
	Fri, 14 Mar 2025 00:08:35 +0200 (EET)
Received: from EUR05-DB8-obe.outbound.protection.outlook.com
 (mail-db8eur05olkn2102.outbound.protection.outlook.com [40.92.89.102])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7ECC968DDFB
 for <ffmpeg-devel@ffmpeg.org>; Fri, 14 Mar 2025 00:08:29 +0200 (EET)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=hhbuotvgSoWQEQU/vTtPD8DouOPYF+9lbWqQ1DA/QL/CLjTaheHHdU24IN4B7jIPSv9b0xZjhUI0zejDOirzWNYFYZ7CmhLToD1a3twEIuEWYaNEw7tIzcYw8IjEAICOpwhpwlmwlMgBIGZxLjW1pIZKFusv3ubs2+RwiOqxuLox4fCWHFso/s3ndHm7YHIOcH1fVQua0tYisvLBalLnb3bAk3zbI0N+XuqTJIfAaa/x5p5VcMd8Yp/f1ft1lnO0XdXagjP6F7dZ6wnTxOL0g1mxmTZRABUB3Z7FM0KqvFF5xbn9UAVRJvlD8BWLvoHENlT0z6OiUjjLkoUWMcFScg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=SR0YDOpS4kGOi5sFNVxUEYVPHSIoXgcy87+gXZ9YJkw=;
 b=a7GMM1TmvRMsysa0lmS1nNjseaZPnswUGAYZEa+z1A6tvwwoWjSpE1DdUsFNtDg4wNtgMs00ObfBRVjag4sVxn6ZNLT+jlgNDwfpXjzvRs4uutHhKwuf43pRrXilt/rPTrPDhUGI9DLYM2vGvhBZ9AhPNa8asqsjoSKjyjGDaQSS2ofi2dz9RM7Ujy+ol0mnZAPP+gEuST0oNk/SsLM6+0APlTKl5MPeRpGDTeJSE+guFwjE5lzjgy7zPaOP/M6FImLPd7SGQcdWsYH1XOvazEhKsbZS8Zld6YGofHQBKFDKp4z8XnFy1XU6Hwm2XhhInKIOSyvTFWZmhvJmX0gGrg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
 dkim=none; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=SR0YDOpS4kGOi5sFNVxUEYVPHSIoXgcy87+gXZ9YJkw=;
 b=nCa9736dp8xtd/j3KaXofn4IFHKizGysLcE5CVIOIyRqj2XrLhUx37QTLJF695i/FuDGscos4ftU1KzW+wPrrBePf4E4wPProxqBlBexf3B+rMhOEuGXwdE4aS4qrYOdyeoEVK1GExz51pE+0wSoyOoJcJSlK/x7BQQ9b685bSrXk7AjOMa8e8NxaG3zms9t5EVmOnswokUhvPFDTVxivNMZ9f7nDWDKMsAwTkG9Dy74jK/uA0ZOTnsNUOi2zqpii1wauZHfH+0mxSSUx26yKEavzH5VtXDKOM0DJ6LWpl3nq1I9jX2YWmZPK7ega35R98N3LMoL4EMxDIxpLbfqxA==
Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14)
 by AS4P250MB0587.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:4bd::15)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.25; Thu, 13 Mar
 2025 22:08:27 +0000
Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
 ([fe80::384d:40d4:ecb7:1c9]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
 ([fe80::384d:40d4:ecb7:1c9%5]) with mapi id 15.20.8534.024; Thu, 13 Mar 2025
 22:08:27 +0000
Message-ID: <AS8P250MB074433BA3F1574B364006D978FD32@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>
Date: Thu, 13 Mar 2025 23:08:25 +0100
User-Agent: Mozilla Thunderbird
To: ffmpeg-devel@ffmpeg.org
References: <20250313170355.92290-1-dev@lynne.ee>
 <20250313170355.92290-16-dev@lynne.ee>
Content-Language: en-US
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
In-Reply-To: <20250313170355.92290-16-dev@lynne.ee>
X-ClientProxiedBy: FR4P281CA0238.DEUP281.PROD.OUTLOOK.COM
 (2603:10a6:d10:e9::17) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
 (2603:10a6:20b:541::14)
X-Microsoft-Original-Message-ID: <510dd123-bf53-4ea2-afa4-5d39597e6cd9@outlook.com>
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AS4P250MB0587:EE_
X-MS-Office365-Filtering-Correlation-Id: 000d0828-1e15-4650-8c37-08dd627b947c
X-Microsoft-Antispam: BCL:0;
 ARA:14566002|19110799003|461199028|6090799003|7092599003|15080799006|5072599009|8060799006|3412199025|440099028|41001999003|19111999003;
X-Microsoft-Antispam-Message-Info: =?utf-8?B?MUJGbWVLa0FpMU5aWDlEbElJR1UyczVwV29ldld2TG1YT1o3cmFMY2ZFazhV?=
 =?utf-8?B?Mkt1YzdHejF6Tk8vbmN4a3VOODQ3N3dJV0NsSkl1a3BoOU1uVUVBRnFQSG5z?=
 =?ut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2pnOFdjT3ZCbWh5cTk1dHdqY3pqUk9KM24x?=
 =?utf-8?B?QXdreHM1Wmt5allzMXErSXJmUTRZUCttYnk0MkNXNFgwdWVxSElyK2lZL2ZM?=
 =?utf-8?B?NWZ2NUFrcFBKOTRSaWo4ajA0RndoMEw3c1BnWE5qbngzeXduZmxaVjg5aGd5?=
 =?utf-8?B?cDVyZXIyU2E1OXhIODNWRlpFRDZVVUhVVFFuOGh4RHFCUUtDZThxRXBydTAz?=
 =?utf-8?B?b253VFBVS1RjZWlNNlFNRUlIV2RYVTdITEd5Z0tlMVhwMEpUTlBSdy9iVEM0?=
 =?utf-8?B?bkE4Zlg1cjFqdjU4Z0NFUloyMUJGK0psVStMR2VnL1VUQ1BOdEJHQWVmZTF3?=
 =?utf-8?B?cVhtZjBlOTQ0WldpRm82eld3SEZHNzZ6M3FxRytwQUo1WDQ4cHl5TVJFYTNr?=
 =?utf-8?B?eTdOMXIyM2hpN003alZ5em80clUwSmtyRVorYTl5NlcrbFpTelJZdGxTWElX?=
 =?utf-8?B?ZnB6dkppOGptd3NMckluOHVmYnkrOXV3ckRrczJneFBlZHI5QThPWHJqQzN5?=
 =?utf-8?B?NzlRQzVNeWtKcXc4T0p6bGVUajVLSE1BaEhGMXRndElBdi9WZnloYmQyNUFu?=
 =?utf-8?B?c3ZhL0t6RHRGZElyWkl5QllmTU9raGd6MytqaFp3ekd1ajA3aWoxWG4zVGtH?=
 =?utf-8?B?SUxrL0RmTWNWM0FiQTlobnhvRnRBcXdsL09sZjFSM0ZpTDRKeWNmS2ZnPT0=?=
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 000d0828-1e15-4650-8c37-08dd627b947c
X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2025 22:08:27.2215 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4P250MB0587
Subject: Re: [FFmpeg-devel] [PATCH v4 15/16] FFHWAccel: add buffer_ref
 argument to start_frame
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/AS8P250MB074433BA3F1574B364006D978FD32@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

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".