[FFmpeg-devel,4/5] lavc/libxavs2.c: replace deprecated parameter 'FrameRate' with new parameter 'fps'

Submitted by hwren on Dec. 2, 2019, 7:29 a.m.

Details

Message ID 1575271780-20422-4-git-send-email-hwrenx@126.com
State New
Headers show

Commit Message

hwren Dec. 2, 2019, 7:29 a.m.
Signed-off-by: hwren <hwrenx@126.com>
---
 libavcodec/libxavs2.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index cf448be..41b7a29 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -60,10 +60,15 @@  typedef struct XAVS2EContext {
 static av_cold int xavs2_init(AVCodecContext *avctx)
 {
     XAVS2EContext *cae = avctx->priv_data;
-    int bit_depth, code;
+    int bit_depth;
+    double framerate = 30.0;
 
     bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10;
 
+    if (avctx->framerate.den > 0 && avctx->framerate.num > 0) {
+        framerate = av_q2d(avctx->framerate);
+    }
+
     /* get API handler */
     cae->api = xavs2_api_get(bit_depth);
     if (!cae->api) {
@@ -83,6 +88,7 @@  static av_cold int xavs2_init(AVCodecContext *avctx)
     xavs2_opt_set2("BitDepth",  "%d", bit_depth);
     xavs2_opt_set2("Log",       "%d", cae->log_level);
     xavs2_opt_set2("Preset",    "%d", cae->preset_level);
+    xavs2_opt_set2("fps",       "%.3lf", framerate);
 
     xavs2_opt_set2("IntraPeriodMax",    "%d", avctx->gop_size);
     xavs2_opt_set2("IntraPeriodMin",    "%d", avctx->gop_size);
@@ -115,9 +121,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) {