Commit 5c196547 authored by Laurent Aimar's avatar Laurent Aimar

* faad: can read stream with multiple frames per pes_packet_t (for mkv).

parent 57b971e9
......@@ -2,7 +2,7 @@
* decoder.c: AAC decoder using libfaad2
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: decoder.c,v 1.24 2003/06/14 22:14:16 hartman Exp $
* $Id: decoder.c,v 1.25 2003/06/22 08:49:11 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -120,14 +120,17 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
return( 0 );
}
static unsigned int pi_channels_maps[6] =
static unsigned int pi_channels_maps[7] =
{
0,
AOUT_CHAN_CENTER, AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT,
AOUT_CHAN_CENTER,
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT,
AOUT_CHAN_CENTER | AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT,
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT,
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT,
/* FIXME */
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT | AOUT_CHAN_REARCENTER,
};
#define FREE( p ) if( p != NULL ) free( p ); p = NULL
......@@ -316,6 +319,7 @@ static void DecodeThread( adec_thread_t *p_adec )
faacDecFrameInfo faad_frame;
int i_frame_size;
pes_packet_t *p_pes;
int i_used;
/* **** Get a new frames from streams **** */
do
......@@ -346,16 +350,20 @@ static void DecodeThread( adec_thread_t *p_adec )
input_DeletePES( p_adec->p_fifo->p_packets_mgt, p_pes );
} while( i_frame_size <= 0 );
i_used = 0;
while( i_used < i_frame_size )
{
/* **** decode this frame **** */
#ifdef HAVE_OLD_FAAD2
p_faad_buffer = faacDecDecode( p_adec->p_handle,
&faad_frame,
p_adec->p_buffer );
&p_adec->p_buffer[i_used] );
#else
p_faad_buffer = faacDecDecode( p_adec->p_handle,
&faad_frame,
p_adec->p_buffer,
i_frame_size );
&p_adec->p_buffer[i_used],
i_frame_size - i_used );
#endif
/* **** some sanity checks to see if we have samples to out **** */
......@@ -367,7 +375,7 @@ static void DecodeThread( adec_thread_t *p_adec )
}
if( ( faad_frame.channels <= 0 )||
( faad_frame.channels > AAC_MAXCHANNELS) ||
( faad_frame.channels > 5 ) )
( faad_frame.channels > 6 ) )
{
msg_Warn( p_adec->p_fifo,
"invalid channels count(%d)", faad_frame.channels );
......@@ -386,6 +394,7 @@ static void DecodeThread( adec_thread_t *p_adec )
faad_frame.channels,
faad_frame.bytesconsumed );
#endif
i_used += faad_frame.bytesconsumed;
/* **** Now we can output these samples **** */
......@@ -444,6 +453,7 @@ static void DecodeThread( adec_thread_t *p_adec )
p_aout_buffer->i_nb_bytes );
aout_DecPlay( p_adec->p_aout, p_adec->p_aout_input, p_aout_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