From 79267f7d3da56a4907d6ff9f2ddfdb2d296a47d1 Mon Sep 17 00:00:00 2001 From: Piotr Srebrny Date: Thu, 10 Nov 2022 09:17:48 +0100 Subject: Look up device classes in an order independent way GStreamer does not guarantee any specific order in the class list returned by gst_device_get_device_class. Instead of using strcmp on this list we can check device classes in the order independet way using gst_device_has_classes. Fixes: QTBUG-107671 Pick-to: 6.4 Change-Id: If43781f39cd229ba9b0d9eefebd687017ba9e952 Reviewed-by: Lars Knoll --- src/plugins/multimedia/gstreamer/qgstreamervideodevices.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/plugins/multimedia/gstreamer/qgstreamervideodevices.cpp b/src/plugins/multimedia/gstreamer/qgstreamervideodevices.cpp index d0c341fc9..cd4d15e02 100644 --- a/src/plugins/multimedia/gstreamer/qgstreamervideodevices.cpp +++ b/src/plugins/multimedia/gstreamer/qgstreamervideodevices.cpp @@ -119,16 +119,12 @@ QList QGstreamerVideoDevices::videoDevices() const void QGstreamerVideoDevices::addDevice(GstDevice *device) { - gchar *type = gst_device_get_device_class(device); - gst_object_ref(device); - if (!strcmp(type, "Video/Source") || !strcmp(type, "Source/Video")) { + if (gst_device_has_classes(device, "Video/Source")) { + gst_object_ref(device); m_videoSources.push_back({device, QByteArray::number(m_idGenerator)}); videoInputsChanged(); m_idGenerator++; - } else { - gst_object_unref(device); } - g_free(type); } void QGstreamerVideoDevices::removeDevice(GstDevice *device) -- cgit v1.2.3