diff options
Diffstat (limited to 'sys/wasapi/gstwasapisink.c')
-rw-r--r-- | sys/wasapi/gstwasapisink.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/sys/wasapi/gstwasapisink.c b/sys/wasapi/gstwasapisink.c index f114eac8c..a124ba30a 100644 --- a/sys/wasapi/gstwasapisink.c +++ b/sys/wasapi/gstwasapisink.c @@ -182,7 +182,7 @@ gst_wasapi_sink_finalize (GObject * object) } g_clear_pointer (&self->positions, g_free); - g_clear_pointer (&self->device, g_free); + g_clear_pointer (&self->device_strid, g_free); self->mute = FALSE; G_OBJECT_CLASS (gst_wasapi_sink_parent_class)->finalize (object); @@ -204,8 +204,8 @@ gst_wasapi_sink_set_property (GObject * object, guint prop_id, case PROP_DEVICE: { const gchar *device = g_value_get_string (value); - g_free (self->device); - self->device = + g_free (self->device_strid); + self->device_strid = device ? g_utf8_to_utf16 (device, -1, NULL, NULL, NULL) : NULL; break; } @@ -229,8 +229,8 @@ gst_wasapi_sink_get_property (GObject * object, guint prop_id, g_value_set_boolean (value, self->mute); break; case PROP_DEVICE: - g_value_take_string (value, self->device ? - g_utf16_to_utf8 (self->device, -1, NULL, NULL, NULL) : NULL); + g_value_take_string (value, self->device_strid ? + g_utf16_to_utf8 (self->device_strid, -1, NULL, NULL, NULL) : NULL); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -309,14 +309,18 @@ gst_wasapi_sink_open (GstAudioSink * asink) if (self->client) return TRUE; + /* FIXME: Switching the default device does not switch the stream to it, + * even if the old device was unplugged. We need to handle this somehow. + * For example, perhaps we should automatically switch to the new device if + * the default device is changed and a device isn't explicitly selected. */ if (!gst_wasapi_util_get_device_client (GST_ELEMENT (self), FALSE, - self->role, self->device, &client)) { - if (!self->device) - GST_ELEMENT_ERROR (self, RESOURCE, OPEN_READ, (NULL), + self->role, self->device_strid, &client)) { + if (!self->device_strid) + GST_ELEMENT_ERROR (self, RESOURCE, OPEN_WRITE, (NULL), ("Failed to get default device")); else - GST_ELEMENT_ERROR (self, RESOURCE, OPEN_READ, (NULL), - ("Failed to open device %S", self->device)); + GST_ELEMENT_ERROR (self, RESOURCE, OPEN_WRITE, (NULL), + ("Failed to open device %S", self->device_strid)); goto beach; } |