summaryrefslogtreecommitdiff
blob: e0943e6471f35651f77143ee4036608139eb6651 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
diff --git a/src/cdaudio-ng/cdaudio-ng.c b/src/cdaudio-ng/cdaudio-ng.c
index 925b847..e986839 100644
--- a/src/cdaudio-ng/cdaudio-ng.c
+++ b/src/cdaudio-ng/cdaudio-ng.c
@@ -26,11 +26,16 @@
 #include <cdio/cdio.h>
 #include <cdio/cdtext.h>
 #include <cdio/track.h>
-#include <cdio/cdda.h>
 #include <cdio/audio.h>
 #include <cdio/sector.h>
 #include <cdio/cd_types.h>

+#if LIBCDIO_VERSION_NUM >= 90
+#include <cdio/paranoia/cdda.h>
+#else
+#include <cdio/cdda.h>
+#endif
+
 /* libcdio's header files #define these */
 #undef PACKAGE
 #undef PACKAGE_BUGREPORT
@@ -269,9 +274,9 @@ static void cdaudio_set_strinfo (trackinfo_t * t,
                                  const char * performer, const char * name,
                                  const char * genre)
 {
-    g_strlcpy (t->performer, performer, DEF_STRING_LEN);
-    g_strlcpy (t->name, name, DEF_STRING_LEN);
-    g_strlcpy (t->genre, genre, DEF_STRING_LEN);
+    g_strlcpy (t->performer, performer ? performer : "", DEF_STRING_LEN);
+    g_strlcpy (t->name, name ? name : "", DEF_STRING_LEN);
+    g_strlcpy (t->genre, genre ? genre : "", DEF_STRING_LEN);
 }

 /* thread safe (mutex may be locked) */
@@ -622,23 +627,32 @@ static void scan_cd (void)
     }

     /* get trackinfo[0] cdtext information (the disc) */
+    cdtext_t *pcdtext = NULL;
     if (aud_get_bool ("CDDA", "use_cdtext"))
     {
         AUDDBG ("getting cd-text information for disc\n");
-        cdtext_t *pcdtext = cdio_get_cdtext (pcdrom_drive->p_cdio, 0);
+#if LIBCDIO_VERSION_NUM >= 90
+        pcdtext = cdio_get_cdtext (pcdrom_drive->p_cdio);
+        if (pcdtext == NULL)
+#else
+        pcdtext = cdio_get_cdtext (pcdrom_drive->p_cdio, 0);
         if (pcdtext == NULL || pcdtext->field[CDTEXT_TITLE] == NULL)
+#endif
         {
             AUDDBG ("no cd-text available for disc\n");
         }
         else
         {
             cdaudio_set_strinfo (&trackinfo[0],
-                                 pcdtext->field[CDTEXT_PERFORMER] ? pcdtext->
-                                 field[CDTEXT_PERFORMER] : "",
-                                 pcdtext->field[CDTEXT_TITLE] ? pcdtext->
-                                 field[CDTEXT_TITLE] : "",
-                                 pcdtext->field[CDTEXT_GENRE] ? pcdtext->
-                                 field[CDTEXT_GENRE] : "");
+#if LIBCDIO_VERSION_NUM >= 90
+                                 cdtext_get(pcdtext, CDTEXT_FIELD_PERFORMER, 0),
+                                 cdtext_get(pcdtext, CDTEXT_FIELD_TITLE, 0),
+                                 cdtext_get(pcdtext, CDTEXT_FIELD_GENRE, 0));
+#else
+                                 pcdtext->field[CDTEXT_PERFORMER],
+                                 pcdtext->field[CDTEXT_TITLE],
+                                 pcdtext->field[CDTEXT_GENRE]);
+#endif
         }
     }

@@ -646,7 +660,7 @@ static void scan_cd (void)
     bool_t cdtext_was_available = FALSE;
     for (trackno = firsttrackno; trackno <= lasttrackno; trackno++)
     {
-        cdtext_t *pcdtext = NULL;
+#if LIBCDIO_VERSION_NUM < 90
         if (aud_get_bool ("CDDA", "use_cdtext"))
         {
             AUDDBG ("getting cd-text information for track %d\n", trackno);
@@ -657,16 +671,20 @@ static void scan_cd (void)
                 pcdtext = NULL;
             }
         }
+#endif

         if (pcdtext != NULL)
         {
             cdaudio_set_strinfo (&trackinfo[trackno],
-                                 pcdtext->field[CDTEXT_PERFORMER] ? pcdtext->
-                                 field[CDTEXT_PERFORMER] : "",
-                                 pcdtext->field[CDTEXT_TITLE] ? pcdtext->
-                                 field[CDTEXT_TITLE] : "",
-                                 pcdtext->field[CDTEXT_GENRE] ? pcdtext->
-                                 field[CDTEXT_GENRE] : "");
+#if LIBCDIO_VERSION_NUM >= 90
+                                 cdtext_get(pcdtext, CDTEXT_FIELD_PERFORMER, trackno),
+                                 cdtext_get(pcdtext, CDTEXT_FIELD_TITLE, trackno),
+                                 cdtext_get(pcdtext, CDTEXT_FIELD_GENRE, trackno));
+#else
+                                 pcdtext->field[CDTEXT_PERFORMER],
+                                 pcdtext->field[CDTEXT_TITLE],
+                                 pcdtext->field[CDTEXT_GENRE]);
+#endif
             cdtext_was_available = TRUE;
         }
         else