decoder/ffmpeg: use the tag_table library
This commit is contained in:
parent
43b7b98949
commit
8ec8282f38
@ -20,26 +20,22 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "ffmpeg_metadata.h"
|
#include "ffmpeg_metadata.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
#include "tag_table.h"
|
||||||
|
|
||||||
#undef G_LOG_DOMAIN
|
#undef G_LOG_DOMAIN
|
||||||
#define G_LOG_DOMAIN "ffmpeg"
|
#define G_LOG_DOMAIN "ffmpeg"
|
||||||
|
|
||||||
typedef struct ffmpeg_tag_map {
|
static const struct tag_table ffmpeg_tags[] = {
|
||||||
enum tag_type type;
|
|
||||||
const char *name;
|
|
||||||
} ffmpeg_tag_map;
|
|
||||||
|
|
||||||
static const ffmpeg_tag_map ffmpeg_tag_maps[] = {
|
|
||||||
#if LIBAVFORMAT_VERSION_INT < ((52<<16)+(50<<8))
|
#if LIBAVFORMAT_VERSION_INT < ((52<<16)+(50<<8))
|
||||||
{ TAG_ARTIST, "author" },
|
{ "author", TAG_ARTIST },
|
||||||
{ TAG_DATE, "year" },
|
{ "year", TAG_DATE },
|
||||||
#endif
|
#endif
|
||||||
{ TAG_ARTIST_SORT, "author-sort" },
|
{ "author-sort", TAG_ARTIST_SORT },
|
||||||
{ TAG_ALBUM_ARTIST, "album_artist" },
|
{ "album_artist", TAG_ALBUM_ARTIST },
|
||||||
{ TAG_ALBUM_ARTIST_SORT, "album_artist-sort" },
|
{ "album_artist-sort", TAG_ALBUM_ARTIST_SORT },
|
||||||
|
|
||||||
/* sentinel */
|
/* sentinel */
|
||||||
{ TAG_NUM_OF_ITEM_TYPES, NULL }
|
{ NULL, TAG_NUM_OF_ITEM_TYPES }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -59,7 +55,7 @@ ffmpeg_copy_dictionary(struct tag *tag, AVDictionary *dict)
|
|||||||
ffmpeg_copy_metadata(tag, i,
|
ffmpeg_copy_metadata(tag, i,
|
||||||
dict, tag_item_names[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)
|
i->name != NULL; ++i)
|
||||||
ffmpeg_copy_metadata(tag, i->type, dict, i->name);
|
ffmpeg_copy_metadata(tag, i->type, dict, i->name);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user