No issues found
Tool | Failure ID | Location | Function | Message | Data |
---|---|---|---|---|---|
clang-analyzer | no-output-found | rb-metadata-common.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None | |
clang-analyzer | no-output-found | rb-metadata-common.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None |
1 /*
2 * Copyright (C) 2003 Colin Walters <walters@verbum.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * The Rhythmbox authors hereby grant permission for non-GPL compatible
10 * GStreamer plugins to be used and distributed together with GStreamer
11 * and Rhythmbox. This permission is above and beyond the permissions granted
12 * by the GPL license by which Rhythmbox is covered. If you modify this code
13 * you may extend this exception to your version of the code, but you are not
14 * obligated to do so. If you do not wish to do so, delete this exception
15 * statement from your version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
25 *
26 */
27
28 #include <config.h>
29
30 #include "rb-metadata.h"
31 #include "rb-debug.h"
32
33 /**
34 * RBMetaDataField:
35 * @RB_METADATA_FIELD_TITLE: Title of the recording
36 * @RB_METADATA_FIELD_ARTIST: Person(s) responsible for the recording
37 * @RB_METADATA_FIELD_ALBUM: Album containing the recording
38 * @RB_METADATA_FIELD_DATE: Release date of the album
39 * @RB_METADATA_FIELD_GENRE: Genre of the recording
40 * @RB_METADATA_FIELD_COMMENT: Free form comment on the recording
41 * @RB_METADATA_FIELD_TRACK_NUMBER: Track number inside a collection
42 * @RB_METADATA_FIELD_MAX_TRACK_NUMBER: Count of tracks inside the collection
43 * @RB_METADATA_FIELD_DISC_NUMBER: Disc number inside a collection
44 * @RB_METADATA_FIELD_MAX_DISC_NUMBER: Count of discs inside the collection
45 * @RB_METADATA_FIELD_DESCRIPTION: Short text describing the recording
46 * @RB_METADATA_FIELD_VERSION: Version of the recording
47 * @RB_METADATA_FIELD_ISRC: International Standard Recording Code
48 * @RB_METADATA_FIELD_ORGANIZATION: Organization responsible for the recording
49 * @RB_METADATA_FIELD_COPYRIGHT: Copyright notice on the recording
50 * @RB_METADATA_FIELD_CONTACT: Contact information
51 * @RB_METADATA_FIELD_LICENSE: License of the recording
52 * @RB_METADATA_FIELD_PERFORMER: Person(s) performing in the recording
53 * @RB_METADATA_FIELD_DURATION: Duration of the recording
54 * @RB_METADATA_FIELD_CODEC: Codec used to store the recording
55 * @RB_METADATA_FIELD_BITRATE: Exact or average encoding bitrate in bits/s
56 * @RB_METADATA_FIELD_TRACK_GAIN: Track gain in dB for replaygain
57 * @RB_METADATA_FIELD_TRACK_PEAK: Track peak volume level
58 * @RB_METADATA_FIELD_ALBUM_GAIN: Album gain in dB for replaygain
59 * @RB_METADATA_FIELD_ALBUM_PEAK: Album peak volume level
60 * @RB_METADATA_FIELD_BPM: Beats Per Minute
61 * @RB_METADATA_FIELD_LANGUAGE_CODE: Language code (ISO-639-1)
62 * @RB_METADATA_FIELD_MUSICBRAINZ_TRACKID: MusicBrainz track ID
63 * @RB_METADATA_FIELD_MUSICBRAINZ_ARTISTID: MusicBrainz artist ID
64 * @RB_METADATA_FIELD_MUSICBRAINZ_ALBUMID: MusicBrainz album ID
65 * @RB_METADATA_FIELD_MUSICBRAINZ_ALBUMARTISTID: MusicBrainz album artist ID
66 * @RB_METADATA_FIELD_ARTIST_SORTNAME: Person(s) responsible for the recording, as used for sorting
67 * @RB_METADATA_FIELD_ALBUM_SORTNAME: Album containing the recording, as used for sorting
68 * @RB_METADATA_FIELD_ALBUM_ARTIST: The artist of the entire album
69 * @RB_METADATA_FIELD_ALBUM_ARTIST_SORTNAME: The artist of the entire album, as it should be sorted
70 * @RB_METADATA_FIELD_LAST: invalid field
71 *
72 * Metadata fields that can be read from and written to files.
73 */
74
75 /**
76 * rb_metadata_get_field_type:
77 * @field: a #RBMetaDataField
78 *
79 * Returns the #GType of the value for a metadata field.
80 *
81 * Return value: value type
82 */
83 GType
84 rb_metadata_get_field_type (RBMetaDataField field)
85 {
86 switch (field) {
87 case RB_METADATA_FIELD_TITLE:
88 case RB_METADATA_FIELD_ARTIST:
89 case RB_METADATA_FIELD_ALBUM:
90 case RB_METADATA_FIELD_GENRE:
91 case RB_METADATA_FIELD_COMMENT:
92 case RB_METADATA_FIELD_DESCRIPTION:
93 case RB_METADATA_FIELD_VERSION:
94 case RB_METADATA_FIELD_ISRC:
95 case RB_METADATA_FIELD_ORGANIZATION:
96 case RB_METADATA_FIELD_COPYRIGHT:
97 case RB_METADATA_FIELD_CONTACT:
98 case RB_METADATA_FIELD_LICENSE:
99 case RB_METADATA_FIELD_PERFORMER:
100 case RB_METADATA_FIELD_CODEC:
101 case RB_METADATA_FIELD_LANGUAGE_CODE:
102 case RB_METADATA_FIELD_MUSICBRAINZ_TRACKID:
103 case RB_METADATA_FIELD_MUSICBRAINZ_ARTISTID:
104 case RB_METADATA_FIELD_MUSICBRAINZ_ALBUMID:
105 case RB_METADATA_FIELD_MUSICBRAINZ_ALBUMARTISTID:
106 case RB_METADATA_FIELD_ARTIST_SORTNAME:
107 case RB_METADATA_FIELD_ALBUM_SORTNAME:
108 case RB_METADATA_FIELD_ALBUM_ARTIST:
109 case RB_METADATA_FIELD_ALBUM_ARTIST_SORTNAME:
110 return G_TYPE_STRING;
111
112 case RB_METADATA_FIELD_DATE:
113 case RB_METADATA_FIELD_TRACK_NUMBER:
114 case RB_METADATA_FIELD_MAX_TRACK_NUMBER:
115 case RB_METADATA_FIELD_DISC_NUMBER:
116 case RB_METADATA_FIELD_MAX_DISC_NUMBER:
117 case RB_METADATA_FIELD_DURATION:
118 case RB_METADATA_FIELD_BITRATE:
119 return G_TYPE_ULONG;
120
121 case RB_METADATA_FIELD_TRACK_GAIN:
122 case RB_METADATA_FIELD_TRACK_PEAK:
123 case RB_METADATA_FIELD_ALBUM_GAIN:
124 case RB_METADATA_FIELD_ALBUM_PEAK:
125 case RB_METADATA_FIELD_BPM:
126 return G_TYPE_DOUBLE;
127
128 default:
129 g_assert_not_reached ();
130 }
131 }
132
133 /**
134 * rb_metadata_get_field_name:
135 * @field: a #RBMetaDataField
136 *
137 * Returns the name of a metadata field.
138 *
139 * Return value: field name
140 */
141 const char *
142 rb_metadata_get_field_name (RBMetaDataField field)
143 {
144 GEnumClass *klass;
145
146 klass = g_type_class_ref (RB_TYPE_METADATA_FIELD);
147 g_assert (field >= 0 && field < klass->n_values);
148 return klass->values[field].value_nick;
149 }
150
151 GQuark
152 rb_metadata_error_quark (void)
153 {
154 static GQuark quark = 0;
155 if (!quark)
156 quark = g_quark_from_static_string ("rb_metadata_error");
157
158 return quark;
159 }
160
161
162 #define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
163
164
165 GType
166 rb_metadata_field_get_type (void)
167 {
168 static GType etype = 0;
169
170 if (etype == 0) {
171 static const GEnumValue values[] =
172 {
173 /* Note: field names are the GStreamer tag names.
174 * We could have just used the GST_TAG_X defines, but that
175 * would suck if we ever got a non-GStreamer metadata backend.
176 */
177 ENUM_ENTRY (RB_METADATA_FIELD_TITLE, "title"),
178 ENUM_ENTRY (RB_METADATA_FIELD_ARTIST, "artist"),
179 ENUM_ENTRY (RB_METADATA_FIELD_ALBUM, "album"),
180 ENUM_ENTRY (RB_METADATA_FIELD_DATE, "date"),
181 ENUM_ENTRY (RB_METADATA_FIELD_GENRE, "genre"),
182 ENUM_ENTRY (RB_METADATA_FIELD_COMMENT, "comment"),
183 ENUM_ENTRY (RB_METADATA_FIELD_TRACK_NUMBER, "track-number"),
184 ENUM_ENTRY (RB_METADATA_FIELD_MAX_TRACK_NUMBER, "track-count"),
185 ENUM_ENTRY (RB_METADATA_FIELD_DISC_NUMBER, "album-disc-number"),
186 ENUM_ENTRY (RB_METADATA_FIELD_MAX_DISC_NUMBER, "album-disc-count"),
187 ENUM_ENTRY (RB_METADATA_FIELD_DESCRIPTION, "description"),
188 ENUM_ENTRY (RB_METADATA_FIELD_VERSION, "version"),
189 ENUM_ENTRY (RB_METADATA_FIELD_ISRC, "isrc"),
190 ENUM_ENTRY (RB_METADATA_FIELD_ORGANIZATION, "organization"),
191 ENUM_ENTRY (RB_METADATA_FIELD_COPYRIGHT, "copyright"),
192 ENUM_ENTRY (RB_METADATA_FIELD_CONTACT, "contact"),
193 ENUM_ENTRY (RB_METADATA_FIELD_LICENSE, "license"),
194 ENUM_ENTRY (RB_METADATA_FIELD_PERFORMER, "performer"),
195 ENUM_ENTRY (RB_METADATA_FIELD_DURATION, "duration"),
196 ENUM_ENTRY (RB_METADATA_FIELD_CODEC, "codec"),
197 ENUM_ENTRY (RB_METADATA_FIELD_BITRATE, "bitrate"),
198 ENUM_ENTRY (RB_METADATA_FIELD_TRACK_GAIN, "replaygain-track-gain"),
199 ENUM_ENTRY (RB_METADATA_FIELD_TRACK_PEAK, "replaygain-track-peak"),
200 ENUM_ENTRY (RB_METADATA_FIELD_ALBUM_GAIN, "replaygain-album-gain"),
201 ENUM_ENTRY (RB_METADATA_FIELD_ALBUM_PEAK, "replaygain-album-peak"),
202 ENUM_ENTRY (RB_METADATA_FIELD_BPM, "beats-per-minute"),
203 ENUM_ENTRY (RB_METADATA_FIELD_LANGUAGE_CODE, "language-code"),
204 ENUM_ENTRY (RB_METADATA_FIELD_MUSICBRAINZ_TRACKID, "musicbrainz-trackid"),
205 ENUM_ENTRY (RB_METADATA_FIELD_MUSICBRAINZ_ARTISTID, "musicbrainz-artistid"),
206 ENUM_ENTRY (RB_METADATA_FIELD_MUSICBRAINZ_ALBUMID, "musicbrainz-albumid"),
207 ENUM_ENTRY (RB_METADATA_FIELD_MUSICBRAINZ_ALBUMARTISTID, "musicbrainz-albumartistid"),
208 ENUM_ENTRY (RB_METADATA_FIELD_ARTIST_SORTNAME, "musicbrainz-sortname"),
209 ENUM_ENTRY (RB_METADATA_FIELD_ALBUM_SORTNAME, "album-sortname"),
210 ENUM_ENTRY (RB_METADATA_FIELD_ALBUM_ARTIST, "album-artist"),
211 ENUM_ENTRY (RB_METADATA_FIELD_ALBUM_ARTIST_SORTNAME, "album-artist-sortname"),
212 { 0, 0, 0 }
213 };
214 etype = g_enum_register_static ("RBMetadataFieldType", values);
215 }
216
217 return etype;
218 }
219
220 GType
221 rb_metadata_error_get_type (void)
222 {
223 static GType etype = 0;
224
225 if (etype == 0) {
226 static const GEnumValue values[] =
227 {
228 ENUM_ENTRY(RB_METADATA_ERROR_IO, "io-error"),
229 ENUM_ENTRY(RB_METADATA_ERROR_MISSING_PLUGIN, "missing-plugins"),
230 ENUM_ENTRY(RB_METADATA_ERROR_UNRECOGNIZED, "identify-failed"),
231 ENUM_ENTRY(RB_METADATA_ERROR_UNSUPPORTED, "unsupported-filetype"),
232 ENUM_ENTRY(RB_METADATA_ERROR_GENERAL, "general-error"),
233 ENUM_ENTRY(RB_METADATA_ERROR_INTERNAL, "internal-error"),
234 ENUM_ENTRY(RB_METADATA_ERROR_EMPTY_FILE, "empty-file"),
235 { 0, 0, 0 }
236 };
237 etype = g_enum_register_static ("RBMetadataErrorType", values);
238 }
239
240 return etype;
241 }