summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-02-06 23:37:19 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-02-08 12:04:20 +0530
commit4b388814af946d89d651fa97872330352f09cf35 (patch)
treeb8e536d6612c6322f00fadc30010c15c84d2a1d5
parent3f1e039007c38aa125ca3d9acabf4171526b76b4 (diff)
downloadgstreamer-plugins-bad-4b388814af946d89d651fa97872330352f09cf35.tar.gz
wasapi: Rename struct element for device name
We will use ->device for storing a pointer to the IMMDevice structure which is needed for fetching the caps supported by devices in exclusive mode. https://bugzilla.gnome.org/show_bug.cgi?id=793289
-rw-r--r--sys/wasapi/gstwasapisink.c24
-rw-r--r--sys/wasapi/gstwasapisink.h2
-rw-r--r--sys/wasapi/gstwasapisrc.c16
-rw-r--r--sys/wasapi/gstwasapisrc.h2
4 files changed, 24 insertions, 20 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;
}
diff --git a/sys/wasapi/gstwasapisink.h b/sys/wasapi/gstwasapisink.h
index 8af96c01c..37ba888d5 100644
--- a/sys/wasapi/gstwasapisink.h
+++ b/sys/wasapi/gstwasapisink.h
@@ -58,7 +58,7 @@ struct _GstWasapiSink
/* properties */
gint role;
gboolean mute;
- wchar_t *device;
+ wchar_t *device_strid;
};
struct _GstWasapiSinkClass
diff --git a/sys/wasapi/gstwasapisrc.c b/sys/wasapi/gstwasapisrc.c
index 7831a5357..3eb19cc6c 100644
--- a/sys/wasapi/gstwasapisrc.c
+++ b/sys/wasapi/gstwasapisrc.c
@@ -183,7 +183,7 @@ gst_wasapi_src_finalize (GObject * object)
g_clear_pointer (&self->cached_caps, gst_caps_unref);
g_clear_pointer (&self->positions, g_free);
- g_clear_pointer (&self->device, g_free);
+ g_clear_pointer (&self->device_strid, g_free);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -201,8 +201,8 @@ gst_wasapi_src_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;
}
@@ -223,8 +223,8 @@ gst_wasapi_src_get_property (GObject * object, guint prop_id,
g_value_set_enum (value, gst_wasapi_erole_to_device_role (self->role));
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);
@@ -306,13 +306,13 @@ gst_wasapi_src_open (GstAudioSrc * asrc)
* 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), TRUE,
- self->role, self->device, &client)) {
- if (!self->device)
+ self->role, self->device_strid, &client)) {
+ if (!self->device_strid)
GST_ELEMENT_ERROR (self, RESOURCE, OPEN_READ, (NULL),
("Failed to get default device"));
else
GST_ELEMENT_ERROR (self, RESOURCE, OPEN_READ, (NULL),
- ("Failed to open device %S", self->device));
+ ("Failed to open device %S", self->device_strid));
goto beach;
}
diff --git a/sys/wasapi/gstwasapisrc.h b/sys/wasapi/gstwasapisrc.h
index 88be532f2..95087bd26 100644
--- a/sys/wasapi/gstwasapisrc.h
+++ b/sys/wasapi/gstwasapisrc.h
@@ -59,7 +59,7 @@ struct _GstWasapiSrc
/* properties */
gint role;
- wchar_t *device;
+ wchar_t *device_strid;
};
struct _GstWasapiSrcClass