diff mxfenc.c @ 5602:0e84f356ca5f libavformat

Remove MAX_STREAMS usage in ogg and mxf muxers
author bcoudurier
date Fri, 29 Jan 2010 06:38:00 +0000
parents 16a2de6da57e
children 536e5527c1e0
line wrap: on
line diff
--- a/mxfenc.c	Thu Jan 28 16:08:13 2010 +0000
+++ b/mxfenc.c	Fri Jan 29 06:38:00 2010 +0000
@@ -1807,22 +1807,13 @@
 
 static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush)
 {
-    AVPacketList *pktl;
-    int stream_count = 0;
-    int streams[MAX_STREAMS];
+    int i, stream_count = 0;
 
-    memset(streams, 0, sizeof(streams));
-    pktl = s->packet_buffer;
-    while (pktl) {
-        //av_log(s, AV_LOG_DEBUG, "show st:%d dts:%lld\n", pktl->pkt.stream_index, pktl->pkt.dts);
-        if (!streams[pktl->pkt.stream_index])
-            stream_count++;
-        streams[pktl->pkt.stream_index]++;
-        pktl = pktl->next;
-    }
+    for (i = 0; i < s->nb_streams; i++)
+        stream_count += !!s->streams[i]->last_in_packet_buffer;
 
     if (stream_count && (s->nb_streams == stream_count || flush)) {
-        pktl = s->packet_buffer;
+        AVPacketList *pktl = s->packet_buffer;
         if (s->nb_streams != stream_count) {
             AVPacketList *last = NULL;
             // find last packet in edit unit