diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-11-17 03:17:00 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-17 03:17:48 +0100 |
commit | 9ad477d9098b5281cede0bd8525ca90b0e52436d (patch) | |
tree | 64617e4d79e4bade2130f1b115cab54a61b45315 /libavcodec/bmpenc.c | |
parent | 8d193a24f2da825aaf5382e4aa42ab533806b033 (diff) | |
parent | e4155f15b35c4272a235f5521d2dc6c2aabdd462 (diff) | |
download | ffmpeg-9ad477d9098b5281cede0bd8525ca90b0e52436d.tar.gz |
Merge commit 'e4155f15b35c4272a235f5521d2dc6c2aabdd462'
* commit 'e4155f15b35c4272a235f5521d2dc6c2aabdd462':
eamad: use the AVFrame API properly.
dpxenc: use the AVFrame API properly.
bmpenc: use the AVFrame API properly.
sgienc: use the AVFrame API properly.
Conflicts:
libavcodec/bmpenc.c
libavcodec/dpxenc.c
libavcodec/eamad.c
libavcodec/sgienc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/bmpenc.c')
-rw-r--r-- | libavcodec/bmpenc.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libavcodec/bmpenc.c b/libavcodec/bmpenc.c index ad02a6b314..2a1956dc4a 100644 --- a/libavcodec/bmpenc.c +++ b/libavcodec/bmpenc.c @@ -60,22 +60,26 @@ static av_cold int bmp_encode_init(AVCodecContext *avctx){ return AVERROR(EINVAL); } + avctx->coded_frame = av_frame_alloc(); + if (!avctx->coded_frame) + return AVERROR(ENOMEM); + return 0; } static int bmp_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet) { + const AVFrame * const p = pict; int n_bytes_image, n_bytes_per_row, n_bytes, i, n, hsize, ret; const uint32_t *pal = NULL; uint32_t palette256[256]; int pad_bytes_per_row, pal_entries = 0, compression = BMP_RGB; int bit_count = avctx->bits_per_coded_sample; uint8_t *ptr, *buf; - AVFrame * const p = (AVFrame *)pict; - p->pict_type= AV_PICTURE_TYPE_I; - p->key_frame= 1; + avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; + avctx->coded_frame->key_frame = 1; switch (avctx->pix_fmt) { case AV_PIX_FMT_RGB444: compression = BMP_BITFIELDS; @@ -159,6 +163,12 @@ static int bmp_encode_frame(AVCodecContext *avctx, AVPacket *pkt, return 0; } +static av_cold int bmp_encode_close(AVCodecContext *avctx) +{ + av_frame_free(&avctx->coded_frame); + return 0; +} + AVCodec ff_bmp_encoder = { .name = "bmp", .long_name = NULL_IF_CONFIG_SMALL("BMP (Windows and OS/2 bitmap)"), @@ -166,6 +176,7 @@ AVCodec ff_bmp_encoder = { .id = AV_CODEC_ID_BMP, .init = bmp_encode_init, .encode2 = bmp_encode_frame, + .close = bmp_encode_close, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_BGRA, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB565, AV_PIX_FMT_RGB555, AV_PIX_FMT_RGB444, |