diff options
author | Lukasz Marek <lukasz.m.luki2@gmail.com> | 2014-04-16 22:16:20 +0400 |
---|---|---|
committer | Lukasz Marek <lukasz.m.luki2@gmail.com> | 2014-04-18 04:15:56 +0400 |
commit | 35bf7a491e4df3399a36588e1377c39e8d5a7e64 (patch) | |
tree | 445b34e7e85b1ce8cbefc6656dd371776f97e91d /libavdevice/pulse_audio_enc.c | |
parent | eb9136a7d60e3a528f05ae9f9be34e4607b327bc (diff) |
lavd/pulse_audio_enc: implement pause messages
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Diffstat (limited to 'libavdevice/pulse_audio_enc.c')
-rw-r--r-- | libavdevice/pulse_audio_enc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c index 473421474e..92e0697aeb 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; |