From: James Almer <jamrial@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] Revert "avformat/mov: ignore item boxes for animated heif" Date: Thu, 28 Mar 2024 21:40:57 -0300 Message-ID: <20240329004057.1213-1-jamrial@gmail.com> (raw) 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 <jamrial@gmail.com> --- 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); -- 2.44.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".
next reply other threads:[~2024-03-29 0:41 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-29 0:40 James Almer [this message] 2024-03-30 15:25 ` James Almer
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240329004057.1213-1-jamrial@gmail.com \ --to=jamrial@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git