Commit 07686534 authored by Michel Kaempf's avatar Michel Kaempf

* ac3_decoder/ac3_decoder.c :

- m�j de la fr�quence th�orique de chaque frame ac3 ;

* audio_output/audio_output.c :
- d�tection des bouclages de flux et resynkronisation automatique sur la
fr�quence th�orique ;
parent f5c7fdfa
...@@ -218,6 +218,22 @@ static void RunThread( ac3dec_thread_t * p_ac3dec ) ...@@ -218,6 +218,22 @@ static void RunThread( ac3dec_thread_t * p_ac3dec )
p_ac3dec->b_invalid = 0; p_ac3dec->b_invalid = 0;
decode_find_sync( p_ac3dec ); decode_find_sync( p_ac3dec );
/*
p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = mdate;
mdate += 32000;
*/
if ( DECODER_FIFO_START(p_ac3dec->fifo)->b_has_pts )
{
p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = DECODER_FIFO_START(p_ac3dec->fifo)->i_pts;
DECODER_FIFO_START(p_ac3dec->fifo)->b_has_pts = 0;
}
else
{
p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = LAST_MDATE;
}
parse_syncinfo( p_ac3dec );
switch ( p_ac3dec->syncinfo.fscod ) switch ( p_ac3dec->syncinfo.fscod )
{ {
case 0: case 0:
...@@ -237,22 +253,6 @@ static void RunThread( ac3dec_thread_t * p_ac3dec ) ...@@ -237,22 +253,6 @@ static void RunThread( ac3dec_thread_t * p_ac3dec )
break; break;
} }
/*
p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = mdate;
mdate += 32000;
*/
if ( DECODER_FIFO_START(p_ac3dec->fifo)->b_has_pts )
{
p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = DECODER_FIFO_START(p_ac3dec->fifo)->i_pts;
DECODER_FIFO_START(p_ac3dec->fifo)->b_has_pts = 0;
}
else
{
p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = LAST_MDATE;
}
parse_syncinfo( p_ac3dec );
parse_bsi( p_ac3dec ); parse_bsi( p_ac3dec );
/* frame 1 */ /* frame 1 */
......
...@@ -503,13 +503,22 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*, ...@@ -503,13 +503,22 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
if ( aout_date < p_fifo->date[p_fifo->l_next_frame] ) if ( aout_date < p_fifo->date[p_fifo->l_next_frame] )
{ {
*/ */
if ( (p_fifo->date[p_fifo->l_next_frame] - p_fifo->date[p_fifo->l_start_frame] > 1000000) || (p_fifo->date[p_fifo->l_next_frame] <= p_fifo->date[p_fifo->l_start_frame]) )
if ( p_fifo->date[p_fifo->l_start_frame] >= p_fifo->date[p_fifo->l_next_frame] )
{ {
fprintf( stderr, "aout debug: p_fifo->l_rate == %li\n", p_fifo->l_rate ); fprintf( stderr, "aout debug: %lli >= %lli\n", p_fifo->date[p_fifo->l_start_frame], p_fifo->date[p_fifo->l_next_frame] );
p_fifo->date[p_fifo->l_start_frame] = p_fifo->date[p_fifo->l_next_frame] - ((1000000 * ((mtime_t)(p_fifo->l_frame_size * ((p_fifo->l_next_frame - p_fifo->l_start_frame) & AOUT_FIFO_SIZE))) >> p_fifo->b_stereo) / ((mtime_t)p_fifo->l_rate)); p_fifo->date[p_fifo->l_start_frame] = p_fifo->date[p_fifo->l_next_frame] - ((1000000 * ((mtime_t)(p_fifo->l_frame_size * ((p_fifo->l_next_frame - p_fifo->l_start_frame) & AOUT_FIFO_SIZE))) >> p_fifo->b_stereo) / ((mtime_t)p_fifo->l_rate));
} }
else if ( (p_fifo->date[p_fifo->l_next_frame] - p_fifo->date[p_fifo->l_start_frame]) > 1000000 )
{
fprintf( stderr, "aout debug: (%lli - %lli) > 1000000\n", p_fifo->date[p_fifo->l_next_frame], p_fifo->date[p_fifo->l_start_frame] );
p_fifo->date[p_fifo->l_start_frame] = p_fifo->date[p_fifo->l_next_frame] - ((1000000 * ((mtime_t)(p_fifo->l_frame_size * ((p_fifo->l_next_frame - p_fifo->l_start_frame) & AOUT_FIFO_SIZE))) >> p_fifo->b_stereo) / ((mtime_t)p_fifo->l_rate));
}
p_fifo->b_next_frame = 1; p_fifo->b_next_frame = 1;
break; break;
/* /*
} }
else else
......
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