summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorArttu Ylä-Outinen <arttu.yla-outinen@tut.fi>2015-09-28 10:55:14 +0300
committerArttu Ylä-Outinen <arttu.yla-outinen@tut.fi>2015-10-07 16:43:34 +0300
commitb3777b2c2eb5d04386992c0388985914d5bbebba (patch)
tree50bfa3f40241789ea6ad0033a378b447e0e85d8e /libavcodec
parentce7872903345c8637c2cfc4245cba4b34f6bbe40 (diff)
libkvazaar: Update to work with the latest version
Function encoder_encode in Kvazaar API was changed to have new output parameters: source picture and frame info. Frame info is used to set the keyframe flag and source picture is ignored. Signed-off-by: Arttu Ylä-Outinen <arttu.yla-outinen@tut.fi>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/libkvazaar.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
index 9fb5be7c79..7430e0ab7b 100644
--- a/libavcodec/libkvazaar.c
+++ b/libavcodec/libkvazaar.c
@@ -137,8 +137,11 @@ static int libkvazaar_encode(AVCodecContext *avctx,
{
int retval = 0;
kvz_picture *img_in = NULL;
+
kvz_data_chunk *data_out = NULL;
uint32_t len_out = 0;
+ kvz_frame_info frame_info;
+
LibkvazaarContext *ctx = avctx->priv_data;
*got_packet_ptr = 0;
@@ -173,7 +176,10 @@ static int libkvazaar_encode(AVCodecContext *avctx,
}
}
- if (!ctx->api->encoder_encode(ctx->encoder, img_in, &data_out, &len_out, NULL)) {
+ if (!ctx->api->encoder_encode(ctx->encoder, img_in,
+ &data_out, &len_out,
+ NULL, NULL,
+ &frame_info)) {
av_log(avctx, AV_LOG_ERROR, "Failed to encode frame.\n");
retval = AVERROR_EXTERNAL;
goto done;
@@ -198,6 +204,14 @@ static int libkvazaar_encode(AVCodecContext *avctx,
ctx->api->chunk_free(data_out);
data_out = NULL;
+
+ avpkt->flags = 0;
+ // IRAP VCL NAL unit types span the range
+ // [BLA_W_LP (16), RSV_IRAP_VCL23 (23)].
+ if (frame_info.nal_unit_type >= KVZ_NAL_BLA_W_LP &&
+ frame_info.nal_unit_type <= KVZ_NAL_RSV_IRAP_VCL23) {
+ avpkt->flags |= AV_PKT_FLAG_KEY;
+ }
}
done: