Commit fefde73e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

aout_Fifo*: remove useless parameter

parent 15366ab4
...@@ -270,8 +270,8 @@ VLC_API void aout_FormatPrepare( audio_sample_format_t * p_format ); ...@@ -270,8 +270,8 @@ VLC_API void aout_FormatPrepare( audio_sample_format_t * p_format );
VLC_API void aout_FormatPrint( aout_instance_t * p_aout, const char * psz_text, const audio_sample_format_t * p_format ); VLC_API void aout_FormatPrint( aout_instance_t * p_aout, const char * psz_text, const audio_sample_format_t * p_format );
VLC_API const char * aout_FormatPrintChannels( const audio_sample_format_t * ) VLC_USED; VLC_API const char * aout_FormatPrintChannels( const audio_sample_format_t * ) VLC_USED;
VLC_API mtime_t aout_FifoFirstDate( aout_instance_t *, aout_fifo_t * ) VLC_USED; VLC_API mtime_t aout_FifoFirstDate( const aout_fifo_t * ) VLC_USED;
VLC_API aout_buffer_t * aout_FifoPop( aout_instance_t * p_aout, aout_fifo_t * p_fifo ) VLC_USED; VLC_API aout_buffer_t *aout_FifoPop( aout_fifo_t * p_fifo ) VLC_USED;
/* From intf.c : */ /* From intf.c : */
VLC_API void aout_VolumeSoftInit( aout_instance_t * ); VLC_API void aout_VolumeSoftInit( aout_instance_t * );
......
...@@ -121,7 +121,7 @@ static aout_buffer_t *DoWork( aout_mixer_t * p_mixer, unsigned samples, ...@@ -121,7 +121,7 @@ static aout_buffer_t *DoWork( aout_mixer_t * p_mixer, unsigned samples,
p_out += i_available_words; p_out += i_available_words;
/* Next buffer */ /* Next buffer */
p_old_buffer = aout_FifoPop( NULL, &p_input->fifo ); p_old_buffer = aout_FifoPop( &p_input->fifo );
aout_BufferFree( p_old_buffer ); aout_BufferFree( p_old_buffer );
if( p_input->fifo.p_first == NULL ) if( p_input->fifo.p_first == NULL )
{ {
......
...@@ -75,7 +75,7 @@ static aout_buffer_t *DoWork( aout_mixer_t * p_mixer, unsigned samples, ...@@ -75,7 +75,7 @@ static aout_buffer_t *DoWork( aout_mixer_t * p_mixer, unsigned samples,
float multiplier ) float multiplier )
{ {
aout_mixer_input_t * p_input = p_mixer->input; aout_mixer_input_t * p_input = p_mixer->input;
aout_buffer_t * p_old_buffer = aout_FifoPop( NULL, &p_input->fifo ); aout_buffer_t * p_old_buffer = aout_FifoPop( &p_input->fifo );
(void) samples; (void) multiplier; (void) samples; (void) multiplier;
return p_old_buffer; return p_old_buffer;
......
...@@ -98,7 +98,7 @@ static aout_buffer_t *DoWork( aout_mixer_t *p_mixer, unsigned samples, ...@@ -98,7 +98,7 @@ static aout_buffer_t *DoWork( aout_mixer_t *p_mixer, unsigned samples,
p_out += avail; p_out += avail;
/* Next buffer */ /* Next buffer */
aout_buffer_t *p_old_buffer = aout_FifoPop( NULL, &p_input->fifo ); aout_buffer_t *p_old_buffer = aout_FifoPop( &p_input->fifo );
aout_BufferFree( p_old_buffer ); aout_BufferFree( p_old_buffer );
if ( p_input->fifo.p_first == NULL ) if ( p_input->fifo.p_first == NULL )
{ {
......
...@@ -531,8 +531,7 @@ static void Play( aout_instance_t *p_aout ) ...@@ -531,8 +531,7 @@ static void Play( aout_instance_t *p_aout )
p_aout->output.pf_play = PlayIgnore; p_aout->output.pf_play = PlayIgnore;
/* get the playing date of the first aout buffer */ /* get the playing date of the first aout buffer */
p_aout->output.p_sys->start_date = p_aout->output.p_sys->start_date = aout_FifoFirstDate( &p_aout->output.fifo );
aout_FifoFirstDate( p_aout, &p_aout->output.fifo );
/* wake up the audio output thread */ /* wake up the audio output thread */
sem_post( &p_aout->output.p_sys->wait ); sem_post( &p_aout->output.p_sys->wait );
......
...@@ -64,7 +64,7 @@ static void Play (aout_instance_t *aout) ...@@ -64,7 +64,7 @@ static void Play (aout_instance_t *aout)
aout_sys_t *sys = aout->output.p_sys; aout_sys_t *sys = aout->output.p_sys;
block_t *block; block_t *block;
while ((block = aout_FifoPop(aout, &aout->output.fifo)) != NULL) while ((block = aout_FifoPop(&aout->output.fifo)) != NULL)
{ {
sys->play (sys->opaque, block->p_buffer, block->i_nb_samples, sys->play (sys->opaque, block->p_buffer, block->i_nb_samples,
block->i_pts); block->i_pts);
......
...@@ -159,7 +159,7 @@ void AudioQueueCallback(void * inUserData, AudioQueueRef inAQ, AudioQueueBufferR ...@@ -159,7 +159,7 @@ void AudioQueueCallback(void * inUserData, AudioQueueRef inAQ, AudioQueueBufferR
if (p_aout) { if (p_aout) {
vlc_mutex_lock( &p_aout->output_fifo_lock ); vlc_mutex_lock( &p_aout->output_fifo_lock );
p_buffer = aout_FifoPop( p_aout, &p_aout->output.fifo ); p_buffer = aout_FifoPop( &p_aout->output.fifo );
vlc_mutex_unlock( &p_aout->output_fifo_lock ); vlc_mutex_unlock( &p_aout->output_fifo_lock );
} }
......
...@@ -579,12 +579,12 @@ static void Play( aout_instance_t *p_aout ) ...@@ -579,12 +579,12 @@ static void Play( aout_instance_t *p_aout )
/* get the playing date of the first aout buffer */ /* get the playing date of the first aout buffer */
p_aout->output.p_sys->p_notif->start_date = p_aout->output.p_sys->p_notif->start_date =
aout_FifoFirstDate( p_aout, &p_aout->output.fifo ); aout_FifoFirstDate( &p_aout->output.fifo );
/* fill in the first samples */ /* fill in the first samples */
for( int i = 0; i < FRAMES_NUM; i++ ) for( int i = 0; i < FRAMES_NUM; i++ )
{ {
p_buffer = aout_FifoPop( p_aout, &p_aout->output.fifo ); p_buffer = aout_FifoPop( &p_aout->output.fifo );
if( !p_buffer ) break; if( !p_buffer ) break;
FillBuffer( p_aout, i, p_buffer ); FillBuffer( p_aout, i, p_buffer );
} }
......
...@@ -318,7 +318,7 @@ static void Play( aout_instance_t * p_aout ) ...@@ -318,7 +318,7 @@ static void Play( aout_instance_t * p_aout )
{ {
aout_buffer_t * p_buffer; aout_buffer_t * p_buffer;
p_buffer = aout_FifoPop( p_aout, &p_aout->output.fifo ); p_buffer = aout_FifoPop( &p_aout->output.fifo );
if( fwrite( p_buffer->p_buffer, p_buffer->i_buffer, 1, if( fwrite( p_buffer->p_buffer, p_buffer->i_buffer, 1,
p_aout->output.p_sys->p_file ) != 1 ) p_aout->output.p_sys->p_file ) != 1 )
......
...@@ -273,7 +273,7 @@ static void Play(aout_instance_t *aout) ...@@ -273,7 +273,7 @@ static void Play(aout_instance_t *aout)
if (pa_context_errno(sys->context) != PA_ERR_NODATA) if (pa_context_errno(sys->context) != PA_ERR_NODATA)
error(aout, "cannot determine latency", sys->context); error(aout, "cannot determine latency", sys->context);
} else { } else {
mtime_t gap = aout_FifoFirstDate(aout, &aout->output.fifo) - mdate() mtime_t gap = aout_FifoFirstDate(&aout->output.fifo) - mdate()
- latency; - latency;
if (gap > AOUT_PTS_TOLERANCE) if (gap > AOUT_PTS_TOLERANCE)
...@@ -295,7 +295,7 @@ static void Play(aout_instance_t *aout) ...@@ -295,7 +295,7 @@ static void Play(aout_instance_t *aout)
* If this function is changed to not always dequeue blocks, be sure to * If this function is changed to not always dequeue blocks, be sure to
* limit the queue size to a reasonable limit to avoid huge leaks. */ * limit the queue size to a reasonable limit to avoid huge leaks. */
for (;;) { for (;;) {
block_t *block = aout_FifoPop(aout, &aout->output.fifo); block_t *block = aout_FifoPop(&aout->output.fifo);
if (block == NULL) if (block == NULL)
break; break;
......
...@@ -251,7 +251,7 @@ static void SDLCallback( void * _p_aout, uint8_t * p_stream, int i_len ) ...@@ -251,7 +251,7 @@ static void SDLCallback( void * _p_aout, uint8_t * p_stream, int i_len )
* it at SDL's face. Nah. */ * it at SDL's face. Nah. */
vlc_mutex_lock( &p_aout->output_fifo_lock ); vlc_mutex_lock( &p_aout->output_fifo_lock );
p_buffer = aout_FifoPop( p_aout, &p_aout->output.fifo ); p_buffer = aout_FifoPop( &p_aout->output.fifo );
vlc_mutex_unlock( &p_aout->output_fifo_lock ); vlc_mutex_unlock( &p_aout->output_fifo_lock );
if ( p_buffer != NULL ) if ( p_buffer != NULL )
......
...@@ -480,7 +480,7 @@ static void Play( aout_instance_t *_p_aout ) ...@@ -480,7 +480,7 @@ static void Play( aout_instance_t *_p_aout )
/* get the playing date of the first aout buffer */ /* get the playing date of the first aout buffer */
_p_aout->output.p_sys->start_date = _p_aout->output.p_sys->start_date =
aout_FifoFirstDate( _p_aout, &_p_aout->output.fifo ); aout_FifoFirstDate( &_p_aout->output.fifo );
msg_Dbg( _p_aout, "Wakeup sleeping output thread."); msg_Dbg( _p_aout, "Wakeup sleeping output thread.");
...@@ -937,7 +937,7 @@ static void* WaveOutThread( void *data ) ...@@ -937,7 +937,7 @@ static void* WaveOutThread( void *data )
#endif #endif
// means we are too early to request a new buffer? // means we are too early to request a new buffer?
waveout_warn("waiting...") waveout_warn("waiting...")
next_date = aout_FifoFirstDate( p_aout, &p_aout->output.fifo ); next_date = aout_FifoFirstDate( &p_aout->output.fifo );
mwait( next_date - AOUT_PTS_TOLERANCE/4 ); mwait( next_date - AOUT_PTS_TOLERANCE/4 );
next_date = mdate(); next_date = mdate();
p_buffer = aout_OutputNextBuffer( p_aout, next_date, p_buffer = aout_OutputNextBuffer( p_aout, next_date,
......
...@@ -76,7 +76,7 @@ int OpenAudio ( vlc_object_t * p_this ) ...@@ -76,7 +76,7 @@ int OpenAudio ( vlc_object_t * p_this )
*****************************************************************************/ *****************************************************************************/
static void Play( aout_instance_t * p_aout ) static void Play( aout_instance_t * p_aout )
{ {
aout_buffer_t * p_buffer = aout_FifoPop( p_aout, &p_aout->output.fifo ); aout_buffer_t * p_buffer = aout_FifoPop( &p_aout->output.fifo );
aout_BufferFree( p_buffer ); aout_BufferFree( p_buffer );
} }
...@@ -125,12 +125,13 @@ void aout_OutputDelete( aout_instance_t * p_aout ); ...@@ -125,12 +125,13 @@ void aout_OutputDelete( aout_instance_t * p_aout );
/* Release with vlc_object_release() */ /* Release with vlc_object_release() */
aout_instance_t * __aout_New ( vlc_object_t * ); aout_instance_t * __aout_New ( vlc_object_t * );
void aout_FifoInit( aout_instance_t *, aout_fifo_t *, uint32_t ); void aout_FifoInit( vlc_object_t *, aout_fifo_t *, uint32_t );
mtime_t aout_FifoNextStart( aout_instance_t *, aout_fifo_t * ); #define aout_FifoInit(o, f, r) aout_FifoInit(VLC_OBJECT(o), f, r)
void aout_FifoPush( aout_instance_t *, aout_fifo_t *, aout_buffer_t * ); mtime_t aout_FifoNextStart( const aout_fifo_t * ) VLC_USED;
void aout_FifoSet( aout_instance_t *, aout_fifo_t *, mtime_t ); void aout_FifoPush( aout_fifo_t *, aout_buffer_t * );
void aout_FifoMoveDates( aout_instance_t *, aout_fifo_t *, mtime_t ); void aout_FifoSet( aout_fifo_t *, mtime_t );
void aout_FifoDestroy( aout_instance_t * p_aout, aout_fifo_t * p_fifo ); void aout_FifoMoveDates( aout_fifo_t *, mtime_t );
void aout_FifoDestroy( aout_fifo_t * p_fifo );
void aout_FormatsPrint( aout_instance_t * p_aout, const char * psz_text, const audio_sample_format_t * p_format1, const audio_sample_format_t * p_format2 ); void aout_FormatsPrint( aout_instance_t * p_aout, const char * psz_text, const audio_sample_format_t * p_format1, const audio_sample_format_t * p_format2 );
bool aout_ChangeFilterString( vlc_object_t *, aout_instance_t *, const char *psz_variable, const char *psz_name, bool b_add ); bool aout_ChangeFilterString( vlc_object_t *, aout_instance_t *, const char *psz_variable, const char *psz_name, bool b_add );
......
...@@ -40,27 +40,6 @@ ...@@ -40,27 +40,6 @@
* Instances management (internal and external) * Instances management (internal and external)
*/ */
#define AOUT_ASSERT_FIFO_LOCKED aout_assert_fifo_locked(p_aout, p_fifo)
static inline void aout_assert_fifo_locked( aout_instance_t * p_aout, aout_fifo_t * p_fifo )
{
#ifndef NDEBUG
if( !p_aout )
return;
if( p_fifo == &p_aout->output.fifo )
vlc_assert_locked( &p_aout->output_fifo_lock );
else
if( p_aout->p_input != NULL
&& p_fifo == &p_aout->p_input->mixer.fifo )
vlc_assert_locked( &p_aout->input_fifos_lock );
else
vlc_assert_locked( &p_aout->mixer_lock );
#else
(void)p_aout;
(void)p_fifo;
#endif
}
/* Local functions */ /* Local functions */
static void aout_Destructor( vlc_object_t * p_this ); static void aout_Destructor( vlc_object_t * p_this );
...@@ -369,18 +348,14 @@ void aout_FormatsPrint( aout_instance_t * p_aout, const char * psz_text, ...@@ -369,18 +348,14 @@ void aout_FormatsPrint( aout_instance_t * p_aout, const char * psz_text,
* before calling any of these functions. * before calling any of these functions.
*/ */
#undef aout_FifoInit
/***************************************************************************** /*****************************************************************************
* aout_FifoInit : initialize the members of a FIFO * aout_FifoInit : initialize the members of a FIFO
*****************************************************************************/ *****************************************************************************/
void aout_FifoInit( aout_instance_t * p_aout, aout_fifo_t * p_fifo, void aout_FifoInit( vlc_object_t *obj, aout_fifo_t * p_fifo, uint32_t i_rate )
uint32_t i_rate )
{ {
AOUT_ASSERT_FIFO_LOCKED; if( unlikely(i_rate == 0) )
msg_Err( obj, "initialising fifo with zero divider" );
if( i_rate == 0 )
{
msg_Err( p_aout, "initialising fifo with zero divider" );
}
p_fifo->p_first = NULL; p_fifo->p_first = NULL;
p_fifo->pp_last = &p_fifo->p_first; p_fifo->pp_last = &p_fifo->p_first;
...@@ -390,12 +365,8 @@ void aout_FifoInit( aout_instance_t * p_aout, aout_fifo_t * p_fifo, ...@@ -390,12 +365,8 @@ void aout_FifoInit( aout_instance_t * p_aout, aout_fifo_t * p_fifo,
/***************************************************************************** /*****************************************************************************
* aout_FifoPush : push a packet into the FIFO * aout_FifoPush : push a packet into the FIFO
*****************************************************************************/ *****************************************************************************/
void aout_FifoPush( aout_instance_t * p_aout, aout_fifo_t * p_fifo, void aout_FifoPush( aout_fifo_t * p_fifo, aout_buffer_t * p_buffer )
aout_buffer_t * p_buffer )
{ {
(void)p_aout;
AOUT_ASSERT_FIFO_LOCKED;
*p_fifo->pp_last = p_buffer; *p_fifo->pp_last = p_buffer;
p_fifo->pp_last = &p_buffer->p_next; p_fifo->pp_last = &p_buffer->p_next;
*p_fifo->pp_last = NULL; *p_fifo->pp_last = NULL;
...@@ -417,12 +388,9 @@ void aout_FifoPush( aout_instance_t * p_aout, aout_fifo_t * p_fifo, ...@@ -417,12 +388,9 @@ void aout_FifoPush( aout_instance_t * p_aout, aout_fifo_t * p_fifo,
* aout_FifoSet : set end_date and trash all buffers (because they aren't * aout_FifoSet : set end_date and trash all buffers (because they aren't
* properly dated) * properly dated)
*****************************************************************************/ *****************************************************************************/
void aout_FifoSet( aout_instance_t * p_aout, aout_fifo_t * p_fifo, void aout_FifoSet( aout_fifo_t * p_fifo, mtime_t date )
mtime_t date )
{ {
aout_buffer_t * p_buffer; aout_buffer_t * p_buffer;
(void)p_aout;
AOUT_ASSERT_FIFO_LOCKED;
date_Set( &p_fifo->end_date, date ); date_Set( &p_fifo->end_date, date );
p_buffer = p_fifo->p_first; p_buffer = p_fifo->p_first;
...@@ -439,12 +407,9 @@ void aout_FifoSet( aout_instance_t * p_aout, aout_fifo_t * p_fifo, ...@@ -439,12 +407,9 @@ void aout_FifoSet( aout_instance_t * p_aout, aout_fifo_t * p_fifo,
/***************************************************************************** /*****************************************************************************
* aout_FifoMoveDates : Move forwards or backwards all dates in the FIFO * aout_FifoMoveDates : Move forwards or backwards all dates in the FIFO
*****************************************************************************/ *****************************************************************************/
void aout_FifoMoveDates( aout_instance_t * p_aout, aout_fifo_t * p_fifo, void aout_FifoMoveDates( aout_fifo_t * p_fifo, mtime_t difference )
mtime_t difference )
{ {
aout_buffer_t * p_buffer; aout_buffer_t * p_buffer;
(void)p_aout;
AOUT_ASSERT_FIFO_LOCKED;
date_Move( &p_fifo->end_date, difference ); date_Move( &p_fifo->end_date, difference );
p_buffer = p_fifo->p_first; p_buffer = p_fifo->p_first;
...@@ -458,10 +423,8 @@ void aout_FifoMoveDates( aout_instance_t * p_aout, aout_fifo_t * p_fifo, ...@@ -458,10 +423,8 @@ void aout_FifoMoveDates( aout_instance_t * p_aout, aout_fifo_t * p_fifo,
/***************************************************************************** /*****************************************************************************
* aout_FifoNextStart : return the current end_date * aout_FifoNextStart : return the current end_date
*****************************************************************************/ *****************************************************************************/
mtime_t aout_FifoNextStart( aout_instance_t * p_aout, aout_fifo_t * p_fifo ) mtime_t aout_FifoNextStart( const aout_fifo_t *p_fifo )
{ {
(void)p_aout;
AOUT_ASSERT_FIFO_LOCKED;
return date_Get( &p_fifo->end_date ); return date_Get( &p_fifo->end_date );
} }
...@@ -469,41 +432,32 @@ mtime_t aout_FifoNextStart( aout_instance_t * p_aout, aout_fifo_t * p_fifo ) ...@@ -469,41 +432,32 @@ mtime_t aout_FifoNextStart( aout_instance_t * p_aout, aout_fifo_t * p_fifo )
* aout_FifoFirstDate : return the playing date of the first buffer in the * aout_FifoFirstDate : return the playing date of the first buffer in the
* FIFO * FIFO
*****************************************************************************/ *****************************************************************************/
mtime_t aout_FifoFirstDate( aout_instance_t * p_aout, aout_fifo_t * p_fifo ) mtime_t aout_FifoFirstDate( const aout_fifo_t *p_fifo )
{ {
(void)p_aout; return (p_fifo->p_first != NULL) ? p_fifo->p_first->i_pts : 0;
AOUT_ASSERT_FIFO_LOCKED;
return p_fifo->p_first ? p_fifo->p_first->i_pts : 0;
} }
/***************************************************************************** /*****************************************************************************
* aout_FifoPop : get the next buffer out of the FIFO * aout_FifoPop : get the next buffer out of the FIFO
*****************************************************************************/ *****************************************************************************/
aout_buffer_t * aout_FifoPop( aout_instance_t * p_aout, aout_fifo_t * p_fifo ) aout_buffer_t *aout_FifoPop( aout_fifo_t * p_fifo )
{ {
aout_buffer_t * p_buffer; aout_buffer_t *p_buffer = p_fifo->p_first;
(void)p_aout; if( p_buffer != NULL )
AOUT_ASSERT_FIFO_LOCKED;
p_buffer = p_fifo->p_first;
if ( p_buffer == NULL ) return NULL;
p_fifo->p_first = p_buffer->p_next;
if ( p_fifo->p_first == NULL )
{ {
p_fifo->p_first = p_buffer->p_next;
if( p_fifo->p_first == NULL )
p_fifo->pp_last = &p_fifo->p_first; p_fifo->pp_last = &p_fifo->p_first;
} }
return p_buffer; return p_buffer;
} }
/***************************************************************************** /*****************************************************************************
* aout_FifoDestroy : destroy a FIFO and its buffers * aout_FifoDestroy : destroy a FIFO and its buffers
*****************************************************************************/ *****************************************************************************/
void aout_FifoDestroy( aout_instance_t * p_aout, aout_fifo_t * p_fifo ) void aout_FifoDestroy( aout_fifo_t * p_fifo )
{ {
aout_buffer_t * p_buffer; aout_buffer_t * p_buffer;
(void)p_aout;
AOUT_ASSERT_FIFO_LOCKED;
p_buffer = p_fifo->p_first; p_buffer = p_fifo->p_first;
while ( p_buffer != NULL ) while ( p_buffer != NULL )
......
...@@ -284,7 +284,7 @@ void aout_DecFlush( aout_instance_t *p_aout, aout_input_t *p_input ) ...@@ -284,7 +284,7 @@ void aout_DecFlush( aout_instance_t *p_aout, aout_input_t *p_input )
{ {
aout_lock_input_fifos( p_aout ); aout_lock_input_fifos( p_aout );
aout_FifoSet( p_aout, &p_input->mixer.fifo, 0 ); aout_FifoSet( &p_input->mixer.fifo, 0 );
p_input->mixer.begin = NULL; p_input->mixer.begin = NULL;
aout_unlock_input_fifos( p_aout ); aout_unlock_input_fifos( p_aout );
......
...@@ -449,7 +449,7 @@ int aout_InputDelete( aout_instance_t * p_aout, aout_input_t * p_input ) ...@@ -449,7 +449,7 @@ int aout_InputDelete( aout_instance_t * p_aout, aout_input_t * p_input )
aout_FiltersDestroyPipeline( p_input->pp_resamplers, aout_FiltersDestroyPipeline( p_input->pp_resamplers,
p_input->i_nb_resamplers ); p_input->i_nb_resamplers );
p_input->i_nb_resamplers = 0; p_input->i_nb_resamplers = 0;
aout_FifoDestroy( p_aout, &p_input->mixer.fifo ); aout_FifoDestroy( &p_input->mixer.fifo );
return 0; return 0;
} }
...@@ -549,7 +549,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input, ...@@ -549,7 +549,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
* this. We'll deal with that when pushing the buffer, and compensate * this. We'll deal with that when pushing the buffer, and compensate
* with the next incoming buffer. */ * with the next incoming buffer. */
aout_lock_input_fifos( p_aout ); aout_lock_input_fifos( p_aout );
start_date = aout_FifoNextStart( p_aout, &p_input->mixer.fifo ); start_date = aout_FifoNextStart( &p_input->mixer.fifo );
aout_unlock_input_fifos( p_aout ); aout_unlock_input_fifos( p_aout );
if ( start_date != 0 && start_date < mdate() ) if ( start_date != 0 && start_date < mdate() )
...@@ -560,7 +560,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input, ...@@ -560,7 +560,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
msg_Warn( p_aout, "computed PTS is out of range (%"PRId64"), " msg_Warn( p_aout, "computed PTS is out of range (%"PRId64"), "
"clearing out", mdate() - start_date ); "clearing out", mdate() - start_date );
aout_lock_input_fifos( p_aout ); aout_lock_input_fifos( p_aout );
aout_FifoSet( p_aout, &p_input->mixer.fifo, 0 ); aout_FifoSet( &p_input->mixer.fifo, 0 );
p_input->mixer.begin = NULL; p_input->mixer.begin = NULL;
aout_unlock_input_fifos( p_aout ); aout_unlock_input_fifos( p_aout );
if ( p_input->i_resampling_type != AOUT_RESAMPLING_NONE ) if ( p_input->i_resampling_type != AOUT_RESAMPLING_NONE )
...@@ -591,7 +591,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input, ...@@ -591,7 +591,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
msg_Warn( p_aout, "audio drift is too big (%"PRId64"), clearing out", msg_Warn( p_aout, "audio drift is too big (%"PRId64"), clearing out",
start_date - p_buffer->i_pts ); start_date - p_buffer->i_pts );
aout_lock_input_fifos( p_aout ); aout_lock_input_fifos( p_aout );
aout_FifoSet( p_aout, &p_input->mixer.fifo, 0 ); aout_FifoSet( &p_input->mixer.fifo, 0 );
p_input->mixer.begin = NULL; p_input->mixer.begin = NULL;
aout_unlock_input_fifos( p_aout ); aout_unlock_input_fifos( p_aout );
if ( p_input->i_resampling_type != AOUT_RESAMPLING_NONE ) if ( p_input->i_resampling_type != AOUT_RESAMPLING_NONE )
...@@ -721,7 +721,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input, ...@@ -721,7 +721,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
p_buffer->i_pts = start_date; p_buffer->i_pts = start_date;
aout_lock_input_fifos( p_aout ); aout_lock_input_fifos( p_aout );
aout_FifoPush( p_aout, &p_input->mixer.fifo, p_buffer ); aout_FifoPush( &p_input->mixer.fifo, p_buffer );
aout_unlock_input_fifos( p_aout ); aout_unlock_input_fifos( p_aout );
return 0; return 0;
} }
...@@ -748,7 +748,7 @@ static void inputFailure( aout_instance_t * p_aout, aout_input_t * p_input, ...@@ -748,7 +748,7 @@ static void inputFailure( aout_instance_t * p_aout, aout_input_t * p_input,
aout_FiltersDestroyPipeline( p_input->pp_filters, p_input->i_nb_filters ); aout_FiltersDestroyPipeline( p_input->pp_filters, p_input->i_nb_filters );
aout_FiltersDestroyPipeline( p_input->pp_resamplers, aout_FiltersDestroyPipeline( p_input->pp_resamplers,
p_input->i_nb_resamplers ); p_input->i_nb_resamplers );
aout_FifoDestroy( p_aout, &p_input->mixer.fifo ); aout_FifoDestroy( &p_input->mixer.fifo );
var_Destroy( p_aout, "visual" ); var_Destroy( p_aout, "visual" );
var_Destroy( p_aout, "equalizer" ); var_Destroy( p_aout, "equalizer" );
var_Destroy( p_aout, "audio-filter" ); var_Destroy( p_aout, "audio-filter" );
......
...@@ -112,7 +112,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume ) ...@@ -112,7 +112,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
* happen :). */ * happen :). */
msg_Warn( p_mixer, "output PTS is out of range (%"PRId64"), clearing out", msg_Warn( p_mixer, "output PTS is out of range (%"PRId64"), clearing out",
mdate() - start_date ); mdate() - start_date );
aout_FifoSet( p_aout, &p_aout->output.fifo, 0 ); aout_FifoSet( &p_aout->output.fifo, 0 );
date_Set( &exact_start_date, 0 ); date_Set( &exact_start_date, 0 );
start_date = 0; start_date = 0;
} }
...@@ -135,7 +135,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume ) ...@@ -135,7 +135,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
msg_Warn( p_mixer, "input PTS is out of range (%"PRId64"), " msg_Warn( p_mixer, "input PTS is out of range (%"PRId64"), "
"trashing", now - p_buffer->i_pts ); "trashing", now - p_buffer->i_pts );
aout_BufferFree( aout_FifoPop( p_aout, p_fifo ) ); aout_BufferFree( aout_FifoPop( p_fifo ) );
p_input->begin = NULL; p_input->begin = NULL;
} }
...@@ -163,7 +163,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume ) ...@@ -163,7 +163,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
* regularly. */ * regularly. */
msg_Warn( p_mixer, "the mixer got a packet in the past (%"PRId64")", msg_Warn( p_mixer, "the mixer got a packet in the past (%"PRId64")",
start_date - prev_date ); start_date - prev_date );
aout_BufferFree( aout_FifoPop( p_aout, p_fifo ) ); aout_BufferFree( aout_FifoPop( p_fifo ) );
p_input->begin = NULL; p_input->begin = NULL;
p_buffer = p_fifo->p_first; p_buffer = p_fifo->p_first;
} }
...@@ -184,7 +184,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume ) ...@@ -184,7 +184,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
aout_buffer_t *p_deleted; aout_buffer_t *p_deleted;
while( (p_deleted = p_fifo->p_first) != p_buffer ) while( (p_deleted = p_fifo->p_first) != p_buffer )
aout_BufferFree( aout_FifoPop( p_aout, p_fifo ) ); aout_BufferFree( aout_FifoPop( p_fifo ) );
} }
prev_date = p_buffer->i_pts + p_buffer->i_length; prev_date = p_buffer->i_pts + p_buffer->i_length;
...@@ -216,7 +216,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume ) ...@@ -216,7 +216,7 @@ static int MixBuffer( aout_instance_t * p_aout, float volume )
{ {
/* Is it really the best way to do it ? */ /* Is it really the best way to do it ? */
aout_lock_output_fifo( p_aout ); aout_lock_output_fifo( p_aout );
aout_FifoSet( p_aout, &p_aout->output.fifo, 0 ); aout_FifoSet( &p_aout->output.fifo, 0 );
date_Set( &exact_start_date, 0 ); date_Set( &exact_start_date, 0 );
aout_unlock_output_fifo( p_aout ); aout_unlock_output_fifo( p_aout );
goto giveup; goto giveup;
......
...@@ -158,8 +158,7 @@ int aout_OutputNew( aout_instance_t * p_aout, ...@@ -158,8 +158,7 @@ int aout_OutputNew( aout_instance_t * p_aout,
aout_lock_output_fifo( p_aout ); aout_lock_output_fifo( p_aout );
/* Prepare FIFO. */ /* Prepare FIFO. */
aout_FifoInit( p_aout, &p_aout->output.fifo, aout_FifoInit( p_aout, &p_aout->output.fifo, p_aout->output.output.i_rate );
p_aout->output.output.i_rate );
aout_unlock_output_fifo( p_aout ); aout_unlock_output_fifo( p_aout );
...@@ -212,7 +211,7 @@ void aout_OutputDelete( aout_instance_t * p_aout ) ...@@ -212,7 +211,7 @@ void aout_OutputDelete( aout_instance_t * p_aout )
p_aout->output.i_nb_filters ); p_aout->output.i_nb_filters );
aout_lock_output_fifo( p_aout ); aout_lock_output_fifo( p_aout );
aout_FifoDestroy( p_aout, &p_aout->output.fifo ); aout_FifoDestroy( &p_aout->output.fifo );
aout_unlock_output_fifo( p_aout ); aout_unlock_output_fifo( p_aout );
} }
...@@ -235,7 +234,7 @@ void aout_OutputPlay( aout_instance_t * p_aout, aout_buffer_t * p_buffer ) ...@@ -235,7 +234,7 @@ void aout_OutputPlay( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
} }
aout_lock_output_fifo( p_aout ); aout_lock_output_fifo( p_aout );
aout_FifoPush( p_aout, &p_aout->output.fifo, p_buffer ); aout_FifoPush( &p_aout->output.fifo, p_buffer );
p_aout->output.pf_play( p_aout ); p_aout->output.pf_play( p_aout );
aout_unlock_output_fifo( p_aout ); aout_unlock_output_fifo( p_aout );
} }
...@@ -282,7 +281,7 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout, ...@@ -282,7 +281,7 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout,
* to deal with this kind of starvation. */ * to deal with this kind of starvation. */
/* Set date to 0, to allow the mixer to send a new buffer ASAP */ /* Set date to 0, to allow the mixer to send a new buffer ASAP */
aout_FifoSet( p_aout, &p_aout->output.fifo, 0 ); aout_FifoSet( &p_aout->output.fifo, 0 );
if ( !p_aout->output.b_starving ) if ( !p_aout->output.b_starving )
msg_Dbg( p_aout, msg_Dbg( p_aout,
"audio output is starving (no input), playing silence" ); "audio output is starving (no input), playing silence" );
...@@ -333,12 +332,12 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout, ...@@ -333,12 +332,12 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout,
msg_Warn( p_aout, "output date isn't PTS date, requesting " msg_Warn( p_aout, "output date isn't PTS date, requesting "
"resampling (%"PRId64")", difference ); "resampling (%"PRId64")", difference );
aout_FifoMoveDates( p_aout, &p_aout->output.fifo, difference ); aout_FifoMoveDates( &p_aout->output.fifo, difference );
aout_unlock_output_fifo( p_aout ); aout_unlock_output_fifo( p_aout );
aout_lock_input_fifos( p_aout ); aout_lock_input_fifos( p_aout );
aout_fifo_t *p_fifo = &p_aout->p_input->mixer.fifo; aout_fifo_t *p_fifo = &p_aout->p_input->mixer.fifo;
aout_FifoMoveDates( p_aout, p_fifo, difference ); aout_FifoMoveDates( p_fifo, difference );
aout_unlock_input_fifos( p_aout ); aout_unlock_input_fifos( p_aout );
return p_buffer; return p_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