summaryrefslogtreecommitdiff
path: root/libavcodec/v408enc.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-02-23 17:17:04 +0000
committerMichael Niedermayer <michaelni@gmx.at>2012-02-23 23:42:04 +0100
commit1b93244381af895c481d9de967a278d17262ecd0 (patch)
treec914b64d5d1c4fb93e9b036c9c504022f5162dec /libavcodec/v408enc.c
parent1f801f3a705a5eea58f7d4d2b6a2a9fa3da462f0 (diff)
downloadffmpeg-1b93244381af895c481d9de967a278d17262ecd0.tar.gz
v408enc: switch to encode2()
Signed-off-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/v408enc.c')
-rw-r--r--libavcodec/v408enc.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/libavcodec/v408enc.c b/libavcodec/v408enc.c
index e945ba65ad..caa0bb8b8a 100644
--- a/libavcodec/v408enc.c
+++ b/libavcodec/v408enc.c
@@ -22,6 +22,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "internal.h"
static av_cold int v408_encode_init(AVCodecContext *avctx)
{
@@ -35,19 +36,18 @@ static av_cold int v408_encode_init(AVCodecContext *avctx)
return 0;
}
-static int v408_encode_frame(AVCodecContext *avctx, uint8_t *buf,
- int buf_size, void *data)
+static int v408_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pic, int *got_packet)
{
- AVFrame *pic = data;
- uint8_t *dst = buf;
+ uint8_t *dst;
uint8_t *y, *u, *v, *a;
- int i, j;
- int output_size = 0;
+ int i, j, ret;
- if (buf_size < avctx->width * avctx->height * 4) {
+ if ((ret = ff_alloc_packet(pkt, avctx->width * avctx->height * 4)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Out buffer is too small.\n");
- return AVERROR(ENOMEM);
+ return ret;
}
+ dst = pkt->data;
avctx->coded_frame->reference = 0;
avctx->coded_frame->key_frame = 1;
@@ -71,7 +71,6 @@ static int v408_encode_frame(AVCodecContext *avctx, uint8_t *buf,
*dst++ = v[j];
*dst++ = a[j];
}
- output_size += 4;
}
y += pic->linesize[0];
u += pic->linesize[1];
@@ -79,7 +78,9 @@ static int v408_encode_frame(AVCodecContext *avctx, uint8_t *buf,
a += pic->linesize[3];
}
- return output_size;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+ return 0;
}
static av_cold int v408_encode_close(AVCodecContext *avctx)
@@ -95,7 +96,7 @@ AVCodec ff_ayuv_encoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_AYUV,
.init = v408_encode_init,
- .encode = v408_encode_frame,
+ .encode2 = v408_encode_frame,
.close = v408_encode_close,
.pix_fmts = (const enum PixelFormat[]){ PIX_FMT_YUVA444P, PIX_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed MS 4:4:4:4"),
@@ -107,7 +108,7 @@ AVCodec ff_v408_encoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_V408,
.init = v408_encode_init,
- .encode = v408_encode_frame,
+ .encode2 = v408_encode_frame,
.close = v408_encode_close,
.pix_fmts = (const enum PixelFormat[]){ PIX_FMT_YUVA444P, PIX_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed QT 4:4:4:4"),