From patchwork Mon Sep 16 14:43:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Izen X-Patchwork-Id: 51625 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:9108:0:b0:48e:c0f8:d0de with SMTP id r8csp74vqg; Mon, 16 Sep 2024 14:19:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUaD/eEjbEXUQLXTa+vssJLZmWqBk+GGvHXEY3WN7U3HQlbcPJnNH311mXdhu3iTVyOcO1NoeYI5JwdGgu6n4qO@gmail.com X-Google-Smtp-Source: AGHT+IGZRvA5Ndo5CAi3bXxNriMHLPCjGsHikk/cSEQdLFm/xna9jOUT+4ZgKySvl42uZj9nCev4 X-Received: by 2002:a05:6512:114c:b0:533:4191:fa47 with SMTP id 2adb3069b0e04-5367ff24b46mr4810569e87.47.1726521568042; Mon, 16 Sep 2024 14:19:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726521568; cv=none; d=google.com; s=arc-20240605; b=FoggwEpzlLdH7oG4dzQ0fmD2qUMRCG7HRwaumD55mYAQT7yoV6y9YZhivk5EpMPCfR 4BNmNTvr38JPjhMEmbT5gHaHtypbWmV5a7So0SPOJ3yzdmmWX760ym8EZQq6hTJczK2/ V06w6W3vBaAmrNEiIkaNQBpKi+tBaYShpYkfQXev1+BkSnz5nXx/5wHpyEeGZm4vUPAj juS76XBEsK6jpm6PPlOhDo1hdcc20bcqrAGFW7WXp3SV5PobF4FJACTJ3S++OynO1LaS BAqK77eG6i6oVdE9QjnvTVrVB3D6swmdL5RoObTC+Yf/troRFQtDqKPmPr4S9AiftE+K yDDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=DpEsmdQrjAK/idEz66bCFAMEzUx0u4+KbmsVCl7lSHU=; fh=+bdjGe20eEUjtjncwA1dnEEVYNfJL4vyhV+sIRR4l+g=; b=hap7TtkeN9FiqmbqejeWhRgyFqaabfsZe7IVStwKwEX1tjFjzj1M9K/g03VjzJM+6f YQ/ri9Jx+J4pSHTg7RCtONITXgOwDQyZK3dQLPSRtmNrAr7010/VpnPbZBWyYwMIinOr 5oFPMB4+tOWA2QPAVJJ1fv99jmHO6ZeCGN36ErT3rU5OUZXYh4PLtOmqu/lWSr4ntdve 7UESBhkYcPBID+pfPJQA5JiY7jPtQbhd5I5vnbQyc1moxpVaTJS5WlMhpaGty3H/3g4C oY+qb4QBxaoAjyZlpZXqHKMY7fexq1IGeJb2wi3smyO9u/1Xi4qcLy48hV3QmGZBXozT Eqpw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=PF9BwwjY; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 2adb3069b0e04-53687049927si2016855e87.186.2024.09.16.14.19.26; Mon, 16 Sep 2024 14:19:28 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=PF9BwwjY; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=fail header.i=@gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EDCE068D786; Mon, 16 Sep 2024 17:44:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BDB1868A9CE for ; Mon, 16 Sep 2024 17:44:09 +0300 (EEST) Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-6b747f2e2b7so35194677b3.3 for ; Mon, 16 Sep 2024 07:44:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726497848; x=1727102648; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+nflhqBkzPARwEfzpQatk3tZfY/LIg4hqe7mV5HLuis=; b=PF9BwwjYATlN50CSBno++KkP7BTUEzNVwtB1kxz2cWVzH53G/r5iNUdxrWhhVVPZnT GP5VTGc3q8x31ukRNzMHCzzxl0enn6hENf5gxrb70f5piEz5Oh7Sa7Vh9lojn9CM3+L6 jxHywB50YQvwjM/rZ759pfg1u8SFG3ORDNJ8o3U0EgWdQ7mPS0ZrS0e3EyIoRgkwxPjP jbBodnnxxVFKRJu/Q5skx322BMIA7d4SlSpiMIu6OmSrwxGFfuxiEGkT5ncvZQ227rlZ BJXY3YJ2t9NHC9GZJ4ZGZnCGsEDGH630zmEXQaTd19MXB52vl/TpIVPVr/OgMT1Hb03w 7zeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726497848; x=1727102648; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+nflhqBkzPARwEfzpQatk3tZfY/LIg4hqe7mV5HLuis=; b=dx16Si60KzpHaJ4TnQlplrsYK87/vJB0Rjpu+PIVBUCvmJMJb2Fg5f5A7lGBr3b14L uid8hf+qIc560XYiGLHrV7oGk1us/+5keKYlsLoKILHM0/ukgiloIzaqX17dPLPCHwQW oavHvki/TytzNOPbiNTyHbCh0pRg3AkOGms4ZcUhzXmszQjKVycwnMkIrSn9g9ybxSSn tsEjCinrbW26pVBF53KQbERr4Z42NOEtlUvrt230B8KYDGg74OmdwrzPK7k7pWbSs2Um E8aHtgWoAfjmb8M/kzdohJdgdCwRiy1Jc1VKknQxgF1BD2lYOuo7P5Sf8YUeLZ1qhYlZ WJwQ== X-Gm-Message-State: AOJu0YyGr/JBDf6+VAgDYmb3tO4XVw/gzCCb5NwFGPFuGWjOzpPVSA3/ bZfuagE2mo8hEuBqz4iJ5YCttyUoEZAy+33z170pKXdGzZWNi+0RQD+hpQ== X-Received: by 2002:a05:690c:60c6:b0:6db:31f6:a812 with SMTP id 00721157ae682-6ddc691a07dmr27706397b3.4.1726497848319; Mon, 16 Sep 2024 07:44:08 -0700 (PDT) Received: from gauss.local (c-68-56-149-176.hsd1.mi.comcast.net. [68.56.149.176]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-459aac864c9sm27815501cf.38.2024.09.16.07.44.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2024 07:44:08 -0700 (PDT) From: Leo Izen To: ffmpeg-devel@ffmpeg.org Date: Mon, 16 Sep 2024 10:43:44 -0400 Message-ID: <20240916144344.390716-4-leo.izen@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240916144344.390716-1-leo.izen@gmail.com> References: <20240916144344.390716-1-leo.izen@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 3/3] avcodec/pngenc: write eXIf chunks 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 Cc: Leo Izen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: /wQ2cheWuqvZ Write EXIF metadata exposed AV_FRAME_DATA_EXIF as an eXIf chunk to PNG files, if present. Signed-off-by: Leo Izen --- libavcodec/pngenc.c | 4 ++++ tests/ref/fate/cover-art-mp3-id3v2-remux | 6 +++--- tests/ref/fate/mov-cover-image | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index cb79c04e11..02996bfed8 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -414,6 +414,10 @@ static int encode_headers(AVCodecContext *avctx, const AVFrame *pict) } } + side_data = av_frame_get_side_data(pict, AV_FRAME_DATA_EXIF); + if (side_data) + png_write_chunk(&s->bytestream, MKTAG('e', 'X', 'I', 'f'), side_data->data, FFMIN(side_data->size, INT_MAX)); + side_data = av_frame_get_side_data(pict, AV_FRAME_DATA_ICC_PROFILE); if ((ret = png_write_iccp(s, side_data))) return ret; diff --git a/tests/ref/fate/cover-art-mp3-id3v2-remux b/tests/ref/fate/cover-art-mp3-id3v2-remux index 52b7e72a56..60802490f1 100644 --- a/tests/ref/fate/cover-art-mp3-id3v2-remux +++ b/tests/ref/fate/cover-art-mp3-id3v2-remux @@ -1,5 +1,5 @@ -94946f0efd5f9bb0061ac1fbff7d731f *tests/data/fate/cover-art-mp3-id3v2-remux.mp3 -399346 tests/data/fate/cover-art-mp3-id3v2-remux.mp3 +0643e306430fbadeb1c89da6ab36a303 *tests/data/fate/cover-art-mp3-id3v2-remux.mp3 +399414 tests/data/fate/cover-art-mp3-id3v2-remux.mp3 #tb 0: 1/14112000 #media_type 0: audio #codec_id 0: mp3 @@ -23,7 +23,7 @@ 0, -353590, -353590, 368640, 417, 0x15848290, S=1, 10 1, 0, 0, 0, 208350, 0x291b44d1 2, 0, 0, 0, 15760, 0x71d5c418 -3, 0, 0, 0, 165671, 0x7c1c8070 +3, 0, 0, 0, 165739, 0x2e108b69 0, 15050, 15050, 368640, 418, 0x46f684a4 0, 383690, 383690, 368640, 418, 0x46f684a4 0, 752330, 752330, 368640, 418, 0x46f684a4 diff --git a/tests/ref/fate/mov-cover-image b/tests/ref/fate/mov-cover-image index 5f65c630ea..7721b88001 100644 --- a/tests/ref/fate/mov-cover-image +++ b/tests/ref/fate/mov-cover-image @@ -1,5 +1,5 @@ -54a8870d5d1e6cc4da28ae422aa70898 *tests/data/fate/mov-cover-image.mp4 -1011919 tests/data/fate/mov-cover-image.mp4 +371e01af72ce3bc8339429068455b920 *tests/data/fate/mov-cover-image.mp4 +1012013 tests/data/fate/mov-cover-image.mp4 #extradata 0: 2, 0x00340022 #tb 0: 1/44100 #media_type 0: audio @@ -20,7 +20,7 @@ 0, -1088, -1088, 1024, 6, 0x027e00e8, F=0x5 0, -64, -64, 1024, 6, 0x027e00e8 1, 0, 0, 0, 25441, 0xe82503b0 -2, 0, 0, 0, 32657, 0x080255d2 +2, 0, 0, 0, 32751, 0x410d5f1d 0, 960, 960, 1024, 6, 0x027e00e8 0, 1984, 1984, 1024, 6, 0x027e00e8 0, 3008, 3008, 1024, 6, 0x027e00e8