]> git.sesse.net Git - vlc/commitdiff
mpeg mux: simplify EStoPES prototype
authorRafaël Carré <funman@videolan.org>
Wed, 10 Sep 2014 14:31:41 +0000 (16:31 +0200)
committerRafaël Carré <funman@videolan.org>
Wed, 10 Sep 2014 14:42:33 +0000 (16:42 +0200)
modules/mux/mpeg/pes.c
modules/mux/mpeg/pes.h
modules/mux/mpeg/ps.c
modules/mux/mpeg/ts.c

index 9210b3f3ebd0d47850be4bc461062957ed512884..5f1bd0b1315310a98efa374b3773b7686d654cab 100644 (file)
@@ -316,12 +316,13 @@ static inline int PESHeader( uint8_t *p_hdr, mtime_t i_pts, mtime_t i_dts,
  *                       To allow unbounded PES packets in transport stream
  *                       VIDEO_ES, set to INT_MAX.
  */
-int  EStoPES ( block_t **pp_pes, block_t *p_es,
+void EStoPES ( block_t **pp_pes,
                    es_format_t *p_fmt, int i_stream_id,
                    int b_mpeg2, int b_data_alignment, int i_header_size,
                    int i_max_pes_size )
 {
-    block_t *p_pes;
+    block_t *p_es = *pp_pes;
+    block_t *p_pes = NULL;
     mtime_t i_pts, i_dts, i_length;
 
     uint8_t *p_data;
@@ -388,8 +389,6 @@ int  EStoPES ( block_t **pp_pes, block_t *p_es,
     i_size = p_es->i_buffer;
     p_data = p_es->p_buffer;
 
-    *pp_pes = p_pes = NULL;
-
     do
     {
         i_pes_payload = __MIN( i_size, i_max_pes_size );
@@ -434,15 +433,14 @@ int  EStoPES ( block_t **pp_pes, block_t *p_es,
     } while( i_size > 0 );
 
     /* Now redate all pes */
-    i_dts    = (*pp_pes)->i_dts;
-    i_length = (*pp_pes)->i_length / i_pes_count;
-    for( p_pes = *pp_pes; p_pes != NULL; p_pes = p_pes->p_next )
+    i_dts    = p_pes->i_dts;
+    i_length = p_pes->i_length / i_pes_count;
+    while( p_pes )
     {
         p_pes->i_dts = i_dts;
         p_pes->i_length = i_length;
 
         i_dts += i_length;
+        p_pes = p_pes->p_next;
     }
-
-    return 0;
 }
index efdf1d246d8054c1dd7337575214fe59912a7a0c..17dda532af9f57c58f75c8f6c96f3b467488048a 100644 (file)
@@ -35,7 +35,7 @@
 
 #define PES_PAYLOAD_SIZE_MAX 65500
 
-int  EStoPES ( block_t **pp_pes, block_t *p_es,
+void EStoPES ( block_t **pp_pes,
                    es_format_t *p_fmt, int i_stream_id,
                    int b_mpeg2, int b_data_alignment, int i_header_size,
                    int i_max_pes_size );
index e00390b005d9fd76da6f5f03bd11d8218a136922..599dfb1489f4d6227cf32d3510ca97a3d7ac37e1 100644 (file)
@@ -513,7 +513,7 @@ static int Mux( sout_mux_t *p_mux )
 
         /* Get and mux a packet */
         p_data = block_FifoGet( p_input->p_fifo );
-         EStoPES ( &p_data, p_data, p_input->p_fmt, p_stream->i_stream_id,
+        EStoPES ( &p_data, p_input->p_fmt, p_stream->i_stream_id,
                        p_sys->b_mpeg2, 0, 0, p_sys->i_pes_max_size );
 
         block_ChainAppend( &p_ps, p_data );
index a6d73e7ac59159b65d8615bc1d267f67fc93512e..8d440ecda46305f8fd53756c71bcd28e404656cc 100644 (file)
@@ -1383,7 +1383,7 @@ static bool MuxStreams(sout_mux_t *p_mux )
                 p_spu->p_buffer[1] = 1;
                 p_spu->p_buffer[2] = ' ';
 
-                EStoPES( &p_spu, p_spu, p_input->p_fmt,
+                EStoPES( &p_spu, p_input->p_fmt,
                              p_stream->i_stream_id, 1, 0, 0, 0 );
                 p_data->p_next = p_spu;
             }
@@ -1429,7 +1429,7 @@ static bool MuxStreams(sout_mux_t *p_mux )
             i_max_pes_size = INT_MAX;
         }
 
-         EStoPES ( &p_data, p_data, p_input->p_fmt, p_stream->i_stream_id,
+        EStoPES ( &p_data, p_input->p_fmt, p_stream->i_stream_id,
                        1, b_data_alignment, i_header_size,
                        i_max_pes_size );