diff options
author | James Zern <jzern@google.com> | 2012-06-10 14:15:20 -0700 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-06-11 02:06:43 +0200 |
commit | cb7f06228658b5d31290f245b8e7a4eba2c6758d (patch) | |
tree | 51ce926ba808dabf71ba6ac72e27e4c43fcb4f15 /libavcodec/libvpxenc.c | |
parent | a5ca3203f03252e36c997e5e270cc36691cace5c (diff) | |
download | ffmpeg-streaming-cb7f06228658b5d31290f245b8e7a4eba2c6758d.zip ffmpeg-streaming-cb7f06228658b5d31290f245b8e7a4eba2c6758d.tar.gz |
libvpxenc: add support for forced key frames
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libvpxenc.c')
-rw-r--r-- | libavcodec/libvpxenc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index b3ec17d..f9180f0 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -503,6 +503,7 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt, VP8Context *ctx = avctx->priv_data; struct vpx_image *rawimg = NULL; int64_t timestamp = 0; + long flags = 0; int res, coded_size; if (frame) { @@ -514,10 +515,11 @@ 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; + flags = frame->pict_type == AV_PICTURE_TYPE_I ? VPX_EFLAG_FORCE_KF : 0; } 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; |