From 8ec8282f38876b5b266e387cb9157ccd229d0afa Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 11 Feb 2012 16:39:03 +0100 Subject: decoder/ffmpeg: use the tag_table library --- src/decoder/ffmpeg_metadata.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/decoder') diff --git a/src/decoder/ffmpeg_metadata.c b/src/decoder/ffmpeg_metadata.c index ce943f3dd..d091afbc6 100644 --- a/src/decoder/ffmpeg_metadata.c +++ b/src/decoder/ffmpeg_metadata.c @@ -20,26 +20,22 @@ #include "config.h" #include "ffmpeg_metadata.h" #include "tag.h" +#include "tag_table.h" #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "ffmpeg" -typedef struct ffmpeg_tag_map { - enum tag_type type; - const char *name; -} ffmpeg_tag_map; - -static const ffmpeg_tag_map ffmpeg_tag_maps[] = { +static const struct tag_table ffmpeg_tags[] = { #if LIBAVFORMAT_VERSION_INT < ((52<<16)+(50<<8)) - { TAG_ARTIST, "author" }, - { TAG_DATE, "year" }, + { "author", TAG_ARTIST }, + { "year", TAG_DATE }, #endif - { TAG_ARTIST_SORT, "author-sort" }, - { TAG_ALBUM_ARTIST, "album_artist" }, - { TAG_ALBUM_ARTIST_SORT, "album_artist-sort" }, + { "author-sort", TAG_ARTIST_SORT }, + { "album_artist", TAG_ALBUM_ARTIST }, + { "album_artist-sort", TAG_ALBUM_ARTIST_SORT }, /* sentinel */ - { TAG_NUM_OF_ITEM_TYPES, NULL } + { NULL, TAG_NUM_OF_ITEM_TYPES } }; static void @@ -59,7 +55,7 @@ ffmpeg_copy_dictionary(struct tag *tag, AVDictionary *dict) ffmpeg_copy_metadata(tag, i, dict, tag_item_names[i]); - for (const struct ffmpeg_tag_map *i = ffmpeg_tag_maps; + for (const struct tag_table *i = ffmpeg_tags; i->name != NULL; ++i) ffmpeg_copy_metadata(tag, i->type, dict, i->name); } -- cgit v1.2.3