From patchwork Sun May 27 19:21:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 9106 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:11c:0:0:0:0:0 with SMTP id c28-v6csp1188726jad; Sun, 27 May 2018 12:22:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIgBwMmwjqz3f5/Bghi704TVvfBYkrkuWplZzMV6J/RD4lt42Ijsz58iIc/TCdvORR3TYaS X-Received: by 2002:a1c:e384:: with SMTP id a126-v6mr8153289wmh.93.1527448945719; Sun, 27 May 2018 12:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527448945; cv=none; d=google.com; s=arc-20160816; b=YfHj9mcSYuaN6P3Ghm5kG+CMj4zSRAdoDBM+PEy2WnthdDVi7jJhS3m+LsG5AG1lgK sAWFC5GPHG2GfHL9KKXg1Fgw6zIUcUSxAaf05woYZIqRjMJgWdC01F/VuZRlTpGxV5pg 6LMb0GyeCdl50Qry0Cv5GB4TTcqjMeOItaBOS//7umjSG2ZdljvEiBMjpti1kkpqSk4J xSKA4dSBW8kE1bnwMrLDEztlTHZ0uPh3l20EJvY93Dd/x1BEeJLsYBiowssZjnUrmrX4 a9UiUe7IjKd8OWBfo8tEwMIRZ86nxDkygXIYDYT3BjGbpD+TO3rnqmBG3uh38xfMZf53 41WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=UocTAoAZTeFbf95S437ZBT1WSjMKfJvgyiuLdoAyJ8c=; b=G+qTViYFUi/zvefz1w6hBgCib0rSVo30d6NnnY6EhTdcZi1cEjAtNfASKMfo5/zSUl MhquDhLqeVM2Vn4fmwGkcTLwGW4X6FdklbcVJvC4nGoryeUL29c/aTgrwgUNd9vTT0m+ S+5NEI+ijokYZR6PZAEYEaAHxGij9BntJLhbdRbrY/BOPTEejeC1OJ2CcQxmVVpABmwq NXUhNMIX1bL96jf8aZcNYzZy+sCTEplNcrKETS2/mAOd4nYMVHx/f3Eqd5/eQbPtS5MR 3uli668KKr1dOVqmnvDcLG7NoB4vg3znUvovkY6kF9f+K+FjMgeQ2gywRdG4h9087taE QrHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g50-v6si8080391wrd.55.2018.05.27.12.22.25; Sun, 27 May 2018 12:22:25 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8014168A2D6; Sun, 27 May 2018 22:21:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B3A8868920E for ; Sun, 27 May 2018 22:21:18 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 247C4E1097; Sun, 27 May 2018 21:22:02 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1V0Z4xsmZ025; Sun, 27 May 2018 21:22:01 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id F24E6E08D1; Sun, 27 May 2018 21:22:00 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 27 May 2018 21:21:51 +0200 Message-Id: <20180527192154.25996-2-cus@passwd.hu> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180527192154.25996-1-cus@passwd.hu> References: <20180527192154.25996-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 2/5] avformat/mxfdec: use int math for sample count calculation 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: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This also changes the rounding to nearest. Signed-off-by: Marton Balint --- libavformat/mxfdec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 40c9e0c3a9..78a2aa7289 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -3167,8 +3167,7 @@ static int mxf_compute_sample_count(MXFContext *mxf, int stream_index, if (!spf) { int remainder = (sample_rate.num * time_base.num) % (time_base.den * sample_rate.den); - *sample_count = av_q2d(av_mul_q((AVRational){mxf->current_edit_unit, 1}, - av_mul_q(sample_rate, time_base))); + *sample_count = av_rescale_q(mxf->current_edit_unit, sample_rate, track->edit_rate); if (remainder) av_log(mxf->fc, AV_LOG_WARNING, "seeking detected on stream #%d with time base (%d/%d) and "