[FFmpeg-devel] [patch] ogg vorbis album/artist tag support

Måns Rullgård mans
Fri Jun 22 09:55:07 CEST 2007


Benoit Fouet <benoit.fouet at purplelabs.com> writes:

> M?ns Rullg?rd wrote:
>> "Ronald S. Bultje" <rbultje at ronald.bitfreak.net> writes:
>>
>>   
>>> Hi,
>>>
>>> $subj is a re-send of a patch that Michael OK'ed but Mans
>>> (maintainer) never commented on in december or so. Could someone
>>> please commit this?
>>>
>>> Ronald
>>>
>>> Index: ffmpeg-mpe/libavformat/oggparsevorbis.c
>>> ===================================================================
>>> --- ffmpeg-mpe.orig/libavformat/oggparsevorbis.c	2007-03-03 18:16:51.000000000 -0500
>>> +++ ffmpeg-mpe/libavformat/oggparsevorbis.c	2007-03-03 18:17:56.000000000 -0500
>>> @@ -87,7 +87,7 @@
>>>              ct[vl] = 0;
>>>  
>>>              // took from Vorbis_I_spec
>>> -            if (!strcmp (tt, "AUTHOR"))
>>> +            if (!strcmp (tt, "AUTHOR") || !strcmp (tt, "ARTIST"))
>>>                  strncpy (as->author, ct, FFMIN(sizeof (as->author), vl));
>>>              else if (!strcmp (tt, "TITLE"))
>>>                  strncpy (as->title, ct, FFMIN(sizeof (as->title), vl));
>>> @@ -97,6 +97,8 @@
>>>                  strncpy (as->comment, ct, FFMIN(sizeof (as->comment), vl));
>>>              else if (!strcmp (tt, "GENRE"))
>>>                  strncpy (as->genre, ct, FFMIN(sizeof (as->genre), vl));
>>> +            else if (!strcmp (tt, "ALBUM"))
>>> +                strncpy (as->album, ct, FFMIN(sizeof (as->album), vl));
>>>              else if (!strcmp (tt, "TRACKNUMBER"))
>>>                  as->track = atoi (ct);
>>>              //Too bored to add others for today
>>>     
>>
>> This use of strncpy() is wrong.  It might not null terminate the
>> strings properly.  Yes, the existing ones are also wrong.
>
> indeed, would it be ok to use pstrcpy instead ?

Yes.  However, pstrcpy() and its friends should be moved to libavutil
and given proper av_ names.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list