[FFmpeg-cvslog] r23226 - in branches/0.6: . libavformat/mpegts.c

siretart subversion
Fri May 21 22:15:54 CEST 2010


Author: siretart
Date: Fri May 21 22:15:53 2010
New Revision: 23226

Log:
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

Modified:
   branches/0.6/   (props changed)
   branches/0.6/libavformat/mpegts.c

Modified: branches/0.6/libavformat/mpegts.c
==============================================================================
--- branches/0.6/libavformat/mpegts.c	Fri May 21 22:13:34 2010	(r23225)
+++ branches/0.6/libavformat/mpegts.c	Fri May 21 22:15:53 2010	(r23226)
@@ -807,6 +807,16 @@ static int mpegts_push_data(MpegTSFilter
                 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;



More information about the ffmpeg-cvslog mailing list