[vlc-commits] Inline aout_BufferAlloc and simplify
Rémi Denis-Courmont
git at videolan.org
Mon May 30 17:21:05 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon May 30 18:10:34 2011 +0300| [d8839e25289af9e72a39a0b60f18ccde3a660b05] | committer: Rémi Denis-Courmont
Inline aout_BufferAlloc and simplify
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d8839e25289af9e72a39a0b60f18ccde3a660b05
---
src/audio_output/aout_internal.h | 3 ---
src/audio_output/common.c | 18 ------------------
src/audio_output/mixer.c | 37 +++++++++++++++++--------------------
3 files changed, 17 insertions(+), 41 deletions(-)
diff --git a/src/audio_output/aout_internal.h b/src/audio_output/aout_internal.h
index 968805e..60c45e8 100644
--- a/src/audio_output/aout_internal.h
+++ b/src/audio_output/aout_internal.h
@@ -26,9 +26,6 @@
# include <vlc_aout_mixer.h>
-aout_buffer_t *aout_BufferAlloc(aout_alloc_t *allocation, mtime_t microseconds,
- aout_buffer_t *old_buffer);
-
typedef struct
{
struct vout_thread_t *(*pf_request_vout)( void *, struct vout_thread_t *,
diff --git a/src/audio_output/common.c b/src/audio_output/common.c
index c29f33f..1e0fa5a 100644
--- a/src/audio_output/common.c
+++ b/src/audio_output/common.c
@@ -736,24 +736,6 @@ 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 );
-}
-
/* Return the order in which filters should be inserted */
static int FilterOrder( const char *psz_name )
{
diff --git a/src/audio_output/mixer.c b/src/audio_output/mixer.c
index 1180a1e..27a7693 100644
--- a/src/audio_output/mixer.c
+++ b/src/audio_output/mixer.c
@@ -97,7 +97,6 @@ void aout_MixerDelete( aout_instance_t * p_aout )
static int MixBuffer( aout_instance_t * p_aout )
{
int i, i_first_input = 0;
- aout_buffer_t * p_output_buffer;
mtime_t start_date, end_date;
date_t exact_start_date;
@@ -323,33 +322,31 @@ static int MixBuffer( aout_instance_t * p_aout )
}
/* Run the mixer. */
- p_output_buffer = aout_BufferAlloc( &p_aout->p_mixer->allocation,
- ((uint64_t)p_aout->output.i_nb_samples * 1000000)
- / p_aout->output.output.i_rate,
- /* This is a bit kludgy, but is actually only used
- * for the S/PDIF dummy mixer : */
- p_aout->pp_inputs[i_first_input]->mixer.fifo.p_first);
- if ( p_output_buffer == NULL )
+ aout_buffer_t * p_outbuf;
+
+ if( p_aout->p_mixer->allocation.b_alloc )
{
- aout_unlock_input_fifos( p_aout );
- return -1;
+ p_outbuf = block_Alloc( p_aout->output.i_nb_samples
+ * p_aout->p_mixer->fmt.i_bytes_per_frame
+ / p_aout->p_mixer->fmt.i_frame_length );
+ if( likely(p_outbuf != NULL) )
+ p_outbuf->i_nb_samples = p_aout->output.i_nb_samples;
}
- /* This is again a bit kludgy - for the S/PDIF mixer. */
- if ( p_aout->p_mixer->allocation.b_alloc )
+ else
+ p_outbuf = p_aout->pp_inputs[i_first_input]->mixer.fifo.p_first;
+ if ( p_outbuf == NULL )
{
- p_output_buffer->i_nb_samples = p_aout->output.i_nb_samples;
- p_output_buffer->i_buffer = p_aout->output.i_nb_samples
- * p_aout->p_mixer->fmt.i_bytes_per_frame
- / p_aout->p_mixer->fmt.i_frame_length;
+ aout_unlock_input_fifos( p_aout );
+ return -1;
}
- p_output_buffer->i_pts = start_date;
- p_output_buffer->i_length = end_date - start_date;
+ p_outbuf->i_pts = start_date;
+ p_outbuf->i_length = end_date - start_date;
- p_aout->p_mixer->mix( p_aout->p_mixer, p_output_buffer );
+ p_aout->p_mixer->mix( p_aout->p_mixer, p_outbuf );
aout_unlock_input_fifos( p_aout );
- aout_OutputPlay( p_aout, p_output_buffer );
+ aout_OutputPlay( p_aout, p_outbuf );
return 0;
}
More information about the vlc-commits
mailing list