[vlc-commits] PulseAudio: implement flush

Rémi Denis-Courmont git at videolan.org
Mon Aug 1 19:18:29 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug  1 20:18:13 2011 +0300| [5910fb02d1fa75b604a55380278eebf95f2a3fa0] | committer: Rémi Denis-Courmont

PulseAudio: implement flush

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5910fb02d1fa75b604a55380278eebf95f2a3fa0
---

 modules/audio_output/pulse.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index b42e5ce..a3da6d4 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -515,6 +515,27 @@ static void Pause(audio_output_t *aout, bool paused, mtime_t date)
     vlc_pa_unlock();
 }
 
+/**
+ * Flush or drain the playback stream
+ */
+static void Flush(audio_output_t *aout, bool wait)
+{
+    aout_sys_t *sys = aout->sys;
+    pa_stream *s = sys->stream;
+    pa_operation *op;
+
+    vlc_pa_lock();
+
+    if (wait)
+        op = pa_stream_drain(s, NULL, NULL);
+        /* TODO: wait for drain completion*/
+    else
+        op = pa_stream_flush(s, NULL, NULL);
+    if (op != NULL)
+        pa_operation_unref(op);
+    vlc_pa_unlock();
+}
+
 static int VolumeSet(audio_output_t *aout, float vol, bool mute)
 {
     aout_sys_t *sys = aout->sys;
@@ -783,7 +804,7 @@ static int Open(vlc_object_t *obj)
     aout->format.i_format = format;
     aout->pf_play = Play;
     aout->pf_pause = Pause;
-    aout->pf_flush = NULL;
+    aout->pf_flush = Flush;
     aout->pf_volume_set = VolumeSet;
     return VLC_SUCCESS;
 



More information about the vlc-commits mailing list