vorbis_encoder: added support for all MPD tag types

Copy all tags know to MPD to the vorbis_comment.
This commit is contained in:
Max Kellermann
2009-03-15 18:36:29 +01:00
parent 4bb84c05d7
commit ae1a7fc84a
2 changed files with 6 additions and 29 deletions

View File

@@ -266,39 +266,14 @@ vorbis_encoder_flush(struct encoder *_encoder, G_GNUC_UNUSED GError **error)
return true;
}
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);
}
}