wok-next view gst0-plugins-ugly/stuff/patches/cdio-cd-text-api.patch @ rev 21257
encfs: use cmake
author | Hans-G?nter Theisgen |
---|---|
date | Fri Dec 06 13:47:57 2019 +0100 (2019-12-06) |
parents | |
children |
line source
1 From 649bd92cd2600719862ad5189899212409dd0a67 Mon Sep 17 00:00:00 2001
2 From: Leon Merten Lohse <leon@green-side.de>
3 Date: Thu, 03 May 2012 22:50:30 +0000
4 Subject: cdio: compensate for libcdio's recent cd-text api changes
6 https://bugzilla.gnome.org/show_bug.cgi?id=675112
8 Conflicts:
10 ext/cdio/gstcdiocddasrc.c
11 ---
12 diff --git a/ext/cdio/gstcdio.c b/ext/cdio/gstcdio.c
13 index 2f58d18..483ebf5 100644
14 --- a/ext/cdio/gstcdio.c
15 +++ b/ext/cdio/gstcdio.c
16 @@ -30,12 +30,16 @@
17 GST_DEBUG_CATEGORY (gst_cdio_debug);
19 void
20 -gst_cdio_add_cdtext_field (GstObject * src, cdtext_t * cdtext,
21 +gst_cdio_add_cdtext_field (GstObject * src, cdtext_t * cdtext, track_t track,
22 cdtext_field_t field, const gchar * gst_tag, GstTagList ** p_tags)
23 {
24 const gchar *txt;
26 +#if LIBCDIO_VERSION_NUM > 83
27 + txt = cdtext_get_const (cdtext, field, track);
28 +#else
29 txt = cdtext_get_const (field, cdtext);
30 +#endif
31 if (txt == NULL || *txt == '\0') {
32 GST_DEBUG_OBJECT (src, "empty CD-TEXT field %u (%s)", field, gst_tag);
33 return;
34 @@ -57,6 +61,12 @@ gst_cdio_add_cdtext_field (GstObject * src, cdtext_t * cdtext,
35 }
37 GstTagList *
38 +#if LIBCDIO_VERSION_NUM > 83
39 +gst_cdio_get_cdtext (GstObject * src, cdtext_t * t, track_t track)
40 +{
41 + GstTagList *tags = NULL;
42 +
43 +#else
44 gst_cdio_get_cdtext (GstObject * src, CdIo * cdio, track_t track)
45 {
46 GstTagList *tags = NULL;
47 @@ -67,14 +77,22 @@ gst_cdio_get_cdtext (GstObject * src, CdIo * cdio, track_t track)
48 GST_DEBUG_OBJECT (src, "no CD-TEXT for track %u", track);
49 return NULL;
50 }
51 +#endif
53 - gst_cdio_add_cdtext_field (src, t, CDTEXT_PERFORMER, GST_TAG_ARTIST, &tags);
54 - gst_cdio_add_cdtext_field (src, t, CDTEXT_TITLE, GST_TAG_TITLE, &tags);
55 + gst_cdio_add_cdtext_field (src, t, track, CDTEXT_FIELD_PERFORMER,
56 + GST_TAG_ARTIST, &tags);
57 + gst_cdio_add_cdtext_field (src, t, track, CDTEXT_FIELD_TITLE, GST_TAG_TITLE,
58 + &tags);
60 return tags;
61 }
63 void
64 +#if LIBCDIO_VERSION_NUM > 83
65 +gst_cdio_add_cdtext_album_tags (GstObject * src, cdtext_t * t,
66 + GstTagList * tags)
67 +{
68 +#else
69 gst_cdio_add_cdtext_album_tags (GstObject * src, CdIo * cdio, GstTagList * tags)
70 {
71 cdtext_t *t;
72 @@ -84,11 +102,14 @@ gst_cdio_add_cdtext_album_tags (GstObject * src, CdIo * cdio, GstTagList * tags)
73 GST_DEBUG_OBJECT (src, "no CD-TEXT for album");
74 return;
75 }
76 +#endif
78 - /* FIXME: map CDTEXT_PERFORMER to GST_TAG_ALBUM_ARTIST once we have that */
79 - gst_cdio_add_cdtext_field (src, t, CDTEXT_TITLE, GST_TAG_ALBUM, &tags);
80 - gst_cdio_add_cdtext_field (src, t, CDTEXT_GENRE, GST_TAG_GENRE, &tags);
81 -
82 + gst_cdio_add_cdtext_field (src, t, 0, CDTEXT_FIELD_PERFORMER,
83 + GST_TAG_ALBUM_ARTIST, &tags);
84 + gst_cdio_add_cdtext_field (src, t, 0, CDTEXT_FIELD_TITLE, GST_TAG_ALBUM,
85 + &tags);
86 + gst_cdio_add_cdtext_field (src, t, 0, CDTEXT_FIELD_GENRE, GST_TAG_GENRE,
87 + &tags);
88 GST_DEBUG ("CD-TEXT album tags: %" GST_PTR_FORMAT, tags);
89 }
91 diff --git a/ext/cdio/gstcdio.h b/ext/cdio/gstcdio.h
92 index ef31ed0..c6da580 100644
93 --- a/ext/cdio/gstcdio.h
94 +++ b/ext/cdio/gstcdio.h
95 @@ -24,22 +24,38 @@
96 #include <gst/gst.h>
97 #include <cdio/cdio.h>
98 #include <cdio/cdtext.h>
99 +#include <cdio/version.h>
100 +
101 +#if LIBCDIO_VERSION_NUM <= 83
102 + #define CDTEXT_FIELD_PERFORMER CDTEXT_PERFORMER
103 + #define CDTEXT_FIELD_GENRE CDTEXT_GENRE
104 + #define CDTEXT_FIELD_TITLE CDTEXT_TITLE
105 +#endif
107 GST_DEBUG_CATEGORY_EXTERN (gst_cdio_debug);
108 #define GST_CAT_DEFAULT gst_cdio_debug
110 void gst_cdio_add_cdtext_field (GstObject * src,
111 cdtext_t * cdtext,
112 + track_t track,
113 cdtext_field_t field,
114 const gchar * gst_tag,
115 GstTagList ** p_tags);
117 GstTagList * gst_cdio_get_cdtext (GstObject * src,
118 +#if LIBCDIO_VERSION_NUM > 83
119 + cdtext_t * t,
120 +#else
121 CdIo * cdio,
122 +#endif
123 track_t track);
125 void gst_cdio_add_cdtext_album_tags (GstObject * src,
126 +#if LIBCDIO_VERSION_NUM > 83
127 + cdtext_t * t,
128 +#else
129 CdIo * cdio,
130 +#endif
131 GstTagList * tags);
133 #endif /* __GST_CDIO_H__ */
134 diff --git a/ext/cdio/gstcdiocddasrc.c b/ext/cdio/gstcdiocddasrc.c
135 index 615a0c8..830839e 100644
136 --- a/ext/cdio/gstcdiocddasrc.c
137 +++ b/ext/cdio/gstcdiocddasrc.c
138 @@ -206,6 +206,9 @@ gst_cdio_cdda_src_open (GstAudioCdSrc * audiocdsrc, const gchar * device)
139 GstCdioCddaSrc *src;
140 discmode_t discmode;
141 gint first_track, num_tracks, i;
142 +#if LIBCDIO_VERSION_NUM > 83
143 + cdtext_t *cdtext;
144 +#endif
146 src = GST_CDIO_CDDA_SRC (audiocdsrc);
148 @@ -232,8 +235,18 @@ gst_cdio_cdda_src_open (GstAudioCdSrc * audiocdsrc, const gchar * device)
149 if (src->read_speed != -1)
150 cdio_set_speed (src->cdio, src->read_speed);
152 +#if LIBCDIO_VERSION_NUM > 83
153 + cdtext = cdio_get_cdtext (src->cdio);
154 +
155 + if (NULL == cdtext)
156 + GST_DEBUG_OBJECT (src, "no CD-TEXT on disc");
157 + else
158 + gst_cdio_add_cdtext_album_tags (GST_OBJECT_CAST (src), cdtext,
159 + cddabasesrc->tags);
160 +#else
161 gst_cdio_add_cdtext_album_tags (GST_OBJECT_CAST (src), src->cdio,
162 cddabasesrc->tags);
163 +#endif
165 GST_LOG_OBJECT (src, "%u tracks, first track: %d", num_tracks, first_track);
167 @@ -250,8 +263,14 @@ gst_cdio_cdda_src_open (GstAudioCdSrc * audiocdsrc, const gchar * device)
168 * the right thing here (for cddb id calculations etc. as well) */
169 track.start = cdio_get_track_lsn (src->cdio, i + first_track);
170 track.end = track.start + len_sectors - 1; /* -1? */
171 +#if LIBCDIO_VERSION_NUM > 83
172 + if (NULL != cdtext)
173 + track.tags = gst_cdio_get_cdtext (GST_OBJECT (src), cdtext,
174 + i + first_track);
175 +#else
176 track.tags = gst_cdio_get_cdtext (GST_OBJECT (src), src->cdio,
177 i + first_track);
178 +#endif
180 gst_audio_cd_src_add_track (GST_AUDIO_CD_SRC (src), &track);
181 }
182 --
183 cgit v0.9.0.2-2-gbebe