2006-10-27 James Livingston <doclivingston@gmail.com>
[rhythmbox.git] / metadata / rb-metadata-common.c
blobd61ed5151d5baeb3215b0e321947eb679b55c3b3
1 /*
2 * arch-tag: Implementation of common metadata functions
4 * Copyright (C) 2003 Colin Walters <walters@verbum.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include <config.h>
24 #include "rb-metadata.h"
25 #include "rb-debug.h"
27 struct RBMetaDataFieldInfo {
28 GType type;
29 const char *name;
33 * Note: the field names are the same as those used by GStreamer. We
34 * could have just use the GST_TAG_X defines, but that would suck if we
35 * ever got a non-GStreamer metadata backend.
37 static struct RBMetaDataFieldInfo field_info[RB_METADATA_FIELD_LAST] = {
38 /* RB_METADATA_FIELD_TITLE */ { G_TYPE_STRING, "title" },
39 /* RB_METADATA_FIELD_ARTIST */ { G_TYPE_STRING, "artist" },
40 /* RB_METADATA_FIELD_ALBUM */ { G_TYPE_STRING, "album" },
41 /* RB_METADATA_FIELD_DATE */ { G_TYPE_ULONG, "date" },
42 /* RB_METADATA_FIELD_GENRE */ { G_TYPE_STRING, "genre" },
43 /* RB_METADATA_FIELD_COMMENT */ { G_TYPE_STRING, "comment" },
44 /* RB_METADATA_FIELD_TRACK_NUMBER */ { G_TYPE_ULONG, "track-number" },
45 /* RB_METADATA_FIELD_MAX_TRACK_NUMBER */ { G_TYPE_ULONG, "track-count" },
46 /* RB_METADATA_FIELD_DISC_NUMBER */ { G_TYPE_ULONG, "album-disc-number" },
47 /* RB_METADATA_FIELD_MAX_DISC_NUMBER */ { G_TYPE_ULONG, "album-disc-count" },
48 /* RB_METADATA_FIELD_DESCRIPTION */ { G_TYPE_STRING, "description" },
49 /* RB_METADATA_FIELD_VERSION */ { G_TYPE_STRING, "version" },
50 /* RB_METADATA_FIELD_IRSC */ { G_TYPE_STRING, "isrc" },
51 /* RB_METADATA_FIELD_ORGANIZATION */ { G_TYPE_STRING, "organization" },
52 /* RB_METADATA_FIELD_COPYRIGHT */ { G_TYPE_STRING, "copyright" },
53 /* RB_METADATA_FIELD_CONTACT */ { G_TYPE_STRING, "contact" },
54 /* RB_METADATA_FIELD_LICENSE */ { G_TYPE_STRING, "license" },
55 /* RB_METADATA_FIELD_PERFORMER */ { G_TYPE_STRING, "performer" },
56 /* RB_METADATA_FIELD_DURATION */ { G_TYPE_ULONG, "duration" },
57 /* RB_METADATA_FIELD_CODEC */ { G_TYPE_STRING, "codec" },
58 /* RB_METADATA_FIELD_BITRATE */ { G_TYPE_ULONG, "bitrate" },
59 /* RB_METADATA_FIELD_TRACK_GAIN */ { G_TYPE_DOUBLE, "replaygain-track-gain" },
60 /* RB_METADATA_FIELD_TRACK_PEAK */ { G_TYPE_DOUBLE, "replaygain-track-peak" },
61 /* RB_METADATA_FIELD_ALBUM_GAIN */ { G_TYPE_DOUBLE, "replaygain-album-gain" },
62 /* RB_METADATA_FIELD_ALBUM_PEAK */ { G_TYPE_DOUBLE, "replaygain-album-peak" },
63 /* RB_METADATA_FIELD_LANGUAGE_CODE */ { G_TYPE_STRING, "language-code" },
64 /* RB_METADATA_FIELD_MUSICBRAINZ-TRACKID */ { G_TYPE_STRING, "musicbrainz-trackid" }
67 GType
68 rb_metadata_get_field_type (RBMetaDataField field)
70 g_assert (field >= 0 && field < RB_METADATA_FIELD_LAST);
71 return field_info[field].type;
74 const char *
75 rb_metadata_get_field_name (RBMetaDataField field)
77 g_assert (field >= 0 && field < RB_METADATA_FIELD_LAST);
78 return field_info[field].name;
81 GQuark
82 rb_metadata_error_quark (void)
84 static GQuark quark = 0;
85 if (!quark)
86 quark = g_quark_from_static_string ("rb_metadata_error");
88 return quark;