summaryrefslogtreecommitdiff
path: root/libavformat/id3v2.c
diff options
context:
space:
mode:
authorPatrick Dehne <patrick@mysonicweb.com>2009-06-19 14:03:35 +0000
committerDiego Biurrun <diego@biurrun.de>2009-06-19 14:03:35 +0000
commit50fcd5be36d04a7674f5eef267ef71117efa3796 (patch)
treef16c5eb8a4f77edbb2036d35c160b30dd69d9aa0 /libavformat/id3v2.c
parent2a04d6e7726d5397913544180196c8c06784aea6 (diff)
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
patch by Patrick Dehne, patrick mysonicweb com Originally committed as revision 19224 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/id3v2.c')
-rw-r--r--libavformat/id3v2.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 6a3ecb9e75..9bf9f1aea6 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -48,6 +48,26 @@ int ff_id3v2_tag_len(const uint8_t * buf)
return len;
}
+void ff_id3v2_read(AVFormatContext *s)
+{
+ int len, ret;
+ uint8_t buf[ID3v2_HEADER_SIZE];
+
+ ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
+ if (ret != ID3v2_HEADER_SIZE)
+ return;
+ if (ff_id3v2_match(buf)) {
+ /* parse ID3v2 header */
+ len = ((buf[6] & 0x7f) << 21) |
+ ((buf[7] & 0x7f) << 14) |
+ ((buf[8] & 0x7f) << 7) |
+ (buf[9] & 0x7f);
+ ff_id3v2_parse(s, len, buf[3], buf[5]);
+ } else {
+ url_fseek(s->pb, 0, SEEK_SET);
+ }
+}
+
static unsigned int get_size(ByteIOContext *s, int len)
{
int v = 0;