[FFmpeg-devel] [PATCH v2 4/4] lavc/libxavs2: replace 'FrameRate' with 'fps'

hwren hwrenx at 126.com
Mon Oct 14 06:09:17 EEST 2019


Remove deprecated parameter FrameRate (frame rate code) and use fps (frame rate) instead.
Avoid encoder warnings.

Signed-off-by: hwren <hwrenx at 126.com>
---
 libavcodec/libxavs2.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index e52f0c4..4e4e1b2 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -61,7 +61,8 @@ typedef struct XAVS2EContext {
 static av_cold int xavs2_init(AVCodecContext *avctx)
 {
     XAVS2EContext *cae = avctx->priv_data;
-    int            bit_depth, code;
+    int            bit_depth;
+    float          framerate;
 
     bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10;
 
@@ -78,8 +79,13 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
         return AVERROR(ENOMEM);
     }
 
+    if (avctx->framerate.den > 0 && avctx->framerate.num > 0) {
+        framerate = (float)avctx->framerate.num / (float)avctx->framerate.den;
+    }
+
     xavs2_opt_set2("Width", "%d", avctx->width);
     xavs2_opt_set2("Height", "%d", avctx->height);
+    xavs2_opt_set2("fps", "%.3f", framerate);
     xavs2_opt_set2("BFrames", "%d", avctx->max_b_frames);
     xavs2_opt_set2("BitDepth", "%d", bit_depth);
     xavs2_opt_set2("Log", "%d", cae->log_level);
@@ -113,9 +119,6 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
         xavs2_opt_set2("InitialQP", "%d", cae->qp);
     }
 
-    ff_mpeg12_find_best_frame_rate(avctx->framerate, &code, NULL, NULL, 0);
-    xavs2_opt_set2("FrameRate", "%d", code);
-
     cae->encoder = cae->api->encoder_create(cae->param);
     if (!cae->encoder) {
         av_log(avctx, AV_LOG_ERROR, "Can not create encoder. Null pointer returned\n");
-- 
2.7.4



More information about the ffmpeg-devel mailing list