Add extra codec-specific bit rate control configuration callback interface.
Signed-off-by: Jun Zhao <jun.z...@intel.com> --- libavcodec/vaapi_encode.c | 9 +++++++++ libavcodec/vaapi_encode.h | 3 +++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 2fe8501..0e7f0a1 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -1261,6 +1261,7 @@ static av_cold int vaapi_encode_init_rate_control(AVCodecContext *avctx) int fr_num, fr_den; VAConfigAttrib rc_attr = { VAConfigAttribRateControl }; VAStatus vas; + int err; vas = vaGetConfigAttributes(ctx->hwctx->display, ctx->va_profile, ctx->va_entrypoint, @@ -1412,6 +1413,14 @@ static av_cold int vaapi_encode_init_rate_control(AVCodecContext *avctx) .max_qp = (avctx->qmax > 0 ? avctx->qmax : 0), #endif }; + if (ctx->codec->bit_rate_control) { + err = ctx->codec->bit_rate_control(avctx); + if (err < 0) { + av_log(avctx, AV_LOG_ERROR, "Codec specific bit rate control setting " + "failed: %d.\n", err); + return err; + } + } vaapi_encode_add_global_param(avctx, &ctx->rc_params.misc, sizeof(ctx->rc_params)); diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h index 965fe65..c40de65 100644 --- a/libavcodec/vaapi_encode.h +++ b/libavcodec/vaapi_encode.h @@ -268,6 +268,9 @@ typedef struct VAAPIEncodeType { // add any necessary global parameters). int (*configure)(AVCodecContext *avctx); + // Perform any extra codec-specific bit rate control configuration + int (*bit_rate_control)(AVCodecContext *avctx); + // The size of the parameter structures: // sizeof(VAEnc{type}ParameterBuffer{codec}). size_t sequence_params_size; -- 1.7.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel