diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-02-17 21:27:44 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-02-17 22:38:30 +0100 |
commit | 48ad7f822d8fdaf99aeeec67552e32fe8a83a687 (patch) | |
tree | 6f2e34f7bcf29d06a37a9ced8fd048f90f495660 /libavcodec/r210enc.c | |
parent | f9caec0cf9a2bd06efa3bc800649713e8531cad0 (diff) | |
download | ffmpeg-48ad7f822d8fdaf99aeeec67552e32fe8a83a687.tar.gz |
r210enc: switch to encode2()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/r210enc.c')
-rw-r--r-- | libavcodec/r210enc.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/libavcodec/r210enc.c b/libavcodec/r210enc.c index f5ba42da50..10ae001915 100644 --- a/libavcodec/r210enc.c +++ b/libavcodec/r210enc.c @@ -21,6 +21,7 @@ */ #include "avcodec.h" +#include "internal.h" #include "bytestream.h" static av_cold int encode_init(AVCodecContext *avctx) @@ -33,25 +34,25 @@ static av_cold int encode_init(AVCodecContext *avctx) return 0; } -static int encode_frame(AVCodecContext *avctx, uint8_t *buf, - int buf_size, void *data) +static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, + const AVFrame *pic, int *got_packet) { - AVFrame *pic = data; - int i, j; + int i, j, ret; int aligned_width = FFALIGN(avctx->width, 64); int pad = (aligned_width - avctx->width) * 4; uint8_t *src_line; - uint8_t *dst = buf; + uint8_t *dst; - if (buf_size < 4 * aligned_width * avctx->height) { - av_log(avctx, AV_LOG_ERROR, "output buffer too small\n"); - return AVERROR(ENOMEM); + if ((ret = ff_alloc_packet(pkt, 4 * aligned_width * avctx->height)) < 0) { + av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n"); + return ret; } avctx->coded_frame->reference = 0; avctx->coded_frame->key_frame = 1; avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; src_line = pic->data[0]; + dst = pkt->data; for (i = 0; i < avctx->height; i++) { uint16_t *src = (uint16_t *)src_line; @@ -74,7 +75,10 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *buf, src_line += pic->linesize[0]; } - return 4 * aligned_width * avctx->height; + pkt->size = 4 * aligned_width * avctx->height; + pkt->flags |= AV_PKT_FLAG_KEY; + *got_packet = 1; + return 0; } static av_cold int encode_close(AVCodecContext *avctx) @@ -90,7 +94,7 @@ AVCodec ff_r210_encoder = { .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_R210, .init = encode_init, - .encode = encode_frame, + .encode2 = encode_frame, .close = encode_close, .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_RGB48, PIX_FMT_NONE }, .long_name = NULL_IF_CONFIG_SMALL("Uncompressed RGB 10-bit"), @@ -102,7 +106,7 @@ AVCodec ff_r10k_encoder = { .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_R10K, .init = encode_init, - .encode = encode_frame, + .encode2 = encode_frame, .close = encode_close, .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_RGB48, PIX_FMT_NONE }, .long_name = NULL_IF_CONFIG_SMALL("AJA Kona 10-bit RGB Codec"), @@ -114,7 +118,7 @@ AVCodec ff_avrp_encoder = { .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_AVRP, .init = encode_init, - .encode = encode_frame, + .encode2 = encode_frame, .close = encode_close, .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_RGB48, PIX_FMT_NONE }, .long_name = NULL_IF_CONFIG_SMALL("Avid 1:1 10-bit RGB Packer"), |