]> git.sesse.net Git - vlc/blobdiff - modules/services_discovery/udev.c
Use var_CreateGetNonEmptyString for decklink-mode.
[vlc] / modules / services_discovery / udev.c
index 650059b9432786207b31ea72573f3f72aaa98023..b7b7c7f078f4985756e1db982443a911edbd5906 100644 (file)
@@ -28,6 +28,7 @@
 #include <vlc_common.h>
 #include <vlc_services_discovery.h>
 #include <vlc_plugin.h>
+#include <vlc_url.h>
 #include <search.h>
 #include <poll.h>
 #include <errno.h>
@@ -538,7 +539,7 @@ static char *disc_get_mrl (struct udev_device *dev)
     if (val && !strcmp (val, "blank"))
         return NULL; /* ignore empty drives and virgin recordable discs */
 
-    const char *scheme = "invalid";
+    const char *scheme = NULL;
     val = udev_device_get_property_value (dev,
                                           "ID_CDROM_MEDIA_TRACK_COUNT_AUDIO");
     if (val && atoi (val))
@@ -558,15 +559,11 @@ static char *disc_get_mrl (struct udev_device *dev)
 
     /* We didn't get any property that could tell we have optical disc
        that we can play */
-    if( !strcmp( scheme, "invalid" ) )
+    if (scheme == NULL)
         return NULL;
 
     val = udev_device_get_devnode (dev);
-    char *mrl;
-
-    if (asprintf (&mrl, "%s://%s", scheme, val) == -1)
-        mrl = NULL;
-    return mrl;
+    return make_URI (val, scheme);
 }
 
 static char *disc_get_name (struct udev_device *dev)