From 39bbccdf79c74de68cd47c5f8fb1dec9e688cb9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Sun, 4 May 2014 01:14:33 -0400 Subject: [PATCH] pulsedevicemonitor: Index are per facility, not global So need to keep the type of device in the device object --- ext/pulse/pulsedevicemonitor.c | 7 ++++++- ext/pulse/pulsedevicemonitor.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ext/pulse/pulsedevicemonitor.c b/ext/pulse/pulsedevicemonitor.c index af4db6daaf..b4ee819941 100644 --- a/ext/pulse/pulsedevicemonitor.c +++ b/ext/pulse/pulsedevicemonitor.c @@ -282,7 +282,11 @@ context_subscribe_cb (pa_context * context, pa_subscription_event_type_t type, for (item = monitor->devices; item; item = item->next) { dev = item->data; - if (dev->device_index == idx) { + if (((facility == PA_SUBSCRIPTION_EVENT_SOURCE && + dev->type == GST_PULSE_DEVICE_TYPE_SOURCE) || + (facility == PA_SUBSCRIPTION_EVENT_SINK && + dev->type == GST_PULSE_DEVICE_TYPE_SINK)) && + dev->device_index == idx) { gst_object_ref (dev); break; } @@ -629,6 +633,7 @@ gst_pulse_device_new (guint device_index, const gchar * device_name, "display-name", device_name, "caps", caps, "klass", klass, "internal-name", internal_name, NULL); + gstdev->type = type; gstdev->device_index = device_index; gstdev->element = element; diff --git a/ext/pulse/pulsedevicemonitor.h b/ext/pulse/pulsedevicemonitor.h index 9d9070e23f..100ba9b0ac 100644 --- a/ext/pulse/pulsedevicemonitor.h +++ b/ext/pulse/pulsedevicemonitor.h @@ -83,6 +83,7 @@ typedef struct _GstPulseDeviceClass GstPulseDeviceClass; struct _GstPulseDevice { GstDevice parent; + GstPulseDeviceType type; guint device_index; gchar *internal_name; const gchar *element;