]> git.sesse.net Git - vlc/commitdiff
* modules/mux/mpeg/*: new --sout-ps-pes-max-size option.
authorGildas Bazin <gbazin@videolan.org>
Mon, 18 Apr 2005 15:32:31 +0000 (15:32 +0000)
committerGildas Bazin <gbazin@videolan.org>
Mon, 18 Apr 2005 15:32:31 +0000 (15:32 +0000)
modules/mux/mpeg/pes.c
modules/mux/mpeg/pes.h
modules/mux/mpeg/ps.c
modules/mux/mpeg/ts.c

index 3ec404024e03056e0df04e7c9caba87c267ff866..bde0beae521ae657a9a8e19fa541fb7a760f3404 100644 (file)
@@ -44,8 +44,6 @@
 #include "pes.h"
 #include "bits.h"
 
-#define PES_PAYLOAD_SIZE_MAX 65500
-
 static inline int PESHeader( uint8_t *p_hdr, mtime_t i_pts, mtime_t i_dts,
                              int i_es_size, es_format_t *p_fmt,
                              int i_stream_id, int i_private_id,
@@ -233,7 +231,8 @@ static inline int PESHeader( uint8_t *p_hdr, mtime_t i_pts, mtime_t i_dts,
 
 int E_( EStoPES )( sout_instance_t *p_sout, block_t **pp_pes, block_t *p_es,
                    es_format_t *p_fmt, int i_stream_id,
-                   int b_mpeg2, int b_data_alignment, int i_header_size )
+                   int b_mpeg2, int b_data_alignment, int i_header_size,
+                   int i_max_pes_size )
 {
     block_t *p_pes;
     mtime_t i_pts, i_dts, i_length;
@@ -266,7 +265,8 @@ int E_( EStoPES )( sout_instance_t *p_sout, block_t **pp_pes, block_t *p_es,
 
     do
     {
-        i_pes_payload = __MIN( i_size, PES_PAYLOAD_SIZE_MAX );
+        i_pes_payload = __MIN( i_size, (i_max_pes_size ?
+                               i_max_pes_size : PES_PAYLOAD_SIZE_MAX) );
         i_pes_header  = PESHeader( header, i_pts, i_dts, i_pes_payload,
                                    p_fmt, i_stream_id, i_private_id, b_mpeg2,
                                    b_data_alignment, i_header_size );
index 837dbbcb9ef560951e166487125b55bbeb0a2c02..c786ee1a34a9b202cb29b991293e95030a87dba6 100644 (file)
@@ -32,6 +32,9 @@
 #define PES_DSMCC_STREAM                0xf2
 #define PES_ITU_T_H222_1_TYPE_E_STREAM  0xf8
 
+#define PES_PAYLOAD_SIZE_MAX 65500
+
 int E_( EStoPES )( sout_instance_t *p_sout, block_t **pp_pes, block_t *p_es,
                    es_format_t *p_fmt, int i_stream_id,
-                   int b_mpeg2, int b_data_alignment, int i_header_size );
+                   int b_mpeg2, int b_data_alignment, int i_header_size,
+                   int i_max_pes_size );
index a5f29c1688f8f8bb7ac394399520c248a8fa007f..a333dc087fe87d69e9175e4277b5ee8d81cfa36e 100644 (file)
   "stream, compared to the SCRs. This allows for some buffering inside " \
   "the client decoder.")
 
+#define PES_SIZE_TEXT N_("PES maximum size")
+#define PES_SIZE_LONGTEXT N_("This option will set the maximum allowed PES "\
+  "size when producing the MPEG PS stream.")
+
 static int     Open   ( vlc_object_t * );
 static void    Close  ( vlc_object_t * );
 
@@ -66,6 +70,8 @@ vlc_module_begin();
 
     add_integer( SOUT_CFG_PREFIX "dts-delay", 200, NULL, DTS_TEXT,
                  DTS_LONGTEXT, VLC_TRUE );
+    add_integer( SOUT_CFG_PREFIX "pes-max-size", PES_PAYLOAD_SIZE_MAX, NULL,
+                 PES_SIZE_TEXT, PES_SIZE_LONGTEXT, VLC_TRUE );
 vlc_module_end();
 
 /*****************************************************************************
@@ -123,12 +129,14 @@ struct sout_mux_sys_t
 
     vlc_bool_t b_mpeg2;
 
+    int i_pes_max_size;
+
     int i_psm_version;
     uint32_t crc32_table[256];
 };
 
 static const char *ppsz_sout_options[] = {
-    "dts-delay", NULL
+    "dts-delay", "pes-max-size", NULL
 };
 
 /*****************************************************************************
@@ -173,6 +181,9 @@ static int Open( vlc_object_t *p_this )
     var_Get( p_mux, SOUT_CFG_PREFIX "dts-delay", &val );
     p_sys->i_dts_delay = (int64_t)val.i_int * 1000;
 
+    var_Get( p_mux, SOUT_CFG_PREFIX "pes-max-size", &val );
+    p_sys->i_pes_max_size = (int64_t)val.i_int;
+
     /* Initialise CRC32 table */
     if( p_sys->b_mpeg2 )
     {
@@ -507,7 +518,7 @@ static int Mux( sout_mux_t *p_mux )
         p_data = block_FifoGet( p_input->p_fifo );
         E_( EStoPES )( p_mux->p_sout, &p_data, p_data,
                        p_input->p_fmt, p_stream->i_stream_id,
-                       p_sys->b_mpeg2, 0, 0 );
+                       p_sys->b_mpeg2, 0, 0, p_sys->i_pes_max_size );
 
         block_ChainAppend( &p_ps, p_data );
 
index 0b5ca5a68985ea5a7b55f112e179d0056a2042b7..fe47e991984117d03ee88459514a7007b68e62fe 100644 (file)
@@ -1147,7 +1147,7 @@ static int Mux( sout_mux_t *p_mux )
                                     E_(EStoPES)( p_mux->p_sout, &p_spu, p_spu,
                                                  p_input->p_fmt,
                                                  p_stream->i_stream_id, 1,
-                                                 0, 0 );
+                                                 0, 0, 0 );
                                     p_data->p_next = p_spu;
                                 }
                             }
@@ -1183,7 +1183,7 @@ static int Mux( sout_mux_t *p_mux )
                         }
                         E_( EStoPES )( p_mux->p_sout, &p_data, p_data,
                                        p_input->p_fmt, p_stream->i_stream_id,
-                                       1, b_data_alignment, i_header_size );
+                                       1, b_data_alignment, i_header_size, 0 );
 
                         BufferChainAppend( &p_stream->chain_pes, p_data );