[FFmpeg-devel] [PATCH] Encode Year ID3v2 tag for mp3 files

Michael Niedermayer michaelni
Wed Nov 14 01:28:53 CET 2007


On Wed, Nov 14, 2007 at 12:11:55AM +0000, Patrice Bensoussan wrote:
>
> On 13 Nov 2007, at 23:59, Michael Niedermayer wrote:
>
>> On Tue, Nov 13, 2007 at 11:51:35PM +0000, M?ns Rullg?rd wrote:
>>> Patrice Bensoussan <patrice.bensoussan at free.fr> writes:
>>>
>>>> Hello,
>>>>
>>>> Here is a patch to encode the year information on mp3 files using
>>>> ID3v2 tag which was missing.
>>>> Patrice
>>>>
>>>> PS: resubmitting patch from the email address registered on the
>>>> mailing list, please disregard previous email, sorry about that...
>>>>
>>>>
>>>> Index: libavformat/mp3.c
>>>> ===================================================================
>>>> --- libavformat/mp3.c	(revision 11006)
>>>> +++ libavformat/mp3.c	(working copy)
>>>> @@ -582,9 +582,12 @@
>>>> {
>>>>     int totlen = 0;
>>>>     char tracktxt[10];
>>>> +    char yeartxt[10];
>>>>
>>>>     if(s->track)
>>>>         snprintf(tracktxt, sizeof(tracktxt) - 1, "%d", s->track);
>>>> +    if(s->year)
>>>> +        snprintf(yeartxt, sizeof(yeartxt) - 1, "%d", s->year);
>>>
>>> The -1 is unnecessary.
>>
>> indeed, ive missed that
>> and the other snprintfs should also be fixed
>
> Indeed, I didn't check the man on this one... I assumed the code for track 
> number was right ;-)
> Here is a new patch including the fix for both.

thats a misunderstanding, there should be 2 patches, 1 for each issue


[...]
> -        snprintf(tracktxt, sizeof(tracktxt) - 1, "%d", s->track);
> +        snprintf(tracktxt, sizeof(tracktxt), "%d", s->track);
> +    if(s->year)
> +        snprintf(yeartxt, sizeof(yeartxt), "%d", s->year);

these could be vertically aligned like:

        snprintf(tracktxt, sizeof(tracktxt), "%d", s->track);
    if(s->year)
        snprintf( yeartxt, sizeof( yeartxt), "%d", s->year );

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

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- 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/20071114/a971fe46/attachment.pgp>



More information about the ffmpeg-devel mailing list