[FFmpeg-devel] [PATCH] id3v2: read TXXX frames

Michael Niedermayer michaelni
Tue Sep 29 14:21:42 CEST 2009


On Mon, Sep 28, 2009 at 03:47:26PM +0200, Anton Khirnov wrote:
> i hope this looks better.
> 
> also added a check for "TXX" frames used in id3v2.2 tags.
> 
> and i should probably mention that this patch depends on id3v2
> metadata conversion table from "mp3 muxer: write all metadata" thread
> :)
> 
> On Mon, Sep 28, 2009 at 11:38 AM, Daniel Verkamp <daniel at drv.nu> wrote:
> >
> > Surely the FFMIN is not necessary at all here due to dst[dstlen] = 0
> > just previously... if the string is shorter than dstlen - 1, then the
> > strlen() result will be used, and the only other possible case is
> > strlen(dst) == dstlen - 1, so just
> >
> > ?val = dst + strlen(dst) + 1
> >
> > should be enough.
> 
> unless i'm missing something, there's exactly dstlen bytes between
> dst[0] and dst[dstlen], so strlen(dst) == dstlen in the worst case.
> 
> Anton Khirnov

>  id3v2.c |   58 ++++++++++++++++++++--------------------------------------
>  mp3.c   |    1 +
>  2 files changed, 21 insertions(+), 38 deletions(-)
> 26136dedc2a99cb5e96d556b89109c23d2a6b252  0001-id3v2-Export-all-text-information-frames.patch
> From 0c18942fb23c9443293a517a192e895f470cdb79 Mon Sep 17 00:00:00 2001
> From: Anton Khirnov <wyskas at gmail.com>
> Date: Thu, 24 Sep 2009 20:41:53 +0200
> Subject: [PATCH] id3v2: Export all text information frames with correct names.
[...]
> @@ -134,19 +135,26 @@ static void read_ttag(AVFormatContext *s, int taglen, const char *key)
>          av_log(s, AV_LOG_WARNING, "Unknown encoding in tag %s\n.", key);
>      }
>  
> -    if (!strcmp(key, "genre")
> +    if (!(strcmp(key, "TCON") && strcmp(key, "TCO"))
>          && (sscanf(dst, "(%d)", &genre) == 1 || sscanf(dst, "%d", &genre) == 1)
>          && genre <= ID3v1_GENRE_MAX)
> -        av_strlcpy(dst, ff_id3v1_genre_str[genre], sizeof(dst));
> +        val = ff_id3v1_genre_str[genre];
> +    else if (!(strcmp(key, "TXXX") && strcmp(key, "TXX"))) { /*dst now contains two 0-terminated strings*/
> +        dst[dstlen] = 0;
> +        key = dst;

> +        val = ((val = dst + strlen(dst) + 1) <= dst + dstlen) ? val : dst + dstlen;

that is obfuscated

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- 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/065e2148/attachment.pgp>



More information about the ffmpeg-devel mailing list