]> git.sesse.net Git - vlc/blobdiff - modules/services_discovery/udev.c
No need for sprintf() here
[vlc] / modules / services_discovery / udev.c
index 0a85c88dfaf1821d993eda3d67eabe29541b59db..1e4901b217fc475c2fabde3c139ed9d7fb382e74 100644 (file)
@@ -35,6 +35,7 @@
 static int OpenV4L (vlc_object_t *);
 static int OpenDisc (vlc_object_t *);
 static void Close (vlc_object_t *);
+static int vlc_sd_probe_Open (vlc_object_t *);
 
 /*
  * Module descriptor
@@ -57,8 +58,30 @@ vlc_module_begin ()
     set_callbacks (OpenDisc, Close)
     add_shortcut ("disc")
 
+    VLC_SD_PROBE_SUBMODULE
+
 vlc_module_end ()
 
+static int vlc_sd_probe_Open (vlc_object_t *obj)
+{
+    vlc_probe_t *probe = (vlc_probe_t *)obj;
+
+    struct udev *udev = udev_new ();
+    if (udev == NULL)
+        return VLC_PROBE_CONTINUE;
+
+    struct udev_monitor *mon = udev_monitor_new_from_netlink (udev, "udev");
+    if (mon != NULL)
+    {
+        vlc_sd_probe_Add (probe, "v4l{longname=\"Video capture\"}",
+                          N_("Video capture"), SD_CAT_DEVICES);
+        vlc_sd_probe_Add (probe, "disc{longname=\"Discs\"}", N_("Discs"), SD_CAT_MYCOMPUTER);
+        udev_monitor_unref (mon);
+    }
+    udev_unref (udev);
+    return VLC_PROBE_CONTINUE;
+}
+
 struct device
 {
     dev_t devnum; /* must be first */