changeset 3680:8aa88bbf5f01 libavformat

matroskadec: don't try to re-read already parsed ID in matroska_parse_cluster()
author aurel
date Tue, 05 Aug 2008 00:42:26 +0000
parents 039a28684d43
children 495728a85fe6
files matroskadec.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/matroskadec.c	Tue Aug 05 00:42:23 2008 +0000
+++ b/matroskadec.c	Tue Aug 05 00:42:26 2008 +0000
@@ -1631,7 +1631,15 @@
     MatroskaCluster cluster = { 0 };
     EbmlList *blocks_list;
     MatroskaBlock *blocks;
-    int i, res = ebml_parse(matroska, matroska_clusters, &cluster);
+    int i, res;
+    if (matroska->has_cluster_id){
+        /* For the first cluster we parse, it's ID was already read as
+           part of matroska_read_header(), so don't read it again */
+        res = ebml_parse_id(matroska, matroska_clusters,
+                            MATROSKA_ID_CLUSTER, &cluster);
+        matroska->has_cluster_id = 0;
+    } else
+        res = ebml_parse(matroska, matroska_clusters, &cluster);
     blocks_list = &cluster.blocks;
     blocks = blocks_list->elem;
     for (i=0; !res && i<blocks_list->nb_elem; i++)