Revision b7effd4e libavformat/mpegts.c

View differences:

libavformat/mpegts.c
860 860

  
861 861
    len = ff_mp4_read_descr(s, &pb, &tag);
862 862
    if (tag == MP4IODescrTag) {
863
        get_be16(&pb); // ID
864
        get_byte(&pb);
865
        get_byte(&pb);
866
        get_byte(&pb);
867
        get_byte(&pb);
868
        get_byte(&pb);
863
        avio_rb16(&pb); // ID
864
        avio_r8(&pb);
865
        avio_r8(&pb);
866
        avio_r8(&pb);
867
        avio_r8(&pb);
868
        avio_r8(&pb);
869 869
        len = ff_mp4_read_descr(s, &pb, &tag);
870 870
        if (tag == MP4ESDescrTag) {
871
            *es_id = get_be16(&pb); /* ES_ID */
871
            *es_id = avio_rb16(&pb); /* ES_ID */
872 872
            av_dlog(s, "ES_ID %#x\n", *es_id);
873
            get_byte(&pb); /* priority */
873
            avio_r8(&pb); /* priority */
874 874
            len = ff_mp4_read_descr(s, &pb, &tag);
875 875
            if (tag == MP4DecConfigDescrTag) {
876 876
                *dec_config_descr = av_malloc(len);
877 877
                if (!*dec_config_descr)
878 878
                    return AVERROR(ENOMEM);
879 879
                *dec_config_descr_size = len;
880
                get_buffer(&pb, *dec_config_descr, len);
880
                avio_read(&pb, *dec_config_descr, len);
881 881
            }
882 882
        }
883 883
    }
......
1332 1332
    int skip, len;
1333 1333

  
1334 1334
    for(;;) {
1335
        len = get_buffer(pb, buf, TS_PACKET_SIZE);
1335
        len = avio_read(pb, buf, TS_PACKET_SIZE);
1336 1336
        if (len != TS_PACKET_SIZE)
1337 1337
            return AVERROR(EIO);
1338 1338
        /* check paquet sync byte */
......
1455 1455

  
1456 1456
    /* read the first 1024 bytes to get packet size */
1457 1457
    pos = url_ftell(pb);
1458
    len = get_buffer(pb, buf, sizeof(buf));
1458
    len = avio_read(pb, buf, sizeof(buf));
1459 1459
    if (len != sizeof(buf))
1460 1460
        goto fail;
1461 1461
    ts->raw_packet_size = get_packet_size(buf, sizeof(buf));
......
1565 1565
            pos = url_ftell(s->pb);
1566 1566
            for(i = 0; i < MAX_PACKET_READAHEAD; i++) {
1567 1567
                url_fseek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET);
1568
                get_buffer(s->pb, pcr_buf, 12);
1568
                avio_read(s->pb, pcr_buf, 12);
1569 1569
                if (parse_pcr(&next_pcr_h, &next_pcr_l, pcr_buf) == 0) {
1570 1570
                    /* XXX: not precise enough */
1571 1571
                    ts->pcr_incr = ((next_pcr_h - pcr_h) * 300 + (next_pcr_l - pcr_l)) /
......
1650 1650
    if (find_next) {
1651 1651
        for(;;) {
1652 1652
            url_fseek(s->pb, pos, SEEK_SET);
1653
            if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
1653
            if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
1654 1654
                return AV_NOPTS_VALUE;
1655 1655
            if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&
1656 1656
                parse_pcr(&timestamp, &pcr_l, buf) == 0) {
......
1664 1664
            if (pos < 0)
1665 1665
                return AV_NOPTS_VALUE;
1666 1666
            url_fseek(s->pb, pos, SEEK_SET);
1667
            if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
1667
            if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
1668 1668
                return AV_NOPTS_VALUE;
1669 1669
            if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&
1670 1670
                parse_pcr(&timestamp, &pcr_l, buf) == 0) {
......
1775 1775

  
1776 1776
    for(;;) {
1777 1777
        url_fseek(s->pb, pos, SEEK_SET);
1778
        if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
1778
        if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
1779 1779
            return -1;
1780 1780
//        pid = AV_RB16(buf + 1) & 0x1fff;
1781 1781
        if(buf[1] & 0x40) break;

Also available in: Unified diff