[FFmpeg-cvslog] avformat/mov: ignore old infe box versions

James Almer git at videolan.org
Thu Apr 18 19:03:27 EEST 2024


ffmpeg | branch: release/7.0 | James Almer <jamrial at gmail.com> | Sat Apr 13 10:11:03 2024 -0300| [ed55219eddc96f6c41f88069d7e492976002f528] | committer: James Almer

avformat/mov: ignore old infe box versions

Some files with no image items have them, and were working prior to the recent
HEIF parsing overhaul.
Ignore such boxes instead, to recover the old behavior.

Fixes a regression since d9fed9df2a9e70c9375d3b2591db35c09303d369.

Tested-by: Wu Jianhua <toqsxw at outlook.com>
Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit 5b9db32ccc9426dc2aa37f21eee4c9efd1baf75b)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ed55219eddc96f6c41f88069d7e492976002f528
---

 libavformat/mov.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 50fbcd1f9b..d9009f2eab 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -8128,8 +8128,8 @@ static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom, int idx)
     size -= 4;
 
     if (version < 2) {
-        av_log(c->fc, AV_LOG_ERROR, "infe: version < 2 not supported\n");
-        return AVERROR_PATCHWELCOME;
+        avpriv_report_missing_feature(c->fc, "infe version < 2");
+        return 1;
     }
 
     item_id = version > 2 ? avio_rb32(pb) : avio_rb16(pb);
@@ -8200,6 +8200,8 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         ret = mov_read_infe(c, pb, infe, i);
         if (ret < 0)
             return ret;
+        if (ret)
+            return 0;
     }
 
     c->found_iinf = 1;
@@ -9495,14 +9497,15 @@ static int mov_read_header(AVFormatContext *s)
             av_log(s, AV_LOG_ERROR, "error reading header\n");
             return err;
         }
-    } while ((pb->seekable & AVIO_SEEKABLE_NORMAL) && !mov->found_moov && !mov->found_iloc && !mov->moov_retry++);
-    if (!mov->found_moov && !mov->found_iloc) {
+    } while ((pb->seekable & AVIO_SEEKABLE_NORMAL) &&
+             !mov->found_moov && (!mov->found_iloc || !mov->found_iinf) && !mov->moov_retry++);
+    if (!mov->found_moov && !mov->found_iloc && !mov->found_iinf) {
         av_log(s, AV_LOG_ERROR, "moov atom not found\n");
         return AVERROR_INVALIDDATA;
     }
     av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb));
 
-    if (mov->found_iloc) {
+    if (mov->found_iloc && mov->found_iinf) {
         for (i = 0; i < mov->nb_heif_item; i++) {
             HEIFItem *item = &mov->heif_item[i];
             MOVStreamContext *sc;



More information about the ffmpeg-cvslog mailing list