[vlc-commits] commit: udev sd: fix udev based disc finding (Ilkka Ollakka )

git at videolan.org git at videolan.org
Sun Mar 7 16:32:20 CET 2010


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sun Mar  7 17:28:39 2010 +0200| [0820fb75f362afb97b6b11ece174c1e2f19abdd5] | committer: Ilkka Ollakka 

udev sd: fix udev based disc finding

Only blank discs seem to give ID_CDROM_MEDIA_STATE=blank normal audio-cds just
dont have that property at all. And instead defaulting to file, default to
invalid and return NULL if we don't find any property to tell use that optical
disc is something we are able to play currently.

Fixes udev discs sd for me, tested with empty dvd-r discs and audio cds.

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

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

diff --git a/modules/services_discovery/udev.c b/modules/services_discovery/udev.c
index 32020cd..0c64b5f 100644
--- a/modules/services_discovery/udev.c
+++ b/modules/services_discovery/udev.c
@@ -523,19 +523,18 @@ static char *disc_get_mrl (struct udev_device *dev)
         return NULL; /* Ignore non-optical block devices */
 
     val = udev_device_get_property_value (dev, "ID_CDROM_MEDIA_STATE");
-    if ((val == NULL) || !strcmp (val, "blank"))
+    if (val && !strcmp (val, "blank"))
         return NULL; /* ignore empty drives and virgin recordable discs */
 
-    const char *scheme = "file";
+    const char *scheme = "invalid";
     val = udev_device_get_property_value (dev,
                                           "ID_CDROM_MEDIA_TRACK_COUNT_AUDIO");
     if (val && atoi (val))
         scheme = "cdda"; /* Audio CD rather than file system */
-#if 0 /* we can use file:// for DVDs */
     val = udev_device_get_property_value (dev, "ID_CDROM_MEDIA_DVD");
     if (val && atoi (val))
-        scheme = "dvd";
-#endif
+        scheme = "file";
+
     val = udev_device_get_property_value (dev, "ID_CDROM_MEDIA_BD");
     if (val && atoi (val))
         scheme = "bd";
@@ -545,6 +544,11 @@ static char *disc_get_mrl (struct udev_device *dev)
         scheme = "hddvd";
 #endif
 
+    /* We didn't get any property that could tell we have optical disc
+       that we can play */
+    if( !strcmp( scheme, "invalid" ) )
+        return NULL;
+
     val = udev_device_get_devnode (dev);
     char *mrl;
 



More information about the vlc-commits mailing list