Revision e63a3628 libavformat/wv.c

View differences:

libavformat/wv.c
86 86

  
87 87
    wc->pos = url_ftell(pb);
88 88
    if(!append){
89
        tag = get_le32(pb);
89
        tag = avio_rl32(pb);
90 90
        if (tag != MKTAG('w', 'v', 'p', 'k'))
91 91
            return -1;
92
        size = get_le32(pb);
92
        size = avio_rl32(pb);
93 93
        if(size < 24 || size > WV_BLOCK_LIMIT){
94 94
            av_log(ctx, AV_LOG_ERROR, "Incorrect block size %i\n", size);
95 95
            return -1;
96 96
        }
97 97
        wc->blksize = size;
98
        ver = get_le16(pb);
98
        ver = avio_rl16(pb);
99 99
        if(ver < 0x402 || ver > 0x410){
100 100
            av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n", ver);
101 101
            return -1;
102 102
        }
103
        get_byte(pb); // track no
104
        get_byte(pb); // track sub index
105
        wc->samples = get_le32(pb); // total samples in file
106
        wc->soff = get_le32(pb); // offset in samples of current block
107
        get_buffer(pb, wc->extra, WV_EXTRA_SIZE);
103
        avio_r8(pb); // track no
104
        avio_r8(pb); // track sub index
105
        wc->samples = avio_rl32(pb); // total samples in file
106
        wc->soff = avio_rl32(pb); // offset in samples of current block
107
        avio_read(pb, wc->extra, WV_EXTRA_SIZE);
108 108
    }else{
109 109
        size = wc->blksize;
110 110
    }
......
127 127
        }
128 128
        while(url_ftell(pb) < block_end){
129 129
            int id, size;
130
            id = get_byte(pb);
131
            size = (id & 0x80) ? get_le24(pb) : get_byte(pb);
130
            id = avio_r8(pb);
131
            size = (id & 0x80) ? avio_rl24(pb) : avio_r8(pb);
132 132
            size <<= 1;
133 133
            if(id&0x40)
134 134
                size--;
......
138 138
                    av_log(ctx, AV_LOG_ERROR, "Insufficient channel information\n");
139 139
                    return -1;
140 140
                }
141
                chan = get_byte(pb);
141
                chan = avio_r8(pb);
142 142
                switch(size - 2){
143 143
                case 0:
144
                    chmask = get_byte(pb);
144
                    chmask = avio_r8(pb);
145 145
                    break;
146 146
                case 1:
147
                    chmask = get_le16(pb);
147
                    chmask = avio_rl16(pb);
148 148
                    break;
149 149
                case 2:
150
                    chmask = get_le24(pb);
150
                    chmask = avio_rl24(pb);
151 151
                    break;
152 152
                case 3:
153
                    chmask = get_le32(pb);
153
                    chmask = avio_rl32(pb);
154 154
                    break;
155 155
                case 5:
156 156
                    url_fskip(pb, 1);
157
                    chan |= (get_byte(pb) & 0xF) << 8;
158
                    chmask = get_le24(pb);
157
                    chan |= (avio_r8(pb) & 0xF) << 8;
158
                    chmask = avio_rl24(pb);
159 159
                    break;
160 160
                default:
161 161
                    av_log(ctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size);
......
163 163
                }
164 164
                break;
165 165
            case 0x27:
166
                rate = get_le24(pb);
166
                rate = avio_rl24(pb);
167 167
                break;
168 168
            default:
169 169
                url_fskip(pb, size);
......
254 254
    if(wc->multichannel)
255 255
        AV_WL32(pkt->data, wc->blksize + WV_EXTRA_SIZE + 12);
256 256
    memcpy(pkt->data + off, wc->extra, WV_EXTRA_SIZE);
257
    ret = get_buffer(s->pb, pkt->data + WV_EXTRA_SIZE + off, wc->blksize);
257
    ret = avio_read(s->pb, pkt->data + WV_EXTRA_SIZE + off, wc->blksize);
258 258
    if(ret != wc->blksize){
259 259
        av_free_packet(pkt);
260 260
        return AVERROR(EIO);
261 261
    }
262 262
    while(!(wc->flags & WV_END_BLOCK)){
263
        if(get_le32(s->pb) != MKTAG('w', 'v', 'p', 'k')){
263
        if(avio_rl32(s->pb) != MKTAG('w', 'v', 'p', 'k')){
264 264
            av_free_packet(pkt);
265 265
            return -1;
266 266
        }
......
275 275
            return -1;
276 276
        }
277 277
        wc->blksize = size;
278
        ver = get_le16(s->pb);
278
        ver = avio_rl16(s->pb);
279 279
        if(ver < 0x402 || ver > 0x410){
280 280
            av_free_packet(pkt);
281 281
            av_log(s, AV_LOG_ERROR, "Unsupported version %03X\n", ver);
282 282
            return -1;
283 283
        }
284
        get_byte(s->pb); // track no
285
        get_byte(s->pb); // track sub index
286
        wc->samples = get_le32(s->pb); // total samples in file
287
        wc->soff = get_le32(s->pb); // offset in samples of current block
284
        avio_r8(s->pb); // track no
285
        avio_r8(s->pb); // track sub index
286
        wc->samples = avio_rl32(s->pb); // total samples in file
287
        wc->soff = avio_rl32(s->pb); // offset in samples of current block
288 288
        if((ret = av_append_packet(s->pb, pkt, WV_EXTRA_SIZE)) < 0){
289 289
            av_free_packet(pkt);
290 290
            return ret;

Also available in: Unified diff