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/sgienc.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/sgienc.c')
-rw-r--r-- | libavcodec/sgienc.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libavcodec/sgienc.c b/libavcodec/sgienc.c index 48532ff3e1..0e4f304a23 100644 --- a/libavcodec/sgienc.c +++ b/libavcodec/sgienc.c @@ -34,6 +34,9 @@ static av_cold int encode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "SGI does not support resolutions above 65535x65535\n"); return -1; } + avctx->coded_frame = av_frame_alloc(); + if (!avctx->coded_frame) + return AVERROR(ENOMEM); return 0; } @@ -41,14 +44,14 @@ static av_cold int encode_init(AVCodecContext *avctx) static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) { - AVFrame * const p = (AVFrame *)frame; + const AVFrame * const p = frame; uint8_t *offsettab, *lengthtab, *in_buf, *encode_buf, *buf; int x, y, z, length, tablesize, ret; unsigned int width, height, depth, dimension, bytes_per_channel, pixmax, put_be; unsigned char *end_buf; - 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; width = avctx->width; height = avctx->height; @@ -199,6 +202,12 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, return 0; } +static av_cold int encode_close(AVCodecContext *avctx) +{ + av_frame_free(&avctx->coded_frame); + return 0; +} + AVCodec ff_sgi_encoder = { .name = "sgi", .long_name = NULL_IF_CONFIG_SMALL("SGI image"), @@ -206,6 +215,7 @@ AVCodec ff_sgi_encoder = { .id = AV_CODEC_ID_SGI, .init = encode_init, .encode2 = encode_frame, + .close = encode_close, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA, AV_PIX_FMT_RGB48LE, AV_PIX_FMT_RGB48BE, |