[vlc-commits] Do not show non-capture V4L2 devices in services (fix #5095)

Rémi Denis-Courmont git at videolan.org
Fri Oct 7 22:21:40 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Oct  7 20:57:54 2011 +0300| [748b8ea610e9a32ac6be5ade389e060abe563462] | committer: Rémi Denis-Courmont

Do not show non-capture V4L2 devices in services (fix #5095)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=748b8ea610e9a32ac6be5ade389e060abe563462
---

 modules/services_discovery/udev.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/modules/services_discovery/udev.c b/modules/services_discovery/udev.c
index 239de74..8c65b75 100644
--- a/modules/services_discovery/udev.c
+++ b/modules/services_discovery/udev.c
@@ -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);



More information about the vlc-commits mailing list