From 0e6c8532215790bbe560a9eea4f3cc82bb55cf92 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Wed, 9 Sep 2015 04:18:26 +0200 Subject: lavc: Move b_frame_strategy and b_sensitivity to codec private options The b_frame_strategy option is only used by mpegvideoenc, qsv, x264, and xavs, while b_sensitivity is only used by mpegvideoenc. These are very codec-specific options, so deprecate the global variants. Set proper limits to the maximum allowed values. Signed-off-by: Vittorio Giovara --- libavcodec/libx264.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'libavcodec/libx264.c') diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index fe0247f9a3..5db00ff540 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -79,6 +79,7 @@ typedef struct X264Context { int motion_est; int forced_idr; int coder; + int b_frame_strategy; char *x264_params; } X264Context; @@ -439,8 +440,12 @@ static av_cold int X264_init(AVCodecContext *avctx) x4->params.analyse.i_noise_reduction = avctx->noise_reduction; if (avctx->me_subpel_quality >= 0) x4->params.analyse.i_subpel_refine = avctx->me_subpel_quality; +#if FF_API_PRIVATE_OPT +FF_DISABLE_DEPRECATION_WARNINGS if (avctx->b_frame_strategy >= 0) - x4->params.i_bframe_adaptive = avctx->b_frame_strategy; + x4->b_frame_strategy = avctx->b_frame_strategy; +FF_ENABLE_DEPRECATION_WARNINGS +#endif if (avctx->keyint_min >= 0) x4->params.i_keyint_min = avctx->keyint_min; #if FF_API_CODER_TYPE @@ -527,6 +532,9 @@ FF_ENABLE_DEPRECATION_WARNINGS if (x4->coder >= 0) x4->params.b_cabac = x4->coder; + if (x4->b_frame_strategy >= 0) + x4->params.i_bframe_adaptive = x4->b_frame_strategy; + if (x4->profile) if (x264_param_apply_profile(&x4->params, x4->profile) < 0) { av_log(avctx, AV_LOG_ERROR, "Error setting profile %s.\n", x4->profile); @@ -730,6 +738,7 @@ static const AVOption options[] = { { "default", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, INT_MIN, INT_MAX, VE, "coder" }, { "cavlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "coder" }, { "cabac", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "coder" }, + { "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 2, VE }, { "x264-params", "Override the x264 configuration using a :-separated list of key=value parameters", OFFSET(x264_params), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, { NULL }, @@ -754,7 +763,9 @@ static const AVCodecDefault x264_defaults[] = { { "me_method", "-1" }, #endif { "subq", "-1" }, +#if FF_API_PRIVATE_OPT { "b_strategy", "-1" }, +#endif { "keyint_min", "-1" }, #if FF_API_CODER_TYPE { "coder", "-1" }, -- cgit v1.2.3