Commit accc4e29 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Real Demuxer: Code factorisation after previous commit.

parent 8d153467
......@@ -495,37 +495,7 @@ static int Demux( demux_t *p_demux )
}
else if( tk->fmt.i_cat == AUDIO_ES && b_selected )
{
if( tk->fmt.i_codec == VLC_FOURCC( 'm','p','4','a' ) )
{
int i_sub = (p_sys->buffer[1] >> 4)&0x0f;
uint8_t *p_sub = &p_sys->buffer[2+2*i_sub];
/* Set PCR */
if( p_sys->i_pcr < i_pts )
{
p_sys->i_pcr = i_pts;
es_out_Control( p_demux->out, ES_OUT_SET_PCR,
(int64_t)p_sys->i_pcr );
}
int i;
for( i = 0; i < i_sub; i++ )
{
int i_sub_size = GetWBE( &p_sys->buffer[2+i*2]);
block_t *p_block = block_New( p_demux, i_sub_size );
if( p_block )
{
memcpy( p_block->p_buffer, p_sub, i_sub_size );
p_sub += i_sub_size;
p_block->i_dts =
p_block->i_pts = ( i == 0 ? i_pts : 0 );
es_out_Send( p_demux->out, tk->p_es, p_block );
}
}
}
else if( tk->fmt.i_codec == VLC_FOURCC( 'c', 'o', 'o', 'k' ) ||
if( tk->fmt.i_codec == VLC_FOURCC( 'c', 'o', 'o', 'k' ) ||
tk->fmt.i_codec == VLC_FOURCC( 'a', 't', 'r', 'c') ||
tk->fmt.i_codec == VLC_FOURCC( 's', 'i', 'p', 'r') ||
tk->fmt.i_codec == VLC_FOURCC( '2', '8', '_', '8') )
......@@ -604,9 +574,7 @@ static int Demux( demux_t *p_demux )
}
else
{
block_t *p_block = block_New( p_demux, i_size );
/* Set the PCR */
/* Set PCR */
if( p_sys->i_pcr < i_pts )
{
p_sys->i_pcr = i_pts;
......@@ -614,6 +582,32 @@ static int Demux( demux_t *p_demux )
(int64_t)p_sys->i_pcr );
}
if( tk->fmt.i_codec == VLC_FOURCC( 'm','p','4','a' ) )
{
int i_sub = (p_sys->buffer[1] >> 4)&0x0f;
uint8_t *p_sub = &p_sys->buffer[2+2*i_sub];
int i;
for( i = 0; i < i_sub; i++ )
{
int i_sub_size = GetWBE( &p_sys->buffer[2+i*2]);
block_t *p_block = block_New( p_demux, i_sub_size );
if( p_block )
{
memcpy( p_block->p_buffer, p_sub, i_sub_size );
p_sub += i_sub_size;
p_block->i_dts =
p_block->i_pts = ( i == 0 ? i_pts : 0 );
es_out_Send( p_demux->out, tk->p_es, p_block );
}
}
}
else
{
block_t *p_block = block_New( p_demux, i_size );
if( tk->fmt.i_codec == VLC_FOURCC( 'a', '5', '2', ' ' ) )
{
uint8_t *src = p_sys->buffer;
......@@ -636,6 +630,7 @@ static int Demux( demux_t *p_demux )
es_out_Send( p_demux->out, tk->p_es, p_block );
}
}
}
return 1;
......
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