changeset 3665:8fb8a0dfe593 libavformat

matroskadec: extract read_level_up out of ebml_read_element_id
author aurel
date Tue, 05 Aug 2008 00:41:40 +0000
parents 6a81fd414b18
children 0e60f2b18452
files matroskadec.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/matroskadec.c	Tue Aug 05 00:41:37 2008 +0000
+++ b/matroskadec.c	Tue Aug 05 00:41:40 2008 +0000
@@ -559,10 +559,6 @@
         return read;
     *id = matroska->peek_id  = total | (1 << (read * 7));
 
-    /* level tracking */
-    if (level_up)
-        *level_up = ebml_read_element_level_up(matroska);
-
     return read;
 }
 
@@ -591,10 +587,15 @@
               int                  *level_up)
 {
     uint32_t id;
+    int res;
 
-    if (ebml_read_element_id(matroska, &id, level_up) < 0)
+    res = ebml_read_element_id(matroska, &id, NULL);
+    if (res < 0)
         return 0;
 
+    if (res > 0 && level_up)
+        *level_up = ebml_read_element_level_up(matroska);
+
     return id;
 }