Commit 700452e0 authored by Gildas Bazin's avatar Gildas Bazin

* modules/codec/*: make sure all audio decoders set
output_format.i_bytes_per_frame and output_format.i_frame_length
properly.
parent b70087de
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* adpcm.c : adpcm variant audio decoder * adpcm.c : adpcm variant audio decoder
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: adpcm.c,v 1.2 2002/12/18 14:17:10 sam Exp $ * $Id: adpcm.c,v 1.3 2002/12/30 17:28:31 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -305,6 +305,9 @@ static int InitThread( adec_thread_t * p_adec ) ...@@ -305,6 +305,9 @@ static int InitThread( adec_thread_t * p_adec )
p_adec->output_format.i_physical_channels = p_adec->output_format.i_physical_channels =
p_adec->output_format.i_original_channels = p_adec->output_format.i_original_channels =
pi_channels_maps[p_adec->p_wf->nChannels]; pi_channels_maps[p_adec->p_wf->nChannels];
p_adec->output_format.i_bytes_per_frame =
p_adec->p_wf->nChannels * 2;
p_adec->output_format.i_frame_length = 1;
p_adec->p_aout = NULL; p_adec->p_aout = NULL;
p_adec->p_aout_input = NULL; p_adec->p_aout_input = NULL;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* araw.c: Pseudo audio decoder; for raw pcm data * araw.c: Pseudo audio decoder; for raw pcm data
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: araw.c,v 1.8 2002/11/28 16:32:29 fenrir Exp $ * $Id: araw.c,v 1.9 2002/12/30 17:28:31 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -247,6 +247,8 @@ static int InitThread( adec_thread_t * p_adec ) ...@@ -247,6 +247,8 @@ static int InitThread( adec_thread_t * p_adec )
p_adec->output_format.i_physical_channels = p_adec->output_format.i_physical_channels =
p_adec->output_format.i_original_channels = p_adec->output_format.i_original_channels =
pi_channels_maps[p_adec->p_wf->nChannels]; pi_channels_maps[p_adec->p_wf->nChannels];
p_adec->output_format.i_bytes_per_frame = p_adec->p_wf->nBlockAlign;
p_adec->output_format.i_frame_length = 1;
p_adec->p_aout = NULL; p_adec->p_aout = NULL;
p_adec->p_aout_input = NULL; p_adec->p_aout_input = NULL;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* decoder.c: AAC decoder using libfaad2 * decoder.c: AAC decoder using libfaad2
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: decoder.c,v 1.14 2002/11/28 16:32:29 fenrir Exp $ * $Id: decoder.c,v 1.15 2002/12/30 17:28:31 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -407,6 +407,9 @@ static void DecodeThread( adec_thread_t *p_adec ) ...@@ -407,6 +407,9 @@ static void DecodeThread( adec_thread_t *p_adec )
p_adec->output_format.i_physical_channels = p_adec->output_format.i_physical_channels =
p_adec->output_format.i_original_channels = p_adec->output_format.i_original_channels =
pi_channels_maps[faad_frame.channels]; pi_channels_maps[faad_frame.channels];
p_adec->output_format.i_bytes_per_frame =
faad_frame.channels * sizeof(float);
p_adec->output_format.i_frame_length = 1;
aout_DateInit( &p_adec->date, p_adec->output_format.i_rate ); aout_DateInit( &p_adec->date, p_adec->output_format.i_rate );
p_adec->p_aout_input = aout_DecNew( p_adec->p_fifo, p_adec->p_aout_input = aout_DecNew( p_adec->p_fifo,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* audio.c: audio decoder using ffmpeg library * audio.c: audio decoder using ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: audio.c,v 1.8 2002/12/18 14:17:10 sam Exp $ * $Id: audio.c,v 1.9 2002/12/30 17:28:31 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -260,6 +260,9 @@ void E_( DecodeThread_Audio )( adec_thread_t *p_adec ) ...@@ -260,6 +260,9 @@ void E_( DecodeThread_Audio )( adec_thread_t *p_adec )
p_adec->output_format.i_physical_channels = p_adec->output_format.i_physical_channels =
p_adec->output_format.i_original_channels = p_adec->output_format.i_original_channels =
pi_channels_maps[p_adec->p_context->channels]; pi_channels_maps[p_adec->p_context->channels];
p_adec->output_format.i_bytes_per_frame =
p_adec->p_context->channels * sizeof(int16_t);
p_adec->output_format.i_frame_length = 1;
aout_DateInit( &p_adec->date, p_adec->output_format.i_rate ); aout_DateInit( &p_adec->date, p_adec->output_format.i_rate );
p_adec->p_aout_input = aout_DecNew( p_adec->p_fifo, p_adec->p_aout_input = aout_DecNew( p_adec->p_fifo,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* lpcm.c: lpcm decoder module * lpcm.c: lpcm decoder module
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: lpcm.c,v 1.8 2002/12/28 02:02:18 massiot Exp $ * $Id: lpcm.c,v 1.9 2002/12/30 17:28:31 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@videolan.org> * Henri Fallon <henri@videolan.org>
...@@ -176,7 +176,7 @@ static void DecodeFrame( dec_thread_t * p_dec ) ...@@ -176,7 +176,7 @@ static void DecodeFrame( dec_thread_t * p_dec )
aout_buffer_t * p_buffer; aout_buffer_t * p_buffer;
mtime_t i_pts; mtime_t i_pts;
uint8_t i_header; uint8_t i_header;
unsigned int i_rate, i_original_channels; unsigned int i_rate, i_original_channels, i_nb_channels;
/* Look for sync word - should be 0xXX80 */ /* Look for sync word - should be 0xXX80 */
RealignBits( &p_dec->bit_stream ); RealignBits( &p_dec->bit_stream );
...@@ -214,18 +214,22 @@ static void DecodeFrame( dec_thread_t * p_dec ) ...@@ -214,18 +214,22 @@ static void DecodeFrame( dec_thread_t * p_dec )
{ {
case 0: case 0:
i_original_channels = AOUT_CHAN_CENTER; i_original_channels = AOUT_CHAN_CENTER;
i_nb_channels = 1;
break; break;
case 1: case 1:
i_original_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; i_original_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
i_nb_channels = 2;
break; break;
case 3: case 3:
i_original_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT i_original_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT; | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
i_nb_channels = 4;
break; break;
case 5: case 5:
i_original_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT i_original_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT
| AOUT_CHAN_CENTER | AOUT_CHAN_LFE; | AOUT_CHAN_CENTER | AOUT_CHAN_LFE;
i_nb_channels = 6;
break; break;
case 2: case 2:
case 4: case 4:
...@@ -255,6 +259,8 @@ static void DecodeFrame( dec_thread_t * p_dec ) ...@@ -255,6 +259,8 @@ static void DecodeFrame( dec_thread_t * p_dec )
p_dec->output_format.i_original_channels = i_original_channels; p_dec->output_format.i_original_channels = i_original_channels;
p_dec->output_format.i_physical_channels p_dec->output_format.i_physical_channels
= i_original_channels & AOUT_CHAN_PHYSMASK; = i_original_channels & AOUT_CHAN_PHYSMASK;
p_dec->output_format.i_bytes_per_frame = i_nb_channels * 2;
p_dec->output_format.i_frame_length = 1;
aout_DateInit( &p_dec->end_date, i_rate ); aout_DateInit( &p_dec->end_date, i_rate );
p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo, p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo,
&p_dec->p_aout, &p_dec->p_aout,
......
...@@ -180,6 +180,9 @@ enum mad_flow libmad_output( void *p_data, struct mad_header const *p_header, ...@@ -180,6 +180,9 @@ enum mad_flow libmad_output( void *p_data, struct mad_header const *p_header,
p_dec->output_format.i_rate = p_pcm->samplerate; p_dec->output_format.i_rate = p_pcm->samplerate;
p_dec->output_format.i_physical_channels = i_channels; p_dec->output_format.i_physical_channels = i_channels;
p_dec->output_format.i_original_channels = i_channels; p_dec->output_format.i_original_channels = i_channels;
p_dec->output_format.i_bytes_per_frame =
p_pcm->channels * sizeof(mad_fixed_t);
p_dec->output_format.i_frame_length = 1;
aout_DateInit( &p_dec->end_date, p_pcm->samplerate ); aout_DateInit( &p_dec->end_date, p_pcm->samplerate );
p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo, p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo,
&p_dec->p_aout, &p_dec->p_aout,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* decoder.c: MPEG audio decoder thread * decoder.c: MPEG audio decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: decoder.c,v 1.9 2002/12/06 16:34:05 sam Exp $ * $Id: decoder.c,v 1.10 2002/12/30 17:28:31 gbazin Exp $
* *
* Authors: Michel Kaempf <maxx@via.ecp.fr> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr> * Michel Lespinasse <walken@via.ecp.fr>
...@@ -192,6 +192,9 @@ static void DecodeThread( adec_thread_t * p_dec ) ...@@ -192,6 +192,9 @@ static void DecodeThread( adec_thread_t * p_dec )
( sync_info.b_stereo ? AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT : ( sync_info.b_stereo ? AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT :
AOUT_CHAN_CENTER ); AOUT_CHAN_CENTER );
p_dec->output_format.i_rate = sync_info.sample_rate; p_dec->output_format.i_rate = sync_info.sample_rate;
p_dec->output_format.i_bytes_per_frame =
( sync_info.b_stereo ? 2 : 1 ) * sizeof(float);
p_dec->output_format.i_frame_length = 1;
aout_DateInit( &p_dec->end_date, sync_info.sample_rate ); aout_DateInit( &p_dec->end_date, sync_info.sample_rate );
p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo, p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo,
&p_dec->p_aout, &p_dec->p_aout,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vorbis.c: vorbis decoder module making use of libvorbis. * vorbis.c: vorbis decoder module making use of libvorbis.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: vorbis.c,v 1.9 2002/12/19 23:23:25 sigmunau Exp $ * $Id: vorbis.c,v 1.10 2002/12/30 17:28:31 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -224,6 +224,9 @@ static int RunDecoder( decoder_fifo_t * p_fifo ) ...@@ -224,6 +224,9 @@ static int RunDecoder( decoder_fifo_t * p_fifo )
p_dec->output_format.i_original_channels = p_dec->output_format.i_original_channels =
pi_channels_maps[p_dec->vi.channels]; pi_channels_maps[p_dec->vi.channels];
p_dec->output_format.i_rate = p_dec->vi.rate; p_dec->output_format.i_rate = p_dec->vi.rate;
p_dec->output_format.i_bytes_per_frame =
p_dec->vi.channels * sizeof(float);
p_dec->output_format.i_frame_length = 1;
aout_DateInit( &p_dec->end_date, p_dec->vi.rate ); aout_DateInit( &p_dec->end_date, p_dec->vi.rate );
p_dec->p_aout = NULL; p_dec->p_aout = NULL;
......
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