From patchwork Mon Oct 14 13:22:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hwren X-Patchwork-Id: 15749 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 ECA9D44823B for ; Mon, 14 Oct 2019 16:22:58 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DA273689B45; Mon, 14 Oct 2019 16:22:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from m15-114.126.com (m15-114.126.com [220.181.15.114]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BC904689A59 for ; Mon, 14 Oct 2019 16:22:50 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=kVGg7Eir7t46n7W/tb 3EHvbhAgLQzmwZr21Qyq7ZSP4=; b=ki8i11Jr1Tf+CwnsRmxavlCUmGlnPa9aIo KDUFh5H17PgBsUy82y/Uog4tGncDyM8chjoOXmVyr9yBUCwGPOpp8yrwBbpdPkVI ujNjlnK0HPJB3yFe4w3WYe7HgdW20M/nlfscZrffGrjtjovghai+opmgt5vQ1S0b BRNMnpJEs= Received: from localhost.localdomain (unknown [115.27.199.30]) by smtp7 (Coremail) with SMTP id DsmowABHJr+mdqRdNhTeCA--.41504S6; Mon, 14 Oct 2019 21:22:47 +0800 (CST) From: hwren To: ffmpeg-devel@ffmpeg.org Date: Mon, 14 Oct 2019 21:22:45 +0800 Message-Id: <1571059365-3263-4-git-send-email-hwrenx@126.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1571059365-3263-1-git-send-email-hwrenx@126.com> References: <4703a40a.8758.16dca6c60d6.Coremail.hwrenx@126.com> <1571059365-3263-1-git-send-email-hwrenx@126.com> X-CM-TRANSID: DsmowABHJr+mdqRdNhTeCA--.41504S6 X-Coremail-Antispam: 1Uf129KBjvJXoW7WF4rXFWrXr1UAFWktryrWFg_yoW8CF4Upr 1UXrsIyrn3Xan3AaykXr4Fv3Z8Cryjv3W8Jan2kw1kZFWFvr98KFZrGFyUKa92vay8Ary5 Ga1ktr15Zr45K37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07ja_M3UUUUU= X-Originating-IP: [115.27.199.30] X-CM-SenderInfo: pkzuv0b06rjloofrz/1tbiDwhO6VpD+eWuBgAAsN Subject: [FFmpeg-devel] [PATCH v5 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..0ee3f4d 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; + double 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 = av_q2d(avctx->framerate); + } + 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", "%.3lf", 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) {