From patchwork Mon Oct 14 13:15:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hwren X-Patchwork-Id: 15746 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 621DE447A06 for ; Mon, 14 Oct 2019 16:16:17 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 40449689AD6; Mon, 14 Oct 2019 16:16:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from m15-113.126.com (m15-113.126.com [220.181.15.113]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1B7676881CE for ; Mon, 14 Oct 2019 16:16:08 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=SY1E6XT12RYepXWvmD 22vQ3y7gg8YDRk1+GGejfnci4=; b=JxID/FSaEUxWcpoCrjnk9z8f8ZuVeKMHpB lZB7pvlOvzq0F0KMPQcf8t8bbeNvHPAuVrAVi0kxUA8fJLpegiX5jlTMjblqdFp/ XSpmsGtN/wBX9SJdmslw+0dcapNWbWqmhgo3Me9RSBYtgH8tKXCdQhA2pEBylLaH 08wCiSe0Q= Received: from localhost.localdomain (unknown [115.27.199.30]) by smtp3 (Coremail) with SMTP id DcmowACHLCoVdaRdtnfpCQ--.36923S5; Mon, 14 Oct 2019 21:16:07 +0800 (CST) From: hwren To: ffmpeg-devel@ffmpeg.org Date: Mon, 14 Oct 2019 21:15:33 +0800 Message-Id: <1571058933-2928-4-git-send-email-hwrenx@126.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <599bee9a.869e.16dca6019ce.Coremail.hwrenx@126.com> References: <599bee9a.869e.16dca6019ce.Coremail.hwrenx@126.com> X-CM-TRANSID: DcmowACHLCoVdaRdtnfpCQ--.36923S5 X-Coremail-Antispam: 1Uf129KBjvJXoW7WF4rXFWrXr1UAFWktryrWFg_yoW8CFWkpr 1UXrsIywn3Xan3AaykXr1Fv3Z8Cr1jv3W8Jan2kw1kZFWFqr98KFsrGFyUKa92vay8Ary5 Ga1ktr15Zw15K37anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jxBMNUUUUU= X-Originating-IP: [115.27.199.30] X-CM-SenderInfo: pkzuv0b06rjloofrz/1tbiYBdO6VpD9vGFZAAAsv Subject: [FFmpeg-devel] [PATCH v4 4/4] lavc/libxavs2: replace 'FrameRate' with '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" Remove deprecated parameter FrameRate (frame rate code) and use fps (frame rate) instead. Avoid encoder warnings. Signed-off-by: hwren --- libavcodec/libxavs2.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index 8077607..382f745 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,6 +79,10 @@ 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("BFrames", "%d", avctx->max_b_frames); @@ -85,6 +90,7 @@ static av_cold int xavs2_init(AVCodecContext *avctx) xavs2_opt_set2("Log", "%d", cae->log_level); xavs2_opt_set2("Preset", "%d", cae->preset_level); xavs2_opt_set2("OpenGOP", "%d", !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)); + xavs2_opt_set2("fps", "%.3f", framerate); xavs2_opt_set2("IntraPeriodMax", "%d", avctx->gop_size); xavs2_opt_set2("IntraPeriodMin", "%d", avctx->gop_size); @@ -114,10 +120,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) {