From patchwork Fri Mar 29 00:40:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 47633 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp1702389pzb; Thu, 28 Mar 2024 17:41:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU23uf0fb63KDK3qrMpTo1DvUvNf/84xaQi3DfTlNzjLGPaCrkWvpF98XcC6wCI7YdOnfnb7lrBTOYwfF7eHuxuTDVc235MnMfihw== X-Google-Smtp-Source: AGHT+IG89rsiYl0bfvwYJPpFi+xWi7RLKFgEaNp+Ez0kRTLmzp7ojIBk8oZvNPBfVV43AeulPfds X-Received: by 2002:a17:906:409a:b0:a4e:28ca:f172 with SMTP id u26-20020a170906409a00b00a4e28caf172mr1757156ejj.5.1711672882062; Thu, 28 Mar 2024 17:41:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711672882; cv=none; d=google.com; s=arc-20160816; b=no2XoKGNuF44+uvlXEmDYpaLRbYQz3lrxM6xzOptlaZWFyU3Z+xY5PMo5Gg5zLEAmW yNTguhKTX0j67r7KsLKF1m0qhh7rzG1I4UysMS6ftrd2mc9Zj0YRWfxe7ZYs35apt2cI OXVxfuG4gHLGwtAqJUcKbzANM2LtFaW8MnHu3iwTtruaqKURdCa0otv8yFb1kEkXkUgG 9WUWUBGqMU6O4e41qj48xOA/8dWtIdyqAKpdkmkxjHgWNct6sMKRvpCTaJ0haa9EcVVH Jg4I5k7NL+MVYaF1BYQ6aFiU0/8xAotguhChkHKHvABWVIqM6bWAg9omqHlkN/9CXefg 8ykA== 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=23NPVkzbcEf/hl3Yy6gzpFUiYin92f8jTBYOk9lgEHw=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=OxmHsqhv92J/Iy0i7Tj+hxyLqcVPgIv/3Oui7ZETjIJsH9VliqA4IhMwPZu/V6DQbn Ly1CnAu0IyLiN9qt9E4v2ekEf2Q0x4xFw3349lctH0/lsD6MX+IMCMbpq23IGN2cpIst OQfU4Gv3GgJRrAlPBkZvfFWQDCdLhKO2Q2T0tBnvYIXK3jLdau5NY5E7LnOcEaBRgtFg vZcJZ/0NvvyOIgicWhBoxqFi+Hfru+y/KSiqtFEmbVEc1yz2kjI9pNmUvo1Em84TOBpB ez/SHQoKuzN1Zm4PbcFEWzkTKsJ8VLwuqb2VaTYnIm5AStMd8jtDy3Hv+7/kQNVIllxk +NRw==; 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=fSPUTHxd; 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 k9-20020a170906680900b00a45e1870f42si1180647ejr.730.2024.03.28.17.41.21; Thu, 28 Mar 2024 17:41:22 -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=fSPUTHxd; 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 2C7B168D749; Fri, 29 Mar 2024 02:41:19 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1F82368D198 for ; Fri, 29 Mar 2024 02:41:12 +0200 (EET) Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3c3ac720bceso963818b6e.3 for ; Thu, 28 Mar 2024 17:41:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711672869; x=1712277669; 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=4YDLRpEjiXIyFaHoXu3U4ZtNUvfe/4vCGi2p1rBos0s=; b=fSPUTHxd8M99njPVw1Eb1zOvuP3W01lh/u5PHSKnSsIiwLRuxtMlj4Ufui2rn1edFk pdsPzZiO2SGFr5kuqwwvnOBBJHoD65N/rBD4FYiQeIbZLm60ga06cERNSS3j+uHpO37o JN8usA63QTsvdQI3QYEbQloLXwqTBrZvVuuROC5GizeV2+O+8r1mtlUae78sd++tc8rS dsL4MQI995s6Vec1WkMe2FkFwosUAMBrRAAlgg7I/oOLuNM/IOJ9B4MvM7CZz5cCiP9N 2Kmhe2cyVpTRAgs8hTCHN22Aq+QH41dMOuRHRQeDMw1xEY9rO8Jrd0cZJivWfNiRFAjI 3g5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711672869; x=1712277669; 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=4YDLRpEjiXIyFaHoXu3U4ZtNUvfe/4vCGi2p1rBos0s=; b=cChqGHWcae6INd8pfgp738w5qSeNg3uiZLW3SJzh6d+v7KK05VUT4cMQ8G6/geSjee ZT0d3pxXX21mqdI1n+NMk5pJBUE2Ahlz6oW7qG/bpuPQKLJJl0UTY2PsmQdEJ2Ge8H4s 28uxIZGMYcHqJNgCUYQ23ba076SYHQMNts4WlOCr/aIHr9bMiFbAcRYnwOgKIPHNk+Nd g19KUwvL8u8QUBj5N/lPmVKDh2hhhTTD6ARzt5++CMZbSqbmDWlSyu/3AtbPMVlD9PTF yaK5xYEBtm8FwdB6T5AyEhqmuRrw3N+F2Nc7n5PS2Kj9ZJceONhqPgm2Mec26ktarI3e wVlw== X-Gm-Message-State: AOJu0YwxbsXPXLFQR2iJXC9snj0+HH1jqsXV+nYw9bbwdN5sstPQr4Mt Sj20nil6owQSPEkJTpMvsXu/4x1zTQAqCOWxUSZZwua7IgPkHjAqhaoHckgF X-Received: by 2002:a05:6808:124a:b0:3c3:d497:b750 with SMTP id o10-20020a056808124a00b003c3d497b750mr955764oiv.55.1711672869472; Thu, 28 Mar 2024 17:41:09 -0700 (PDT) Received: from localhost.localdomain ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id fj14-20020a056a003a0e00b006e554afa254sm1994816pfb.38.2024.03.28.17.41.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 17:41:09 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 Mar 2024 21:40:57 -0300 Message-ID: <20240329004057.1213-1-jamrial@gmail.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] Revert "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: L5FSGq6lIgQL This reverts commit f6b7b473d456a6aa1c063c4261b17277e2c70ac0. The image in the item boxes and the animation in the trak box are not necessarely the same, so both should be exported. Signed-off-by: James Almer --- libavformat/mov.c | 44 ++++---------------------------------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 5463f36770..c93a09d385 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -83,7 +83,6 @@ 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); @@ -4860,25 +4859,6 @@ 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->nb_heif_item - 1; i >= 0; i--) { - HEIFItem *item = &c->heif_item[i]; - - av_freep(&item->name); - - if (!item->st) - continue; - - mov_free_stream_context(c->fc, item->st); - ff_remove_stream(c->fc, item->st); - } - av_freep(&c->heif_item); - c->nb_heif_item = 0; - c->found_iinf = c->found_iloc = 0; - } - st = avformat_new_stream(c->fc, NULL); if (!st) return AVERROR(ENOMEM); st->id = -1; @@ -8065,9 +8045,8 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) int64_t base_offset, extent_offset, extent_length; uint8_t value; - 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. + if (c->found_iloc) { + av_log(c->fc, AV_LOG_INFO, "Duplicate iloc box found\n"); return 0; } @@ -8198,11 +8177,6 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom) 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. @@ -8356,12 +8330,6 @@ 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); @@ -8396,12 +8364,6 @@ 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); @@ -8485,6 +8447,7 @@ static int mov_read_iprp(MOVContext *c, AVIOContext *pb, MOVAtom atom) ret = 0; fail: + c->cur_item_id = -1; for (int i = 0; i < nb_atoms; i++) av_free(atoms[i].data); av_free(atoms); @@ -9508,6 +9471,7 @@ static int mov_read_header(AVFormatContext *s) mov->trak_index = -1; mov->thmb_item_id = -1; mov->primary_item_id = -1; + mov->cur_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);