aboutsummaryrefslogtreecommitdiffstats
path: root/src/encoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-15 18:36:29 +0100
committerMax Kellermann <max@duempel.org>2009-03-15 18:36:29 +0100
commitae1a7fc84ae81a02208fdf6cb3f02581deee94f1 (patch)
tree37ffdc1ad867df2384631f54ffae3d6af9acef2f /src/encoder
parent4bb84c05d7b701a55143af9431afd6b61eee31e2 (diff)
downloadmpd-ae1a7fc84ae81a02208fdf6cb3f02581deee94f1.tar.gz
mpd-ae1a7fc84ae81a02208fdf6cb3f02581deee94f1.tar.xz
mpd-ae1a7fc84ae81a02208fdf6cb3f02581deee94f1.zip
vorbis_encoder: added support for all MPD tag types
Copy all tags know to MPD to the vorbis_comment.
Diffstat (limited to 'src/encoder')
-rw-r--r--src/encoder/vorbis_encoder.c33
1 files changed, 4 insertions, 29 deletions
diff --git a/src/encoder/vorbis_encoder.c b/src/encoder/vorbis_encoder.c
index cbf227c22..b2b71f335 100644
--- a/src/encoder/vorbis_encoder.c
+++ b/src/encoder/vorbis_encoder.c
@@ -267,38 +267,13 @@ vorbis_encoder_flush(struct encoder *_encoder, G_GNUC_UNUSED GError **error)
}
static void
-add_tag(vorbis_comment *vc, const char *name, char *value)
-{
- if (value) {
- union {
- const char *in;
- char *out;
- } u = { .in = name };
-
- vorbis_comment_add_tag(vc, u.out, value);
- }
-}
-
-static void
copy_tag_to_vorbis_comment(vorbis_comment *vc, const struct tag *tag)
{
for (unsigned i = 0; i < tag->num_items; i++) {
- switch (tag->items[i]->type) {
- case TAG_ITEM_ARTIST:
- add_tag(vc, "ARTIST", tag->items[i]->value);
- break;
-
- case TAG_ITEM_ALBUM:
- add_tag(vc, "ALBUM", tag->items[i]->value);
- break;
-
- case TAG_ITEM_TITLE:
- add_tag(vc, "TITLE", tag->items[i]->value);
- break;
-
- default:
- break;
- }
+ struct tag_item *item = tag->items[i];
+ char *name = g_ascii_strup(tag_item_names[item->type], -1);
+ vorbis_comment_add_tag(vc, name, item->value);
+ g_free(name);
}
}