X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Faudio_output%2Fcommon.c;h=62b11e8cc84b61eccfaa21765be03cb965966af9;hb=9b4469b28e0e41ebe99a379fe3252fdc6bec22f0;hp=b153f0c4de4ecfdb31bcced56ae354b8285d0f30;hpb=d29ead01af9c4d6cdeb5fd96765f9a348770e6c2;p=vlc diff --git a/src/audio_output/common.c b/src/audio_output/common.c index b153f0c4de..62b11e8cc8 100644 --- a/src/audio_output/common.c +++ b/src/audio_output/common.c @@ -77,7 +77,6 @@ static void aout_Destructor( vlc_object_t * p_this ); aout_instance_t * __aout_New( vlc_object_t * p_parent ) { aout_instance_t * p_aout; - vlc_value_t val; /* Allocate descriptor. */ p_aout = vlc_object_create( p_parent, VLC_OBJECT_AOUT ); @@ -97,8 +96,7 @@ aout_instance_t * __aout_New( vlc_object_t * p_parent ) p_aout->output.b_starving = 1; var_Create( p_aout, "intf-change", VLC_VAR_BOOL ); - val.b_bool = true; - var_Set( p_aout, "intf-change", val ); + var_SetBool( p_aout, "intf-change", true ); vlc_object_set_destructor( p_aout, aout_Destructor ); @@ -371,13 +369,14 @@ void aout_FifoPush( aout_instance_t * p_aout, aout_fifo_t * p_fifo, /* Enforce the continuity of the stream. */ if ( date_Get( &p_fifo->end_date ) ) { - p_buffer->start_date = date_Get( &p_fifo->end_date ); - p_buffer->end_date = date_Increment( &p_fifo->end_date, + p_buffer->i_pts = date_Get( &p_fifo->end_date ); + p_buffer->i_length = date_Increment( &p_fifo->end_date, p_buffer->i_nb_samples ); + p_buffer->i_length -= p_buffer->i_pts; } else { - date_Set( &p_fifo->end_date, p_buffer->end_date ); + date_Set( &p_fifo->end_date, p_buffer->i_pts + p_buffer->i_length ); } } @@ -418,8 +417,7 @@ void aout_FifoMoveDates( aout_instance_t * p_aout, aout_fifo_t * p_fifo, p_buffer = p_fifo->p_first; while ( p_buffer != NULL ) { - p_buffer->start_date += difference; - p_buffer->end_date += difference; + p_buffer->i_pts += difference; p_buffer = p_buffer->p_next; } } @@ -442,7 +440,7 @@ mtime_t aout_FifoFirstDate( aout_instance_t * p_aout, aout_fifo_t * p_fifo ) { (void)p_aout; AOUT_ASSERT_FIFO_LOCKED; - return p_fifo->p_first ? p_fifo->p_first->start_date : 0; + return p_fifo->p_first ? p_fifo->p_first->i_pts : 0; } /***************************************************************************** @@ -696,3 +694,21 @@ bool aout_CheckChannelExtraction( int *pi_selection, } return i_out == i_channels; } + +/***************************************************************************** + * aout_BufferAlloc: + *****************************************************************************/ + +aout_buffer_t *aout_BufferAlloc(aout_alloc_t *allocation, mtime_t microseconds, + aout_buffer_t *old_buffer) +{ + if ( !allocation->b_alloc ) + { + return old_buffer; + } + + size_t i_alloc_size = (int)( (uint64_t)allocation->i_bytes_per_sec + * (microseconds) / 1000000 + 1 ); + + return block_Alloc( i_alloc_size ); +}