wasapi: Don't cast GstDeviceProvider to GstElement
authorSeungha Yang <seungha.yang@navercorp.com>
Tue, 17 Sep 2019 11:29:03 +0000 (20:29 +0900)
committerTim-Philipp Müller <tim@centricular.com>
Thu, 17 Oct 2019 18:51:34 +0000 (19:51 +0100)
The GstDeviceProvider isn't subclass of GstElement.

(gst-device-monitor-1.0:49356): GLib-GObject-WARNING **: 20:21:18.651:
invalid cast from 'GstWasapiDeviceProvider' to 'GstElement'

sys/wasapi/gstwasapidevice.c
sys/wasapi/gstwasapiutil.c
sys/wasapi/gstwasapiutil.h

index 723368e..62087eb 100644 (file)
@@ -63,7 +63,7 @@ gst_wasapi_device_provider_probe (GstDeviceProvider * provider)
   GstWasapiDeviceProvider *self = GST_WASAPI_DEVICE_PROVIDER (provider);
   GList *devices = NULL;
 
-  if (!gst_wasapi_util_get_devices (GST_ELEMENT (self), TRUE, &devices))
+  if (!gst_wasapi_util_get_devices (GST_OBJECT (self), TRUE, &devices))
     GST_ERROR_OBJECT (self, "Failed to enumerate devices");
 
   return devices;
index ef4e005..eac2883 100644 (file)
@@ -313,7 +313,7 @@ gst_wasapi_util_hresult_to_string (HRESULT hr)
 }
 
 static IMMDeviceEnumerator *
-gst_wasapi_util_get_device_enumerator (GstElement * self)
+gst_wasapi_util_get_device_enumerator (GstObject * self)
 {
   HRESULT hr;
   IMMDeviceEnumerator *enumerator = NULL;
@@ -326,7 +326,7 @@ gst_wasapi_util_get_device_enumerator (GstElement * self)
 }
 
 gboolean
-gst_wasapi_util_get_devices (GstElement * self, gboolean active,
+gst_wasapi_util_get_devices (GstObject * self, gboolean active,
     GList ** devices)
 {
   gboolean res = FALSE;
@@ -550,7 +550,7 @@ gst_wasapi_util_get_device_client (GstElement * self,
   IMMDevice *device = NULL;
   IAudioClient *client = NULL;
 
-  if (!(enumerator = gst_wasapi_util_get_device_enumerator (self)))
+  if (!(enumerator = gst_wasapi_util_get_device_enumerator (GST_OBJECT (self))))
     goto beach;
 
   if (!device_strid) {
index 715e0db..4e560e6 100644 (file)
@@ -92,7 +92,7 @@ gint gst_wasapi_erole_to_device_role (gint erole);
 
 gchar *gst_wasapi_util_hresult_to_string (HRESULT hr);
 
-gboolean gst_wasapi_util_get_devices (GstElement * element, gboolean active,
+gboolean gst_wasapi_util_get_devices (GstObject * element, gboolean active,
     GList ** devices);
 
 gboolean gst_wasapi_util_get_device_client (GstElement * element,