aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/id3v2.c
diff options
context:
space:
mode:
authorMichael Karcher <ffmpeg@mkarcher.dialup.fu-berlin.de>2010-06-11 13:44:57 +0000
committerCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>2010-06-11 13:44:57 +0000
commit3a1350e8d9955a5eb9ec90f9b3e27ae63c3fb0bb (patch)
tree0c5f4ce531628c132328144c7d0e1ed76b642393 /libavformat/id3v2.c
parent1c1697117dbd2923d5876c10a1ebaeec233338b5 (diff)
downloadffmpeg-3a1350e8d9955a5eb9ec90f9b3e27ae63c3fb0bb.tar.gz
Generalize ID3v2 functions to support ID3v2-like ID headers with a
different magic in the header (mainly targeted to Sony's .oma/.aa3 format). Patch by Michael Karcher, ffmpeg A mkarcher dialup fu-berlin de Originally committed as revision 23583 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/id3v2.c')
-rw-r--r--libavformat/id3v2.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 6fa11db6c0..7e4a16fae8 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -22,12 +22,13 @@
#include "id3v2.h"
#include "id3v1.h"
#include "libavutil/avstring.h"
+#include "libavutil/intreadwrite.h"
-int ff_id3v2_match(const uint8_t *buf)
+int ff_id3v2_match(const uint8_t *buf, const char * magic)
{
- return buf[0] == 'I' &&
- buf[1] == 'D' &&
- buf[2] == '3' &&
+ return buf[0] == magic[0] &&
+ buf[1] == magic[1] &&
+ buf[2] == magic[2] &&
buf[3] != 0xff &&
buf[4] != 0xff &&
(buf[6] & 0x80) == 0 &&
@@ -48,7 +49,7 @@ int ff_id3v2_tag_len(const uint8_t * buf)
return len;
}
-void ff_id3v2_read(AVFormatContext *s)
+void ff_id3v2_read(AVFormatContext *s, const char *magic)
{
int len, ret;
uint8_t buf[ID3v2_HEADER_SIZE];
@@ -56,7 +57,7 @@ void ff_id3v2_read(AVFormatContext *s)
ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
if (ret != ID3v2_HEADER_SIZE)
return;
- if (ff_id3v2_match(buf)) {
+ if (ff_id3v2_match(buf, magic)) {
/* parse ID3v2 header */
len = ((buf[6] & 0x7f) << 21) |
((buf[7] & 0x7f) << 14) |