Revision e63a3628 libavformat/ape.c

View differences:

libavformat/ape.c
162 162
    /* TODO: Skip any leading junk such as id3v2 tags */
163 163
    ape->junklength = 0;
164 164

  
165
    tag = get_le32(pb);
165
    tag = avio_rl32(pb);
166 166
    if (tag != MKTAG('M', 'A', 'C', ' '))
167 167
        return -1;
168 168

  
169
    ape->fileversion = get_le16(pb);
169
    ape->fileversion = avio_rl16(pb);
170 170

  
171 171
    if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) {
172 172
        av_log(s, AV_LOG_ERROR, "Unsupported file version - %d.%02d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10);
......
174 174
    }
175 175

  
176 176
    if (ape->fileversion >= 3980) {
177
        ape->padding1             = get_le16(pb);
178
        ape->descriptorlength     = get_le32(pb);
179
        ape->headerlength         = get_le32(pb);
180
        ape->seektablelength      = get_le32(pb);
181
        ape->wavheaderlength      = get_le32(pb);
182
        ape->audiodatalength      = get_le32(pb);
183
        ape->audiodatalength_high = get_le32(pb);
184
        ape->wavtaillength        = get_le32(pb);
185
        get_buffer(pb, ape->md5, 16);
177
        ape->padding1             = avio_rl16(pb);
178
        ape->descriptorlength     = avio_rl32(pb);
179
        ape->headerlength         = avio_rl32(pb);
180
        ape->seektablelength      = avio_rl32(pb);
181
        ape->wavheaderlength      = avio_rl32(pb);
182
        ape->audiodatalength      = avio_rl32(pb);
183
        ape->audiodatalength_high = avio_rl32(pb);
184
        ape->wavtaillength        = avio_rl32(pb);
185
        avio_read(pb, ape->md5, 16);
186 186

  
187 187
        /* Skip any unknown bytes at the end of the descriptor.
188 188
           This is for future compatibility */
......
190 190
            url_fseek(pb, ape->descriptorlength - 52, SEEK_CUR);
191 191

  
192 192
        /* Read header data */
193
        ape->compressiontype      = get_le16(pb);
194
        ape->formatflags          = get_le16(pb);
195
        ape->blocksperframe       = get_le32(pb);
196
        ape->finalframeblocks     = get_le32(pb);
197
        ape->totalframes          = get_le32(pb);
198
        ape->bps                  = get_le16(pb);
199
        ape->channels             = get_le16(pb);
200
        ape->samplerate           = get_le32(pb);
193
        ape->compressiontype      = avio_rl16(pb);
194
        ape->formatflags          = avio_rl16(pb);
195
        ape->blocksperframe       = avio_rl32(pb);
196
        ape->finalframeblocks     = avio_rl32(pb);
197
        ape->totalframes          = avio_rl32(pb);
198
        ape->bps                  = avio_rl16(pb);
199
        ape->channels             = avio_rl16(pb);
200
        ape->samplerate           = avio_rl32(pb);
201 201
    } else {
202 202
        ape->descriptorlength = 0;
203 203
        ape->headerlength = 32;
204 204

  
205
        ape->compressiontype      = get_le16(pb);
206
        ape->formatflags          = get_le16(pb);
207
        ape->channels             = get_le16(pb);
208
        ape->samplerate           = get_le32(pb);
209
        ape->wavheaderlength      = get_le32(pb);
210
        ape->wavtaillength        = get_le32(pb);
211
        ape->totalframes          = get_le32(pb);
212
        ape->finalframeblocks     = get_le32(pb);
205
        ape->compressiontype      = avio_rl16(pb);
206
        ape->formatflags          = avio_rl16(pb);
207
        ape->channels             = avio_rl16(pb);
208
        ape->samplerate           = avio_rl32(pb);
209
        ape->wavheaderlength      = avio_rl32(pb);
210
        ape->wavtaillength        = avio_rl32(pb);
211
        ape->totalframes          = avio_rl32(pb);
212
        ape->finalframeblocks     = avio_rl32(pb);
213 213

  
214 214
        if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) {
215 215
            url_fseek(pb, 4, SEEK_CUR); /* Skip the peak level */
......
217 217
        }
218 218

  
219 219
        if (ape->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) {
220
            ape->seektablelength = get_le32(pb);
220
            ape->seektablelength = avio_rl32(pb);
221 221
            ape->headerlength += 4;
222 222
            ape->seektablelength *= sizeof(int32_t);
223 223
        } else
......
260 260
    if (ape->seektablelength > 0) {
261 261
        ape->seektable = av_malloc(ape->seektablelength);
262 262
        for (i = 0; i < ape->seektablelength / sizeof(uint32_t); i++)
263
            ape->seektable[i] = get_le32(pb);
263
            ape->seektable[i] = avio_rl32(pb);
264 264
    }
265 265

  
266 266
    ape->frames[0].pos     = ape->firstframe;
......
355 355

  
356 356
    AV_WL32(pkt->data    , nblocks);
357 357
    AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
358
    ret = get_buffer(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
358
    ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
359 359

  
360 360
    pkt->pts = ape->frames[ape->currentframe].pts;
361 361
    pkt->stream_index = 0;

Also available in: Unified diff