diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-02-13 01:39:11 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-02-13 02:06:44 +0100 |
commit | 4e04e1b81e4e31b7a11b3b5033ac97d2da3b866d (patch) | |
tree | c12bd6d0b08e93cecc67993391c0ff0c6caed991 /libavcodec/dnxhdenc.c | |
parent | f51a0721604deb9aea230522e618b2c4769cad77 (diff) | |
parent | 3e23badd83edc021e8a830db109a08c5553988b0 (diff) | |
download | ffmpeg-4e04e1b81e4e31b7a11b3b5033ac97d2da3b866d.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
swscale: convert yuv2yuvX() to using named arguments.
swscale: rename "dstw" to "w" to prevent name collisions.
swscale: use named registers in yuv2yuv1_plane() place.
lavf: fix aspect ratio mismatch message.
avconv: set AVFormatContext.duration from '-t'
cljr: implement encode2.
cljr: set the properties of the coded_frame, not input frame.
dnxhdenc: switch to encode2.
bmpenc: switch to encode2().
Conflicts:
libavcodec/bmpenc.c
libavcodec/cljr.c
libavformat/utils.c
tests/ref/vsynth1/cljr
tests/ref/vsynth2/cljr
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dnxhdenc.c')
-rw-r--r-- | libavcodec/dnxhdenc.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index 8045da2399..576fe67151 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -29,6 +29,7 @@ #include "libavutil/opt.h" #include "avcodec.h" #include "dsputil.h" +#include "internal.h" #include "mpegvideo.h" #include "mpegvideo_common.h" #include "dnxhdenc.h" @@ -901,18 +902,21 @@ static void dnxhd_load_picture(DNXHDEncContext *ctx, const AVFrame *frame) ctx->cur_field = frame->interlaced_frame && !frame->top_field_first; } -static int dnxhd_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data) +static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt, + const AVFrame *frame, int *got_packet) { DNXHDEncContext *ctx = avctx->priv_data; int first_field = 1; int offset, i, ret; + uint8_t *buf; - if (buf_size < ctx->cid_table->frame_size) { + if ((ret = ff_alloc_packet(pkt, ctx->cid_table->frame_size)) < 0) { av_log(avctx, AV_LOG_ERROR, "output buffer is too small to compress picture\n"); - return -1; + return ret; } + buf = pkt->data; - dnxhd_load_picture(ctx, data); + dnxhd_load_picture(ctx, frame); encode_coding_unit: for (i = 0; i < 3; i++) { @@ -953,13 +957,14 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, unsigned char *buf, int b first_field = 0; ctx->cur_field ^= 1; buf += ctx->cid_table->coding_unit_size; - buf_size -= ctx->cid_table->coding_unit_size; goto encode_coding_unit; } ctx->frame.quality = ctx->qscale*FF_QP2LAMBDA; - return ctx->cid_table->frame_size; + pkt->flags |= AV_PKT_FLAG_KEY; + *got_packet = 1; + return 0; } static int dnxhd_encode_end(AVCodecContext *avctx) @@ -1002,7 +1007,7 @@ AVCodec ff_dnxhd_encoder = { .id = CODEC_ID_DNXHD, .priv_data_size = sizeof(DNXHDEncContext), .init = dnxhd_encode_init, - .encode = dnxhd_encode_picture, + .encode2 = dnxhd_encode_picture, .close = dnxhd_encode_end, .capabilities = CODEC_CAP_SLICE_THREADS, .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_YUV422P10, PIX_FMT_NONE}, |