Revision e63a3628 libavformat/matroskadec.c

View differences:

libavformat/matroskadec.c
543 543
    int read = 1, n = 1;
544 544
    uint64_t total = 0;
545 545

  
546
    /* The first byte tells us the length in bytes - get_byte() can normally
546
    /* The first byte tells us the length in bytes - avio_r8() can normally
547 547
     * return 0, but since that's not a valid first ebmlID byte, we can
548 548
     * use it safely here to catch EOS. */
549
    if (!(total = get_byte(pb))) {
549
    if (!(total = avio_r8(pb))) {
550 550
        /* we might encounter EOS here */
551 551
        if (!url_feof(pb)) {
552 552
            int64_t pos = url_ftell(pb);
......
570 570
    /* read out length */
571 571
    total ^= 1 << ff_log2_tab[total];
572 572
    while (n++ < read)
573
        total = (total << 8) | get_byte(pb);
573
        total = (total << 8) | avio_r8(pb);
574 574

  
575 575
    *number = total;
576 576

  
......
605 605
    /* big-endian ordering; build up number */
606 606
    *num = 0;
607 607
    while (n++ < size)
608
        *num = (*num << 8) | get_byte(pb);
608
        *num = (*num << 8) | avio_r8(pb);
609 609

  
610 610
    return 0;
611 611
}
......
619 619
    if (size == 0) {
620 620
        *num = 0;
621 621
    } else if (size == 4) {
622
        *num= av_int2flt(get_be32(pb));
622
        *num= av_int2flt(avio_rb32(pb));
623 623
    } else if(size==8){
624
        *num= av_int2dbl(get_be64(pb));
624
        *num= av_int2dbl(avio_rb64(pb));
625 625
    } else
626 626
        return AVERROR_INVALIDDATA;
627 627

  
......
639 639
     * byte more, read the string and NULL-terminate it ourselves. */
640 640
    if (!(*str = av_malloc(size + 1)))
641 641
        return AVERROR(ENOMEM);
642
    if (get_buffer(pb, (uint8_t *) *str, size) != size) {
642
    if (avio_read(pb, (uint8_t *) *str, size) != size) {
643 643
        av_freep(str);
644 644
        return AVERROR(EIO);
645 645
    }
......
660 660

  
661 661
    bin->size = length;
662 662
    bin->pos  = url_ftell(pb);
663
    if (get_buffer(pb, bin->data, length) != length) {
663
    if (avio_read(pb, bin->data, length) != length) {
664 664
        av_freep(&bin->data);
665 665
        return AVERROR(EIO);
666 666
    }
......
1394 1394
            ffio_init_context(&b, track->codec_priv.data,track->codec_priv.size,
1395 1395
                          0, NULL, NULL, NULL, NULL);
1396 1396
            url_fskip(&b, 22);
1397
            flavor                       = get_be16(&b);
1398
            track->audio.coded_framesize = get_be32(&b);
1397
            flavor                       = avio_rb16(&b);
1398
            track->audio.coded_framesize = avio_rb32(&b);
1399 1399
            url_fskip(&b, 12);
1400
            track->audio.sub_packet_h    = get_be16(&b);
1401
            track->audio.frame_size      = get_be16(&b);
1402
            track->audio.sub_packet_size = get_be16(&b);
1400
            track->audio.sub_packet_h    = avio_rb16(&b);
1401
            track->audio.frame_size      = avio_rb16(&b);
1402
            track->audio.sub_packet_size = avio_rb16(&b);
1403 1403
            track->audio.buf = av_malloc(track->audio.frame_size * track->audio.sub_packet_h);
1404 1404
            if (codec_id == CODEC_ID_RA_288) {
1405 1405
                st->codec->block_align = track->audio.coded_framesize;

Also available in: Unified diff