* [FFmpeg-devel] [PATCH] Revert "avformat/mov: ignore item boxes for animated heif"
@ 2024-03-29 0:40 James Almer
2024-03-30 15:25 ` James Almer
0 siblings, 1 reply; 2+ messages in thread
From: James Almer @ 2024-03-29 0:40 UTC (permalink / raw)
To: ffmpeg-devel
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".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] Revert "avformat/mov: ignore item boxes for animated heif"
2024-03-29 0:40 [FFmpeg-devel] [PATCH] Revert "avformat/mov: ignore item boxes for animated heif" James Almer
@ 2024-03-30 15:25 ` James Almer
0 siblings, 0 replies; 2+ messages in thread
From: James Almer @ 2024-03-30 15:25 UTC (permalink / raw)
To: ffmpeg-devel
On 3/28/2024 9:40 PM, James Almer wrote:
> 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(-)
Will apply.
_______________________________________________
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".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-30 15:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-29 0:40 [FFmpeg-devel] [PATCH] Revert "avformat/mov: ignore item boxes for animated heif" James Almer
2024-03-30 15:25 ` James Almer
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