Mercurial > libavformat.hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
5044:2ef633b32f7a | 5045:9ed3c88ed9ba |
---|---|
46 if (buf[5] & 0x10) | 46 if (buf[5] & 0x10) |
47 len += ID3v2_HEADER_SIZE; | 47 len += ID3v2_HEADER_SIZE; |
48 return len; | 48 return len; |
49 } | 49 } |
50 | 50 |
51 void ff_id3v2_read(AVFormatContext *s) | |
52 { | |
53 int len, ret; | |
54 uint8_t buf[ID3v2_HEADER_SIZE]; | |
55 | |
56 ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE); | |
57 if (ret != ID3v2_HEADER_SIZE) | |
58 return; | |
59 if (ff_id3v2_match(buf)) { | |
60 /* parse ID3v2 header */ | |
61 len = ((buf[6] & 0x7f) << 21) | | |
62 ((buf[7] & 0x7f) << 14) | | |
63 ((buf[8] & 0x7f) << 7) | | |
64 (buf[9] & 0x7f); | |
65 ff_id3v2_parse(s, len, buf[3], buf[5]); | |
66 } else { | |
67 url_fseek(s->pb, 0, SEEK_SET); | |
68 } | |
69 } | |
70 | |
51 static unsigned int get_size(ByteIOContext *s, int len) | 71 static unsigned int get_size(ByteIOContext *s, int len) |
52 { | 72 { |
53 int v = 0; | 73 int v = 0; |
54 while (len--) | 74 while (len--) |
55 v = (v << 7) + (get_byte(s) & 0x7F); | 75 v = (v << 7) + (get_byte(s) & 0x7F); |