Commit 8d153467 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Real demuxer, set correctly the PCR, patch by Yuehua Zhao, modified by /me.

It should fix some issues with Samples with Video + Cook.
If you think this is wrong, please revert.

parent 36cb61ac
......@@ -358,13 +358,6 @@ static int Demux( demux_t *p_demux )
{
msg_Dbg( p_demux, "sending size=%d", tk->p_frame->i_buffer );
if( p_sys->i_pcr < tk->p_frame->i_dts )
{
p_sys->i_pcr = tk->p_frame->i_dts;
es_out_Control( p_demux->out, ES_OUT_SET_PCR,
(int64_t)p_sys->i_pcr );
}
es_out_Send( p_demux->out, tk->p_es, tk->p_frame );
tk->i_frame = 0;
......@@ -402,7 +395,9 @@ static int Demux( demux_t *p_demux )
msg_Dbg( p_demux, "copying new buffer n=%d offset=%d copy=%d",
i_ck, i_offset, i_copy );
((uint32_t*)(tk->p_frame->p_buffer+i_len+8))[i_ck] = i_offset;
((uint32_t*)(tk->p_frame->p_buffer+i_len+8))[i_ck*2 +0 ] = 1;
((uint32_t*)(tk->p_frame->p_buffer+i_len+8))[i_ck*2 +1 ] = i_offset;
memcpy( &tk->p_frame->p_buffer[i_offset + 8], p, i_copy );
}
......@@ -500,6 +495,11 @@ 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 )
{
......@@ -508,11 +508,6 @@ 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++ )
{
......@@ -577,6 +572,14 @@ static int Demux( demux_t *p_demux )
while( tk->i_out_subpacket != tk->i_subpackets &&
tk->p_subpackets[tk->i_out_subpacket] )
{
/* Set the PCR */
if (tk->i_out_subpacket == 0)
{
p_sys->i_pcr = tk->p_subpackets[tk->i_out_subpacket]->i_dts;
es_out_Control( p_demux->out, ES_OUT_SET_PCR,
(int64_t)p_sys->i_pcr );
}
block_t *p_block = tk->p_subpackets[tk->i_out_subpacket];
tk->p_subpackets[tk->i_out_subpacket] = 0;
......@@ -603,6 +606,14 @@ static int Demux( demux_t *p_demux )
{
block_t *p_block = block_New( p_demux, i_size );
/* Set the 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 );
}
if( tk->fmt.i_codec == VLC_FOURCC( 'a', '5', '2', ' ' ) )
{
uint8_t *src = p_sys->buffer;
......
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