void (*pf_play)( audio_output_t * ); /**< Audio buffer callback */
void (* pf_pause)( audio_output_t *, bool, mtime_t ); /**< Pause/resume
callback (optional, may be NULL) */
+ void (* pf_flush)( audio_output_t *, bool ); /**< Flush/drain callback
+ (optional, may be NULL) */
aout_volume_cb pf_volume_set; /**< Volume setter (or NULL) */
int i_nb_samples;
};
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
+ p_aout->pf_flush = NULL;
snd_pcm_hw_params_t *p_hw;
snd_pcm_sw_params_t *p_sw;
aout->pf_play = Play;
aout->pf_pause = NULL;
+ aout->pf_flush = NULL;
if (sys->set_volume != NULL)
aout->pf_volume_set = VolumeSet;
else
p_aout->format.i_nb_samples = FRAME_SIZE;
p_aout->format.pf_play = Play;
p_aout->format.pf_pause = NULL;
+ p_aout->pf_flush = NULL;
msg_Dbg(p_aout, "Starting AudioQueue (status = %i)", status);
status = AudioQueueStart(p_sys->audioQueue, NULL);
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
+ p_aout->pf_flush = NULL;
aout_FormatPrint( p_aout, "VLC is looking for:", &p_aout->format );
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
+ p_aout->pf_flush = NULL;
aout_VolumeSoftInit( p_aout );
/* Retrieve config values */
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
+ p_aout->pf_flush = NULL;
/* Audio format */
psz_format = var_CreateGetString( p_this, "audiofile-format" );
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
+ p_aout->pf_flush = NULL;
aout_VolumeSoftInit( p_aout );
/* JACK only supports fl32 format */
p_aout->i_nb_samples = 2048;
p_aout->format.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
p_aout->pf_play = Play;
- p_aout->pf_pause = NULL;
+ p_aout->pf_pause = NULL;
+ p_aout->pf_flush = NULL;
aout_FormatPrepare( &p_aout->format );
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
+ p_aout->pf_flush = NULL;
if ( var_Type( p_aout, "audio-device" ) == 0 )
{
p_aout->sys = p_sys;
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
+ p_aout->pf_flush = NULL;
/* Retrieve output device id from config */
p_sys->i_device_id = var_CreateGetInteger( p_aout, "portaudio-audio-device" );
aout->format.i_format = format;
aout->pf_play = Play;
aout->pf_pause = Pause;
+ aout->pf_flush = NULL;
aout->pf_volume_set = VolumeSet;
return VLC_SUCCESS;
p_aout->i_nb_samples = obtained.samples;
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
+ p_aout->pf_flush = NULL;
return VLC_SUCCESS;
}
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
+ p_aout->pf_flush = NULL;
/*
initialize/update Device selection List
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
+ p_aout->pf_flush = NULL;
aout_VolumeSoftInit( p_aout );
if( AOUT_FMT_NON_LINEAR( &p_aout->format )
const audio_sample_format_t * p_format );
void aout_OutputPlay( audio_output_t * p_aout, aout_buffer_t * p_buffer );
void aout_OutputPause( audio_output_t * p_aout, bool, mtime_t );
+void aout_OutputFlush( audio_output_t * p_aout, bool );
void aout_OutputDelete( audio_output_t * p_aout );
{
aout_lock( p_aout );
aout_FifoReset( &p_input->fifo );
+ aout_FifoReset( &p_aout->fifo );
+ aout_OutputFlush( p_aout, false );
aout_unlock( p_aout );
}
aout->pf_pause( aout, pause, date );
}
+/**
+ * Flushes or drains the audio output buffers.
+ * This enables the output to expedite seek and stop.
+ * @param wait if true, wait for buffer playback (i.e. drain),
+ * if false, discard the buffers immediately (i.e. flush)
+ */
+void aout_OutputFlush( audio_output_t *aout, bool wait )
+{
+ vlc_assert_locked( &aout->lock );
+
+ if( aout->pf_flush != NULL )
+ aout->pf_flush( aout, wait );
+}
+
/*** Volume handling ***/