[FFmpeg-devel] [PATCH] Shorten ID3v2 tags
James Darnley
james.darnley
Sat Jul 3 01:02:50 CEST 2010
Currently an unnecessary NULL byte is written at the end of each ID3v2
tag. The docs linked to here (
http://www.id3.org/Developer_Information ) do not say that the NULL
byte is necessary. No other software writes this byte (lame.exe,
Winamp, mp3tag).
-------------- next part --------------
>From 8b3df22c37362d4e1e3e6f5702cb61500fead975 Mon Sep 17 00:00:00 2001
From: James Darnley <james.darnley at gmail.com>
Date: Sat, 3 Jul 2010 00:27:14 +0200
Subject: [PATCH 4/5] Shorten ID3v2 tags
The strings do not need to end with a NULL byte
---
libavformat/mp3.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavformat/mp3.c b/libavformat/mp3.c
index acb77dc..454ed22 100644
--- a/libavformat/mp3.c
+++ b/libavformat/mp3.c
@@ -321,8 +321,8 @@ static int mp3_write_header(struct AVFormatContext *s)
if (AV_RB32(t->key) == AV_RB32(ff_id3v2_tags[i])) {
int len = strlen(t->value);
tag = AV_RB32(t->key);
- totlen += len + ID3v2_HEADER_SIZE + 2;
- id3v2_put_ttag(s, t->value, len + 1, tag);
+ totlen += len + ID3v2_HEADER_SIZE + 1;
+ id3v2_put_ttag(s, t->value, len, tag);
break;
}
}
@@ -335,8 +335,8 @@ static int mp3_write_header(struct AVFormatContext *s)
tag = MKBETAG('T', 'X', 'X', 'X');
strcpy(buf, t->key);
strcpy(buf + len + 1, t->value);
- id3v2_put_ttag(s, buf, len + len1 + 2, tag);
- totlen += len + len1 + ID3v2_HEADER_SIZE + 3;
+ id3v2_put_ttag(s, buf, len + len1 + 1, tag);
+ totlen += len + len1 + ID3v2_HEADER_SIZE + 2;
av_free(buf);
}
}
--
1.7.0.4
More information about the ffmpeg-devel
mailing list