[vlc-commits] [Git][videolan/vlc][master] cdda: Fix handling of GIO CDDA URIs for the whole disk

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Sat Sep 11 08:51:23 UTC 2021



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
e2e52384 by Colomban Wendling at 2021-09-11T08:31:48+00:00
cdda: Fix handling of GIO CDDA URIs for the whole disk

GIO uses the format "cdda://dev/" for the whole disk, and
"cdda://dev/Track%20N.wav" for specific tracks.  When support for
specific tracks was added to the VLC CDDA module, it broke support for
whole disk URIs with a trailing slash.

This also fixes an infinite loop listing tracks if trying to open track
0, which is invalid. This is because that same open function is used to
open specific tracks when using the "whole disk" mode as well, so this
location parser resetting the track to 0 loops again at discovering all
tracks when tryign to open e.g. "cdda://sr0/Track%200".

Fixes #24767.

- - - - -


1 changed file:

- modules/access/cdda.c


Changes:

=====================================
modules/access/cdda.c
=====================================
@@ -88,10 +88,21 @@ static vcddev_t *DiscOpen(vlc_object_t *obj, const char *location,
         const char *sl = strrchr(dec, '/');
         if (sl != NULL)
         {
-            if (sscanf(sl, "/Track %2u", trackp) == 1)
+            unsigned track = 0;
+
+            /* Match a location in the form "/" or "/Track <number>*".  If
+             * there's no match or if it's 0 (invalid), read the whole disk --
+             * but leave *trackp to the inherited value from cdda-track option.
+             * It's important not to reset it to 0 because although it means
+             * "whole disk" we must not switch back to that mode if we get
+             * called for a specific track later on, at the risk of recursing
+             * forever. */
+            if (sl[1] == '\0' || sscanf(sl, "/Track %2u", &track) == 1)
+            {
+                if (track != 0)
+                    *trackp = track;
                 dec[sl - dec] = '\0';
-            else
-                *trackp = 0;
+            }
         }
 
         if (unlikely(asprintf(&devpath, "/dev/%s", dec) == -1))



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e2e52384fb79264cb77121aa8922aba4cddf834b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e2e52384fb79264cb77121aa8922aba4cddf834b
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list