Mercurial > libavformat.hg
diff id3v2.c @ 5045:9ed3c88ed9ba libavformat
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
patch by Patrick Dehne, patrick mysonicweb com
author | diego |
---|---|
date | Fri, 19 Jun 2009 14:03:35 +0000 |
parents | 2d29b49bae3e |
children | c54f27786f9b |
line wrap: on
line diff
--- a/id3v2.c Fri Jun 19 13:26:10 2009 +0000 +++ b/id3v2.c Fri Jun 19 14:03:35 2009 +0000 @@ -48,6 +48,26 @@ 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;