From d413ee75194a06f7fdb175c4ca060d562bb3083c Mon Sep 17 00:00:00 2001 From: jbr Date: Sat, 13 Jun 2009 22:45:58 +0000 Subject: [PATCH] Add a VorbisComment metadata conversion table and use it in the FLAC and Ogg demuxers. git-svn-id: file:///var/local/repositories/ffmpeg/trunk@19186 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b --- libavformat/flacdec.c | 1 + libavformat/oggdec.c | 1 + libavformat/oggdec.h | 3 +++ libavformat/oggparsevorbis.c | 15 +++++++++++++++ 4 files changed, 20 insertions(+) diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index c8432145ce..067d4fafe9 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -146,4 +146,5 @@ AVInputFormat flac_demuxer = { .flags= AVFMT_GENERIC_INDEX, .extensions = "flac", .value = CODEC_ID_FLAC, + .metadata_conv = ff_vorbiscomment_metadata_conv, }; diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 5362489f5c..5d42db765c 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -583,4 +583,5 @@ AVInputFormat ogg_demuxer = { NULL, ogg_read_timestamp, .extensions = "ogg", + .metadata_conv = ff_vorbiscomment_metadata_conv, }; diff --git a/libavformat/oggdec.h b/libavformat/oggdec.h index cbba414626..91a59742ff 100644 --- a/libavformat/oggdec.h +++ b/libavformat/oggdec.h @@ -26,6 +26,7 @@ #define AVFORMAT_OGGDEC_H #include "avformat.h" +#include "metadata.h" struct ogg_codec { const int8_t *magic; @@ -91,6 +92,8 @@ extern const struct ogg_codec ff_speex_codec; extern const struct ogg_codec ff_theora_codec; extern const struct ogg_codec ff_vorbis_codec; +extern const AVMetadataConv ff_vorbiscomment_metadata_conv[]; + int vorbis_comment(AVFormatContext *ms, uint8_t *buf, int size); #endif /* AVFORMAT_OGGDEC_H */ diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index 8eb1f4789c..5b45631ab6 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -30,6 +30,21 @@ #include "avformat.h" #include "oggdec.h" +/** + * VorbisComment metadata conversion mapping. + * from Ogg Vorbis I format specification: comment field and header specification + * http://xiph.org/vorbis/doc/v-comment.html + */ +const AVMetadataConv ff_vorbiscomment_metadata_conv[] = { + { "ARTIST" , "author" }, + { "TITLE" , "title" }, + { "ALBUM" , "album" }, + { "DATE" , "year" }, + { "TRACKNUMBER", "track" }, + { "GENRE" , "genre" }, + { 0 } +}; + int vorbis_comment(AVFormatContext * as, uint8_t *buf, int size) { -- 2.11.4.GIT