[FFmpeg-cvslog] lavd/pulse_audio_enc: implement pause messages

Lukasz Marek git at videolan.org
Fri Apr 18 05:04:09 CEST 2014


ffmpeg | branch: master | Lukasz Marek <lukasz.m.luki2 at gmail.com> | Wed Apr 16 20:16:20 2014 +0200| [35bf7a491e4df3399a36588e1377c39e8d5a7e64] | committer: Lukasz Marek

lavd/pulse_audio_enc: implement pause messages

Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=35bf7a491e4df3399a36588e1377c39e8d5a7e64
---

 libavdevice/pulse_audio_enc.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c
index 4734214..92e0697 100644
--- a/libavdevice/pulse_audio_enc.c
+++ b/libavdevice/pulse_audio_enc.c
@@ -271,6 +271,14 @@ static int pulse_finish_stream_operation(PulseData *s, pa_operation *op, const c
     return s->last_result;
 }
 
+static int pulse_set_pause(PulseData *s, int pause)
+{
+    pa_operation *op;
+    pa_threaded_mainloop_lock(s->mainloop);
+    op = pa_stream_cork(s->stream, pause, pulse_stream_result, s);
+    return pulse_finish_stream_operation(s, op, "pa_stream_cork");
+}
+
 static int pulse_flash_stream(PulseData *s)
 {
     pa_operation *op;
@@ -687,6 +695,12 @@ static int pulse_control_message(AVFormatContext *h, int type,
     int ret;
 
     switch(type) {
+    case AV_APP_TO_DEV_PAUSE:
+        return pulse_set_pause(s, 1);
+    case AV_APP_TO_DEV_PLAY:
+        return pulse_set_pause(s, 0);
+    case AV_APP_TO_DEV_TOGGLE_PAUSE:
+        return pulse_set_pause(s, !pa_stream_is_corked(s->stream));
     case AV_APP_TO_DEV_MUTE:
         if (!s->mute) {
             s->mute = 1;



More information about the ffmpeg-cvslog mailing list