X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Faudio_output%2Fcommon.c;h=55068c4313b80f020f59b2b2626b409235f8ace8;hb=07a61eae0b43acf1a0312689f5a70f738893326e;hp=fde38b3ab78a159d08996192c18102ea87767fa8;hpb=174f75debc6ff4b0b3a7037bc21e7b77bfe2a9d8;p=vlc diff --git a/src/audio_output/common.c b/src/audio_output/common.c index fde38b3ab7..55068c4313 100644 --- a/src/audio_output/common.c +++ b/src/audio_output/common.c @@ -197,6 +197,8 @@ const char * aout_FormatPrintChannels( const audio_sample_format_t * p_format ) { switch ( p_format->i_physical_channels & AOUT_CHAN_PHYSMASK ) { + case AOUT_CHAN_LEFT: + case AOUT_CHAN_RIGHT: case AOUT_CHAN_CENTER: if ( (p_format->i_original_channels & AOUT_CHAN_CENTER) || (p_format->i_original_channels @@ -348,7 +350,7 @@ void aout_FifoInit( aout_instance_t * p_aout, aout_fifo_t * p_fifo, p_fifo->p_first = NULL; p_fifo->pp_last = &p_fifo->p_first; - aout_DateInit( &p_fifo->end_date, i_rate ); + date_Init( &p_fifo->end_date, i_rate, 1 ); } /***************************************************************************** @@ -364,15 +366,15 @@ void aout_FifoPush( aout_instance_t * p_aout, aout_fifo_t * p_fifo, p_fifo->pp_last = &p_buffer->p_next; *p_fifo->pp_last = NULL; /* Enforce the continuity of the stream. */ - if ( aout_DateGet( &p_fifo->end_date ) ) + if ( date_Get( &p_fifo->end_date ) ) { - p_buffer->start_date = aout_DateGet( &p_fifo->end_date ); - p_buffer->end_date = aout_DateIncrement( &p_fifo->end_date, - p_buffer->i_nb_samples ); + p_buffer->start_date = date_Get( &p_fifo->end_date ); + p_buffer->end_date = date_Increment( &p_fifo->end_date, + p_buffer->i_nb_samples ); } else { - aout_DateSet( &p_fifo->end_date, p_buffer->end_date ); + date_Set( &p_fifo->end_date, p_buffer->end_date ); } } @@ -387,7 +389,7 @@ void aout_FifoSet( aout_instance_t * p_aout, aout_fifo_t * p_fifo, (void)p_aout; AOUT_ASSERT_FIFO_LOCKED; - aout_DateSet( &p_fifo->end_date, date ); + date_Set( &p_fifo->end_date, date ); p_buffer = p_fifo->p_first; while ( p_buffer != NULL ) { @@ -409,7 +411,7 @@ void aout_FifoMoveDates( aout_instance_t * p_aout, aout_fifo_t * p_fifo, (void)p_aout; AOUT_ASSERT_FIFO_LOCKED; - aout_DateMove( &p_fifo->end_date, difference ); + date_Move( &p_fifo->end_date, difference ); p_buffer = p_fifo->p_first; while ( p_buffer != NULL ) { @@ -426,7 +428,7 @@ mtime_t aout_FifoNextStart( aout_instance_t * p_aout, aout_fifo_t * p_fifo ) { (void)p_aout; AOUT_ASSERT_FIFO_LOCKED; - return aout_DateGet( &p_fifo->end_date ); + return date_Get( &p_fifo->end_date ); } /***************************************************************************** @@ -481,65 +483,6 @@ void aout_FifoDestroy( aout_instance_t * p_aout, aout_fifo_t * p_fifo ) p_fifo->pp_last = &p_fifo->p_first; } - -/* - * Date management (internal and external) - */ - -/***************************************************************************** - * aout_DateInit : set the divider of an audio_date_t - *****************************************************************************/ -void aout_DateInit( audio_date_t * p_date, uint32_t i_divider ) -{ - p_date->date = 0; - p_date->i_divider = i_divider; - p_date->i_remainder = 0; -} - -/***************************************************************************** - * aout_DateSet : set the date of an audio_date_t - *****************************************************************************/ -void aout_DateSet( audio_date_t * p_date, mtime_t new_date ) -{ - p_date->date = new_date; - p_date->i_remainder = 0; -} - -/***************************************************************************** - * aout_DateMove : move forwards or backwards the date of an audio_date_t - *****************************************************************************/ -void aout_DateMove( audio_date_t * p_date, mtime_t difference ) -{ - p_date->date += difference; -} - -/***************************************************************************** - * aout_DateGet : get the date of an audio_date_t - *****************************************************************************/ -mtime_t aout_DateGet( const audio_date_t * p_date ) -{ - return p_date->date; -} - -/***************************************************************************** - * aout_DateIncrement : increment the date and return the result, taking - * into account rounding errors - *****************************************************************************/ -mtime_t aout_DateIncrement( audio_date_t * p_date, uint32_t i_nb_samples ) -{ - mtime_t i_dividend = INT64_C(1000000) * i_nb_samples; - assert( p_date->i_divider > 0 ); /* uninitialized audio_data_t ? */ - p_date->date += i_dividend / p_date->i_divider; - p_date->i_remainder += (int)(i_dividend % p_date->i_divider); - if ( p_date->i_remainder >= p_date->i_divider ) - { - /* This is Bresenham algorithm. */ - p_date->date++; - p_date->i_remainder -= p_date->i_divider; - } - return p_date->date; -} - /***************************************************************************** * aout_CheckChannelReorder : Check if we need to do some channel re-ordering *****************************************************************************/