Revision e63a3628 libavformat/iff.c

View differences:

libavformat/iff.c
101 101
    if (!buf)
102 102
        return AVERROR(ENOMEM);
103 103

  
104
    if (get_buffer(s->pb, buf, data_size) < 0) {
104
    if (avio_read(s->pb, buf, data_size) < 0) {
105 105
        av_free(buf);
106 106
        return AVERROR(EIO);
107 107
    }
......
136 136
    st->codec->channels = 1;
137 137
    url_fskip(pb, 8);
138 138
    // codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content
139
    st->codec->codec_tag = get_le32(pb);
139
    st->codec->codec_tag = avio_rl32(pb);
140 140

  
141 141
    while(!url_feof(pb)) {
142 142
        uint64_t orig_pos;
143 143
        int res;
144 144
        const char *metadata_tag = NULL;
145
        chunk_id = get_le32(pb);
146
        data_size = get_be32(pb);
145
        chunk_id = avio_rl32(pb);
146
        data_size = avio_rb32(pb);
147 147
        orig_pos = url_ftell(pb);
148 148

  
149 149
        switch(chunk_id) {
......
153 153
            if (data_size < 14)
154 154
                return AVERROR_INVALIDDATA;
155 155
            url_fskip(pb, 12);
156
            st->codec->sample_rate = get_be16(pb);
156
            st->codec->sample_rate = avio_rb16(pb);
157 157
            if (data_size >= 16) {
158 158
                url_fskip(pb, 1);
159
                compression        = get_byte(pb);
159
                compression        = avio_r8(pb);
160 160
            }
161 161
            break;
162 162

  
......
168 168
        case ID_CHAN:
169 169
            if (data_size < 4)
170 170
                return AVERROR_INVALIDDATA;
171
            st->codec->channels = (get_be32(pb) < 6) ? 1 : 2;
171
            st->codec->channels = (avio_rb32(pb) < 6) ? 1 : 2;
172 172
            break;
173 173

  
174 174
        case ID_CMAP:
......
176 176
            st->codec->extradata      = av_malloc(data_size);
177 177
            if (!st->codec->extradata)
178 178
                return AVERROR(ENOMEM);
179
            if (get_buffer(pb, st->codec->extradata, data_size) < 0)
179
            if (avio_read(pb, st->codec->extradata, data_size) < 0)
180 180
                return AVERROR(EIO);
181 181
            break;
182 182

  
......
184 184
            st->codec->codec_type            = AVMEDIA_TYPE_VIDEO;
185 185
            if (data_size <= 8)
186 186
                return AVERROR_INVALIDDATA;
187
            st->codec->width                 = get_be16(pb);
188
            st->codec->height                = get_be16(pb);
187
            st->codec->width                 = avio_rb16(pb);
188
            st->codec->height                = avio_rb16(pb);
189 189
            url_fskip(pb, 4); // x, y offset
190
            st->codec->bits_per_coded_sample = get_byte(pb);
190
            st->codec->bits_per_coded_sample = avio_r8(pb);
191 191
            if (data_size >= 11) {
192 192
                url_fskip(pb, 1); // masking
193
                compression                  = get_byte(pb);
193
                compression                  = avio_r8(pb);
194 194
            }
195 195
            if (data_size >= 16) {
196 196
                url_fskip(pb, 3); // paddding, transparent
197
                st->sample_aspect_ratio.num  = get_byte(pb);
198
                st->sample_aspect_ratio.den  = get_byte(pb);
197
                st->sample_aspect_ratio.num  = avio_r8(pb);
198
                st->sample_aspect_ratio.den  = avio_r8(pb);
199 199
            }
200 200
            break;
201 201

  
......
286 286
    if(st->codec->channels == 2) {
287 287
        uint8_t sample_buffer[PACKET_SIZE];
288 288

  
289
        ret = get_buffer(pb, sample_buffer, PACKET_SIZE);
289
        ret = avio_read(pb, sample_buffer, PACKET_SIZE);
290 290
        if(av_new_packet(pkt, PACKET_SIZE) < 0) {
291 291
            av_log(s, AV_LOG_ERROR, "cannot allocate packet\n");
292 292
            return AVERROR(ENOMEM);

Also available in: Unified diff