]> git.sesse.net Git - vlc/commitdiff
Do not show non-capture V4L2 devices in services (fix #5095)
authorRémi Denis-Courmont <remi@remlab.net>
Fri, 7 Oct 2011 17:57:54 +0000 (20:57 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Fri, 7 Oct 2011 20:16:33 +0000 (23:16 +0300)
modules/services_discovery/udev.c

index 239de74ffb7b75cdcbf7962dd2ba71b3b3acf79f..8c65b75541aa614c9be454c83bb9facde9581a7c 100644 (file)
@@ -398,18 +398,26 @@ static char *decode_property (struct udev_device *dev, const char *name)
 
 
 /*** Video4Linux support ***/
-static bool is_v4l_legacy (struct udev_device *dev)
+static bool v4l_is_legacy (struct udev_device *dev)
 {
     const char *version;
 
     version = udev_device_get_property_value (dev, "ID_V4L_VERSION");
-    return version && !strcmp (version, "1");
+    return (version != NULL) && !strcmp (version, "1");
+}
+
+static bool v4l_can_capture (struct udev_device *dev)
+{
+    const char *caps;
+
+    caps = udev_device_get_property_value (dev, "ID_V4L_CAPABILITIES");
+    return (caps != NULL) && (strstr (caps, ":capture:") != NULL);
 }
 
 static char *v4l_get_mrl (struct udev_device *dev)
 {
     /* Determine media location */
-    if (is_v4l_legacy (dev))
+    if (v4l_is_legacy (dev) || !v4l_can_capture (dev))
         return NULL;
 
     const char *node = udev_device_get_devnode (dev);