Commit 7a58ef70 authored by Christophe Massiot's avatar Christophe Massiot

* Major API change of the audio output. New aout_Dec* functions.

* Fixed a compile issue in s16tofloat32swab.
* Fixed a typo in demux/mpeg/ts.c.
parent cc35b1d0
......@@ -22,7 +22,7 @@ INTERFACE := interface intf_eject
PLAYLIST := playlist
INPUT := input input_ext-plugins input_ext-dec input_ext-intf input_dec input_programs input_clock input_info
VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
AUDIO_OUTPUT := audio_output filters input mixer output intf
AUDIO_OUTPUT := common filters input mixer output intf dec
STREAM_OUTPUT := stream_output
MISC := mtime modules threads cpu configuration netutils iso_lang messages objects extras
......
......@@ -2,7 +2,7 @@
* aout_internal.h : internal defines for audio output
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: aout_internal.h,v 1.20 2002/09/20 23:27:03 massiot Exp $
* $Id: aout_internal.h,v 1.21 2002/09/26 22:40:18 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -120,6 +120,8 @@ typedef struct aout_mixer_t
void (* pf_do_work)( struct aout_instance_t *,
struct aout_buffer_t * );
/* If b_error == 1, there is no mixer nor audio output pipeline. */
vlc_bool_t b_error;
/* Multiplier used to raise or lower the volume of the sound in
* software. Beware, this creates sound distortion and should be avoided
* as much as possible. This isn't available for non-float32 mixer. */
......@@ -147,8 +149,10 @@ struct aout_input_t
/* Mixer information */
byte_t * p_first_byte_to_mix;
/* Is the input dead ? */
/* If b_error == 1, there is no input pipeline. */
vlc_bool_t b_error;
/* Did we just change the output format ? (expect buffer inconsistencies) */
vlc_bool_t b_changed;
};
/*****************************************************************************
......@@ -186,7 +190,7 @@ struct aout_instance_t
/* Locks : please note that if you need several of these locks, it is
* mandatory (to avoid deadlocks) to take them in the following order :
* p_input->lock, mixer_lock, output_fifo_lock, input_fifos_lock.
* mixer_lock, p_input->lock, output_fifo_lock, input_fifos_lock.
* --Meuuh */
/* When input_fifos_lock is taken, none of the p_input->fifo structures
* can be read or modified by a third-party thread. */
......@@ -214,6 +218,8 @@ struct aout_instance_t
* Prototypes
*****************************************************************************/
/* From input.c : */
int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input );
int aout_InputDelete( aout_instance_t * p_aout, aout_input_t * p_input );
int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
aout_buffer_t * p_buffer );
......@@ -235,7 +241,7 @@ void aout_FiltersPlay( aout_instance_t * p_aout,
/* From mixer.c : */
int aout_MixerNew( aout_instance_t * p_aout );
void aout_MixerDelete( aout_instance_t * p_aout );
int aout_MixerDelete( aout_instance_t * p_aout );
void aout_MixerRun( aout_instance_t * p_aout );
int aout_MixerMultiplierSet( aout_instance_t * p_aout, float f_multiplier );
int aout_MixerMultiplierGet( aout_instance_t * p_aout, float * pf_multiplier );
......@@ -247,7 +253,7 @@ void aout_OutputPlay( aout_instance_t * p_aout, aout_buffer_t * p_buffer );
void aout_OutputDelete( aout_instance_t * p_aout );
VLC_EXPORT( aout_buffer_t *, aout_OutputNextBuffer, ( aout_instance_t *, mtime_t, vlc_bool_t ) );
/* From audio_output.c : */
/* From common.c : */
VLC_EXPORT( int, aout_FormatNbChannels, ( audio_sample_format_t * p_format ) );
void aout_FormatPrepare( audio_sample_format_t * p_format );
void aout_FifoInit( aout_instance_t *, aout_fifo_t *, u32 );
......
......@@ -2,7 +2,7 @@
* audio_output.h : audio output interface
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: audio_output.h,v 1.66 2002/09/20 23:27:03 massiot Exp $
* $Id: audio_output.h,v 1.67 2002/09/26 22:40:18 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -168,23 +168,23 @@ struct audio_date_t
/*****************************************************************************
* Prototypes
*****************************************************************************/
/* From audio_output.c : */
#define aout_NewInstance(a) __aout_NewInstance(VLC_OBJECT(a))
VLC_EXPORT( aout_instance_t *, __aout_NewInstance, ( vlc_object_t * ) );
VLC_EXPORT( void, aout_DeleteInstance, ( aout_instance_t * ) );
VLC_EXPORT( aout_buffer_t *, aout_BufferNew, ( aout_instance_t *, aout_input_t *, size_t ) );
VLC_EXPORT( void, aout_BufferDelete, ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) );
VLC_EXPORT( int, aout_BufferPlay, ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) );
/* From common.c : */
#define aout_New(a) __aout_New(VLC_OBJECT(a))
VLC_EXPORT( aout_instance_t *, __aout_New, ( vlc_object_t * ) );
VLC_EXPORT( void, aout_Delete, ( aout_instance_t * ) );
VLC_EXPORT( void, aout_DateInit, ( audio_date_t *, u32 ) );
VLC_EXPORT( void, aout_DateSet, ( audio_date_t *, mtime_t ) );
VLC_EXPORT( void, aout_DateMove, ( audio_date_t *, mtime_t ) );
VLC_EXPORT( mtime_t, aout_DateGet, ( const audio_date_t * ) );
VLC_EXPORT( mtime_t, aout_DateIncrement, ( audio_date_t *, u32 ) );
/* From input.c : */
#define aout_InputNew(a,b,c) __aout_InputNew(VLC_OBJECT(a),b,c)
VLC_EXPORT( aout_input_t *, __aout_InputNew, ( vlc_object_t *, aout_instance_t **, audio_sample_format_t * ) );
VLC_EXPORT( void, aout_InputDelete, ( aout_instance_t *, aout_input_t * ) );
/* From dec.c : */
#define aout_DecNew(a, b, c) __aout_DecNew(VLC_OBJECT(a), b, c)
VLC_EXPORT( aout_input_t *, __aout_DecNew, ( vlc_object_t *, aout_instance_t **, audio_sample_format_t * ) );
VLC_EXPORT( int, aout_DecDelete, ( aout_instance_t *, aout_input_t * ) );
VLC_EXPORT( aout_buffer_t *, aout_DecNewBuffer, ( aout_instance_t *, aout_input_t *, size_t ) );
VLC_EXPORT( void, aout_DecDeleteBuffer, ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) );
VLC_EXPORT( int, aout_DecPlay, ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) );
/* From intf.c : */
VLC_EXPORT( int, aout_VolumeGet, ( aout_instance_t *, audio_volume_t * ) );
......@@ -192,4 +192,5 @@ VLC_EXPORT( int, aout_VolumeSet, ( aout_instance_t *, audio_volume_t ) );
VLC_EXPORT( int, aout_VolumeInfos, ( aout_instance_t *, audio_volume_t * ) );
VLC_EXPORT( int, aout_VolumeUp, ( aout_instance_t *, int, audio_volume_t * ) );
VLC_EXPORT( int, aout_VolumeDown, ( aout_instance_t *, int, audio_volume_t * ) );
VLC_EXPORT( int, aout_Restart, ( aout_instance_t * p_aout ) );
......@@ -2,11 +2,11 @@
struct module_symbols_t
{
aout_buffer_t * (* aout_BufferNew_inner) ( aout_instance_t *, aout_input_t *, size_t ) ;
aout_buffer_t * (* aout_DecNewBuffer_inner) ( aout_instance_t *, aout_input_t *, size_t ) ;
aout_buffer_t * (* aout_FifoPop_inner) ( aout_instance_t * p_aout, aout_fifo_t * p_fifo ) ;
aout_buffer_t * (* aout_OutputNextBuffer_inner) ( aout_instance_t *, mtime_t, vlc_bool_t ) ;
aout_input_t * (* __aout_InputNew_inner) ( vlc_object_t *, aout_instance_t **, audio_sample_format_t * ) ;
aout_instance_t * (* __aout_NewInstance_inner) ( vlc_object_t * ) ;
aout_input_t * (* __aout_DecNew_inner) ( vlc_object_t *, aout_instance_t **, audio_sample_format_t * ) ;
aout_instance_t * (* __aout_New_inner) ( vlc_object_t * ) ;
char * (* __config_GetPsz_inner) (vlc_object_t *, const char *) ;
char * (* config_GetHomeDir_inner) ( void ) ;
char * (* input_OffsetToTime_inner) ( input_thread_t *, char *, off_t ) ;
......@@ -37,8 +37,10 @@ struct module_symbols_t
int (* __vlc_thread_create_inner) ( vlc_object_t *, char *, int, char *, void * ( * ) ( void * ), int, vlc_bool_t ) ;
int (* __vlc_threads_end_inner) ( vlc_object_t * ) ;
int (* __vlc_threads_init_inner) ( vlc_object_t * ) ;
int (* aout_BufferPlay_inner) ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) ;
int (* aout_DecDelete_inner) ( aout_instance_t *, aout_input_t * ) ;
int (* aout_DecPlay_inner) ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) ;
int (* aout_FormatNbChannels_inner) ( audio_sample_format_t * p_format ) ;
int (* aout_Restart_inner) ( aout_instance_t * p_aout ) ;
int (* aout_VolumeDown_inner) ( aout_instance_t *, int, audio_volume_t * ) ;
int (* aout_VolumeGet_inner) ( aout_instance_t *, audio_volume_t * ) ;
int (* aout_VolumeInfos_inner) ( aout_instance_t *, audio_volume_t * ) ;
......@@ -111,12 +113,11 @@ struct module_symbols_t
void (* __vlc_object_yield_inner) ( vlc_object_t * ) ;
void (* __vlc_thread_join_inner) ( vlc_object_t *, char *, int ) ;
void (* __vlc_thread_ready_inner) ( vlc_object_t * ) ;
void (* aout_BufferDelete_inner) ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) ;
void (* aout_DateInit_inner) ( audio_date_t *, u32 ) ;
void (* aout_DateMove_inner) ( audio_date_t *, mtime_t ) ;
void (* aout_DateSet_inner) ( audio_date_t *, mtime_t ) ;
void (* aout_DeleteInstance_inner) ( aout_instance_t * ) ;
void (* aout_InputDelete_inner) ( aout_instance_t *, aout_input_t * ) ;
void (* aout_DecDeleteBuffer_inner) ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) ;
void (* aout_Delete_inner) ( aout_instance_t * ) ;
void (* aout_VolumeNoneInit_inner) ( aout_instance_t * ) ;
void (* aout_VolumeSoftInit_inner) ( aout_instance_t * ) ;
void (* config_Duplicate_inner) ( module_t *, module_config_t * ) ;
......@@ -172,8 +173,8 @@ struct module_symbols_t
# define UnalignedGetBits p_symbols->UnalignedGetBits_inner
# define UnalignedRemoveBits p_symbols->UnalignedRemoveBits_inner
# define UnalignedShowBits p_symbols->UnalignedShowBits_inner
# define __aout_InputNew p_symbols->__aout_InputNew_inner
# define __aout_NewInstance p_symbols->__aout_NewInstance_inner
# define __aout_DecNew p_symbols->__aout_DecNew_inner
# define __aout_New p_symbols->__aout_New_inner
# define __config_GetFloat p_symbols->__config_GetFloat_inner
# define __config_GetInt p_symbols->__config_GetInt_inner
# define __config_GetPsz p_symbols->__config_GetPsz_inner
......@@ -222,19 +223,20 @@ struct module_symbols_t
# define __vlc_threads_end p_symbols->__vlc_threads_end_inner
# define __vlc_threads_init p_symbols->__vlc_threads_init_inner
# define __vout_CreateThread p_symbols->__vout_CreateThread_inner
# define aout_BufferDelete p_symbols->aout_BufferDelete_inner
# define aout_BufferNew p_symbols->aout_BufferNew_inner
# define aout_BufferPlay p_symbols->aout_BufferPlay_inner
# define aout_DateGet p_symbols->aout_DateGet_inner
# define aout_DateIncrement p_symbols->aout_DateIncrement_inner
# define aout_DateInit p_symbols->aout_DateInit_inner
# define aout_DateMove p_symbols->aout_DateMove_inner
# define aout_DateSet p_symbols->aout_DateSet_inner
# define aout_DeleteInstance p_symbols->aout_DeleteInstance_inner
# define aout_DecDelete p_symbols->aout_DecDelete_inner
# define aout_DecDeleteBuffer p_symbols->aout_DecDeleteBuffer_inner
# define aout_DecNewBuffer p_symbols->aout_DecNewBuffer_inner
# define aout_DecPlay p_symbols->aout_DecPlay_inner
# define aout_Delete p_symbols->aout_Delete_inner
# define aout_FifoPop p_symbols->aout_FifoPop_inner
# define aout_FormatNbChannels p_symbols->aout_FormatNbChannels_inner
# define aout_InputDelete p_symbols->aout_InputDelete_inner
# define aout_OutputNextBuffer p_symbols->aout_OutputNextBuffer_inner
# define aout_Restart p_symbols->aout_Restart_inner
# define aout_VolumeDown p_symbols->aout_VolumeDown_inner
# define aout_VolumeGet p_symbols->aout_VolumeGet_inner
# define aout_VolumeInfos p_symbols->aout_VolumeInfos_inner
......
......@@ -3,7 +3,7 @@
* with endianness change
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: s16tofloat32swab.c,v 1.3 2002/09/20 23:27:03 massiot Exp $
* $Id: s16tofloat32swab.c,v 1.4 2002/09/26 22:40:19 massiot Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@videolan.org>
......@@ -115,7 +115,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
#ifndef HAVE_SWAB
p_tmp[0] = ((byte_t *)p_in)[1];
p_tmp[1] = ((byte_t *)p_in)[0];
*p_out = (float)*( *(s16 *)p_tmp ) / 32768.0;
*p_out = (float)( *(s16 *)p_tmp ) / 32768.0;
#else
*p_out = (float)*p_in / 32768.0;
#endif
......
......@@ -2,7 +2,7 @@
* a52.c: A/52 basic parser
*****************************************************************************
* Copyright (C) 2001-2002 VideoLAN
* $Id: a52.c,v 1.12 2002/09/20 23:27:03 massiot Exp $
* $Id: a52.c,v 1.13 2002/09/26 22:40:20 massiot Exp $
*
* Authors: Stphane Borel <stef@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -174,7 +174,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
|| (p_dec->output_format.i_bytes_per_frame != i_frame_size) ) )
{
/* Parameters changed - this should not happen. */
aout_InputDelete( p_dec->p_aout, p_dec->p_aout_input );
aout_DecDelete( p_dec->p_aout, p_dec->p_aout_input );
p_dec->p_aout_input = NULL;
}
......@@ -186,9 +186,9 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
p_dec->output_format.i_bytes_per_frame = i_frame_size;
p_dec->output_format.i_frame_length = A52_FRAME_NB;
aout_DateInit( &end_date, i_rate );
p_dec->p_aout_input = aout_InputNew( p_dec->p_fifo,
&p_dec->p_aout,
&p_dec->output_format );
p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo,
&p_dec->p_aout,
&p_dec->output_format );
if ( p_dec->p_aout_input == NULL )
{
......@@ -206,8 +206,8 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
continue;
}
p_buffer = aout_BufferNew( p_dec->p_aout, p_dec->p_aout_input,
A52_FRAME_NB );
p_buffer = aout_DecNewBuffer( p_dec->p_aout, p_dec->p_aout_input,
A52_FRAME_NB );
if ( p_buffer == NULL ) return -1;
p_buffer->start_date = aout_DateGet( &end_date );
p_buffer->end_date = aout_DateIncrement( &end_date,
......@@ -219,13 +219,13 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
i_frame_size - 7 );
if( p_dec->p_fifo->b_die )
{
aout_BufferDelete( p_dec->p_aout, p_dec->p_aout_input,
p_buffer );
aout_DecDeleteBuffer( p_dec->p_aout, p_dec->p_aout_input,
p_buffer );
break;
}
/* Send the buffer to the mixer. */
aout_BufferPlay( p_dec->p_aout, p_dec->p_aout_input, p_buffer );
aout_DecPlay( p_dec->p_aout, p_dec->p_aout_input, p_buffer );
}
/* If b_error is set, the spdif thread enters the error loop */
......@@ -247,7 +247,7 @@ static void EndThread( dec_thread_t * p_dec )
{
if ( p_dec->p_aout_input != NULL )
{
aout_InputDelete( p_dec->p_aout, p_dec->p_aout_input );
aout_DecDelete( p_dec->p_aout, p_dec->p_aout_input );
}
free( p_dec );
......
......@@ -2,7 +2,7 @@
* a52old.c: A52 decoder module main file
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: a52old.c,v 1.6 2002/08/30 22:22:24 massiot Exp $
* $Id: a52old.c,v 1.7 2002/09/26 22:40:20 massiot Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
*
......@@ -167,7 +167,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
{
/* Delete old output */
msg_Warn( p_a52dec->p_fifo, "opening a new aout" );
aout_InputDelete( p_a52dec->p_aout, p_a52dec->p_aout_input );
aout_DecDelete( p_a52dec->p_aout, p_a52dec->p_aout_input );
}
/* Set output configuration */
......@@ -175,9 +175,9 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
output_format.i_channels = 2; /* FIXME ! */
output_format.i_rate = sync_info.sample_rate;
aout_DateInit( &end_date, output_format.i_rate );
p_a52dec->p_aout_input = aout_InputNew( p_a52dec->p_fifo,
&p_a52dec->p_aout,
&output_format );
p_a52dec->p_aout_input = aout_DecNew( p_a52dec->p_fifo,
&p_a52dec->p_aout,
&output_format );
}
if( p_a52dec->p_aout_input == NULL )
......@@ -198,9 +198,9 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
continue;
}
p_aout_buffer = aout_BufferNew( p_a52dec->p_aout,
p_a52dec->p_aout_input,
A52DEC_FRAME_SIZE );
p_aout_buffer = aout_DecNewBuffer( p_a52dec->p_aout,
p_a52dec->p_aout_input,
A52DEC_FRAME_SIZE );
if( !p_aout_buffer )
{
msg_Err( p_a52dec->p_fifo, "cannot get aout buffer" );
......@@ -215,14 +215,14 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
if (decode_frame (p_a52dec, (s16*)p_aout_buffer->p_buffer))
{
b_sync = 0;
aout_BufferDelete( p_a52dec->p_aout, p_a52dec->p_aout_input,
p_aout_buffer );
aout_DecDeleteBuffer( p_a52dec->p_aout, p_a52dec->p_aout_input,
p_aout_buffer );
continue;
}
else
{
aout_BufferPlay( p_a52dec->p_aout, p_a52dec->p_aout_input,
p_aout_buffer );
aout_DecPlay( p_a52dec->p_aout, p_a52dec->p_aout_input,
p_aout_buffer );
}
RealignBits(&p_a52dec->bit_stream);
......@@ -344,7 +344,7 @@ static void EndThread (a52dec_t * p_a52dec)
/* If the audio output fifo was created, we destroy it */
if( p_a52dec->p_aout_input )
{
aout_InputDelete( p_a52dec->p_aout, p_a52dec->p_aout_input );
aout_DecDelete( p_a52dec->p_aout, p_a52dec->p_aout_input );
}
/* Free allocated structures */
......
......@@ -2,7 +2,7 @@
* decoder.c: AAC decoder using libfaad2
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: decoder.c,v 1.2 2002/08/23 14:05:22 sam Exp $
* $Id: decoder.c,v 1.3 2002/09/26 22:40:21 massiot Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -447,15 +447,15 @@ static void DecodeThread( adec_thread_t *p_adec )
if( p_adec->p_aout_input )
{
/* **** Delete the old **** */
aout_InputDelete( p_adec->p_aout, p_adec->p_aout_input );
aout_DecDelete( p_adec->p_aout, p_adec->p_aout_input );
}
/* **** Create a new audio output **** */
p_adec->output_format.i_channels = faad_frame.channels;
aout_DateInit( &p_adec->date, p_adec->output_format.i_rate );
p_adec->p_aout_input = aout_InputNew( p_adec->p_fifo,
&p_adec->p_aout,
&p_adec->output_format );
p_adec->p_aout_input = aout_DecNew( p_adec->p_fifo,
&p_adec->p_aout,
&p_adec->output_format );
}
if( !p_adec->p_aout_input )
......@@ -473,9 +473,9 @@ static void DecodeThread( adec_thread_t *p_adec )
return;
}
p_aout_buffer = aout_BufferNew( p_adec->p_aout,
p_adec->p_aout_input,
faad_frame.samples / faad_frame.channels );
p_aout_buffer = aout_DecNewBuffer( p_adec->p_aout,
p_adec->p_aout_input,
faad_frame.samples / faad_frame.channels );
if( !p_aout_buffer )
{
msg_Err( p_adec->p_fifo, "cannot get aout buffer" );
......@@ -490,7 +490,7 @@ static void DecodeThread( adec_thread_t *p_adec )
p_faad_buffer,
p_aout_buffer->i_nb_bytes );
aout_BufferPlay( p_adec->p_aout, p_adec->p_aout_input, p_aout_buffer );
aout_DecPlay( p_adec->p_aout, p_adec->p_aout_input, p_aout_buffer );
}
......@@ -501,7 +501,7 @@ static void EndThread (adec_thread_t *p_adec)
{
if( p_adec->p_aout_input )
{
aout_InputDelete( p_adec->p_aout, p_adec->p_aout_input );
aout_DecDelete( p_adec->p_aout, p_adec->p_aout_input );
}
if( p_adec->p_handle )
......
......@@ -2,7 +2,7 @@
* lpcm.c: lpcm decoder module
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: lpcm.c,v 1.1 2002/09/20 23:27:03 massiot Exp $
* $Id: lpcm.c,v 1.2 2002/09/26 22:40:20 massiot Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@videolan.org>
......@@ -131,9 +131,9 @@ static int RunDecoder( decoder_fifo_t * p_fifo )
p_dec->output_format.i_rate = 48000;
aout_DateInit( &p_dec->end_date, 48000 );
p_dec->p_aout_input = aout_InputNew( p_dec->p_fifo,
&p_dec->p_aout,
&p_dec->output_format );
p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo,
&p_dec->p_aout,
&p_dec->output_format );
if ( p_dec->p_aout_input == NULL )
{
......@@ -175,9 +175,9 @@ void DecodeFrame( dec_thread_t * p_dec )
aout_DateSet( &p_dec->end_date, i_pts );
}
p_aout_buffer = aout_BufferNew( p_dec->p_aout,
p_dec->p_aout_input,
LPCM_FRAME_NB );
p_aout_buffer = aout_DecNewBuffer( p_dec->p_aout,
p_dec->p_aout_input,
LPCM_FRAME_NB );
if( !p_aout_buffer )
{
......@@ -200,13 +200,13 @@ void DecodeFrame( dec_thread_t * p_dec )
if( p_dec->p_fifo->b_die )
{
aout_BufferDelete( p_dec->p_aout, p_dec->p_aout_input,
p_aout_buffer );
aout_DecDeleteBuffer( p_dec->p_aout, p_dec->p_aout_input,
p_aout_buffer );
return;
}
aout_BufferPlay( p_dec->p_aout, p_dec->p_aout_input,
p_aout_buffer );
aout_DecPlay( p_dec->p_aout, p_dec->p_aout_input,
p_aout_buffer );
}
/*****************************************************************************
......@@ -216,7 +216,7 @@ static void EndThread( dec_thread_t * p_dec )
{
if( p_dec->p_aout_input != NULL )
{
aout_InputDelete( p_dec->p_aout, p_dec->p_aout_input );
aout_DecDelete( p_dec->p_aout, p_dec->p_aout_input );
}
free( p_dec );
......
......@@ -155,7 +155,7 @@ enum mad_flow libmad_output( void *p_data, struct mad_header const *p_header,
|| p_dec->output_format.i_channels != p_pcm->channels) )
{
/* Parameters changed - this should not happen. */
aout_InputDelete( p_dec->p_aout, p_dec->p_aout_input );
aout_DecDelete( p_dec->p_aout, p_dec->p_aout_input );
p_dec->p_aout_input = NULL;
}
......@@ -165,9 +165,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_channels = p_pcm->channels;
aout_DateInit( &p_dec->end_date, p_pcm->samplerate );
p_dec->p_aout_input = aout_InputNew( p_dec->p_fifo,
&p_dec->p_aout,
&p_dec->output_format );
p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo,
&p_dec->p_aout,
&p_dec->output_format );
if ( p_dec->p_aout_input == NULL )
{
......@@ -199,7 +199,7 @@ enum mad_flow libmad_output( void *p_data, struct mad_header const *p_header,
return MAD_FLOW_CONTINUE;
}
p_buffer = aout_BufferNew( p_dec->p_aout, p_dec->p_aout_input, i_samples );
p_buffer = aout_DecNewBuffer( p_dec->p_aout, p_dec->p_aout_input, i_samples );
if ( p_buffer == NULL )
{
......@@ -233,7 +233,7 @@ enum mad_flow libmad_output( void *p_data, struct mad_header const *p_header,
p_pcm->channels );
}
aout_BufferPlay( p_dec->p_aout, p_dec->p_aout_input, p_buffer );
aout_DecPlay( p_dec->p_aout, p_dec->p_aout_input, p_buffer );
return MAD_FLOW_CONTINUE;
}
......
......@@ -2,7 +2,7 @@
* decoder.c: MPEG audio decoder thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: decoder.c,v 1.3 2002/08/26 23:00:22 massiot Exp $
* $Id: decoder.c,v 1.4 2002/09/26 22:40:23 massiot Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
......@@ -174,7 +174,7 @@ static void DecodeThread( adec_thread_t * p_dec )
{
/* Delete old output */
msg_Warn( p_dec->p_fifo, "opening a new aout" );
aout_InputDelete( p_dec->p_aout, p_dec->p_aout_input );
aout_DecDelete( p_dec->p_aout, p_dec->p_aout_input );
}
/* Set output configuration */
......@@ -182,9 +182,9 @@ static void DecodeThread( adec_thread_t * p_dec )
p_dec->output_format.i_channels = ( sync_info.b_stereo ? 2 : 1 );
p_dec->output_format.i_rate = sync_info.sample_rate;
aout_DateInit( &p_dec->end_date, sync_info.sample_rate );
p_dec->p_aout_input = aout_InputNew( p_dec->p_fifo,
&p_dec->p_aout,
&p_dec->output_format );
p_dec->p_aout_input = aout_DecNew( p_dec->p_fifo,
&p_dec->p_aout,
&p_dec->output_format );
}
if( p_dec->p_aout_input == NULL )
......@@ -200,9 +200,9 @@ static void DecodeThread( adec_thread_t * p_dec )
return;
}
p_aout_buffer = aout_BufferNew( p_dec->p_aout,
p_dec->p_aout_input,
ADEC_FRAME_NB );
p_aout_buffer = aout_DecNewBuffer( p_dec->p_aout,
p_dec->p_aout_input,
ADEC_FRAME_NB );
if( !p_aout_buffer )
{
msg_Err( p_dec->p_fifo, "cannot get aout buffer" );
......@@ -216,11 +216,11 @@ static void DecodeThread( adec_thread_t * p_dec )
if( adec_DecodeFrame (p_dec, (float*)p_aout_buffer->p_buffer ) )
{
/* Ouch, failed decoding... We'll have to resync */
aout_BufferDelete( p_dec->p_aout, p_dec->p_aout_input, p_aout_buffer );
aout_DecDeleteBuffer( p_dec->p_aout, p_dec->p_aout_input, p_aout_buffer );
}
else
{
aout_BufferPlay( p_dec->p_aout, p_dec->p_aout_input, p_aout_buffer );
aout_DecPlay( p_dec->p_aout, p_dec->p_aout_input, p_aout_buffer );
}
}
}
......@@ -236,7 +236,7 @@ static void EndThread ( adec_thread_t *p_dec )
/* If the audio output fifo was created, we destroy it */
if( p_dec->p_aout_input )
{
aout_InputDelete( p_dec->p_aout, p_dec->p_aout_input );
aout_DecDelete( p_dec->p_aout, p_dec->p_aout_input );
}
......
......@@ -2,7 +2,7 @@
* mpeg_ts.c : Transport Stream input module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: ts.c,v 1.5 2002/09/23 23:05:58 massiot Exp $
* $Id: ts.c,v 1.6 2002/09/26 22:40:24 massiot Exp $
*
* Authors: Henri Fallon <henri@via.ecp.fr>
* Johan Bilien <jobi@via.ecp.fr>
......@@ -907,7 +907,6 @@ void TS_DVBPSI_HandlePMT( input_thread_t * p_input, dvbpsi_pmt_t * p_new_pmt )
p_new_es->i_stream_id = 0xBD;
break;
case DVD_SPU_ES:
case A52_AUDIO_ES:
if ( !b_vls_compat )
p_new_es->i_fourcc = VLC_FOURCC('s','p','u',' ');
else
......
/*****************************************************************************
* audio_output.c : audio output instance miscellaneous functions
* common.c : audio output management of common data structures
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: audio_output.c,v 1.103 2002/09/20 23:27:04 massiot Exp $
* $Id: common.c,v 1.1 2002/09/26 22:40:25 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -29,21 +29,18 @@
#include <vlc/vlc.h>
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#endif
#include "audio_output.h"
#include "aout_internal.h"
/*
* Instances management (see also input.c:aout_InputNew())
* Instances management (internal and external)
*/
/*****************************************************************************
* aout_NewInstance: initialize aout structure
* aout_New: initialize aout structure
*****************************************************************************/
aout_instance_t * __aout_NewInstance( vlc_object_t * p_parent )
aout_instance_t * __aout_New( vlc_object_t * p_parent )
{
aout_instance_t * p_aout;
......@@ -60,6 +57,7 @@ aout_instance_t * __aout_NewInstance( vlc_object_t * p_parent )
vlc_mutex_init( p_parent, &p_aout->output_fifo_lock );
p_aout->i_nb_inputs = 0;
p_aout->mixer.f_multiplier = 1.0;
p_aout->mixer.b_error = 1;
vlc_object_attach( p_aout, p_parent->p_vlc );
......@@ -67,9 +65,9 @@ aout_instance_t * __aout_NewInstance( vlc_object_t * p_parent )
}
/*****************************************************************************
* aout_DeleteInstance: destroy aout structure
* aout_Delete: destroy aout structure
*****************************************************************************/
void aout_DeleteInstance( aout_instance_t * p_aout )
void aout_Delete( aout_instance_t * p_aout )
{
vlc_mutex_destroy( &p_aout->input_fifos_lock );
vlc_mutex_destroy( &p_aout->mixer_lock );
......@@ -81,77 +79,7 @@ void aout_DeleteInstance( aout_instance_t * p_aout )
/*
* Buffer management (interface to the decoders)
*/
/*****************************************************************************
* aout_BufferNew : ask for a new empty buffer
*****************************************************************************/
aout_buffer_t * aout_BufferNew( aout_instance_t * p_aout,
aout_input_t * p_input,
size_t i_nb_samples )
{
aout_buffer_t * p_buffer;
mtime_t duration = (1000000 * (mtime_t)i_nb_samples)
/ p_input->input.i_rate;
/* This necessarily allocates in the heap. */
aout_BufferAlloc( &p_input->input_alloc, duration, NULL, p_buffer );
p_buffer->i_nb_samples = i_nb_samples;
p_buffer->i_nb_bytes = i_nb_samples * p_input->input.i_bytes_per_frame
/ p_input->input.i_frame_length;
if ( p_buffer == NULL )
{
msg_Err( p_aout, "NULL buffer !" );
}
else
{
p_buffer->start_date = p_buffer->end_date = 0;
}
return p_buffer;
}
/*****************************************************************************
* aout_BufferDelete : destroy an undecoded buffer
*****************************************************************************/
void aout_BufferDelete( aout_instance_t * p_aout, aout_input_t * p_input,
aout_buffer_t * p_buffer )
{
aout_BufferFree( p_buffer );
}
/*****************************************************************************
* aout_BufferPlay : filter & mix the decoded buffer
*****************************************************************************/
int aout_BufferPlay( aout_instance_t * p_aout, aout_input_t * p_input,
aout_buffer_t * p_buffer )
{
if ( p_buffer->start_date == 0 )
{
msg_Warn( p_aout, "non-dated buffer received" );
aout_BufferFree( p_buffer );
}
else
{
p_buffer->end_date = p_buffer->start_date
+ (mtime_t)(p_buffer->i_nb_samples * 1000000)
/ p_input->input.i_rate;
}
/* If the buffer is too early, wait a while. */
mwait( p_buffer->start_date - AOUT_MAX_PREPARE_TIME );
if ( aout_InputPlay( p_aout, p_input, p_buffer ) == -1 ) return -1;