summaryrefslogtreecommitdiff
path: root/libavcodec/libvpxenc.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2012-12-05 17:17:20 +0200
committerMartin Storsjö <martin@martin.st>2012-12-09 20:28:08 +0200
commit774e6fc9edecc00eab7a47dacfc9a7b9845b1286 (patch)
tree0d2ca999cb8de0ba2db61bda7cb3d30e3a71709a /libavcodec/libvpxenc.c
parentec5da7aee277e3e5265a632cd4e932e3d5487de7 (diff)
libvpxenc: Support forcing keyframes
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec/libvpxenc.c')
-rw-r--r--libavcodec/libvpxenc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 9774d5aec4..17b9800f25 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -495,6 +495,7 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt,
struct vpx_image *rawimg = NULL;
int64_t timestamp = 0;
int res, coded_size;
+ vpx_enc_frame_flags_t flags = 0;
if (frame) {
rawimg = &ctx->rawimg;
@@ -505,10 +506,12 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt,
rawimg->stride[VPX_PLANE_U] = frame->linesize[1];
rawimg->stride[VPX_PLANE_V] = frame->linesize[2];
timestamp = frame->pts;
+ if (frame->pict_type == AV_PICTURE_TYPE_I)
+ flags |= VPX_EFLAG_FORCE_KF;
}
res = vpx_codec_encode(&ctx->encoder, rawimg, timestamp,
- avctx->ticks_per_frame, 0, ctx->deadline);
+ avctx->ticks_per_frame, flags, ctx->deadline);
if (res != VPX_CODEC_OK) {
log_encoder_error(avctx, "Error encoding frame");
return AVERROR_INVALIDDATA;