From patchwork Thu Sep 26 14:34:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 51908 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:d8ca:0:b0:48e:c0f8:d0de with SMTP id dy10csp909080vqb; Sat, 28 Sep 2024 03:31:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVQR960VkFdcE8wFtRutdept5zSmFVatFPf785Amq9gRJMJcuKrmM+V6si90hAsSRq2G2N9xITO/7PzEMDmyyBo@gmail.com X-Google-Smtp-Source: AGHT+IEos8W/DP+L9ol+Pgg0XSvS1oY32bOD7wpTVUAcX2DXGdk4GYD5pZ5cMXWg3vlRBxnpmD7u X-Received: by 2002:a05:6402:90e:b0:5c7:18d3:633f with SMTP id 4fb4d7f45d1cf-5c8824d5ebbmr5619574a12.10.1727519473813; Sat, 28 Sep 2024 03:31:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727519473; cv=none; d=google.com; s=arc-20240605; b=NUQV/OoZYrLvE0KiVx+fXadgOe40De3hKYLGNtlUZMo6xnsLVQ2KCdX2WPIJslP78i UwWkSdExwrMc+VMmDjSpW1z8UfNOKSS6A9wrhLWbklmuyb3PzKML2Io0gAvpRFSQbqpv uN/hrz8WTjFSCi8q+UksCJY1EQ7tr1UnrVbX4e8CtsE/sAfjlZkZHBKZePYRShJxfL4M DjtXtl6/kSqXqSBuhkmWiIT5kpK1X5AnZq9w3cEx8MkZstFKnuQOKaM/3RSJJYuThw6v JnBorDF9JGitI+KxRmlE0UGKHOhLIRUlmo39cPoveLmWkvjAlw9dK5pqm8VNT359l4sU SlAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding: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=6zaRwNKdigHU+Znis0HMFS4qiUNGY1AfscNMJK18k+4=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=QKBhruZ5fImBdD7p/H+Qhb8aclcOT0jpd0+khmCF9EClfYikcl3gzTP/IHrL7i41Vl iTdEYwWBhDBnOOMGaCA5pRMRhdgiF6FkR95B9h0PGrsc4B6MVbTyCIYR5bYGofKmGFV8 wMN/pImWXCspqO1ztZlt8EzCKk3/L0vYjXSkseld5go/5DGF5iD9aA5BIXlzMD8uaMVH qX3sZbCzMRFL6lbt+xA1xTgPDCChcwgcGmKPmwPMLCL0Di4gaaoq2cR0feSKEPMfqEB/ 2LaVuVPtFP8u0zQI6U29d0qTVT0lR/pavsqRFTgf01jqfomNj2ZVNGoEgJ0G37YyXTZ8 bOiw==; 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=NBXlWreo; 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 4fb4d7f45d1cf-5c88240819dsi2902318a12.84.2024.09.28.03.31.13; Sat, 28 Sep 2024 03:31:13 -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=NBXlWreo; 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 4E71568DD12; Thu, 26 Sep 2024 17:34:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 714AF68D97E for ; Thu, 26 Sep 2024 17:34:08 +0300 (EEST) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-206b9455460so7662355ad.0 for ; Thu, 26 Sep 2024 07:34:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727361246; x=1727966046; 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=ULc+ddP8lkZo8NBQpSszOW++EsFysNEDp66O+Uje9z8=; b=NBXlWreo6lPKOE8a5Bn8LEwhr5BDFB3wloe/tW+rIrTFFApL49teGWkmdOKEdriC7f 47rDt+wgH3u3Z7X5pFEf5l/f0UZ98FAobGpyUtSPkbSUFSEwk9DAIex6Nl4DcP+qAym2 tXngpfLjVDPbHDFy4etkWT7pcWPjc26cabBtW8aLC4gjEsQdjQxlIXg6gSnC/+ZVmV/N NC1mkkrq1brM3CQuRdm2qnJlTDr+pln9W1rQ7+bWlvIuwd1tKIRjg7kd789hbxVzlMFB Sc7jQknVIzdEnedv/M4q9ljgpd4a/A68xIHyfoPSKHbvRoCf7TjDj0hI41y6tuEWrHMK z9mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727361246; x=1727966046; 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=ULc+ddP8lkZo8NBQpSszOW++EsFysNEDp66O+Uje9z8=; b=l5orUFunO/gkNQLNBP6wFUkc0WyZPCCxgKOfeu32jQt/jnS70eQIV5h35x2V7WPFtv g9xSsWcGuOziBqnGoonVPw6kU5q+bbMEmI+jEpaC3Dtad5W2rCWZrJ18l5+fJlS3htNd pFa+jEmbtPMVHQ45Lhbn5JwcKDAJ7t2Ycipfousj1w6fUi7E+VS6/XNm1LdwrKgbcY7e WTG8PzB73FE1g5bM9BIX+TnPqOhb/VJFXzQgt4LDFH6LhxvtsspBXNmlNQENg+PsXEsv UJH0FfNk5Np8bTo0KQEiHp0lMnNojFbQ0m0V1vY+jH9ebv6Ax4MW4U91gVkbCyS5MVnc 1FAA== X-Gm-Message-State: AOJu0YxGGfI5tlEOZ8aC5k+h//tVDAT2PDXQzcB84s+nsYbSM3TZECC5 6VF45SLOStj7aDAJ3d9kVHf9ZG5IbLa4kmESx1XkjJq92ajpAlTcmMsI0A== X-Received: by 2002:a17:902:cec2:b0:20a:fd4e:fef6 with SMTP id d9443c01a7336-20b19bd86f1mr50289305ad.8.1727361246160; Thu, 26 Sep 2024 07:34:06 -0700 (PDT) Received: from localhost.localdomain ([181.92.233.116]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20b02566edfsm24976755ad.87.2024.09.26.07.34.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2024 07:34:05 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 26 Sep 2024 11:34:36 -0300 Message-ID: <20240926143436.1946-1-jamrial@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <172733053331.13000.16432068133101552247@lain.khirnov.net> References: <172733053331.13000.16432068133101552247@lain.khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] avformat/mov: support parsing auxl iref type 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: bFGiBTqyn42f Use the reference information present in iref boxes of type auxl to include the relevant streams into a Tile Grid stream group. These streams are "auxiliar", which can be things like separate alpha planes and HDR gain maps. This does not yet export the relation of a said auxiliary streams and an independent stream (not a grid). For this, a new Stream group type would probably be needed. Signed-off-by: James Almer --- libavformat/mov.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 8a257ba535..f1274392f3 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -8844,8 +8844,8 @@ static int mov_read_iref_dimg(MOVContext *c, AVIOContext *pb, int version) return 0; } -static int mov_add_ref_to_item(MOVContext *c, AVIOContext *pb, int version, - HEIFItem *from_item) +static int mov_add_ref_to_item(MOVContext *c, AVIOContext *pb, uint32_t type, + int version, HEIFItem *from_item) { HEIFItem **ref_item_list, *to_item = NULL; int to_item_id = version ? avio_rb32(pb) : avio_rb16(pb); @@ -8856,7 +8856,8 @@ static int mov_add_ref_to_item(MOVContext *c, AVIOContext *pb, int version, to_item = &c->heif_item[j]; } if (!to_item) { - av_log(c->fc, AV_LOG_ERROR, "thmb in iref references a non-existent item\n"); + av_log(c->fc, AV_LOG_ERROR, "%s in iref references a non-existent item\n", + av_fourcc2str(type)); return AVERROR_INVALIDDATA; } @@ -8870,7 +8871,8 @@ static int mov_add_ref_to_item(MOVContext *c, AVIOContext *pb, int version, return 0; } -static int mov_read_iref_thmb(MOVContext *c, AVIOContext *pb, int version) +static int mov_read_iref_generic(MOVContext *c, AVIOContext *pb, uint32_t type, + int version) { HEIFItem *from_item = NULL; int entries; @@ -8882,20 +8884,21 @@ static int mov_read_iref_thmb(MOVContext *c, AVIOContext *pb, int version) from_item = &c->heif_item[i]; } if (!from_item) { - av_log(c->fc, AV_LOG_ERROR, "thmb in iref references a non-existent item\n"); + av_log(c->fc, AV_LOG_ERROR, "%s in iref references a non-existent item\n", + av_fourcc2str(type)); return AVERROR_INVALIDDATA; } entries = avio_rb16(pb); /* 'to' item ids */ for (int i = 0; i < entries; i++) { - int ret = mov_add_ref_to_item(c, pb, version, from_item); + int ret = mov_add_ref_to_item(c, pb, type, version, from_item); if (ret < 0) return ret; } - av_log(c->fc, AV_LOG_TRACE, "thmb: from_item_id %d, entries %d\n", - from_item_id, entries); + av_log(c->fc, AV_LOG_TRACE, "%s: from_item_id %d, entries %d\n", + av_fourcc2str(type), from_item_id, entries); return 0; } @@ -8924,8 +8927,9 @@ static int mov_read_iref(MOVContext *c, AVIOContext *pb, MOVAtom atom) case MKTAG('d','i','m','g'): mov_read_iref_dimg(c, pb, version); break; + case MKTAG('a','u','x','l'): case MKTAG('t','h','m','b'): - mov_read_iref_thmb(c, pb, version); + mov_read_iref_generic(c, pb, type, version); break; default: av_log(c->fc, AV_LOG_DEBUG, "Unknown iref type %s size %"PRIu32"\n",