[FFmpeg-devel] [PATCH] mp3 muxer: write all metadata
Michael Niedermayer
michaelni
Tue Sep 29 01:29:35 CEST 2009
On Sat, Sep 26, 2009 at 11:24:12AM +0200, Anton Khirnov wrote:
> On Fri, Sep 25, 2009 at 03:18:23PM +0200, Michael Niedermayer wrote:
> > is either of you aware of AVMetadataConv ?
> > what can we do to make it more clear how the metadata api works?
> > that is demuxers export the metadata that is stored in the file,
> > muxers store it as it is provided to the muxer. There are some
> > specific rules how trees and multiple tags are exportet but i dont
> > see why one would rename all tag keys explixitly or reformat values in
> > the demuxer
> > That is what AVMetadataConv is for ...
> >
> two new patches attached, i hope i did this right now.
>
> Anton Khirnov
> id3v2.c | 19 +++++++++++++++++++
> id3v2.h | 3 +++
> mp3.c | 1 +
> 3 files changed, 23 insertions(+)
> 76aa7e7e0577c68a065e0a49499187a3c09e50d6 0001-add-id3v2-metadata-conversion-table.patch
> From 38e4372cad8a68e035f44600413a6de7e37e052e Mon Sep 17 00:00:00 2001
> From: Anton Khirnov <wyskas at gmail.com>
> Date: Fri, 25 Sep 2009 21:18:12 +0200
> Subject: [PATCH 1/2] add id3v2 metadata conversion table and use it in mp3 muxer
ok
[...]
> id3v2.c | 9 +++++++
> id3v2.h | 6 ++++
> mp3.c | 79 ++++++++++++++++++++++++++++++++++++----------------------------
> 3 files changed, 60 insertions(+), 34 deletions(-)
> a9e6d33f910633686f91101f34cb4ae4082eb2c6 0002-mp3-muxer-write-all-metadata.patch
> From 86356d63f09bc5513360471a9b986567c4bee9b2 Mon Sep 17 00:00:00 2001
> From: Anton Khirnov <wyskas at gmail.com>
> Date: Fri, 25 Sep 2009 09:04:42 +0200
> Subject: [PATCH 2/2] mp3 muxer: write all metadata
>
> ---
> libavformat/id3v2.c | 9 ++++++
> libavformat/id3v2.h | 6 ++++
> libavformat/mp3.c | 79 +++++++++++++++++++++++++++++----------------------
> 3 files changed, 60 insertions(+), 34 deletions(-)
>
> diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
> index 8f8f277..e129e81 100644
> --- a/libavformat/id3v2.c
> +++ b/libavformat/id3v2.c
> @@ -273,3 +273,12 @@ const AVMetadataConv ff_id3v2_metadata_conv[] = {
> { "TSOT", "titlesort"},
> { 0 }
> };
> +
> +const char * const ff_id3v2_tags[] = {
> + "TALB", "TBPM", "TCOM", "TCON", "TCOP", "TDEN", "TDLY", "TDOR", "TDRC",
> + "TDRL", "TDTG", "TENC", "TEXT", "TFLT", "TIPL", "TIT1", "TIT2", "TIT3",
> + "TKEY", "TLAN", "TLEN", "TMCL", "TMED", "TMOO", "TOAL", "TOFN", "TOLY",
> + "TOPE", "TOWN", "TPE1", "TPE2", "TPE3", "TPE4", "TPOS", "TPRO", "TPUB",
> + "TRCK", "TRSN", "TRSO", "TSOA", "TSOP", "TSOT", "TSRC", "TSSE", "TSST",
> + NULL
> +};
an array of char[4] would be smaller than an array of pointers to strings
[...]
> put_be32(s->pb, MKBETAG('I', 'D', '3', 0x04)); /* ID3v2.4 */
> put_byte(s->pb, 0);
> put_byte(s->pb, 0); /* flags */
>
> + /* reserve space for size */
> + size_pos = url_ftell(s->pb);
> + put_be32(s->pb, 0);
> +
> + while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) {
> + uint32_t tag = 0;
> +
> + if (t->key[0] == 'T' && strcmp(t->key, "TSSE")) {
> + int i;
> + for (i = 0; ff_id3v2_tags[i]; i++)
> + if (!strcmp(t->key, ff_id3v2_tags[i])) {
> + tag = MKBETAG(t->key[0], t->key[1], t->key[2], t->key[3]);
AV_RB32()
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090929/7f2dd42a/attachment.pgp>
More information about the ffmpeg-devel
mailing list