From patchwork Mon Dec 2 07:29:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hwren X-Patchwork-Id: 16528 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 064E144AE28 for ; Mon, 2 Dec 2019 10:01:21 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DE3D568AFED; Mon, 2 Dec 2019 10:01:20 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-m963.mail.126.com (mail-m963.mail.126.com [123.126.96.3]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 079F368AF5E for ; Mon, 2 Dec 2019 10:01:11 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=yzs/r74lDSBROI/tqS wKzOWM3DPlPknuYQIbjcMsQxI=; b=eXDQYo+sk/ZFPAGFAxNapYDY7jjU6QL1h1 m6DZRJS05goUiC0Kp5sn9cY1atabNPCd+uaZRZ6ryHwLkMfEMV7xxYoKoVRBD1Cu H188i+4c22ocNIMC4pq0D9Ur3FYS4C8WJu5siwWTMA35PiOG2Vhd5mNBMOFpEzUG d9MefJ9TI= Received: from localhost.localdomain (unknown [114.242.250.14]) by smtp8 (Coremail) with SMTP id NORpCgDH9f1nveRdvJacAA--.787S6; Mon, 02 Dec 2019 15:29:47 +0800 (CST) From: hwren To: ffmpeg-devel@ffmpeg.org Date: Mon, 2 Dec 2019 15:29:39 +0800 Message-Id: <1575271780-20422-4-git-send-email-hwrenx@126.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1575271780-20422-1-git-send-email-hwrenx@126.com> References: <1575271780-20422-1-git-send-email-hwrenx@126.com> X-CM-TRANSID: NORpCgDH9f1nveRdvJacAA--.787S6 X-Coremail-Antispam: 1Uf129KBjvJXoW7Ar47tw4UGF1UKr45XrWUArb_yoW8XFyDpr 12qrnIyrn3Xan3AayDJF1FvF1DCryYq3W8Jan2kw10vFWFvr98KFZrGFyUKa92vay8ArW5 Wa1ktr15Zws8K37anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jnvtAUUUUU= X-Originating-IP: [114.242.250.14] X-CM-SenderInfo: pkzuv0b06rjloofrz/1tbiJAt-6VpD+QW2AgAAso Subject: [FFmpeg-devel] [PATCH 4/5] lavc/libxavs2.c: replace deprecated parameter 'FrameRate' with new parameter 'fps' X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: hwren --- libavcodec/libxavs2.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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) {