Revision b7effd4e libavformat/id3v2.c

View differences:

libavformat/id3v2.c
55 55
{
56 56
    int v = 0;
57 57
    while (len--)
58
        v = (v << 7) + (get_byte(s) & 0x7F);
58
        v = (v << 7) + (avio_r8(s) & 0x7F);
59 59
    return v;
60 60
}
61 61

  
......
65 65
    const char *val = NULL;
66 66
    int len, dstlen = sizeof(dst) - 1;
67 67
    unsigned genre;
68
    unsigned int (*get)(AVIOContext*) = get_be16;
68
    unsigned int (*get)(AVIOContext*) = avio_rb16;
69 69

  
70 70
    dst[0] = 0;
71 71
    if (taglen < 1)
......
73 73

  
74 74
    taglen--; /* account for encoding type byte */
75 75

  
76
    switch (get_byte(pb)) { /* encoding type */
76
    switch (avio_r8(pb)) { /* encoding type */
77 77

  
78 78
    case ID3v2_ENCODING_ISO8859:
79 79
        q = dst;
80 80
        while (taglen-- && q - dst < dstlen - 7) {
81 81
            uint8_t tmp;
82
            PUT_UTF8(get_byte(pb), tmp, *q++ = tmp;)
82
            PUT_UTF8(avio_r8(pb), tmp, *q++ = tmp;)
83 83
        }
84 84
        *q = 0;
85 85
        break;
86 86

  
87 87
    case ID3v2_ENCODING_UTF16BOM:
88 88
        taglen -= 2;
89
        switch (get_be16(pb)) {
89
        switch (avio_rb16(pb)) {
90 90
        case 0xfffe:
91
            get = get_le16;
91
            get = avio_rl16;
92 92
        case 0xfeff:
93 93
            break;
94 94
        default:
......
111 111

  
112 112
    case ID3v2_ENCODING_UTF8:
113 113
        len = FFMIN(taglen, dstlen);
114
        get_buffer(pb, dst, len);
114
        avio_read(pb, dst, len);
115 115
        dst[len] = 0;
116 116
        break;
117 117
    default:
......
178 178
        int tunsync = 0;
179 179

  
180 180
        if (isv34) {
181
            get_buffer(s->pb, tag, 4);
181
            avio_read(s->pb, tag, 4);
182 182
            tag[4] = 0;
183 183
            if(version==3){
184
                tlen = get_be32(s->pb);
184
                tlen = avio_rb32(s->pb);
185 185
            }else
186 186
                tlen = get_size(s->pb, 4);
187
            tflags = get_be16(s->pb);
187
            tflags = avio_rb16(s->pb);
188 188
            tunsync = tflags & ID3v2_FLAG_UNSYNCH;
189 189
        } else {
190
            get_buffer(s->pb, tag, 3);
190
            avio_read(s->pb, tag, 3);
191 191
            tag[3] = 0;
192
            tlen = get_be24(s->pb);
192
            tlen = avio_rb24(s->pb);
193 193
        }
194 194
        len -= taghdrlen + tlen;
195 195

  
......
199 199
        next = url_ftell(s->pb) + tlen;
200 200

  
201 201
        if (tflags & ID3v2_FLAG_DATALEN) {
202
            get_be32(s->pb);
202
            avio_rb32(s->pb);
203 203
            tlen -= 4;
204 204
        }
205 205

  
......
211 211
                int i, j;
212 212
                av_fast_malloc(&buffer, &buffer_size, tlen);
213 213
                for (i = 0, j = 0; i < tlen; i++, j++) {
214
                    buffer[j] = get_byte(s->pb);
214
                    buffer[j] = avio_r8(s->pb);
215 215
                    if (j > 0 && !buffer[j] && buffer[j - 1] == 0xff) {
216 216
                        /* Unsynchronised byte, skip it */
217 217
                        j--;
......
259 259
    do {
260 260
        /* save the current offset in case there's nothing to read/skip */
261 261
        off = url_ftell(s->pb);
262
        ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
262
        ret = avio_read(s->pb, buf, ID3v2_HEADER_SIZE);
263 263
        if (ret != ID3v2_HEADER_SIZE)
264 264
            break;
265 265
            found_header = ff_id3v2_match(buf, magic);

Also available in: Unified diff