changeset 1899:1324ae790ee0 libavformat

parse clusters until some packets are queued instead of parsing only one cluster
author aurel
date Sun, 11 Mar 2007 22:26:39 +0000
parents 924bfc59f12c
children 55cc48bb357d
files matroska.c
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/matroska.c	Sun Mar 11 22:19:02 2007 +0000
+++ b/matroska.c	Sun Mar 11 22:26:39 2007 +0000
@@ -2698,9 +2698,8 @@
     int res = 0;
     uint32_t id;
 
-    /* Do we still have a packet queued? */
-    if (matroska_deliver_packet(matroska, pkt) == 0)
-        return 0;
+    /* Read stream until we have a packet queued. */
+    while (matroska_deliver_packet(matroska, pkt)) {
 
     /* Have we already reached the end? */
     if (matroska->done)
@@ -2708,8 +2707,7 @@
 
     while (res == 0) {
         if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
-            res = AVERROR_IO;
-            break;
+            return AVERROR_IO;
         } else if (matroska->level_up) {
             matroska->level_up--;
             break;
@@ -2737,8 +2735,9 @@
 
     if (res == -1)
         matroska->done = 1;
-
-    return matroska_deliver_packet(matroska, pkt);
+    }
+
+    return 0;
 }
 
 static int