~ppsspp/ppsspp/ffmpeg

« back to all changes in this revision

Viewing changes to libavformat/mpc8.c

  • Committer: Henrik Rydgård
  • Date: 2014-01-03 10:44:32 UTC
  • Revision ID: git-v1:87c6c126784b1718bfa448ecf2e6a9fef781eb4e
Update our ffmpeg snapshot to a clone of the official repository.

This is because Maxim's at3plus support has been officially merged!

Show diffs side-by-side

added added

removed removed

Lines of Context:
136
136
    int tag;
137
137
    int64_t size, pos, ppos[2];
138
138
    uint8_t *buf;
139
 
    int i, t, seekd;
 
139
    int i, t, seekd, ret;
140
140
    GetBitContext gb;
141
141
 
142
142
    if (s->nb_streams == 0) {
156
156
    }
157
157
    if(!(buf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE)))
158
158
        return;
159
 
    avio_read(s->pb, buf, size);
 
159
    ret = avio_read(s->pb, buf, size);
 
160
    if (ret != size) {
 
161
        av_log(s, AV_LOG_ERROR, "seek table truncated\n");
 
162
        av_free(buf);
 
163
        return;
 
164
    }
 
165
    memset(buf+size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
 
166
 
160
167
    init_get_bits(&gb, buf, size * 8);
161
168
    size = gb_get_v(&gb);
162
169
    if(size > UINT_MAX/4 || size > c->samples/1152){
241
248
    st->codec->codec_id = AV_CODEC_ID_MUSEPACK8;
242
249
    st->codec->bits_per_coded_sample = 16;
243
250
 
244
 
    if (ff_alloc_extradata(st->codec, 2))
 
251
    if (ff_get_extradata(st->codec, pb, 2) < 0)
245
252
        return AVERROR(ENOMEM);
246
 
    avio_read(pb, st->codec->extradata, st->codec->extradata_size);
247
253
 
248
254
    st->codec->channels = (st->codec->extradata[1] >> 4) + 1;
249
255
    st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5];