Commit 393c3c57 authored by Gildas Bazin's avatar Gildas Bazin

* modules/mux/mpeg/*: new --sout-ps-pes-max-size option.

parent ac70d6fe
......@@ -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 );
......
......@@ -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 );
......@@ -48,6 +48,10 @@
"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 );
......
......@@ -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 );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment