[vlc-commits] mpeg mux: simplify EStoPES prototype

Rafaël Carré git at videolan.org
Wed Sep 10 17:16:49 CEST 2014


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Wed Sep 10 16:31:41 2014 +0200| [f06d95b5edd6cc5c9964bc6ccefc40b7f23a0658] | committer: Rafaël Carré

mpeg mux: simplify EStoPES prototype

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f06d95b5edd6cc5c9964bc6ccefc40b7f23a0658
---

 modules/mux/mpeg/pes.c |   16 +++++++---------
 modules/mux/mpeg/pes.h |    2 +-
 modules/mux/mpeg/ps.c  |    2 +-
 modules/mux/mpeg/ts.c  |    4 ++--
 4 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/modules/mux/mpeg/pes.c b/modules/mux/mpeg/pes.c
index 9210b3f..5f1bd0b 100644
--- a/modules/mux/mpeg/pes.c
+++ b/modules/mux/mpeg/pes.c
@@ -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;
 }
diff --git a/modules/mux/mpeg/pes.h b/modules/mux/mpeg/pes.h
index efdf1d2..17dda53 100644
--- a/modules/mux/mpeg/pes.h
+++ b/modules/mux/mpeg/pes.h
@@ -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 );
diff --git a/modules/mux/mpeg/ps.c b/modules/mux/mpeg/ps.c
index e00390b..599dfb1 100644
--- a/modules/mux/mpeg/ps.c
+++ b/modules/mux/mpeg/ps.c
@@ -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 );
diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index a6d73e7..8d440ec 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -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 );
 



More information about the vlc-commits mailing list