[vlc-devel] commit: udev: support for V4L1 devices (untested) ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Oct 18 13:47:35 CEST 2009


vlc | branch: 1.0-bugfix | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct 15 22:49:24 2009 +0300| [c6ffe1b2dac6554aaebf4ebd4e2f61ed3b43de4f] | committer: Rémi Denis-Courmont 

udev: support for V4L1 devices (untested)
(cherry picked from commit 978bea6ae14a3ee25fb971ab4d764a873073dfb2)

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

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

diff --git a/modules/services_discovery/udev.c b/modules/services_discovery/udev.c
index c9299c2..708e800 100644
--- a/modules/services_discovery/udev.c
+++ b/modules/services_discovery/udev.c
@@ -212,6 +212,14 @@ static char *decode_property (struct udev_device *dev, const char *name)
     return decode (udev_device_get_property_value (dev, name));
 }
 
+static bool is_v4l_legacy (struct udev_device *dev)
+{
+    const char *version;
+
+    version = udev_device_get_property_value (dev, "ID_V4L_VERSION");
+    return version && !strcmp (version, "1");
+}
+
 static void HandleDevice (services_discovery_t *sd, struct udev_device *dev,
                           bool add)
 {
@@ -222,7 +230,9 @@ static void HandleDevice (services_discovery_t *sd, struct udev_device *dev,
         return;
     }
 
-    const char *scheme = "v4l2"; /* FIXME: V4L v1 */
+    const char *scheme = "v4l2";
+    if (is_v4l_legacy (dev))
+        scheme = "v4l";
     const char *node = udev_device_get_devnode (dev);
     char *vnd = decode_property (dev, "ID_VENDOR_ENC");
     const char *name = udev_device_get_property_value (dev, "ID_V4L_PRODUCT");




More information about the vlc-devel mailing list