From 1a5c863a326f775d94dd995155d1d78448aef6d1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 10 Nov 2013 00:49:13 +0100 Subject: player: set PulseAudio stream title to window title Set the PulseAudio stream title, just like the VO window title is set. Refactor update_vo_window_title() so that we can use it for AOs too. The ao_pulse.c bit is stolen from MPlayer. --- audio/out/ao.h | 2 ++ audio/out/ao_pulse.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) (limited to 'audio/out') diff --git a/audio/out/ao.h b/audio/out/ao.h index 7e7b6968bb..c6ad5455d2 100644 --- a/audio/out/ao.h +++ b/audio/out/ao.h @@ -34,6 +34,8 @@ enum aocontrol { // _MUTE commands take a pointer to bool AOCONTROL_GET_MUTE, AOCONTROL_SET_MUTE, + // Has char* as argument, which contains the desired stream title. + AOCONTROL_UPDATE_STREAM_TITLE, }; #define AOPLAY_FINAL_CHUNK 1 diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c index 9d86cddd6d..a4da2a179b 100644 --- a/audio/out/ao_pulse.c +++ b/audio/out/ao_pulse.c @@ -582,6 +582,19 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) pa_threaded_mainloop_unlock(priv->mainloop); return CONTROL_OK; } + + case AOCONTROL_UPDATE_STREAM_TITLE: { + char *title = (char *)arg; + pa_threaded_mainloop_lock(priv->mainloop); + if (!waitop(priv, pa_stream_set_name(priv->stream, title, + success_cb, ao))) + { + GENERIC_ERR_MSG("pa_stream_set_name() failed"); + return CONTROL_ERROR; + } + return CONTROL_OK; + } + default: return CONTROL_UNKNOWN; } -- cgit v1.2.3