summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-02-16 01:51:52 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-02-16 01:51:52 +0000
commitfe5a361c3a42b2698039b711f7f0ffb572c338a6 (patch)
tree891e5c4b1ad9dfac81f37deb51678866b8bd2aa8 /libavformat
parent6545996fb96c0a02a1c6969199bbe44bc8048431 (diff)
downloadffmpeg-fe5a361c3a42b2698039b711f7f0ffb572c338a6.tar.gz
fix mxf interleaving packet purge
Originally committed as revision 17359 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mxfenc.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index fa52d3ff01..e08e952fe6 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -1831,20 +1831,15 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket
if (stream_count && (s->nb_streams == stream_count || flush)) {
pktl = s->packet_buffer;
if (s->nb_streams != stream_count) {
- AVPacketList *first = NULL;
AVPacketList *last = NULL;
- // find first packet in edit unit
+ // find last packet in edit unit
while (pktl) {
- AVStream *st = s->streams[pktl->pkt.stream_index];
- if (st->index == 0)
+ if (!stream_count || pktl->pkt.stream_index == 0)
break;
- else if (!first)
- first = pktl;
last = pktl;
pktl = pktl->next;
+ stream_count--;
}
- if (last)
- last->next = NULL;
// purge packet queue
while (pktl) {
AVPacketList *next = pktl->next;
@@ -1852,9 +1847,13 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket
av_freep(&pktl);
pktl = next;
}
- if (!first)
+ if (last)
+ last->next = NULL;
+ else {
+ s->packet_buffer = NULL;
goto out;
- pktl = first;
+ }
+ pktl = s->packet_buffer;
}
*out = pktl->pkt;