~ppsspp/ppsspp/ffmpeg

« back to all changes in this revision

Viewing changes to libavcodec/smc.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:
46
46
typedef struct SmcContext {
47
47
 
48
48
    AVCodecContext *avctx;
49
 
    AVFrame frame;
 
49
    AVFrame *frame;
50
50
 
51
51
    GetByteContext gb;
52
52
 
81
81
{
82
82
    int width = s->avctx->width;
83
83
    int height = s->avctx->height;
84
 
    int stride = s->frame.linesize[0];
 
84
    int stride = s->frame->linesize[0];
85
85
    int i;
86
86
    int chunk_size;
87
87
    int buf_size = bytestream2_size(&s->gb);
92
92
    unsigned int color_flags_b;
93
93
    unsigned int flag_mask;
94
94
 
95
 
    unsigned char *pixels = s->frame.data[0];
 
95
    unsigned char *pixels = s->frame->data[0];
96
96
 
97
 
    int image_size = height * s->frame.linesize[0];
 
97
    int image_size = height * s->frame->linesize[0];
98
98
    int row_ptr = 0;
99
99
    int pixel_ptr = 0;
100
100
    int pixel_x, pixel_y;
112
112
    int color_octet_index = 0;
113
113
 
114
114
    /* make the palette available */
115
 
    memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
 
115
    memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE);
116
116
 
117
117
    bytestream2_skip(&s->gb, 1);
118
118
    chunk_size = bytestream2_get_be24(&s->gb);
417
417
    s->avctx = avctx;
418
418
    avctx->pix_fmt = AV_PIX_FMT_PAL8;
419
419
 
420
 
    avcodec_get_frame_defaults(&s->frame);
 
420
    s->frame = av_frame_alloc();
 
421
    if (!s->frame)
 
422
        return AVERROR(ENOMEM);
421
423
 
422
424
    return 0;
423
425
}
434
436
 
435
437
    bytestream2_init(&s->gb, buf, buf_size);
436
438
 
437
 
    if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0)
 
439
    if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
438
440
        return ret;
439
441
 
440
442
    if (pal) {
441
 
        s->frame.palette_has_changed = 1;
 
443
        s->frame->palette_has_changed = 1;
442
444
        memcpy(s->pal, pal, AVPALETTE_SIZE);
443
445
    }
444
446
 
445
447
    smc_decode_stream(s);
446
448
 
447
449
    *got_frame      = 1;
448
 
    if ((ret = av_frame_ref(data, &s->frame)) < 0)
 
450
    if ((ret = av_frame_ref(data, s->frame)) < 0)
449
451
        return ret;
450
452
 
451
453
    /* always report that the buffer was completely consumed */
456
458
{
457
459
    SmcContext *s = avctx->priv_data;
458
460
 
459
 
    av_frame_unref(&s->frame);
 
461
    av_frame_free(&s->frame);
460
462
 
461
463
    return 0;
462
464
}