Commit 2e1cf451 authored by gbazin's avatar gbazin

* src/input/decoder.c, modules/codec/faad.c: work around another bug in libfaad with ADTS streams.

parent f9701bc5
......@@ -5,7 +5,7 @@
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
* Gildas Bazin <gbazin@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -200,6 +200,22 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_block->i_buffer = 0;
}
if( p_dec->fmt_out.audio.i_rate == 0 && p_dec->fmt_in.i_extra > 0 )
{
/* We have a decoder config so init the handle */
unsigned long i_rate;
unsigned char i_channels;
if( faacDecInit2( p_sys->hfaad, p_dec->fmt_in.p_extra,
p_dec->fmt_in.i_extra,
&i_rate, &i_channels ) >= 0 )
{
p_dec->fmt_out.audio.i_rate = i_rate;
p_dec->fmt_out.audio.i_channels = i_channels;
aout_DateInit( &p_sys->date, i_rate );
}
}
if( p_dec->fmt_out.audio.i_rate == 0 && p_sys->i_buffer )
{
unsigned long i_rate;
......@@ -308,6 +324,13 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
break;
}
}
if( j == MAX_CHANNEL_POSITIONS )
{
msg_Warn( p_dec, "unknow channel ordering" );
block_Release( p_block );
return NULL;
}
}
p_dec->fmt_out.audio.i_original_channels =
p_dec->fmt_out.audio.i_physical_channels;
......
......@@ -589,6 +589,15 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
while( (p_packetized_block =
p_packetizer->pf_packetize( p_packetizer, &p_block )) )
{
if( p_packetizer->fmt_out.i_extra && !p_dec->fmt_in.i_extra )
{
p_dec->fmt_in.i_extra = p_packetizer->fmt_out.i_extra;
p_dec->fmt_in.p_extra = malloc( p_dec->fmt_in.i_extra );
memcpy( p_dec->fmt_in.p_extra,
p_packetizer->fmt_out.p_extra,
p_dec->fmt_in.i_extra );
}
while( p_packetized_block )
{
block_t *p_next = p_packetized_block->p_next;
......
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