]> git.sesse.net Git - ffmpeg/commitdiff
avformat/matroskadec: Allow multiple Tags elements
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 30 Apr 2020 22:49:49 +0000 (00:49 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 8 May 2020 11:42:35 +0000 (13:42 +0200)
The Matroska specification allows multiple (level 1) Tags elements per
file, yet our demuxer didn't: While it parsed any amount of Tags
elements it found in front of the Clusters (albeit with warnings because
of duplicate elements), it would treat any Tags element only referenced
via a SeekHead entry as already parsed if any Tags element has already
been parsed; therefore this Tags element would not be parsed at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/matroskadec.c

index 1dc1bd470cc99a0ac436f74d24e5270a7be61651..b277c05f9da668882465f387e1a1c1dd28c6a10a 100644 (file)
@@ -1147,11 +1147,11 @@ static MatroskaLevel1Element *matroska_find_level1_elem(MatroskaDemuxContext *ma
     if (id == MATROSKA_ID_CLUSTER)
         return NULL;
 
-    // There can be multiple seekheads.
+    // There can be multiple SeekHeads and Tags.
     for (i = 0; i < matroska->num_level1_elems; i++) {
         if (matroska->level1_elems[i].id == id) {
             if (matroska->level1_elems[i].pos == pos ||
-                id != MATROSKA_ID_SEEKHEAD)
+                id != MATROSKA_ID_SEEKHEAD && id != MATROSKA_ID_TAGS)
                 return &matroska->level1_elems[i];
         }
     }