]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/libx264.c
lavc: Move b_frame_strategy and b_sensitivity to codec private options
[ffmpeg] / libavcodec / libx264.c
index fe0247f9a3cda86c4613105fd933d7ce8a67082d..5db00ff54015cf0fe9c118f0fd61d66846d2035c 100644 (file)
@@ -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" },