From be00ec832c519427cd92218abac77dafdc1d5487 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Mon, 30 Nov 2015 12:17:31 -0500 Subject: lavc: Deprecate coder_type and its symbols Most option values are simply unused or ignored and in practice the majory of codecs only need to check whether to enable rle or not. Add appropriate codec private options which better expose the allowed features. Signed-off-by: Vittorio Giovara --- libavcodec/libx264.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'libavcodec/libx264.c') diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index e2648f3e76..fe0247f9a3 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -78,6 +78,8 @@ typedef struct X264Context { int nal_hrd; int motion_est; int forced_idr; + int coder; + char *x264_params; } X264Context; @@ -441,8 +443,12 @@ static av_cold int X264_init(AVCodecContext *avctx) x4->params.i_bframe_adaptive = avctx->b_frame_strategy; if (avctx->keyint_min >= 0) x4->params.i_keyint_min = avctx->keyint_min; +#if FF_API_CODER_TYPE +FF_DISABLE_DEPRECATION_WARNINGS if (avctx->coder_type >= 0) - x4->params.b_cabac = avctx->coder_type == FF_CODER_TYPE_AC; + x4->coder = avctx->coder_type == FF_CODER_TYPE_AC; +FF_ENABLE_DEPRECATION_WARNINGS +#endif if (avctx->me_cmp >= 0) x4->params.analyse.b_chroma_me = avctx->me_cmp & FF_CMP_CHROMA; @@ -518,6 +524,9 @@ FF_ENABLE_DEPRECATION_WARNINGS #endif } + if (x4->coder >= 0) + x4->params.b_cabac = x4->coder; + 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); @@ -717,6 +726,11 @@ static const AVOption options[] = { { "esa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_ESA }, INT_MIN, INT_MAX, VE, "motion-est" }, { "tesa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_TESA }, INT_MIN, INT_MAX, VE, "motion-est" }, { "forced-idr", "If forwarding iframes, require them to be IDR frames.", OFFSET(forced_idr), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, + { "coder", "Coder type", OFFSET(coder), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE, "coder" }, + { "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" }, + { "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 }, }; @@ -742,7 +756,9 @@ static const AVCodecDefault x264_defaults[] = { { "subq", "-1" }, { "b_strategy", "-1" }, { "keyint_min", "-1" }, +#if FF_API_CODER_TYPE { "coder", "-1" }, +#endif { "cmp", "-1" }, { "threads", AV_STRINGIFY(X264_THREADS_AUTO) }, { "thread_type", "0" }, -- cgit v1.2.3