lavd/pulse_audio_enc: implement pause messages

Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
This commit is contained in:
Lukasz Marek 2014-04-16 20:16:20 +02:00
parent eb9136a7d6
commit 35bf7a491e

View File

@ -271,6 +271,14 @@ static int pulse_finish_stream_operation(PulseData *s, pa_operation *op, const c
return s->last_result; 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) static int pulse_flash_stream(PulseData *s)
{ {
pa_operation *op; pa_operation *op;
@ -687,6 +695,12 @@ static int pulse_control_message(AVFormatContext *h, int type,
int ret; int ret;
switch(type) { 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: case AV_APP_TO_DEV_MUTE:
if (!s->mute) { if (!s->mute) {
s->mute = 1; s->mute = 1;