From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 9DBD74A439 for ; Thu, 28 Mar 2024 03:13:35 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A229A68D715; Thu, 28 Mar 2024 05:12:53 +0200 (EET) Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 206AF68D6FE for ; Thu, 28 Mar 2024 05:12:47 +0200 (EET) Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-6e6b22af648so1202032b3a.0 for ; Wed, 27 Mar 2024 20:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711595564; x=1712200364; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=qzlkIRHJeUgOck//kbcnR2JovfX/5JSAhjWyNAAq9y0=; b=M8x6lcGrmWS2m3DRWZ1SBT2Fv0s6+ZXvHqjqn84mRQy8zenu9viNZo/g0BlZ9wwbw6 mP3T0LzBjMLKwwQrhttwS5SbaZ3yTYOIWrL+vsuaUCrLkEgL+8/CMhRjPAhElxRexg3g 224fWcWjT9p8LDXT3iqQXCoz4Fpf8vI+1yLT/katYM7cQlLreTzTtf+9UmN3/3r2MLjN LBOgSzTQTHiJDAhHpVwZzOzvE6wM9H+aYcdLN0mDOoCVzkvCIwPFHWUszrSKJDJ37n8O Lo1nq++D/PWecJFhg19V3hW5s4T3yLLq1KvGRzx2xK4snhTg18u6HL6p6FJt0q2Nb56t Nhyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711595564; x=1712200364; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qzlkIRHJeUgOck//kbcnR2JovfX/5JSAhjWyNAAq9y0=; b=g6tRpscLDp8ZZZ+38v2cCn4dTnQ560toL8SlILU3k34KXJw4gXOciWAHcbJyzAo8DC 8HDJuAl1EzDr0ib6ZvOuFjqKpYAMd+GDf4H+y7V4y7t6+fwaPGG2MQVtn4qFuN/ECLX1 VlPVCzqQYAY70lAT+Js0+qo+B+z6p/KpCSLuGiE9MOK9pFateILitXue8ts6rqiaClxZ W4kDuNI8cPbFZLcAk8x3FvxnQgwKKovjOueA1QRSr00DgrJoKXOXZYUoc6zqGDaMPINU HkId6KNSvQlvX+LmCCRtfwxuKXGTwsDw4mr49vTcXzSvPNNwnqthBnWTWg3TcGVB7d67 HLhQ== X-Gm-Message-State: AOJu0Yyt/JUDfUSt/fwu2GYeHpXr61ouuzyN0uQaGoPBBr0UvQ1EfsWi hEYxrieYfT+yP9Q6qZVBfcEHrlN44atTdbdJlAfBvkcjXEZVJRcQKS3QF1C6 X-Google-Smtp-Source: AGHT+IEqJJ1m4vfxXnjgHxQdz+ElaH4Y0SbFXnfBqj19NqgpzLxmkHX3uIfFjDUc/7duDP4OLoRwQA== X-Received: by 2002:a05:6a20:4386:b0:1a3:8d32:c182 with SMTP id i6-20020a056a20438600b001a38d32c182mr1834329pzl.11.1711595564173; Wed, 27 Mar 2024 20:12:44 -0700 (PDT) Received: from localhost.localdomain ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id q20-20020a635054000000b005dc120fa3b2sm249964pgl.18.2024.03.27.20.12.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 20:12:43 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 Mar 2024 00:12:09 -0300 Message-ID: <20240328031210.21407-6-jamrial@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240328031210.21407-1-jamrial@gmail.com> References: <20240328031210.21407-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/7 v4] avcodec/decode: make the AVFrameSideData helper wrappers not depend on frames X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: They will be useful to fill arrays stored in other structs. Signed-off-by: James Almer --- libavcodec/av1dec.c | 7 +-- libavcodec/cri.c | 3 +- libavcodec/decode.c | 99 +++++++++++++++++++++++++++-------------- libavcodec/decode.h | 28 ++++++------ libavcodec/dpx.c | 3 +- libavcodec/h2645_sei.c | 4 +- libavcodec/h264_slice.c | 3 +- libavcodec/hevcdec.c | 6 ++- libavcodec/libdav1d.c | 7 +-- libavcodec/libjxldec.c | 3 +- libavcodec/mjpegdec.c | 3 +- libavcodec/mpeg12dec.c | 11 +++-- libavcodec/pngdec.c | 8 ++-- libavcodec/qsvdec.c | 4 +- libavcodec/tiff.c | 3 +- libavcodec/webp.c | 3 +- 16 files changed, 120 insertions(+), 75 deletions(-) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index 32a795e758..54bedc27e1 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -964,7 +964,8 @@ static int export_itut_t35(AVCodecContext *avctx, AVFrame *frame, if (!ret) break; - ret = ff_frame_new_side_data_from_buf(avctx, frame, AV_FRAME_DATA_A53_CC, &buf, NULL); + ret = ff_frame_new_side_data_from_buf(avctx, &frame->side_data, &frame->nb_side_data, + AV_FRAME_DATA_A53_CC, &buf); if (ret < 0) return ret; @@ -1028,7 +1029,7 @@ static int export_metadata(AVCodecContext *avctx, AVFrame *frame) if (s->mdcv) { AVMasteringDisplayMetadata *mastering; - ret = ff_decode_mastering_display_new(avctx, frame, &mastering); + ret = ff_decode_mastering_display_new(avctx, &frame->side_data, &frame->nb_side_data, &mastering); if (ret < 0) return ret; @@ -1051,7 +1052,7 @@ static int export_metadata(AVCodecContext *avctx, AVFrame *frame) if (s->cll) { AVContentLightMetadata *light; - ret = ff_decode_content_light_new(avctx, frame, &light); + ret = ff_decode_content_light_new(avctx, &frame->side_data, &frame->nb_side_data, &light); if (ret < 0) return ret; diff --git a/libavcodec/cri.c b/libavcodec/cri.c index 990e52ac99..94468e7515 100644 --- a/libavcodec/cri.c +++ b/libavcodec/cri.c @@ -398,7 +398,8 @@ skip: } if (hflip || vflip) { - ff_frame_new_side_data(avctx, p, AV_FRAME_DATA_DISPLAYMATRIX, + ff_frame_new_side_data(avctx, &p->side_data, &p->nb_side_data, + AV_FRAME_DATA_DISPLAYMATRIX, sizeof(int32_t) * 9, &rotation); if (rotation) { av_display_rotation_set((int32_t *)rotation->data, 0.f); diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 34bcb7cc64..48048cd599 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1793,93 +1793,124 @@ int ff_decode_preinit(AVCodecContext *avctx) } /** - * Check side data preference and clear existing side data from frame + * Check side data preference and clear existing side data from sd/nb_sd * if needed. * * @retval 0 side data of this type can be added to frame * @retval 1 side data of this type should not be added to frame */ -static int side_data_pref(const AVCodecContext *avctx, AVFrame *frame, - enum AVFrameSideDataType type) +static int side_data_pref(const AVCodecContext *avctx, AVFrameSideData ***sd, + int *nb_sd, enum AVFrameSideDataType type) { DecodeContext *dc = decode_ctx(avctx->internal); // Note: could be skipped for `type` without corresponding packet sd - if (av_frame_get_side_data(frame, type)) { + if (av_frame_side_data_get(*sd, *nb_sd, type)) { if (dc->side_data_pref_mask & (1ULL << type)) return 1; - av_frame_remove_side_data(frame, type); + av_frame_side_data_remove(sd, nb_sd, type); } return 0; } - -int ff_frame_new_side_data(const AVCodecContext *avctx, AVFrame *frame, - enum AVFrameSideDataType type, size_t size, +int ff_frame_new_side_data(const AVCodecContext *avctx, AVFrameSideData ***sd, + int *nb_sd, enum AVFrameSideDataType type, size_t size, AVFrameSideData **psd) { - AVFrameSideData *sd; + AVFrameSideData *entry; - if (side_data_pref(avctx, frame, type)) { + if (side_data_pref(avctx, sd, nb_sd, type)) { if (psd) *psd = NULL; return 0; } - sd = av_frame_new_side_data(frame, type, size); + entry = av_frame_side_data_new(sd, nb_sd, type, size, 0); if (psd) - *psd = sd; + *psd = entry; - return sd ? 0 : AVERROR(ENOMEM); + return entry ? 0 : AVERROR(ENOMEM); } -int ff_frame_new_side_data_from_buf(const AVCodecContext *avctx, - AVFrame *frame, enum AVFrameSideDataType type, - AVBufferRef **buf, AVFrameSideData **psd) +int ff_frame_new_side_data_from_buf(const AVCodecContext *avctx, AVFrameSideData ***sd, + int *nb_sd, enum AVFrameSideDataType type, + AVBufferRef **buf) { - AVFrameSideData *sd = NULL; int ret = 0; - if (side_data_pref(avctx, frame, type)) + if (side_data_pref(avctx, sd, nb_sd, type)) goto finish; - sd = av_frame_new_side_data_from_buf(frame, type, *buf); - if (sd) - *buf = NULL; - else + if (!av_frame_side_data_add(sd, nb_sd, type, buf, 0)) ret = AVERROR(ENOMEM); finish: av_buffer_unref(buf); - if (psd) - *psd = sd; return ret; } -int ff_decode_mastering_display_new(const AVCodecContext *avctx, AVFrame *frame, - AVMasteringDisplayMetadata **mdm) +int ff_decode_mastering_display_new(const AVCodecContext *avctx, AVFrameSideData ***sd, + int *nb_sd, AVMasteringDisplayMetadata **mdm) { - if (side_data_pref(avctx, frame, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA)) { + AVBufferRef *buf; + size_t size; + + if (side_data_pref(avctx, sd, nb_sd, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA)) { *mdm = NULL; return 0; } - *mdm = av_mastering_display_metadata_create_side_data(frame); - return *mdm ? 0 : AVERROR(ENOMEM); + *mdm = av_mastering_display_metadata_alloc_size(&size); + if (!*mdm) + return AVERROR(ENOMEM); + + buf = av_buffer_create((uint8_t *)*mdm, size, NULL, NULL, 0); + if (!buf) { + av_freep(mdm); + return AVERROR(ENOMEM); + } + + if (!av_frame_side_data_add(sd, nb_sd, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA, + &buf, 0)) { + *mdm = NULL; + av_buffer_unref(&buf); + return AVERROR(ENOMEM); + } + + return 0; } -int ff_decode_content_light_new(const AVCodecContext *avctx, AVFrame *frame, - AVContentLightMetadata **clm) +int ff_decode_content_light_new(const AVCodecContext *avctx, AVFrameSideData ***sd, + int *nb_sd, AVContentLightMetadata **clm) { - if (side_data_pref(avctx, frame, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL)) { + AVBufferRef *buf; + size_t size; + + if (side_data_pref(avctx, sd, nb_sd, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL)) { *clm = NULL; return 0; } - *clm = av_content_light_metadata_create_side_data(frame); - return *clm ? 0 : AVERROR(ENOMEM); + *clm = av_content_light_metadata_alloc(&size); + if (!*clm) + return AVERROR(ENOMEM); + + buf = av_buffer_create((uint8_t *)*clm, size, NULL, NULL, 0); + if (!buf) { + av_freep(clm); + return AVERROR(ENOMEM); + } + + if (!av_frame_side_data_add(sd, nb_sd, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL, + &buf, 0)) { + *clm = NULL; + av_buffer_unref(&buf); + return AVERROR(ENOMEM); + } + + return 0; } int ff_copy_palette(void *dst, const AVPacket *src, void *logctx) diff --git a/libavcodec/decode.h b/libavcodec/decode.h index 4ffbd9db8e..1026c9dae9 100644 --- a/libavcodec/decode.h +++ b/libavcodec/decode.h @@ -156,14 +156,14 @@ const AVPacketSideData *ff_get_coded_side_data(const AVCodecContext *avctx, enum AVPacketSideDataType type); /** - * Wrapper around av_frame_new_side_data, which rejects side data overridden by + * Wrapper around av_frame_side_data_new, which rejects side data overridden by * the demuxer. Returns 0 on success, and a negative error code otherwise. - * If successful and sd is not NULL, *sd may either contain a pointer to the new + * If successful and psd is not NULL, *psd may either contain a pointer to the new * side data, or NULL in case the side data was already present. */ -int ff_frame_new_side_data(const AVCodecContext *avctx, AVFrame *frame, - enum AVFrameSideDataType type, size_t size, - AVFrameSideData **sd); +int ff_frame_new_side_data(const AVCodecContext *avctx, AVFrameSideData ***sd, + int *nb_sd, enum AVFrameSideDataType type, size_t size, + AVFrameSideData **psd); /** * Similar to `ff_frame_new_side_data`, but using an existing buffer ref. @@ -171,29 +171,29 @@ int ff_frame_new_side_data(const AVCodecContext *avctx, AVFrame *frame, * *buf is ALWAYS consumed by this function and NULL written in its place, even * on failure. */ -int ff_frame_new_side_data_from_buf(const AVCodecContext *avctx, - AVFrame *frame, enum AVFrameSideDataType type, - AVBufferRef **buf, AVFrameSideData **sd); +int ff_frame_new_side_data_from_buf(const AVCodecContext *avctx, AVFrameSideData ***sd, + int *nb_sd, enum AVFrameSideDataType type, + AVBufferRef **buf); struct AVMasteringDisplayMetadata; struct AVContentLightMetadata; /** - * Wrapper around av_mastering_display_metadata_create_side_data(), which + * Similar to av_mastering_display_metadata_create_side_data(), but * rejects side data overridden by the demuxer. Returns 0 on success, and a * negative error code otherwise. If successful, *mdm may either be a pointer to * the new side data, or NULL in case the side data was already present. */ -int ff_decode_mastering_display_new(const AVCodecContext *avctx, AVFrame *frame, - struct AVMasteringDisplayMetadata **mdm); +int ff_decode_mastering_display_new(const AVCodecContext *avctx, AVFrameSideData ***sd, + int *nb_sd, struct AVMasteringDisplayMetadata **mdm); /** - * Wrapper around av_content_light_metadata_create_side_data(), which + * Similar to av_content_light_metadata_create_side_data(), but * rejects side data overridden by the demuxer. Returns 0 on success, and a * negative error code otherwise. If successful, *clm may either be a pointer to * the new side data, or NULL in case the side data was already present. */ -int ff_decode_content_light_new(const AVCodecContext *avctx, AVFrame *frame, - struct AVContentLightMetadata **clm); +int ff_decode_content_light_new(const AVCodecContext *avctx, AVFrameSideData ***sd, + int *nb_sd, struct AVContentLightMetadata **clm); #endif /* AVCODEC_DECODE_H */ diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c index 80616d98a2..ff9115bf86 100644 --- a/libavcodec/dpx.c +++ b/libavcodec/dpx.c @@ -288,7 +288,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, if (i != 0xFFFFFFFF) { AVFrameSideData *tcside; - ret = ff_frame_new_side_data(avctx, p, AV_FRAME_DATA_S12M_TIMECODE, + ret = ff_frame_new_side_data(avctx, &p->side_data, &p->nb_side_data, + AV_FRAME_DATA_S12M_TIMECODE, sizeof(uint32_t) * 4, &tcside); if (ret < 0) return ret; diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c index afc103b69c..a9f4e01de8 100644 --- a/libavcodec/h2645_sei.c +++ b/libavcodec/h2645_sei.c @@ -750,7 +750,7 @@ FF_ENABLE_DEPRECATION_WARNINGS int i; AVMasteringDisplayMetadata *metadata; - ret = ff_decode_mastering_display_new(avctx, frame, &metadata); + ret = ff_decode_mastering_display_new(avctx, &frame->side_data, &frame->nb_side_data, &metadata); if (ret < 0) return ret; @@ -793,7 +793,7 @@ FF_ENABLE_DEPRECATION_WARNINGS if (sei->content_light.present) { AVContentLightMetadata *metadata; - ret = ff_decode_content_light_new(avctx, frame, &metadata); + ret = ff_decode_content_light_new(avctx, &frame->side_data, &frame->nb_side_data, &metadata); if (ret < 0) return ret; diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index e9a404e41b..6d9d2ddc14 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1253,7 +1253,8 @@ static int h264_export_frame_props(H264Context *h) uint32_t *tc_sd; char tcbuf[AV_TIMECODE_STR_SIZE]; AVFrameSideData *tcside; - ret = ff_frame_new_side_data(h->avctx, out, AV_FRAME_DATA_S12M_TIMECODE, + ret = ff_frame_new_side_data(h->avctx, &out->side_data, &out->nb_side_data, + AV_FRAME_DATA_S12M_TIMECODE, sizeof(uint32_t)*4, &tcside); if (ret < 0) return ret; diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 575836e340..d744e6f598 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -2791,7 +2791,8 @@ static int set_side_data(HEVCContext *s) uint32_t *tc_sd; char tcbuf[AV_TIMECODE_STR_SIZE]; AVFrameSideData *tcside; - ret = ff_frame_new_side_data(s->avctx, out, AV_FRAME_DATA_S12M_TIMECODE, + ret = ff_frame_new_side_data(s->avctx, &out->side_data, &out->nb_side_data, + AV_FRAME_DATA_S12M_TIMECODE, sizeof(uint32_t) * 4, &tcside); if (ret < 0) return ret; @@ -2821,7 +2822,8 @@ static int set_side_data(HEVCContext *s) if (!info_ref) return AVERROR(ENOMEM); - ret = ff_frame_new_side_data_from_buf(s->avctx, out, AV_FRAME_DATA_DYNAMIC_HDR_PLUS, &info_ref, NULL); + ret = ff_frame_new_side_data_from_buf(s->avctx, &out->side_data, &out->nb_side_data, + AV_FRAME_DATA_DYNAMIC_HDR_PLUS, &info_ref); if (ret < 0) return ret; } diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index ddcd0708b4..465c56e757 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -471,7 +471,7 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) if (p->mastering_display) { AVMasteringDisplayMetadata *mastering; - res = ff_decode_mastering_display_new(c, frame, &mastering); + res = ff_decode_mastering_display_new(c, &frame->side_data, &frame->nb_side_data, &mastering); if (res < 0) goto fail; @@ -493,7 +493,7 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) if (p->content_light) { AVContentLightMetadata *light; - res = ff_decode_content_light_new(c, frame, &light); + res = ff_decode_content_light_new(c, &frame->side_data, &frame->nb_side_data, &light); if (res < 0) goto fail; @@ -528,7 +528,8 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) if (!res) break; - res = ff_frame_new_side_data_from_buf(c, frame, AV_FRAME_DATA_A53_CC, &buf, NULL); + res = ff_frame_new_side_data_from_buf(c, &frame->side_data, &frame->nb_side_data, + AV_FRAME_DATA_A53_CC, &buf); if (res < 0) goto fail; diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c index d57a27418f..6e95c79177 100644 --- a/libavcodec/libjxldec.c +++ b/libavcodec/libjxldec.c @@ -483,7 +483,8 @@ static int libjxl_receive_frame(AVCodecContext *avctx, AVFrame *frame) /* full image is one frame, even if animated */ av_log(avctx, AV_LOG_DEBUG, "FULL_IMAGE event emitted\n"); if (ctx->iccp) { - ret = ff_frame_new_side_data_from_buf(avctx, ctx->frame, AV_FRAME_DATA_ICC_PROFILE, &ctx->iccp, NULL); + ret = ff_frame_new_side_data_from_buf(avctx, &ctx->frame->side_data, &ctx->frame->nb_side_data, + AV_FRAME_DATA_ICC_PROFILE, &ctx->iccp); if (ret < 0) return ret; } diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index c9409eac6c..89443dc4cd 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -2839,7 +2839,8 @@ the_end: for (i = 0; i < s->iccnum; i++) total_size += s->iccentries[i].length; - ret = ff_frame_new_side_data(avctx, frame, AV_FRAME_DATA_ICC_PROFILE, total_size, &sd); + ret = ff_frame_new_side_data(avctx, &frame->side_data, &frame->nb_side_data, + AV_FRAME_DATA_ICC_PROFILE, total_size, &sd); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Could not allocate frame side data\n"); return ret; diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 4ad1eb6572..2665ee2f95 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1314,7 +1314,8 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) } } - ret = ff_frame_new_side_data(s->avctx, s->current_picture_ptr->f, + ret = ff_frame_new_side_data(s->avctx, &s->current_picture_ptr->f->side_data, + &s->current_picture_ptr->f->nb_side_data, AV_FRAME_DATA_PANSCAN, sizeof(s1->pan_scan), &pan_scan); if (ret < 0) @@ -1324,8 +1325,9 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) if (s1->a53_buf_ref) { ret = ff_frame_new_side_data_from_buf( - s->avctx, s->current_picture_ptr->f, AV_FRAME_DATA_A53_CC, - &s1->a53_buf_ref, NULL); + s->avctx, &s->current_picture_ptr->f->side_data, + &s->current_picture_ptr->f->nb_side_data, + AV_FRAME_DATA_A53_CC, &s1->a53_buf_ref); if (ret < 0) return ret; } @@ -1341,7 +1343,8 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) if (s1->has_afd) { AVFrameSideData *sd; - ret = ff_frame_new_side_data(s->avctx, s->current_picture_ptr->f, + ret = ff_frame_new_side_data(s->avctx, &s->current_picture_ptr->f->side_data, + &s->current_picture_ptr->f->nb_side_data, AV_FRAME_DATA_AFD, 1, &sd); if (ret < 0) return ret; diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index de50e6a5b6..68c25cb5bd 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -680,8 +680,8 @@ static int populate_avctx_color_fields(AVCodecContext *avctx, AVFrame *frame) } } else if (s->iccp_data) { AVFrameSideData *sd; - ret = ff_frame_new_side_data(avctx, frame, AV_FRAME_DATA_ICC_PROFILE, - s->iccp_data_len, &sd); + ret = ff_frame_new_side_data(avctx, &frame->side_data, &frame->nb_side_data, + AV_FRAME_DATA_ICC_PROFILE, s->iccp_data_len, &sd); if (ret < 0) return ret; if (sd) { @@ -748,7 +748,7 @@ static int populate_avctx_color_fields(AVCodecContext *avctx, AVFrame *frame) if (s->have_clli) { AVContentLightMetadata *clli; - ret = ff_decode_content_light_new(avctx, frame, &clli); + ret = ff_decode_content_light_new(avctx, &frame->side_data, &frame->nb_side_data, &clli); if (ret < 0) return ret; @@ -765,7 +765,7 @@ static int populate_avctx_color_fields(AVCodecContext *avctx, AVFrame *frame) if (s->have_mdvc) { AVMasteringDisplayMetadata *mdvc; - ret = ff_decode_mastering_display_new(avctx, frame, &mdvc); + ret = ff_decode_mastering_display_new(avctx, &frame->side_data, &frame->nb_side_data, &mdvc); if (ret < 0) return ret; diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index fd9267c6f4..de3ed3c357 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -661,7 +661,7 @@ static int qsv_export_hdr_side_data(AVCodecContext *avctx, mfxExtMasteringDispla const int luma_den = 10000; int i; - ret = ff_decode_mastering_display_new(avctx, frame, &mastering); + ret = ff_decode_mastering_display_new(avctx, &frame->side_data, &frame->nb_side_data, &mastering); if (ret < 0) return ret; @@ -687,7 +687,7 @@ static int qsv_export_hdr_side_data(AVCodecContext *avctx, mfxExtMasteringDispla if (clli->InsertPayloadToggle) { AVContentLightMetadata *light; - ret = ff_decode_content_light_new(avctx, frame, &light); + ret = ff_decode_content_light_new(avctx, &frame->side_data, &frame->nb_side_data, &light); if (ret < 0) return ret; diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 7ce1ab32f6..9cde2e60e1 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -1706,7 +1706,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) if (bytestream2_get_bytes_left(&gb_temp) < count) return AVERROR_INVALIDDATA; - ret = ff_frame_new_side_data(s->avctx, frame, AV_FRAME_DATA_ICC_PROFILE, count, &sd); + ret = ff_frame_new_side_data(s->avctx, &frame->side_data, &frame->nb_side_data, + AV_FRAME_DATA_ICC_PROFILE, count, &sd); if (ret < 0) return ret; if (sd) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 9308ea2b69..ec23533ef2 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -1501,7 +1501,8 @@ exif_end: s->has_iccp = 1; - ret = ff_frame_new_side_data(avctx, p, AV_FRAME_DATA_ICC_PROFILE, chunk_size, &sd); + ret = ff_frame_new_side_data(avctx, &p->side_data, &p->nb_side_data, + AV_FRAME_DATA_ICC_PROFILE, chunk_size, &sd); if (ret < 0) return ret; -- 2.44.0 _______________________________________________ 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".