From patchwork Mon Oct 14 06:52:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hwren X-Patchwork-Id: 15737 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 D953944A374 for ; Mon, 14 Oct 2019 09:52:57 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B0A44689DCF; Mon, 14 Oct 2019 09:52:57 +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 980F8689924 for ; Mon, 14 Oct 2019 09:52: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=sfBG4TqL8c9AmA/6ht uOxrSS5DW08V88F/QkadIQXck=; b=c+twvdkoCpJR9KdtgDeMm5yYkyRNlHnQWo PYntcNYlci+v+IxK1/amQ8ozUP2ScRQGug8k4wamO3sM+RwUkWu1xJ+HL8ZkCWQR KFoRVLsaR5Jt2PC8EKZaR0UId8OZTjCXFceMyryfQoLq5rgkCWfe4ADdUdPbiiJp vX6Yf1yic= Received: from localhost.localdomain (unknown [162.105.23.171]) by smtp7 (Coremail) with SMTP id DsmowAAnl7c9G6RdkHHNCA--.39299S6; Mon, 14 Oct 2019 14:52:46 +0800 (CST) From: hwrenx@126.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 14 Oct 2019 14:52:44 +0800 Message-Id: <1571035964-4947-4-git-send-email-hwrenx@126.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1571035964-4947-1-git-send-email-hwrenx@126.com> References: <1571035964-4947-1-git-send-email-hwrenx@126.com> X-CM-TRANSID: DsmowAAnl7c9G6RdkHHNCA--.39299S6 X-Coremail-Antispam: 1Uf129KBjvJXoW7WF4rXFWrXr1UAFWktryrWFg_yoW8Zr1xpr 1UXrsIywn3Xan3AaykXr1Fv3Z8Cr1jv3W8Jan2kw1kZFWFqr98KFsrGFyUKa92vay8Ary5 Gr4ktr15Zw15K37anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07U_fHnUUUUU= X-Originating-IP: [162.105.23.171] X-CM-SenderInfo: pkzuv0b06rjloofrz/1tbiZh5O6VpD8RkbjwAAs6 Subject: [FFmpeg-devel] [PATCH v3 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 Cc: hwren MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: hwren 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) {