From 09b70e1c19e9ffce31146c4853cf705591e30adc Mon Sep 17 00:00:00 2001 From: Gildas Bazin Date: Sun, 11 Jun 2006 20:52:08 +0000 Subject: [PATCH] * modules/packetizer/mpeg4video.c: ts/ps muxers rely on VOL being present in the stream. --- modules/packetizer/mpeg4video.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/modules/packetizer/mpeg4video.c b/modules/packetizer/mpeg4video.c index 924e17fb4a..fdffce8b2c 100644 --- a/modules/packetizer/mpeg4video.c +++ b/modules/packetizer/mpeg4video.c @@ -336,22 +336,37 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag ) if( p_frag->p_buffer[3] == 0xB0 || p_frag->p_buffer[3] == 0xB1 ) { +#if 0 /* Remove VOS start/end code from the original stream */ block_Release( p_frag ); +#else + /* Append the block for now since ts/ps muxers rely on VOL + * being present in the stream */ + block_ChainLastAppend( &p_sys->pp_last, p_frag ); +#endif return NULL; } if( p_frag->p_buffer[3] >= 0x20 && p_frag->p_buffer[3] <= 0x2f ) { /* Copy the complete VOL */ - p_dec->fmt_out.i_extra = p_frag->i_buffer; - p_dec->fmt_out.p_extra = - realloc( p_dec->fmt_out.p_extra, p_dec->fmt_out.i_extra ); + if( p_dec->fmt_out.i_extra != p_frag->i_buffer ) + { + p_dec->fmt_out.p_extra = + realloc( p_dec->fmt_out.p_extra, p_frag->i_buffer ); + p_dec->fmt_out.i_extra = p_frag->i_buffer; + } memcpy( p_dec->fmt_out.p_extra, p_frag->p_buffer, p_frag->i_buffer ); ParseVOL( p_dec, &p_dec->fmt_out, p_dec->fmt_out.p_extra, p_dec->fmt_out.i_extra ); +#if 0 /* Remove from the original stream */ block_Release( p_frag ); +#else + /* Append the block for now since ts/ps muxers rely on VOL + * being present in the stream */ + block_ChainLastAppend( &p_sys->pp_last, p_frag ); +#endif return NULL; } else -- 2.39.2