Mercurial > libavformat.hg
changeset 6006:86f5c95d5ca6 libavformat
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.
author | bcoudurier |
---|---|
date | Tue, 18 May 2010 17:28:07 +0000 |
parents | 10b0e7cac09f |
children | f9eb8adfdb9e |
files | mpegts.c |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mpegts.c Mon May 17 18:12:58 2010 +0000 +++ b/mpegts.c Tue May 18 17:28:07 2010 +0000 @@ -807,6 +807,16 @@ 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;