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 67AE449918 for ; Fri, 23 Feb 2024 14:35:53 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E7AB168CBD7; Fri, 23 Feb 2024 16:32:08 +0200 (EET) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 38B1D68C5EE for ; Fri, 23 Feb 2024 16:31:36 +0200 (EET) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=ZLLmPgqc; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id C765B4D64 for ; Fri, 23 Feb 2024 15:31:34 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id hErfsOvaGn1M for ; Fri, 23 Feb 2024 15:31:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1708698688; bh=pVG5oHMAOiVSxlX9abUs9QVjHky50WMFO4ncQI0sOXI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZLLmPgqc3PtMaBJrO8A9/vVwCRkd7iDr0O5tkExHBd/0RCt+r5H24PglqpE01IWmT EYBDPMPR03GmUjtoAkOH2USZaTRiPjjwBuITRk/GOiU4e+Ye98ARQ7/2GouwOS/iRg 6Yc32E0vvqF6Z+uOPHRt/hVHjwaSJrSa4R5HNJuFfwMoPSnar78kOwDTKrvRjFI1Rb jood9juAV3ocT7OWITFC3GRjsEtUhvGntlCmDyxjFXHUWPTeaPuQK/m6jlFUPZLjrZ WMzv34wEMF7Z8rrPl/bfP8B9MkSh3+thhHOt/lg5oWGYGurUtTP0oL0HQqZqAM31BS Hb4phIHgD3MLw== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id D2E734D56 for ; Fri, 23 Feb 2024 15:31:27 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 19E8B3A25D3 for ; Fri, 23 Feb 2024 15:31:23 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 23 Feb 2024 14:58:49 +0100 Message-ID: <20240223143115.16521-28-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240223143115.16521-1-anton@khirnov.net> References: <20240223143115.16521-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 27/38] avcodec/pngdec: respect side data preference 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: From: Niklas Haas --- libavcodec/pngdec.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 026da30c25..8f409c74b8 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -660,6 +660,7 @@ static int decode_phys_chunk(AVCodecContext *avctx, PNGDecContext *s, static int populate_avctx_color_fields(AVCodecContext *avctx, AVFrame *frame) { PNGDecContext *s = avctx->priv_data; + int ret; if (s->have_cicp) { if (s->cicp_primaries >= AVCOL_PRI_NB) @@ -678,11 +679,15 @@ static int populate_avctx_color_fields(AVCodecContext *avctx, AVFrame *frame) avctx->color_range = frame->color_range = AVCOL_RANGE_UNSPECIFIED; } } else if (s->iccp_data) { - AVFrameSideData *sd = av_frame_new_side_data(frame, AV_FRAME_DATA_ICC_PROFILE, s->iccp_data_len); - if (!sd) - return AVERROR(ENOMEM); - memcpy(sd->data, s->iccp_data, s->iccp_data_len); - av_dict_set(&sd->metadata, "name", s->iccp_name, 0); + AVFrameSideData *sd; + ret = ff_frame_new_side_data(avctx, frame, AV_FRAME_DATA_ICC_PROFILE, + s->iccp_data_len, &sd); + if (ret < 0) + return ret; + if (sd) { + memcpy(sd->data, s->iccp_data, s->iccp_data_len); + av_dict_set(&sd->metadata, "name", s->iccp_name, 0); + } } else if (s->have_srgb) { avctx->color_primaries = frame->color_primaries = AVCOL_PRI_BT709; avctx->color_trc = frame->color_trc = AVCOL_TRC_IEC61966_2_1; -- 2.42.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".