changeset 5032:3aabdadf9d5f libavformat

Add a VorbisComment metadata conversion table and use it in the FLAC and Ogg demuxers.
author jbr
date Sat, 13 Jun 2009 22:45:58 +0000
parents 1b5282d4863f
children 548456902656
files flacdec.c oggdec.c oggdec.h oggparsevorbis.c
diffstat 4 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flacdec.c	Sat Jun 13 22:29:38 2009 +0000
+++ b/flacdec.c	Sat Jun 13 22:45:58 2009 +0000
@@ -146,4 +146,5 @@
     .flags= AVFMT_GENERIC_INDEX,
     .extensions = "flac",
     .value = CODEC_ID_FLAC,
+    .metadata_conv = ff_vorbiscomment_metadata_conv,
 };
--- a/oggdec.c	Sat Jun 13 22:29:38 2009 +0000
+++ b/oggdec.c	Sat Jun 13 22:45:58 2009 +0000
@@ -583,4 +583,5 @@
     NULL,
     ogg_read_timestamp,
     .extensions = "ogg",
+    .metadata_conv = ff_vorbiscomment_metadata_conv,
 };
--- a/oggdec.h	Sat Jun 13 22:29:38 2009 +0000
+++ b/oggdec.h	Sat Jun 13 22:45:58 2009 +0000
@@ -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_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 */
--- a/oggparsevorbis.c	Sat Jun 13 22:29:38 2009 +0000
+++ b/oggparsevorbis.c	Sat Jun 13 22:45:58 2009 +0000
@@ -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)
 {