~ppsspp/ppsspp/ffmpeg

« back to all changes in this revision

Viewing changes to libavcodec/bmpenc.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:
60
60
        return AVERROR(EINVAL);
61
61
    }
62
62
 
 
63
    avctx->coded_frame = av_frame_alloc();
 
64
    if (!avctx->coded_frame)
 
65
        return AVERROR(ENOMEM);
 
66
 
63
67
    return 0;
64
68
}
65
69
 
66
70
static int bmp_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
67
71
                            const AVFrame *pict, int *got_packet)
68
72
{
 
73
    const AVFrame * const p = pict;
69
74
    int n_bytes_image, n_bytes_per_row, n_bytes, i, n, hsize, ret;
70
75
    const uint32_t *pal = NULL;
71
76
    uint32_t palette256[256];
72
77
    int pad_bytes_per_row, pal_entries = 0, compression = BMP_RGB;
73
78
    int bit_count = avctx->bits_per_coded_sample;
74
79
    uint8_t *ptr, *buf;
75
 
    AVFrame * const p = (AVFrame *)pict;
76
80
 
77
 
    p->pict_type= AV_PICTURE_TYPE_I;
78
 
    p->key_frame= 1;
 
81
    avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
 
82
    avctx->coded_frame->key_frame = 1;
79
83
    switch (avctx->pix_fmt) {
80
84
    case AV_PIX_FMT_RGB444:
81
85
        compression = BMP_BITFIELDS;
159
163
    return 0;
160
164
}
161
165
 
 
166
static av_cold int bmp_encode_close(AVCodecContext *avctx)
 
167
{
 
168
    av_frame_free(&avctx->coded_frame);
 
169
    return 0;
 
170
}
 
171
 
162
172
AVCodec ff_bmp_encoder = {
163
173
    .name           = "bmp",
164
174
    .long_name      = NULL_IF_CONFIG_SMALL("BMP (Windows and OS/2 bitmap)"),
166
176
    .id             = AV_CODEC_ID_BMP,
167
177
    .init           = bmp_encode_init,
168
178
    .encode2        = bmp_encode_frame,
 
179
    .close          = bmp_encode_close,
169
180
    .pix_fmts       = (const enum AVPixelFormat[]){
170
181
        AV_PIX_FMT_BGRA, AV_PIX_FMT_BGR24,
171
182
        AV_PIX_FMT_RGB565, AV_PIX_FMT_RGB555, AV_PIX_FMT_RGB444,