Revision 8c908d7d

View differences:

libavcodec/fraps.c
148 148
    version = header & 0xff;
149 149
    header_size = (header & (1<<30))? 8 : 4; /* bit 30 means pad to 8 bytes */
150 150

  
151
    if (version > 2 && version != 4) {
151
    if (version > 2 && version != 4 && version != 5) {
152 152
        av_log(avctx, AV_LOG_ERROR,
153 153
               "This file is encoded with Fraps version %d. " \
154 154
               "This codec can only decode version 0, 1, 2 and 4.\n", version);
......
288 288
            }
289 289
        }
290 290
        break;
291
    case 5:
292
        /* Virtually the same as version 4, but is for RGB24 */
293
        avctx->pix_fmt = PIX_FMT_BGR24;
294
        planes = 3;
295
        f->reference = 1;
296
        f->buffer_hints = FF_BUFFER_HINTS_VALID |
297
                          FF_BUFFER_HINTS_PRESERVE |
298
                          FF_BUFFER_HINTS_REUSABLE;
299
        if (avctx->reget_buffer(avctx, f)) {
300
            av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
301
            return -1;
302
        }
303
        /* skip frame */
304
        if(buf_size == 8) {
305
            f->pict_type = FF_P_TYPE;
306
            f->key_frame = 0;
307
            break;
308
        }
309
        f->pict_type = FF_I_TYPE;
310
        f->key_frame = 1;
311
        if ((AV_RL32(buf) != FPS_TAG)||(buf_size < (planes*1024 + 24))) {
312
            av_log(avctx, AV_LOG_ERROR, "Fraps: error in data stream\n");
313
            return -1;
314
        }
315
        for(i = 0; i < planes; i++) {
316
            offs[i] = AV_RL32(buf + 4 + i * 4);
317
            if(offs[i] >= buf_size || (i && offs[i] <= offs[i - 1] + 1024)) {
318
                av_log(avctx, AV_LOG_ERROR, "Fraps: plane %i offset is out of bounds\n", i);
319
                return -1;
320
            }
321
        }
322
        offs[planes] = buf_size;
323
        for(i = 0; i < planes; i++){
324
            s->tmpbuf = av_realloc(s->tmpbuf, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE);
325
            if(fraps2_decode_plane(s, f->data[0] + i + (f->linesize[0] * (avctx->height - 1)), -f->linesize[0],
326
                    avctx->width, avctx->height, buf + offs[i], offs[i + 1] - offs[i], 1, 3) < 0) {
327
                av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i);
328
                return -1;
329
            }
330
        }
331
        break;
291 332
    }
292 333

  
293 334
    *frame = *f;

Also available in: Unified diff