summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Grunau <janne-ffmpeg@jannau.net>2010-05-21 20:15:53 +0000
committerReinhard Tartler <siretart@tauware.de>2010-05-21 20:15:53 +0000
commitb9a35435a50ce160f13164f943c94c43d2affa81 (patch)
treec30f9062868ed9447f7e63bd3567b350b3c7c15d
parent85ed859e6b577eb03038d810048375e0ef703a80 (diff)
In ts demuxer, output pes packet as soon as they are complete.
This is needed for subtitles where packets are infrequent. Patch by Janne Grunau, janne-ffmpeg at jannau dot net. backport r23157 by bcoudurier Originally committed as revision 23226 to svn://svn.ffmpeg.org/ffmpeg/branches/0.6
-rw-r--r--libavformat/mpegts.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index c92a9c2585..59603384d2 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -807,6 +807,16 @@ static int mpegts_push_data(MpegTSFilter *filter,
pes->data_index += buf_size;
}
buf_size = 0;
+ /* emit complete packets with known packet size
+ * decreases demuxer delay for infrequent packets like subtitles from
+ * a couple of seconds to milliseconds for properly muxed files.
+ * total_size is the number of bytes following pes_packet_length
+ * in the pes header, i.e. not counting the first 6 bytes */
+ if (pes->total_size < MAX_PES_PAYLOAD &&
+ pes->pes_header_size + pes->data_index == pes->total_size + 6) {
+ ts->stop_parse = 1;
+ new_pes_packet(pes, ts->pkt);
+ }
break;
case MPEGTS_SKIP:
buf_size = 0;