aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-05-28 17:03:57 -0700
committerChris Robinson <[email protected]>2010-05-28 17:03:57 -0700
commite9f4576d4d0340b4f4c090977ef48a56c619fd6d (patch)
tree8e691e0500aee15ab95aae1b0f39027c9399d354
parent880902feccccad61ceb8541b6571ae42a3e56d9a (diff)
Watch for changes to the PulseAudio sink device
-rw-r--r--Alc/pulseaudio.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c
index 9b09fce4..da471f8d 100644
--- a/Alc/pulseaudio.c
+++ b/Alc/pulseaudio.c
@@ -93,6 +93,7 @@ MAKE_FUNC(pa_stream_get_buffer_attr);
MAKE_FUNC(pa_stream_get_sample_spec);
MAKE_FUNC(pa_stream_set_read_callback);
MAKE_FUNC(pa_stream_set_state_callback);
+MAKE_FUNC(pa_stream_set_moved_callback);
MAKE_FUNC(pa_stream_new);
MAKE_FUNC(pa_stream_disconnect);
MAKE_FUNC(pa_threaded_mainloop_lock);
@@ -238,6 +239,7 @@ LOAD_FUNC(pa_stream_get_buffer_attr);
LOAD_FUNC(pa_stream_get_sample_spec);
LOAD_FUNC(pa_stream_set_read_callback);
LOAD_FUNC(pa_stream_set_state_callback);
+LOAD_FUNC(pa_stream_set_moved_callback);
LOAD_FUNC(pa_stream_new);
LOAD_FUNC(pa_stream_disconnect);
LOAD_FUNC(pa_threaded_mainloop_lock);
@@ -318,6 +320,15 @@ static void stream_buffer_attr_callback(pa_stream *stream, void *pdata) //{{{
ProcessContext(NULL);
}//}}}
+static void stream_device_callback(pa_stream *stream, void *pdata) //{{{
+{
+ ALCdevice *Device = pdata;
+ pulse_data *data = Device->ExtraData;
+
+ free(data->device_name);
+ data->device_name = strdup(ppa_stream_get_device_name(stream));
+}//}}}
+
static void context_state_callback2(pa_context *context, void *pdata) //{{{
{
ALCdevice *Device = pdata;
@@ -758,6 +769,7 @@ static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{
if(ppa_stream_set_buffer_attr_callback)
ppa_stream_set_buffer_attr_callback(data->stream, stream_buffer_attr_callback, device);
#endif
+ ppa_stream_set_moved_callback(data->stream, stream_device_callback, device);
stream_write_callback(data->stream, data->attr.tlength, device);
ppa_stream_set_write_callback(data->stream, stream_write_callback, device);
@@ -775,6 +787,11 @@ static void pulse_stop_playback(ALCdevice *device) //{{{
ppa_threaded_mainloop_lock(data->loop);
+#if PA_CHECK_VERSION(0,9,15)
+ if(ppa_stream_set_buffer_attr_callback)
+ ppa_stream_set_buffer_attr_callback(data->stream, NULL, NULL);
+#endif
+ ppa_stream_set_moved_callback(data->stream, NULL, NULL);
ppa_stream_set_write_callback(data->stream, NULL, NULL);
ppa_stream_disconnect(data->stream);
ppa_stream_unref(data->stream);