[FFmpeg-devel] [PATCH] MP3 ID3V2 year and comment tags
Stefano Sabatini
stefano.sabatini-lala
Sat Dec 15 20:13:41 CET 2007
On date Saturday 2007-12-15 18:13:43 +0100, phgiroud at free.fr encoded:
> Hello to all,
> This is my first contibution, I hope I'm not breaking any rules. I've
> implemented support for MP3 ID3V2 (for now, only reading) tags "comment" and
> "year"
> Modifications:
>
> static void id3v2_read_ttag(AVFormatContext *s, int taglen, char *dst, int
> dstlen)
> {
> char *q;
> int len;
>
> if(taglen < 1)
> return;
>
> taglen--; /* account for encoding type byte */
> dstlen--; /* Leave space for zero terminator */
> if (dst == s->comment) //We have to skip the "lang" stream
> dst = dst - 4;
> switch(get_byte(s->pb)) { /* encoding type */
>
> case 0: /* ISO-8859-1 (0 - 255 maps directly into unicode) */
> q = dst ;
> while(taglen--) {
> uint8_t tmp;
> PUT_UTF8(get_byte(s->pb), tmp, if (q - dst < dstlen - 1) *q++ =
> tmp;)
> }
> *q = '\0';
> break;
>
> case 3: /* UTF-8 */
> len = FFMIN(taglen, dstlen);
> get_buffer(s->pb, dst, len);
> dst[len] = 0;
> break;
> }
> }
>
>
> and the function id3v2_parse is modified that way:
>
> case MKBETAG('C', 'O', 'M', 'M'):
> case MKBETAG(0, 'C', 'O', 'M'):
> id3v2_read_ttag(s, tlen, s->comment, sizeof(s->comment));
> break;
> case MKBETAG('T', 'Y', 'E', 'R'):
> case MKBETAG(0, 'T', 'Y', 'E'):
> id3v2_read_ttag(s, tlen, tmp, sizeof(tmp));
> s->year = atoi(tmp);
> break;
>
> just before "case 0".
Hi, use svn diff or an equivalent command to get the modifications
contributed, then attach the diff/patch to the mail.
Specifying verbally the modifications apported is not a sane way to
post contributions.
Also please read this:
http://ffmpeg.mplayerhq.hu/general.html#SEC25
Regards.
--
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)
More information about the ffmpeg-devel
mailing list