From patchwork Wed Jan 24 14:54:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 45792 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:120f:b0:199:de12:6fa6 with SMTP id v15csp1323944pzf; Wed, 24 Jan 2024 06:54:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHywwuSpKX3hL4ewPqqS//wO8p105WAPWccBtVbi02pEi2ei1uIas/RKHesN46mrWYfAnC+ X-Received: by 2002:a05:600c:358d:b0:40e:370b:4298 with SMTP id p13-20020a05600c358d00b0040e370b4298mr1181357wmq.121.1706108075258; Wed, 24 Jan 2024 06:54:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706108075; cv=none; d=google.com; s=arc-20160816; b=ws2rk6UotS+EMFf89VqljVLcR1xlMgqU2vqkVyVn6BKZNoMDJ0LY1uswiIPGR6DO1R prijavqfknIFGe3lsFviKdY00FgJtjvlvuv73JlV9D3Me34VWEhAVhLjsXNtDWA00/72 MW3a38HsSb4EzfQjVUqeMt19ijXbJHOVDtwPcoimskVo3s26cF8SIGlXFV1L/StrNWJN zy1xK4pWeGNg0vs6L3w2zmqQPlnurWQc+jgKBO51DiU6kYSFJ26NFaZOlHF8BuFfvdBO TwFFB+jq3GrbIAnUi/iAkT+O/J7xJW6kyIkJf5006xKQWADtkQ1POd5zb8vyQkKWLzie LoKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:message-id:date:to:from :dkim-signature:delivered-to; bh=pE7r+/vY90up/lTHWPTmSntWot8I2dOhM8ToDQrvwc4=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=jHD7auHIucpEZibPrZ9W9Ht8KMNvNh7eagBXyzU58f2X/KCZ6d92ZVbyjR+ri2u8PT xemS/utgoGioGhWtHoI/QEyb0/nU7gNcgpVg2n1GLTuCs3E9iQ5XhxFQtL6G+SUQvpby 6Ptt3El9UpLljam/hoth31yJyKy2VEC9k3j2u6uQBiWVSxfui/r0V14hQVLXFZ4aAUoS 40voVi6hxoQpKpfOT/ZWYwt0ziOXvhyVR9XPVYYlFF54vHSD6MIYRVB4GbC9qIdp7/PI 07pQ9EV8sGv1ON/Fl5mEwedYZtlnBCruHWCIe7ARf6VhCgHX0HG9B/hf6AkcCOzXDn/x 07sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=A2YKznKa; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p3-20020a056402500300b005564f353c64si13758852eda.687.2024.01.24.06.54.34; Wed, 24 Jan 2024 06:54:35 -0800 (PST) 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=A2YKznKa; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D08C268D0DD; Wed, 24 Jan 2024 16:54:31 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1B4EC68CF9C for ; Wed, 24 Jan 2024 16:54:25 +0200 (EET) Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-6dd72c4eb4aso1688644b3a.2 for ; Wed, 24 Jan 2024 06:54:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706108062; x=1706712862; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=yF+hdZNsm1NDFIHbLdeoL/F74vApCkLl/8xR4pc3cCc=; b=A2YKznKaeibL1a7kedG4UplujAaPkIhYDhDA5a5zb9nPJEEKzRm29psEliGHFL5RP1 634CLOv+qOUJClWTGCezfXxetKlVfqeyMKpS0PSHrtP7n//ltKJZyESbTdMxaGq8YYTA LnIGM5GemLbIfKQ8FeYqkFnty+X8jzv0a/cifpsSWyalsOmVYOy5sakWut1+8tls3lD4 TVtsMBum7ATeAIe3oXulBLLF3q5+LVp186s5zDOKoALgPTLJmGUZNjekPvxE4fDZk6uu Pe3t2XbM4Xg0ruM6dpWiJWbkaKU8TS14DMoArIyX0tXDFVVGyvwAduhVw/IW0E35XXVi rEeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706108062; x=1706712862; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yF+hdZNsm1NDFIHbLdeoL/F74vApCkLl/8xR4pc3cCc=; b=lcvngGh2wVFJSEsX2B9MTDxIiyx9vad6/zr5gibyBf/RO/PoOGCMfcWcxT6Mkh/vjp K5FuZp+MlP3sOEkgK3StE9HmBPVGSW8BvEtRGAzwzL1k1VISwJp6uvDbj7MyfPxLdfpb GiNh84Uzu9lCMK6gHLGUtQagedeEXO2Qu2oXBtd0NaCrc14xdyYVktRUh+yaParB2ows NrPUX8Bl5w11SYwRxlUMfJdwvKKpv9mtso8t+6dyvuUz7p2Kel3HL+/91MzxBdrU0HXC brdIQw1b6v60AhF+5b8flB+dH5MFtP7ic9/GRVGpkniB793bmRG0vSOPlOn+aN4+U4PT vZQA== X-Gm-Message-State: AOJu0YzepXckHN6o4rFT8K3uh4d9o8z9U3F/XUTqc+xBt4giqQmR4cJ9 RKCHjgusvvSBm4g0mcPhaaDuVULu+fbIFf8cZd379pT6P9tKlIUWzdspb463 X-Received: by 2002:a05:6a20:bb18:b0:19c:4f2d:a334 with SMTP id fc24-20020a056a20bb1800b0019c4f2da334mr554012pzb.68.1706108061792; Wed, 24 Jan 2024 06:54:21 -0800 (PST) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id s23-20020a62e717000000b006dda22e1c2csm1144598pfh.115.2024.01.24.06.54.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 06:54:21 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Jan 2024 11:54:16 -0300 Message-ID: <20240124145419.7980-1-jamrial@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/4 v2] avformat/mov: ignore item boxes for animated heif 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: 4B0t4cFBgEcE Fixes a regression since d9fed9df2a, where the single animated stream would be exported twice as two independent streams. Signed-off-by: James Almer --- libavformat/isom.h | 1 + libavformat/mov.c | 147 ++++++++++++++++++++++++++++++--------------- 2 files changed, 99 insertions(+), 49 deletions(-) diff --git a/libavformat/isom.h b/libavformat/isom.h index 2cf456fee1..21caaac256 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -280,6 +280,7 @@ typedef struct MOVContext { int64_t duration; ///< duration of the longest track int found_moov; ///< 'moov' atom has been found int found_iloc; ///< 'iloc' atom has been found + int found_iinf; ///< 'iinf' atom has been found int found_mdat; ///< 'mdat' atom has been found int found_hdlr_mdta; ///< 'hdlr' atom with type 'mdta' has been found int trak_index; ///< Index of the current 'trak' diff --git a/libavformat/mov.c b/libavformat/mov.c index 4cffd6c7db..03ca62895e 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -81,6 +81,7 @@ typedef struct MOVParseTableEntry { static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom); static int mov_read_mfra(MOVContext *c, AVIOContext *f); +static void mov_free_stream_context(AVFormatContext *s, AVStream *st); static int64_t add_ctts_entry(MOVCtts** ctts_data, unsigned int* ctts_count, unsigned int* allocated_size, int count, int duration); @@ -4639,6 +4640,23 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) MOVStreamContext *sc; int ret; + if (c->found_iinf) { + // * For animated heif, if the iinf box showed up before the moov + // box, we need to clear all the streams read in the former. + for (int i = c->heif_info_size - 1; i >= 0; i--) { + HEIFItem *item = &c->heif_info[i]; + + if (!item->st) + continue; + + mov_free_stream_context(c->fc, item->st); + ff_remove_stream(c->fc, item->st); + } + av_freep(&c->heif_info); + c->heif_info_size = 0; + c->found_iinf = c->found_iloc = 0; + } + st = avformat_new_stream(c->fc, NULL); if (!st) return AVERROR(ENOMEM); st->id = -1; @@ -7768,8 +7786,9 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) uint64_t base_offset, extent_offset, extent_length; uint8_t value; - if (c->found_iloc) { - av_log(c->fc, AV_LOG_INFO, "Duplicate iloc box found\n"); + if (c->found_moov) { + // * For animated heif, we don't care about the iloc box as all the + // necessary information can be found in the moov box. return 0; } @@ -7891,6 +7910,16 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom) int entry_count; int version, ret; + if (c->found_iinf) { + av_log(c->fc, AV_LOG_WARNING, "Duplicate iinf box found\n"); + return 0; + } + if (c->found_moov) { + // * For animated heif, we don't care about the iinf box as all the + // necessary information can be found in the moov box. + return 0; + } + version = avio_r8(pb); avio_rb24(pb); // flags. entry_count = version ? avio_rb32(pb) : avio_rb16(pb); @@ -7914,6 +7943,7 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom) return ret; } + c->found_iinf = 1; return 0; } @@ -7927,6 +7957,13 @@ static int mov_read_iref(MOVContext *c, AVIOContext *pb, MOVAtom atom) static int mov_read_ispe(MOVContext *c, AVIOContext *pb, MOVAtom atom) { uint32_t width, height; + + if (c->found_moov) { + // * For animated heif, we don't care about the ispe box as all the + // necessary information can be found in the moov box. + return 0; + } + avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ width = avio_rb32(pb); @@ -7961,6 +7998,12 @@ static int mov_read_iprp(MOVContext *c, AVIOContext *pb, MOVAtom atom) int version, flags; int ret; + if (c->found_moov) { + // * For animated heif, we don't care about the iprp box as all the + // necessary information can be found in the moov box. + return 0; + } + a.size = avio_rb32(pb); a.type = avio_rl32(pb); @@ -8581,6 +8624,58 @@ static void mov_free_encryption_index(MOVEncryptionIndex **index) { av_freep(index); } +static void mov_free_stream_context(AVFormatContext *s, AVStream *st) +{ + MOVStreamContext *sc = st->priv_data; + + if (!sc) + return; + + av_freep(&sc->ctts_data); + for (int i = 0; i < sc->drefs_count; i++) { + av_freep(&sc->drefs[i].path); + av_freep(&sc->drefs[i].dir); + } + av_freep(&sc->drefs); + + sc->drefs_count = 0; + + if (!sc->pb_is_copied) + ff_format_io_close(s, &sc->pb); + + sc->pb = NULL; + av_freep(&sc->chunk_offsets); + av_freep(&sc->stsc_data); + av_freep(&sc->sample_sizes); + av_freep(&sc->keyframes); + av_freep(&sc->stts_data); + av_freep(&sc->sdtp_data); + av_freep(&sc->stps_data); + av_freep(&sc->elst_data); + av_freep(&sc->rap_group); + av_freep(&sc->sync_group); + av_freep(&sc->sgpd_sync); + av_freep(&sc->sample_offsets); + av_freep(&sc->open_key_samples); + av_freep(&sc->display_matrix); + av_freep(&sc->index_ranges); + + if (sc->extradata) + for (int i = 0; i < sc->stsd_count; i++) + av_free(sc->extradata[i]); + av_freep(&sc->extradata); + av_freep(&sc->extradata_size); + + mov_free_encryption_index(&sc->cenc.encryption_index); + av_encryption_info_free(sc->cenc.default_encrypted_sample); + av_aes_ctr_free(sc->cenc.aes_ctr); + + av_freep(&sc->stereo3d); + av_freep(&sc->spherical); + av_freep(&sc->mastering); + av_freep(&sc->coll); +} + static int mov_read_close(AVFormatContext *s) { MOVContext *mov = s->priv_data; @@ -8588,54 +8683,8 @@ static int mov_read_close(AVFormatContext *s) for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; - MOVStreamContext *sc = st->priv_data; - - if (!sc) - continue; - - av_freep(&sc->ctts_data); - for (j = 0; j < sc->drefs_count; j++) { - av_freep(&sc->drefs[j].path); - av_freep(&sc->drefs[j].dir); - } - av_freep(&sc->drefs); - - sc->drefs_count = 0; - if (!sc->pb_is_copied) - ff_format_io_close(s, &sc->pb); - - sc->pb = NULL; - av_freep(&sc->chunk_offsets); - av_freep(&sc->stsc_data); - av_freep(&sc->sample_sizes); - av_freep(&sc->keyframes); - av_freep(&sc->stts_data); - av_freep(&sc->sdtp_data); - av_freep(&sc->stps_data); - av_freep(&sc->elst_data); - av_freep(&sc->rap_group); - av_freep(&sc->sync_group); - av_freep(&sc->sgpd_sync); - av_freep(&sc->sample_offsets); - av_freep(&sc->open_key_samples); - av_freep(&sc->display_matrix); - av_freep(&sc->index_ranges); - - if (sc->extradata) - for (j = 0; j < sc->stsd_count; j++) - av_free(sc->extradata[j]); - av_freep(&sc->extradata); - av_freep(&sc->extradata_size); - - mov_free_encryption_index(&sc->cenc.encryption_index); - av_encryption_info_free(sc->cenc.default_encrypted_sample); - av_aes_ctr_free(sc->cenc.aes_ctr); - - av_freep(&sc->stereo3d); - av_freep(&sc->spherical); - av_freep(&sc->mastering); - av_freep(&sc->coll); + mov_free_stream_context(s, st); } av_freep(&mov->dv_demux); From patchwork Wed Jan 24 14:54:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 45793 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:120f:b0:199:de12:6fa6 with SMTP id v15csp1324025pzf; Wed, 24 Jan 2024 06:54:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IG+mrGGGCa+XSa7p3LCvHjPbPOc7Pk9CDt09GZcYAhKvdtbg8udUbOCKPRRNMPeqUPPftbC X-Received: by 2002:a05:600c:1d2a:b0:40e:676c:33e5 with SMTP id l42-20020a05600c1d2a00b0040e676c33e5mr883930wms.79.1706108084843; Wed, 24 Jan 2024 06:54:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706108084; cv=none; d=google.com; s=arc-20160816; b=NUrSqogTab8CMFc2iiVxX/lL9r8MsymOIo+w267Dkk5V9bApRxJD2p7qKcrbl+rpQD AKoj5wEfQ33ywPyl5WhocGHVZt8r1RsRWR4HCvfe3uOfehyiCHF78rNVs6aAu/0IXmIh B6K4CDIr83to2tm7NW1ushkxfO+p6SPmTcUc3A9bzBiZfO0DOADy1LV4ibJu7TM4BhEQ GYCuR1r4AYuqbh0i3qaRkiTvBU6/NcXYWGjYcFoRMJhMRR+zYRYzJGhLYCRzUElgU0WQ lnSk1ZLStFkl8G3rKDeKuB6Nl7hxx/GrFlm920GJojwOHuzErv2ZQCwWxWc1fUvfRtL1 4tVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=LFNxx8XokPl32Fhdl7F5aCSY8QEwbbvBicT7FK+Lyus=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=GCYagJaqutlidtrMrcrG8X9QzLg5XofuftOzfImzU2N55kPCDbyqMIPGyQq6hAy4Hq /uGKfHDhMfGMDcsb5PC1703wnt/Qf+MvNBFkV+0rF3zrNwAEZBwzlMCgyCa2RJOqo/gL GlaPM9GDBy8tkcqecw0krZryCbYZZHsm1AWw2UXzNcD0PwZztnzuW0CnlXNQv9AZduCD UjpFgjTOLgOW3PoQ62EpAKidKS1mfHr1Nq4NMG/za8L5xKn/XQw2CZtOUzyX2y4hlbBS aoZA//9PGDIoK5TJm/uCqslFxl1AVqqQxRTnXe3nx+9WKT7tiAS5XIgztOIeF3P3Kuhf dhTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=dla8w2sQ; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ij14-20020a056402158e00b0055cc7f11b3fsi727015edb.672.2024.01.24.06.54.44; Wed, 24 Jan 2024 06:54:44 -0800 (PST) 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=dla8w2sQ; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 107BF68D0EE; Wed, 24 Jan 2024 16:54:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 59CE868CD0C for ; Wed, 24 Jan 2024 16:54:26 +0200 (EET) Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6ddc1fad6ddso188076b3a.0 for ; Wed, 24 Jan 2024 06:54:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706108063; x=1706712863; 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=oYfrk22LfGGes5ye51Hq3PCr7wmHNu/ut98ZTZmKbtc=; b=dla8w2sQ1thVuNNYG7V5aooooUrPI91l9X23SjHTBrMnWm/dXN9nDb2IrLjH/bvXwz VwD3wbbTz1pY12NMwvGVx4D+X1Z+jVnFU906QWGSlAAC/MyoJDdURTe1hyIR0LUNaafa WXOSd84lOH0WJSK+8/u7PrtZRoGdqyxwYIz6AK6xrUANSLiIbL9dK46N2YzX3gmpFahV t81JTM7+nwSmJxnsSa5FFR9PVSgIfoKuJGj4y/0O29gFxKYGAQc109I9O4dYE8hFpR3r rXpXAcuNYp92tSMJrbB8wEsBuGXLf4N7zEP938io5ojF1oIYv3jbnOYoE6qzzxk9PrPm GtsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706108063; x=1706712863; 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=oYfrk22LfGGes5ye51Hq3PCr7wmHNu/ut98ZTZmKbtc=; b=LicSfPxJahDSqMc1Ch4pOxuXdQl+/SmD9Q5PDuAQLTH72tEdWPh6oHissnHG/Erx63 bIrrTlJsLIFMoyj3INAo5RTifWC2Rk2URQANcYiiStkxe5/ecftyDvhBUbD/ZoppJxJw 6cAVgfqePDxDYcey+QzBsgJiZT6SiUNhua82rFVzcQDh2D7mPrvpFhp0VZndSDYeQ9fR 4bXKTptIwkVfiLnXtUkJWqLTkw0mAGX5v9AOabKnuLRV4TMENAGcp2xei7i6dmpVFATJ 1+gnzwYh5QgFMGMCGREKc4XLIDQXb5tEANkAinbGJkiJ2OdpB3Pt6wa5EYc69xSrLIbq 4vwA== X-Gm-Message-State: AOJu0YyyonzOZRKZfX97SJyksaEJMxR/kCSCTmTlZbZkJinKeDB2CEgx LPAtxw8fDScZBQfx/4INs8imTfU9K+DBlXpH81D3Xcpv1o9XTinf54o2NyKb X-Received: by 2002:a05:6a21:3941:b0:19c:6392:bd04 with SMTP id ac1-20020a056a21394100b0019c6392bd04mr998136pzc.12.1706108063473; Wed, 24 Jan 2024 06:54:23 -0800 (PST) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id s23-20020a62e717000000b006dda22e1c2csm1144598pfh.115.2024.01.24.06.54.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 06:54:22 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Jan 2024 11:54:17 -0300 Message-ID: <20240124145419.7980-2-jamrial@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124145419.7980-1-jamrial@gmail.com> References: <20240124145419.7980-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/4 v4] avformat: add a Tile Grid stream group 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: 7pTfhkZXUiLH This will be used to support tiled image formats like HEIF. Signed-off-by: James Almer --- libavformat/avformat.c | 8 ++++ libavformat/avformat.h | 86 ++++++++++++++++++++++++++++++++++++++++++ libavformat/dump.c | 36 ++++++++++++++++++ libavformat/options.c | 32 ++++++++++++++++ 4 files changed, 162 insertions(+) diff --git a/libavformat/avformat.c b/libavformat/avformat.c index 882927f7b1..58dfa0746a 100644 --- a/libavformat/avformat.c +++ b/libavformat/avformat.c @@ -100,6 +100,14 @@ void ff_free_stream_group(AVStreamGroup **pstg) av_iamf_mix_presentation_free(&stg->params.iamf_mix_presentation); break; } + case AV_STREAM_GROUP_PARAMS_TILE_GRID: { + if (stg->params.tile_grid) { + av_freep(&stg->params.tile_grid->tile_width); + av_freep(&stg->params.tile_grid->tile_height); + } + av_freep(&stg->params.tile_grid); + break; + } default: break; } diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 5d0fe82250..ab9a3fc6be 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1022,11 +1022,96 @@ enum AVStreamGroupParamsType { AV_STREAM_GROUP_PARAMS_NONE, AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT, AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION, + AV_STREAM_GROUP_PARAMS_TILE_GRID, }; struct AVIAMFAudioElement; struct AVIAMFMixPresentation; +/** + * AVTileGrid holds information on how to combine several independent images in + * a single grid for presentation. + * + * Its size is not a part of the ABI. No new fields may be added to this struct + * without a major version bump. + */ +typedef struct AVTileGrid { + const AVClass *av_class; + + /** + * Amount of rows in the grid. + * + * Must be > 0. + */ + int tile_rows; + /** + * Amount of columns in the grid. + * + * Must be > 0. + */ + int tile_cols; + + /** + * A @ref tile_rows * @ref tile_cols sized array of width values for each + * tile in the grid, in row major order. + * The sum of tile width values must be consistent across all rows. + * + * Must be allocated with the av_malloc() family of functions, and will be + * freed by av_tile_grid_free(). + */ + int *tile_width; + + /** + * A @ref tile_rows * @ref tile_cols sized array of height values for each + * tile in the grid, in row major order. + * The sum of tile height values must be consistent across all columns. + * + * Must be allocated with the av_malloc() family of functions, and will be + * freed by av_tile_grid_free(). + */ + int *tile_height; + + /** + * Offset in pixels from the left edge of the grid where the actual image + * meant for presentation starts. + * + * This field must be >= 0 and <= the sum of values for a row in the + * tile_width array minus @ref output_width. + */ + int horizontal_offset; + /** + * Offset in pixels from the top edge of the grid where the actual image meant + * for presentation starts. + * + * This field must be >= 0 and <= the sum of values for a column in the + * tile_height array minus @ref output_height. + */ + int vertical_offset; + + /** + * Width of the final image for presentation. + * + * Must be > 0 and <= the sum of values for a row in the tile_width array + * minus @ref horizontal_offset. + * When it's not equal to the sum of values for a row in the tile_width array, + * the result of said sum minus output_width minus @ref horizontal_offset is + * the amount of pixels to be cropped from the right edge of the final image + * before presentation. + */ + int output_width; + /** + * Height of the final image for presentation. + * + * Must be > 0 and <= the sum of values for a column in the tile_height array + * minus @ref vertical_offset. + * When it's not equal to the sum of values for a column in the tile_height, + * the result of said sum minus output_height minus @ref vertical_offset is + * the amount of pixels to be cropped from the bottom edge of the final image + * before presentation. + */ + int output_height; +} AVTileGrid; + typedef struct AVStreamGroup { /** * A class for @ref avoptions. Set by avformat_stream_group_create(). @@ -1062,6 +1147,7 @@ typedef struct AVStreamGroup { union { struct AVIAMFAudioElement *iamf_audio_element; struct AVIAMFMixPresentation *iamf_mix_presentation; + struct AVTileGrid *tile_grid; } params; /** diff --git a/libavformat/dump.c b/libavformat/dump.c index aff51b43f6..33932f39ae 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -22,6 +22,7 @@ #include #include +#include "libavutil/avstring.h" #include "libavutil/channel_layout.h" #include "libavutil/display.h" #include "libavutil/iamf.h" @@ -720,6 +721,41 @@ static void dump_stream_group(const AVFormatContext *ic, uint8_t *printed, } } break; + case AV_STREAM_GROUP_PARAMS_TILE_GRID: { + const AVTileGrid *tile_grid = stg->params.tile_grid; + AVCodecContext *avctx = avcodec_alloc_context3(NULL); + const char *ptr = NULL; + av_log(NULL, AV_LOG_INFO, " Tile Grid:"); + av_log(NULL, AV_LOG_VERBOSE, " %d rows, %d columns,", tile_grid->tile_rows, tile_grid->tile_cols); + if (avctx && stg->nb_streams && !avcodec_parameters_to_context(avctx, stg->streams[0]->codecpar)) { + int size = tile_grid->tile_rows * tile_grid->tile_cols; + int coded_width = 0, coded_height = 0; + avctx->width = tile_grid->output_width; + avctx->height = tile_grid->output_height; + for (int j = 0; j < tile_grid->tile_cols; j++) + coded_width += tile_grid->tile_width[j]; + for (int j = 0; j < size; j += tile_grid->tile_cols) + coded_height += tile_grid->tile_height[j]; + avctx->coded_width = coded_width; + avctx->coded_height = coded_height; + if (ic->dump_separator) + av_opt_set(avctx, "dump_separator", ic->dump_separator, 0); + buf[0] = 0; + avcodec_string(buf, sizeof(buf), avctx, is_output); + ptr = av_stristr(buf, " "); + } + avcodec_free_context(&avctx); + if (ptr) + av_log(NULL, AV_LOG_INFO, "%s", ptr); + av_log(NULL, AV_LOG_INFO, "\n"); + dump_metadata(NULL, stg->metadata, " ", AV_LOG_INFO); + for (int i = 0; i < stg->nb_streams; i++) { + const AVStream *st = stg->streams[i]; + dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_VERBOSE); + printed[st->index] = 1; + } + break; + } } default: break; diff --git a/libavformat/options.c b/libavformat/options.c index 75ec86ce05..31620013c6 100644 --- a/libavformat/options.c +++ b/libavformat/options.c @@ -337,6 +337,26 @@ fail: return NULL; } +#define FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM +#define OFFSET(x) offsetof(AVTileGrid, x) +static const AVOption tile_grid_options[] = { + { "tile_rows", NULL, OFFSET(tile_rows), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, INT_MAX, FLAGS }, + { "tile_cols", NULL, OFFSET(tile_cols), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, INT_MAX, FLAGS }, + { "horizontal_offset", NULL, OFFSET(horizontal_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS }, + { "vertical_offset", NULL, OFFSET(vertical_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS }, + { "output_size", "size of the output image", OFFSET(output_width), AV_OPT_TYPE_IMAGE_SIZE, + { .str = NULL }, 0, INT_MAX, FLAGS }, + { NULL }, +}; +#undef FLAGS +#undef OFFSET + +static const AVClass tile_grid_class = { + .class_name = "AVTileGrid", + .version = LIBAVUTIL_VERSION_INT, + .option = tile_grid_options, +}; + static void *stream_group_child_next(void *obj, void *prev) { AVStreamGroup *stg = obj; @@ -346,6 +366,8 @@ static void *stream_group_child_next(void *obj, void *prev) return stg->params.iamf_audio_element; case AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION: return stg->params.iamf_mix_presentation; + case AV_STREAM_GROUP_PARAMS_TILE_GRID: + return stg->params.tile_grid; default: break; } @@ -368,6 +390,9 @@ static const AVClass *stream_group_child_iterate(void **opaque) case AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION: ret = av_iamf_mix_presentation_get_class(); break; + case AV_STREAM_GROUP_PARAMS_TILE_GRID: + ret = &tile_grid_class; + break; default: break; } @@ -429,6 +454,13 @@ AVStreamGroup *avformat_stream_group_create(AVFormatContext *s, if (!stg->params.iamf_mix_presentation) goto fail; break; + case AV_STREAM_GROUP_PARAMS_TILE_GRID: + stg->params.tile_grid = av_mallocz(sizeof(*stg->params.tile_grid)); + if (!stg->params.tile_grid) + goto fail; + stg->params.tile_grid->av_class = &tile_grid_class; + av_opt_set_defaults(stg->params.tile_grid); + break; default: goto fail; } From patchwork Wed Jan 24 14:54:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 45794 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:120f:b0:199:de12:6fa6 with SMTP id v15csp1324102pzf; Wed, 24 Jan 2024 06:54:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIErDLUtuemybj8TJiZ5IV7Qh06LQ65PjxgLKD+Xt+IqRlF01lXPDn6HNZsedxxv5ooIkI X-Received: by 2002:a17:906:5509:b0:a30:d454:58a0 with SMTP id r9-20020a170906550900b00a30d45458a0mr1740074ejp.5.1706108093986; Wed, 24 Jan 2024 06:54:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706108093; cv=none; d=google.com; s=arc-20160816; b=eb7yGIxTIppLA8X+f/C5x6KAiUuddLTYx03GDrDrijqzNleqQY3+wvIuKJe3WF55ad hSt46Wko3F+H1fCvr7TI7zaWdAlc5xWY2E0M4ZUyVy5/FxJzRtqu7RszOlSKcWD7mz9q y+vK8S3mOALBWCk+JNXmbKqaNlVVNka9dNgHCTTdS9sSdwfiB7zO/dI1Wp4+aVKMyzAl gN4zYldxAlRznMuqWqz5s+QVI/7GbruXXnFzFl+63QMgAn7G6hVMAg1U1UgOICgWycg2 fHVCcbCWdpWr9yKtcX9yseEiTNhA7ijzMo/VNUCoa6edvMSNGmcXBa7GOo14zuZFQu+3 OfDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=JeyFh4rkTwu2IsbQ9ncRV3ezaIu9a4gX/kBdew8bhKQ=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=K4zbfJjoI6ARl3rGzun0iduEv4rUzSAVDbsGwbYPFz4gluFK20DzjNIsDQhv8koaPx CGTlrv+LefEZhKdnwJ0yMCAN5ZmsinanCZ7l9Qf9Pao5GvFFPzdxiesYR6/eWvYad3ph 7LGm248121kxgUeQCwVCzdyAT+0Mn4bI3A/zZVYF5dhJmXT4yXeLljrcBxfgG4+GL9Hj 0VusPgKtTRLCYZBXCGGM8Priv/lR3IoZHFW759ZOy0W8+lKbrROPlwWrjeWAiaJd9ezr 6uf8HQ7deGbfjD99eGLnXQmrxDdrGFykmNKwoIIyF4ZyhExgDCjiPZi4tfEPCv+Vg7zx BIZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=LVx3Ejoh; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d2-20020a1709064c4200b00a312ba58a9asi543762ejw.506.2024.01.24.06.54.53; Wed, 24 Jan 2024 06:54:53 -0800 (PST) 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=LVx3Ejoh; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 304AE68D0E4; Wed, 24 Jan 2024 16:54:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D885768CF9C for ; Wed, 24 Jan 2024 16:54:27 +0200 (EET) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6ddc0c02593so215034b3a.3 for ; Wed, 24 Jan 2024 06:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706108065; x=1706712865; 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=mH1QpIPRnsw/iMjHaVCKyJen7NivTtVVutOL/JNoKVU=; b=LVx3EjohjbF6/a2C7Co+0aebpyjVGKoDK8VqHGWAOCodfFstsWfHMS6AVMhCBTMQUC j21Fk7b1xJeMNlwrwUEA5gJ7+heWbutGBZ5ET0F1BApJLcT9OunXHCd69PhhDtybvc9B 5+3Ayu4UzLrtdzpnX8tgwN7bHZZBbY50tHf8qdmJ9vqrW+VOEiIYr5DQ8leCwtQWXwCC ypT6Kbv5GpGyFXaaUvpKascp6/naaIlg46mxFO9ZcPlSF9Iwzaiw1C87ERLS9yQxYBwj 25CLuctbDNnWo8PSCf2rcHnZogkcpaCJ1kJuOS0fS3rcSt+z2xkKf+E/M1Mz7XpZCLXT QK0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706108065; x=1706712865; 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=mH1QpIPRnsw/iMjHaVCKyJen7NivTtVVutOL/JNoKVU=; b=wyK7Qo/afWSmlHf64W46XP7xZz0AK9tEd5UCmBAqMEQo7fjN2jcb7GxNE1smJuwR2I kVvUEvRDlZypAVXbmKxCRgI1cVEAWr9WP50Uh1FmKOlNOYBw6mMp/AbJFwFVrSLCmEXO Epuo9BDHdsQcaxyhN4Da+5lSCoZuRMrhb5XxRo5JUHQ5uvwnKC7X4VgTJh6TSv+meI9K pKcBOXupp4jqxL6DHBuAxdRY2S0+AIqHbyiufZ+WM3K+TJsyRJ9F3s6Hn/bLBP5/OF97 BENpfpiW0DhX9TmGiEjymi+pCwMcwEcMWJYTkm5+kE/p35jZjmnjTmX/DlsBuLfyfSeR ir8g== X-Gm-Message-State: AOJu0Yzd8N9kdvize79g6YxR7rfG+nwWaiFh4u89N5tRzZkA31FJynbN cMgAZ1WVUqWSpjoC5rc8SuotfYF/V2tQZO3dJB3pa2jcKO/SIoZk2uulmnm0 X-Received: by 2002:a05:6a20:ce47:b0:19c:194b:9b57 with SMTP id id7-20020a056a20ce4700b0019c194b9b57mr902149pzb.31.1706108064927; Wed, 24 Jan 2024 06:54:24 -0800 (PST) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id s23-20020a62e717000000b006dda22e1c2csm1144598pfh.115.2024.01.24.06.54.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 06:54:24 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Jan 2024 11:54:18 -0300 Message-ID: <20240124145419.7980-3-jamrial@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124145419.7980-1-jamrial@gmail.com> References: <20240124145419.7980-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/4 v2] avformat/mov: add support for tile HEIF still images 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: atx1LZPCipOB Export each tile as its own stream, and the tiling information as a Stream Group of type TILE_GRID. This also enables exporting other stream items like thumbnails, which may be present in non tiled HEIF images too. For those, the primary stream will be tagged with the default disposition. Based on a patch by Swaraj Hota Signed-off-by: James Almer --- libavcodec/packet.h | 9 ++ libavformat/avformat.h | 6 + libavformat/dump.c | 6 + libavformat/isom.h | 7 +- libavformat/mov.c | 320 ++++++++++++++++++++++++++++++++++++----- 5 files changed, 312 insertions(+), 36 deletions(-) diff --git a/libavcodec/packet.h b/libavcodec/packet.h index 2c57d262c6..48ca799334 100644 --- a/libavcodec/packet.h +++ b/libavcodec/packet.h @@ -323,6 +323,15 @@ enum AVPacketSideDataType { */ AV_PKT_DATA_IAMF_RECON_GAIN_INFO_PARAM, + /** + * Tile info for image reconstruction, e.g HEIF. + * @code + * u32le tile number in row major order [0..nb_tiles-1] + * u32le nb_tiles + * @endcode + */ + AV_PKT_DATA_TILE_INFO, + /** * The number of side data types. * This is not part of the public API/ABI in the sense that it may diff --git a/libavformat/avformat.h b/libavformat/avformat.h index ab9a3fc6be..cf4e72e11d 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -811,6 +811,12 @@ typedef struct AVIndexEntry { * The video stream contains still images. */ #define AV_DISPOSITION_STILL_IMAGE (1 << 20) +/** + * The video stream is intended to be merged with another stream before + * presentation. + * Used for example to signal the stream contains a tile from a HEIF grid. + */ +#define AV_DISPOSITION_TILE (1 << 21) /** * @return The AV_DISPOSITION_* flag corresponding to disp or a negative error diff --git a/libavformat/dump.c b/libavformat/dump.c index 33932f39ae..5a8b5d7160 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -514,6 +514,10 @@ static void dump_sidedata(void *ctx, const AVStream *st, const char *indent, av_log(ctx, log_level, "SMPTE ST 12-1:2014: "); dump_s12m_timecode(ctx, st, sd, log_level); break; + case AV_PKT_DATA_TILE_INFO: + av_log(ctx, log_level, "HEIF tile info: tile %u/%u", + AV_RL32(sd->data) + 1U, AV_RL32(sd->data + 4)); + break; default: av_log(ctx, log_level, "unknown side data type %d " "(%"SIZE_SPECIFIER" bytes)", sd->type, sd->size); @@ -640,6 +644,8 @@ static void dump_stream_format(const AVFormatContext *ic, int i, av_log(NULL, log_level, " (still image)"); if (st->disposition & AV_DISPOSITION_NON_DIEGETIC) av_log(NULL, log_level, " (non-diegetic)"); + if (st->disposition & AV_DISPOSITION_TILE) + av_log(NULL, log_level, " (tile)"); av_log(NULL, log_level, "\n"); dump_metadata(NULL, st->metadata, extra_indent, log_level); diff --git a/libavformat/isom.h b/libavformat/isom.h index 21caaac256..c6a8507a68 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -267,10 +267,10 @@ typedef struct HEIFItem { int item_id; int64_t extent_length; int64_t extent_offset; - int64_t size; int width; int height; int type; + int is_idat_relative; } HEIFItem; typedef struct MOVContext { @@ -336,6 +336,11 @@ typedef struct MOVContext { int cur_item_id; HEIFItem *heif_info; int heif_info_size; + int grid_item_id; + int thmb_item_id; + int16_t *tile_id_list; + int nb_tiles; + int64_t idat_offset; int interleaved_read; } MOVContext; diff --git a/libavformat/mov.c b/libavformat/mov.c index 03ca62895e..2dce370b5d 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -185,6 +185,30 @@ static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len, return p - dst; } +static AVStream *get_curr_st(MOVContext *c) +{ + AVStream *st = NULL; + + if (c->fc->nb_streams < 1) + return NULL; + + for (int i = 0; i < c->heif_info_size; i++) { + HEIFItem *item = &c->heif_info[i]; + + if (!item->st) + continue; + if (item->st->id != c->cur_item_id) + continue; + + st = item->st; + break; + } + if (!st) + st = c->fc->streams[c->fc->nb_streams-1]; + + return st; +} + static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len) { AVStream *st; @@ -1767,9 +1791,9 @@ static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom) uint16_t color_primaries, color_trc, color_matrix; int ret; - if (c->fc->nb_streams < 1) + st = get_curr_st(c); + if (!st) return 0; - st = c->fc->streams[c->fc->nb_streams - 1]; ret = ffio_read_size(pb, color_parameter_type, 4); if (ret < 0) @@ -2117,9 +2141,9 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom) AVStream *st; int ret; - if (c->fc->nb_streams < 1) + st = get_curr_st(c); + if (!st) return 0; - st = c->fc->streams[c->fc->nb_streams-1]; if ((uint64_t)atom.size > (1<<30)) return AVERROR_INVALIDDATA; @@ -4946,12 +4970,10 @@ static int heif_add_stream(MOVContext *c, HEIFItem *item) st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->codec_id = mov_codec_id(st, item->type); sc->ffindex = st->index; - c->trak_index = st->index; st->avg_frame_rate.num = st->avg_frame_rate.den = 1; st->time_base.num = st->time_base.den = 1; st->nb_frames = 1; sc->time_scale = 1; - sc = st->priv_data; sc->pb = c->fc->pb; sc->pb_is_copied = 1; @@ -7779,11 +7801,60 @@ static int mov_read_pitm(MOVContext *c, AVIOContext *pb, MOVAtom atom) return atom.size; } +static int mov_read_idat(MOVContext *c, AVIOContext *pb, MOVAtom atom) +{ + c->idat_offset = avio_tell(pb); + return 0; +} + +static int read_image_grid(AVFormatContext *s, AVTileGrid *tile_grid, HEIFItem *item) { + MOVContext *c = s->priv_data; + int64_t offset = 0, pos = avio_tell(s->pb); + uint8_t flags; + + if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL)) { + av_log(c->fc, AV_LOG_INFO, "grid box with non seekable input\n"); + return AVERROR_PATCHWELCOME; + } + if (item->is_idat_relative) { + if (!c->idat_offset) { + av_log(c->fc, AV_LOG_ERROR, "missing idat box required by the image grid\n"); + return AVERROR_INVALIDDATA; + } + offset = c->idat_offset; + } + + avio_seek(s->pb, item->extent_offset + offset, SEEK_SET); + + avio_r8(s->pb); /* version */ + flags = avio_r8(s->pb); + + tile_grid->tile_rows = avio_r8(s->pb) + 1; + tile_grid->tile_cols = avio_r8(s->pb) + 1; + /* actual width and height of output image */ + tile_grid->output_width = (flags & 1) ? avio_rb32(s->pb) : avio_rb16(s->pb); + tile_grid->output_height = (flags & 1) ? avio_rb32(s->pb) : avio_rb16(s->pb); + + tile_grid->tile_width = av_calloc(tile_grid->tile_rows * tile_grid->tile_cols, + sizeof(*tile_grid->tile_width)); + tile_grid->tile_height = av_calloc(tile_grid->tile_rows * tile_grid->tile_cols, + sizeof(*tile_grid->tile_height)); + if (!tile_grid->tile_width || !tile_grid->tile_width) + return AVERROR(ENOMEM); + + av_log(c->fc, AV_LOG_TRACE, "grid: grid_rows %d grid_cols %d output_width %d output_height %d\n", + tile_grid->tile_rows, tile_grid->tile_cols, tile_grid->output_width, tile_grid->output_height); + + avio_seek(s->pb, pos, SEEK_SET); + + return 0; +} + static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int version, offset_size, length_size, base_offset_size, index_size; int item_count, extent_count; - uint64_t base_offset, extent_offset, extent_length; + int64_t base_offset, extent_offset, extent_length; uint8_t value; if (c->found_moov) { @@ -7830,6 +7901,7 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_rb16(pb); // data_reference_index. if (rb_size(pb, &base_offset, base_offset_size) < 0) return AVERROR_INVALIDDATA; + av_log(c->fc, AV_LOG_TRACE, "iloc: base_offset %"PRId64"\n", base_offset); extent_count = avio_rb16(pb); if (extent_count > 1) { // For still AVIF images, we only support one extent item. @@ -7840,6 +7912,8 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (rb_size(pb, &extent_offset, offset_size) < 0 || rb_size(pb, &extent_length, length_size) < 0) return AVERROR_INVALIDDATA; + if (offset_type == 1) + c->heif_info[i].is_idat_relative = 1; c->heif_info[i].extent_length = extent_length; c->heif_info[i].extent_offset = base_offset + extent_offset; av_log(c->fc, AV_LOG_TRACE, "iloc: item_idx %d, offset_type %d, " @@ -7878,10 +7952,6 @@ static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_TRACE, "infe: item_id %d, item_type %s, item_name %s\n", item_id, av_fourcc2str(item_type), item_name); - // Skip all but the primary item until support is added - if (item_id != c->primary_item_id) - return 0; - if (size > 0) avio_skip(pb, size); @@ -7895,6 +7965,9 @@ static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (ret < 0) return ret; break; + case MKTAG('g','r','i','d'): + c->grid_item_id = item_id; + break; default: av_log(c->fc, AV_LOG_TRACE, "infe: ignoring item_type %s\n", av_fourcc2str(item_type)); break; @@ -7954,6 +8027,59 @@ static int mov_read_iref(MOVContext *c, AVIOContext *pb, MOVAtom atom) return mov_read_default(c, pb, atom); } +static int mov_read_dimg(MOVContext *c, AVIOContext *pb, MOVAtom atom) +{ + int entries, i; + int from_item_id = avio_rb16(pb); + + if (c->grid_item_id < 0) { + av_log(c->fc, AV_LOG_ERROR, "Missing grid information\n"); + return AVERROR_INVALIDDATA; + } + if (from_item_id != c->grid_item_id) { + avpriv_request_sample(c->fc, "Derived item of type other than 'grid'"); + return AVERROR_PATCHWELCOME; + } + entries = avio_rb16(pb); + c->tile_id_list = av_malloc_array(entries, sizeof(*c->tile_id_list)); + if (!c->tile_id_list) + return AVERROR(ENOMEM); + /* 'to' item ids */ + for (i = 0; i < entries; i++) + c->tile_id_list[i] = avio_rb16(pb); + c->nb_tiles = entries; + + av_log(c->fc, AV_LOG_TRACE, "dimg: from_item_id %d, entries %d\n", + from_item_id, entries); + + return 0; +} + +static int mov_read_thmb(MOVContext *c, AVIOContext *pb, MOVAtom atom) +{ + int entries; + int to_item_id, from_item_id = avio_rb16(pb); + + entries = avio_rb16(pb); + if (entries > 1) { + avpriv_request_sample(c->fc, "More than one thmb entry"); + return AVERROR_PATCHWELCOME; + } + /* 'to' item ids */ + to_item_id = avio_rb16(pb); + + if (to_item_id != c->primary_item_id || + to_item_id != c->grid_item_id) + return 0; + + c->thmb_item_id = from_item_id; + + av_log(c->fc, AV_LOG_TRACE, "thmb: from_item_id %d, entries %d\n", + from_item_id, entries); + + return 0; +} + static int mov_read_ispe(MOVContext *c, AVIOContext *pb, MOVAtom atom) { uint32_t width, height; @@ -7969,15 +8095,17 @@ static int mov_read_ispe(MOVContext *c, AVIOContext *pb, MOVAtom atom) width = avio_rb32(pb); height = avio_rb32(pb); - av_log(c->fc, AV_LOG_TRACE, "ispe: item_id %d, width %u, height %u\n", + av_log(c->fc, AV_LOG_TRACE, "ispe: cur_item_id %d, width %u, height %u\n", c->cur_item_id, width, height); for (int i = 0; i < c->heif_info_size; i++) { - if (c->heif_info[i].item_id == c->cur_item_id) { - c->heif_info[i].width = width; - c->heif_info[i].height = height; - break; - } + HEIFItem *item = &c->heif_info[i]; + if (item->item_id != c->cur_item_id) + continue; + + item->width = width; + item->height = height; + break; } return 0; @@ -8074,10 +8202,6 @@ static int mov_read_iprp(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_TRACE, "ipma: property_index %d, item_id %d, item_type %s\n", index + 1, item_id, av_fourcc2str(ref->type)); - // Skip properties referencing items other than the primary item until support is added - if (item_id != c->primary_item_id) - continue; - c->cur_item_id = item_id; ret = mov_read_default(c, &ref->b.pub, @@ -8205,6 +8329,9 @@ static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('p','c','m','C'), mov_read_pcmc }, /* PCM configuration box */ { MKTAG('p','i','t','m'), mov_read_pitm }, { MKTAG('e','v','c','C'), mov_read_glbl }, +{ MKTAG('d','i','m','g'), mov_read_dimg }, +{ MKTAG('t','h','m','b'), mov_read_thmb }, +{ MKTAG('i','d','a','t'), mov_read_idat }, { MKTAG('i','r','e','f'), mov_read_iref }, { MKTAG('i','s','p','e'), mov_read_ispe }, { MKTAG('i','p','r','p'), mov_read_iprp }, @@ -8713,6 +8840,7 @@ static int mov_read_close(AVFormatContext *s) av_freep(&mov->aes_decrypt); av_freep(&mov->chapter_tracks); av_freep(&mov->heif_info); + av_freep(&mov->tile_id_list); return 0; } @@ -8852,6 +8980,118 @@ fail: return ret; } +static int mov_parse_tiles(AVFormatContext *s) +{ + MOVContext *mov = s->priv_data; + AVStreamGroup *stg = avformat_stream_group_create(s, AV_STREAM_GROUP_PARAMS_TILE_GRID, NULL); + AVTileGrid *tile_grid; + int err; + + if (!stg) + return AVERROR(ENOMEM); + + tile_grid = stg->params.tile_grid; + + av_assert0(mov->grid_item_id >= 0); + for (int i = 0; i < mov->heif_info_size; i++) { + HEIFItem *item = &mov->heif_info[i]; + + if (item->item_id != mov->grid_item_id) + continue; + err = read_image_grid(s, tile_grid, item); + if (err < 0) + return err; + stg->id = item->item_id; + break; + } + + for (int i = 0; i < mov->nb_tiles; i++) { + int tile_id = mov->tile_id_list[i]; + + for (int j = 0; j < mov->heif_info_size; j++) { + HEIFItem *item = &mov->heif_info[j]; + AVStream *st = item->st; + AVPacketSideData *sd; + MOVStreamContext *sc; + int64_t offset = 0; + + if (item->item_id != tile_id) + continue; + if (!st) { + av_log(s, AV_LOG_ERROR, "HEIF tile %d doesn't reference a stream\n", tile_id); + return AVERROR_INVALIDDATA; + } + if (item->is_idat_relative) { + if (!mov->idat_offset) { + av_log(s, AV_LOG_ERROR, "Missing idat box for HEIF tile %d\n", tile_id); + return AVERROR_INVALIDDATA; + } + offset = mov->idat_offset; + } + + tile_grid->tile_width[i] = item->width; + tile_grid->tile_height[i] = item->height; + st->codecpar->width = item->width; + st->codecpar->height = item->height; + + err = avformat_stream_group_add_stream(stg, st); + if (err == AVERROR(EEXIST)) + return AVERROR_INVALIDDATA; + else if (err < 0) + return err; + + sc = st->priv_data; + sc->sample_sizes[0] = item->extent_length; + sc->chunk_offsets[0] = item->extent_offset + offset; + + st->disposition |= AV_DISPOSITION_TILE; + + mov_build_index(mov, st); + + sd = av_packet_side_data_new(&st->codecpar->coded_side_data, + &st->codecpar->nb_coded_side_data, + AV_PKT_DATA_TILE_INFO, + sizeof(uint32_t) * 2, 0); + if (!sd) + return AVERROR(ENOMEM); + + AV_WL32(sd->data, i); + AV_WL32(sd->data + 4, mov->nb_tiles); + break; + } + } + + for (int i = 0; i < mov->heif_info_size; i++) { + HEIFItem *item = &mov->heif_info[i]; + AVStream *st = item->st; + MOVStreamContext *sc; + int64_t offset = 0; + + if (item->item_id != mov->thmb_item_id) + continue; + + if (!st) { + av_log(s, AV_LOG_ERROR, "HEIF thumbnail doesn't reference a stream\n"); + return AVERROR_INVALIDDATA; + } + if (item->is_idat_relative) { + if (!mov->idat_offset) { + av_log(s, AV_LOG_ERROR, "Missing idat box for HEIF thumbnail\n"); + return AVERROR_INVALIDDATA; + } + offset = mov->idat_offset; + } + + sc = st->priv_data; + sc->sample_sizes[0] = item->extent_length; + sc->chunk_offsets[0] = item->extent_offset + offset; + + mov_build_index(mov, st); + } + + return 0; +} + static int mov_read_header(AVFormatContext *s) { MOVContext *mov = s->priv_data; @@ -8868,6 +9108,9 @@ static int mov_read_header(AVFormatContext *s) mov->fc = s; mov->trak_index = -1; + mov->grid_item_id = -1; + mov->thmb_item_id = -1; + mov->primary_item_id = -1; /* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */ if (pb->seekable & AVIO_SEEKABLE_NORMAL) atom.size = avio_size(pb); @@ -8890,23 +9133,30 @@ static int mov_read_header(AVFormatContext *s) av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb)); if (mov->found_iloc) { - for (i = 0; i < mov->heif_info_size; i++) { - HEIFItem *item = &mov->heif_info[i]; - MOVStreamContext *sc; - AVStream *st; + if (mov->nb_tiles) { + err = mov_parse_tiles(s); + if (err < 0) + return err; + } else + for (i = 0; i < mov->heif_info_size; i++) { + HEIFItem *item = &mov->heif_info[i]; + AVStream *st = item->st; + MOVStreamContext *sc; - if (!item->st) - continue; + if (!st) + continue; - st = item->st; - sc = st->priv_data; - st->codecpar->width = item->width; - st->codecpar->height = item->height; - sc->sample_sizes[0] = item->extent_length; - sc->chunk_offsets[0] = item->extent_offset; + sc = st->priv_data; + st->codecpar->width = item->width; + st->codecpar->height = item->height; + sc->sample_sizes[0] = item->extent_length; + sc->chunk_offsets[0] = item->extent_offset; - mov_build_index(mov, st); - } + if (item->item_id == mov->primary_item_id) + st->disposition |= AV_DISPOSITION_DEFAULT; + + mov_build_index(mov, st); + } } if (pb->seekable & AVIO_SEEKABLE_NORMAL) { From patchwork Wed Jan 24 14:54:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 45795 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:120f:b0:199:de12:6fa6 with SMTP id v15csp1324196pzf; Wed, 24 Jan 2024 06:55:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IEW6bh1VGM0efswOk7opz5zORfWeUOuzg6Ub2m3YkXuDYQtVWpt40Xwz+4lAGrniDFwmuEi X-Received: by 2002:a17:906:34cc:b0:a31:1a22:712d with SMTP id h12-20020a17090634cc00b00a311a22712dmr731606ejb.135.1706108103644; Wed, 24 Jan 2024 06:55:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706108103; cv=none; d=google.com; s=arc-20160816; b=FaKt71E5D3qx+SLy22PLKXPMV115XPsIiXVbIUwf6HGRobRpROWtr8sZ0hxRGIXLYU oKoRciwMem6QHq/HOYAJRy686b2vYubcjYl8WG+gwXJMfJv+AnCtX3GTEctrJbqln7wk Nrz+CM2LIbFVgoy5z7ihtg5CP+lXErV5nbOnPvKDFe5vtj4jjwvsaGXsBcImbLYgfA/y bbUOVf/ynpya+tMd8zCoehjuG4jh0M8xeWFMe2v8/y/mnDrt/qrwAlSqpfmzDogtiTl+ 1Y/CHRyapwv9BwD7m0M0Wc7bct5b/QZs7vt/GHM1B1Tjr0WgFmvu4g+u3kC12NNEfwFO M+NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=1J+m3bA80ZppWgQhr2erYQsiZXFOJK7xb392mtP4eTA=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=tldXWm1uK52cc5CxWXYyw4DkD8G/xkOmhcv3Wbo+R5kUVFXFXuzWujK3we+IMQxNW1 W/bOVqTxpA8CDaw7U/s9Lau7ELyKKbjM/6dQpCEbmGynw1kBRR7ltItOvXq9L9xvlJoA TamgqTK/djrRsDhkga9o6KXDwgIf8HSE9NurgkHTRq7sDhD/bTnwLTy92sK4HIhXQatx JPNrJucJL+LpLu2sHVL9qQy8/6nkkvzfz3cBBqXZrBmjpJGRYkvLuih5ksltg+qsb2xY pjoCVwitSRIurkDnOxj/RC5OJNkF/YstfChhB4f+vzwgrl4kUlCOsbAcro5LATH78ngM TwRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=gA9kGu+c; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id s10-20020a170906284a00b00a2a18adf422si12738800ejc.240.2024.01.24.06.55.03; Wed, 24 Jan 2024 06:55:03 -0800 (PST) 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=gA9kGu+c; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 33DE568D111; Wed, 24 Jan 2024 16:54:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7E2E568D0D2 for ; Wed, 24 Jan 2024 16:54:29 +0200 (EET) Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-5999f3f6ce9so1602815eaf.0 for ; Wed, 24 Jan 2024 06:54:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706108067; x=1706712867; 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=O3Wggy/DPc9g5xWq32eitI1ViNoqlqzlhV0tteMwnEU=; b=gA9kGu+ceSm2OaUeULf/45Bp3mw6AFryFtc/qwRj98QiZWcGsQTLFSPGmxJjJHqSvJ IKIP2BBVFZu0qcrxOi0Z6e2lLIi/+J+PT8iicRsMRLXia9N9wR6kdPfh1t4OGSmIsNb1 3sXtFSqN3gQYsnj6GZzL30Ym6t9h77QMnJNqZxdVJLqugJ262qQYvCdXJEW+zxeliMSY KlL+a3D0bElBoqL4/Y4q3SO8F00cCp2AQgnUoTgB+rug/83YcILOOPJonAYc+nfv9RZn A6l7lkWADlougdYJJUs7ZqjhCpvgj7oLlwUPZanXZxoV+AajMpbN8IFoW40KLLM1VPd9 htIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706108067; x=1706712867; 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=O3Wggy/DPc9g5xWq32eitI1ViNoqlqzlhV0tteMwnEU=; b=ow8sJospWPIiusiXsjJ6ilzXrh/8w4CJL/D+9RQjhPPmf9gunhjxfh2ZilKTSm29fT 2HE5HvC1IgbcoaGQsK9uYMvUjrDfpVz5AWuJVjpJ2SPTcL8fj36W/WrLUxTBUaPk9RVf sNTGIXw4PMUKz73dK+kTjbZxGh5rqhbo70LJRlIEB2ZoPYhn5dkRj9h2P0Y+c9qByp5w 7Zkq5YvxqsheBnYlquQSV/TpcC95uLHI4ZUihEVLgl82OmSo6anC1zgNS6GXX3XVqN2r GRA/5pZ+YWhcFvNAqQF4/9HnLCWwnREkw2HX+M8rz7AyzwehcT985AGzhhyI1ptklcg8 ZznA== X-Gm-Message-State: AOJu0YwFJA/Q4X+te4tZ7vx3yUXHmWNJtSv9TWP1cknZgYG6ESa43xgE OrED8i3PKGjgYscUpgExyWZ7g81Z7Fm8otN8ThCKZqK4Xvrrf1jEJR/CTPJa X-Received: by 2002:a05:6358:6f84:b0:176:2340:70be with SMTP id s4-20020a0563586f8400b00176234070bemr8812630rwn.43.1706108066670; Wed, 24 Jan 2024 06:54:26 -0800 (PST) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id s23-20020a62e717000000b006dda22e1c2csm1144598pfh.115.2024.01.24.06.54.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 06:54:26 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Jan 2024 11:54:19 -0300 Message-ID: <20240124145419.7980-4-jamrial@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124145419.7980-1-jamrial@gmail.com> References: <20240124145419.7980-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4 v2] fate/mov: test remuxing all stream heif items 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: cwc5/VENMeKE Signed-off-by: James Almer --- tests/fate/mov.mak | 2 +- tests/ref/fate/mov-heic-demux-still-image-multiple-items | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak index f202f36d96..f549ae33d7 100644 --- a/tests/fate/mov.mak +++ b/tests/fate/mov.mak @@ -156,7 +156,7 @@ fate-mov-heic-demux-still-image-1-item: CMD = framemd5 -i $(TARGET_SAMPLES)/heif FATE_MOV_FFMPEG-$(call FRAMEMD5, MOV, HEVC, HEVC_PARSER) \ += fate-mov-heic-demux-still-image-multiple-items -fate-mov-heic-demux-still-image-multiple-items: CMD = framemd5 -i $(TARGET_SAMPLES)/heif-conformance/C003.heic -c:v copy +fate-mov-heic-demux-still-image-multiple-items: CMD = framemd5 -i $(TARGET_SAMPLES)/heif-conformance/C003.heic -c:v copy -map 0 # Resulting remux should have: # 1. first audio stream with AV_DISPOSITION_HEARING_IMPAIRED diff --git a/tests/ref/fate/mov-heic-demux-still-image-multiple-items b/tests/ref/fate/mov-heic-demux-still-image-multiple-items index c850c1ff9c..753cef267a 100644 --- a/tests/ref/fate/mov-heic-demux-still-image-multiple-items +++ b/tests/ref/fate/mov-heic-demux-still-image-multiple-items @@ -2,10 +2,17 @@ #version: 2 #hash: MD5 #extradata 0, 100, 5444bf01e03182c73ae957179d560f4d +#extradata 1, 100, 5444bf01e03182c73ae957179d560f4d #tb 0: 1/1 #media_type 0: video #codec_id 0: hevc #dimensions 0: 1280x720 #sar 0: 0/1 +#tb 1: 1/1 +#media_type 1: video +#codec_id 1: hevc +#dimensions 1: 1280x720 +#sar 1: 0/1 #stream#, dts, pts, duration, size, hash 0, 0, 0, 1, 111554, 03ceabfab39afd2e2e796b9362111f32 +1, 0, 0, 1, 112393, daa001d351c088a5bc328459e2501c95