Revision e63a3628 libavformat/nsvdec.c

View differences:

libavformat/nsvdec.c
236 236
            return -1;
237 237
        }
238 238
        v <<= 8;
239
        v |= get_byte(pb);
239
        v |= avio_r8(pb);
240 240
        if (i < 8) {
241 241
            av_dlog(s, "NSV resync: [%d] = %02x\n", i, v & 0x0FF);
242 242
        }
......
277 277

  
278 278
    nsv->state = NSV_UNSYNC; /* in case we fail */
279 279

  
280
    size = get_le32(pb);
280
    size = avio_rl32(pb);
281 281
    if (size < 28)
282 282
        return -1;
283 283
    nsv->NSVf_end = size;
284 284

  
285
    //s->file_size = (uint32_t)get_le32(pb);
286
    file_size = (uint32_t)get_le32(pb);
285
    //s->file_size = (uint32_t)avio_rl32(pb);
286
    file_size = (uint32_t)avio_rl32(pb);
287 287
    av_dlog(s, "NSV NSVf chunk_size %u\n", size);
288 288
    av_dlog(s, "NSV NSVf file_size %u\n", file_size);
289 289

  
290
    nsv->duration = duration = get_le32(pb); /* in ms */
290
    nsv->duration = duration = avio_rl32(pb); /* in ms */
291 291
    av_dlog(s, "NSV NSVf duration %"PRId64" ms\n", duration);
292 292
    // XXX: store it in AVStreams
293 293

  
294
    strings_size = get_le32(pb);
295
    table_entries = get_le32(pb);
296
    table_entries_used = get_le32(pb);
294
    strings_size = avio_rl32(pb);
295
    table_entries = avio_rl32(pb);
296
    table_entries_used = avio_rl32(pb);
297 297
    av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n",
298 298
            strings_size, table_entries, table_entries_used);
299 299
    if (url_feof(pb))
......
309 309

  
310 310
        p = strings = av_mallocz(strings_size + 1);
311 311
        endp = strings + strings_size;
312
        get_buffer(pb, strings, strings_size);
312
        avio_read(pb, strings, strings_size);
313 313
        while (p < endp) {
314 314
            while (*p == ' ')
315 315
                p++; /* strip out spaces */
......
344 344
        nsv->nsvs_file_offset = av_malloc((unsigned)table_entries_used * sizeof(uint32_t));
345 345

  
346 346
        for(i=0;i<table_entries_used;i++)
347
            nsv->nsvs_file_offset[i] = get_le32(pb) + size;
347
            nsv->nsvs_file_offset[i] = avio_rl32(pb) + size;
348 348

  
349 349
        if(table_entries > table_entries_used &&
350
           get_le32(pb) == MKTAG('T','O','C','2')) {
350
           avio_rl32(pb) == MKTAG('T','O','C','2')) {
351 351
            nsv->nsvs_timestamps = av_malloc((unsigned)table_entries_used*sizeof(uint32_t));
352 352
            for(i=0;i<table_entries_used;i++) {
353
                nsv->nsvs_timestamps[i] = get_le32(pb);
353
                nsv->nsvs_timestamps[i] = avio_rl32(pb);
354 354
            }
355 355
        }
356 356
    }
......
365 365
    for (i = 0; i < table_entries; i++) {
366 366
        unsigned char b[8];
367 367
        url_fseek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET);
368
        get_buffer(pb, b, 8);
368
        avio_read(pb, b, 8);
369 369
        av_dlog(s, "NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x"
370 370
           "%c%c%c%c%c%c%c%c\n",
371 371
           nsv->nsvs_file_offset[i], size + nsv->nsvs_file_offset[i],
......
396 396
    NSVStream *nst;
397 397
    av_dlog(s, "%s()\n", __FUNCTION__);
398 398

  
399
    vtag = get_le32(pb);
400
    atag = get_le32(pb);
401
    vwidth = get_le16(pb);
402
    vheight = get_le16(pb);
403
    i = get_byte(pb);
399
    vtag = avio_rl32(pb);
400
    atag = avio_rl32(pb);
401
    vwidth = avio_rl16(pb);
402
    vheight = avio_rl16(pb);
403
    i = avio_r8(pb);
404 404

  
405 405
    av_dlog(s, "NSV NSVs framerate code %2x\n", i);
406 406
    if(i&0x80) { /* odd way of giving native framerates from docs */
......
420 420
    else
421 421
        framerate= (AVRational){i, 1};
422 422

  
423
    nsv->avsync = get_le16(pb);
423
    nsv->avsync = avio_rl16(pb);
424 424
    nsv->framerate = framerate;
425 425

  
426 426
    print_tag("NSV NSVs vtag", vtag, 0);
......
568 568
    if (nsv->state != NSV_HAS_READ_NSVS && nsv->state != NSV_FOUND_BEEF)
569 569
        return -1;
570 570

  
571
    auxcount = get_byte(pb);
572
    vsize = get_le16(pb);
573
    asize = get_le16(pb);
571
    auxcount = avio_r8(pb);
572
    vsize = avio_rl16(pb);
573
    asize = avio_rl16(pb);
574 574
    vsize = (vsize << 4) | (auxcount >> 4);
575 575
    auxcount &= 0x0f;
576 576
    av_dlog(s, "NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize);
577 577
    /* skip aux stuff */
578 578
    for (i = 0; i < auxcount; i++) {
579
        auxsize = get_le16(pb);
580
        auxtag = get_le32(pb);
579
        auxsize = avio_rl16(pb);
580
        auxtag = avio_rl32(pb);
581 581
        av_dlog(s, "NSV aux data: '%c%c%c%c', %d bytes\n",
582 582
              (auxtag & 0x0ff),
583 583
              ((auxtag >> 8) & 0x0ff),
......
623 623
            uint8_t bps;
624 624
            uint8_t channels;
625 625
            uint16_t samplerate;
626
            bps = get_byte(pb);
627
            channels = get_byte(pb);
628
            samplerate = get_le16(pb);
626
            bps = avio_r8(pb);
627
            channels = avio_r8(pb);
628
            samplerate = avio_rl16(pb);
629 629
            asize-=4;
630 630
            av_dlog(s, "NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate);
631 631
            if (fill_header) {

Also available in: Unified diff