[FFmpeg-soc] [soc]: r2375 - dvbmuxer/mpegtsenc.c

bcoudurier subversion at mplayerhq.hu
Wed Jun 4 04:48:07 CEST 2008


Author: bcoudurier
Date: Wed Jun  4 04:48:06 2008
New Revision: 2375

Log:
move code to match ps muxer

Modified:
   dvbmuxer/mpegtsenc.c

Modified: dvbmuxer/mpegtsenc.c
==============================================================================
--- dvbmuxer/mpegtsenc.c	(original)
+++ dvbmuxer/mpegtsenc.c	Wed Jun  4 04:48:06 2008
@@ -603,9 +603,8 @@ static int flush_packet(AVFormatContext 
                          int64_t pts, int64_t dts, int trailer_size)
 {
     MpegTSWriteStream *stream = ctx->streams[stream_index]->priv_data;
-    StreamInfo *pes_stream = &stream->pes_stream;
     int payload_size, stuffing_size, i;
-    int packet_size, es_size;
+    int packet_size;
     int zero_trail_bytes = 0;
     int pad_packet_bytes = 0;
     int pes_size;
@@ -635,16 +634,6 @@ static int flush_packet(AVFormatContext 
     mpegts_write_pes(ctx, ctx->streams[stream_index],
                      stream->payload, q - stream->payload);
 
-    es_size = payload_size - stuffing_size;
-    pes_stream->buffer_index += payload_size - stuffing_size;
-    while(pes_stream->premux_packet && pes_stream->premux_packet->unwritten_size <= es_size){
-        es_size -= pes_stream->premux_packet->unwritten_size;
-        pes_stream->premux_packet= pes_stream->premux_packet->next;
-    }
-
-    if(es_size)
-        pes_stream->premux_packet->unwritten_size -= es_size;
-
     return payload_size - stuffing_size;
 }
 
@@ -685,6 +674,14 @@ static int output_packet(AVFormatContext
         es_size= flush_packet(ctx, best_i, AV_NOPTS_VALUE, AV_NOPTS_VALUE, trailer_size);
     }
 
+    stream->buffer_index += es_size;
+    while(stream->premux_packet && stream->premux_packet->unwritten_size <= es_size){
+        es_size -= stream->premux_packet->unwritten_size;
+        stream->premux_packet= stream->premux_packet->next;
+    }
+    if(es_size)
+        stream->premux_packet->unwritten_size -= es_size;
+
     if(ff_pes_remove_decoded_packets(ctx, s->last_pcr) < 0)
         return -1;
 



More information about the FFmpeg-soc mailing list