Revision b7effd4e libavformat/tta.c

View differences:

libavformat/tta.c
47 47
        ff_id3v1_read(s);
48 48

  
49 49
    start_offset = url_ftell(s->pb);
50
    if (get_le32(s->pb) != AV_RL32("TTA1"))
50
    if (avio_rl32(s->pb) != AV_RL32("TTA1"))
51 51
        return -1; // not tta file
52 52

  
53 53
    url_fskip(s->pb, 2); // FIXME: flags
54
    channels = get_le16(s->pb);
55
    bps = get_le16(s->pb);
56
    samplerate = get_le32(s->pb);
54
    channels = avio_rl16(s->pb);
55
    bps = avio_rl16(s->pb);
56
    samplerate = avio_rl32(s->pb);
57 57
    if(samplerate <= 0 || samplerate > 1000000){
58 58
        av_log(s, AV_LOG_ERROR, "nonsense samplerate\n");
59 59
        return -1;
60 60
    }
61 61

  
62
    datalen = get_le32(s->pb);
62
    datalen = avio_rl32(s->pb);
63 63
    if(datalen < 0){
64 64
        av_log(s, AV_LOG_ERROR, "nonsense datalen\n");
65 65
        return -1;
......
87 87
    framepos = url_ftell(s->pb) + 4*c->totalframes + 4;
88 88

  
89 89
    for (i = 0; i < c->totalframes; i++) {
90
        uint32_t size = get_le32(s->pb);
90
        uint32_t size = avio_rl32(s->pb);
91 91
        av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME);
92 92
        framepos += size;
93 93
    }
......
101 101

  
102 102
    st->codec->extradata_size = url_ftell(s->pb) - start_offset;
103 103
    if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){
104
        //this check is redundant as get_buffer should fail
104
        //this check is redundant as avio_read should fail
105 105
        av_log(s, AV_LOG_ERROR, "extradata_size too large\n");
106 106
        return -1;
107 107
    }
108 108
    st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
109 109
    url_fseek(s->pb, start_offset, SEEK_SET);
110
    get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size);
110
    avio_read(s->pb, st->codec->extradata, st->codec->extradata_size);
111 111

  
112 112
    return 0;
113 113
}

Also available in: Unified diff