From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 6AE7F4024F for ; Mon, 21 Feb 2022 06:03:52 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 82E3268B14F; Mon, 21 Feb 2022 08:03:08 +0200 (EET) Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8E30168B13D for ; Mon, 21 Feb 2022 08:03:01 +0200 (EET) Received: by mail-pj1-f50.google.com with SMTP id m22so333017pja.0 for ; Sun, 20 Feb 2022 22:03:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9pvOn/n5aSCyCuMStVk9ge0QR6f3t/3nkGNqje/Yl24=; b=IHHh1ut73gvqii9Ax89xsQGLpmymfI1ft7WKNeokxh+GIz6tR5VtiyOg/mbFZqlnsn +iDoTvJvBGuGj+hUx4FogJQjgRT2U/1YPRjS05dO7nzS636rrVnVpFjw8dLsWdgBziim aJZEuuY/Qi+D96oqAeZNO2m+IhITJenIJbmkWkYbrPnfRo3l3yfAY1KcdCmjxalDyGL7 uef+aNT/dDJnvgO3+BYCWgiiLdVjIzcP9EeoB2NxJsJCVtawnHvwjTBD7y7wt5ytbpQI PK9pmmt/+I0oq8iGVCRdniweypJ0hQ1wDVHy+SWBZdAG17fqpwWRjPmd7p/Ma7HKem6c t9tg== X-Gm-Message-State: AOAM532UqVJiwxvlqEEEvkKzSwM1hoPueQnMdz472LBfsyUG7JN+bGwb 3tQLnDUVb0YFVlMOsFXqb1N2dskmK3c= X-Google-Smtp-Source: ABdhPJzc1rD6yl7pU7ZobsVGbHkhD50bmrppIwbsCQAym6LBUuVEfh3hDjCiEiVFJ8PMq3+fH1BoEw== X-Received: by 2002:a17:902:7c94:b0:14d:77d2:a72e with SMTP id y20-20020a1709027c9400b0014d77d2a72emr18348095pll.153.1645423379682; Sun, 20 Feb 2022 22:02:59 -0800 (PST) Received: from localhost (76-14-89-2.sf-cable.astound.net. [76.14.89.2]) by smtp.gmail.com with ESMTPSA id k21sm6050786pff.25.2022.02.20.22.02.58 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 20 Feb 2022 22:02:59 -0800 (PST) Received: by localhost (sSMTP sendmail emulation); Sun, 20 Feb 2022 22:02:46 -0800 From: pal@sandflow.com To: ffmpeg-devel@ffmpeg.org Date: Sun, 20 Feb 2022 22:02:29 -0800 Message-Id: <20220221060230.6665-6-pal@sandflow.com> X-Mailer: git-send-email 2.35.1.windows.2 In-Reply-To: <20220221060230.6665-1-pal@sandflow.com> References: <20220221060230.6665-1-pal@sandflow.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 6/7] avformat/imf: refactor to use av_rescale_interval() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Pierre-Anthony Lemieux Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Pierre-Anthony Lemieux --- libavformat/imfdec.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index ac212b05e1..bc27e3cc2a 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -69,6 +69,7 @@ #include "libavutil/avstring.h" #include "libavutil/bprint.h" #include "libavutil/intreadwrite.h" +#include "libavutil/mathematics.h" #include "libavutil/opt.h" #include "mxf.h" #include "url.h" @@ -904,14 +905,6 @@ static int imf_probe(const AVProbeData *p) return AVPROBE_SCORE_MAX; } -static void rescale_interval(AVRational tb_in, AVRational tb_out, - int64_t *min_ts, int64_t *ts, int64_t *max_ts) -{ - *ts = av_rescale_q(*ts, tb_in, tb_out); - *min_ts = av_rescale_q_rnd(*min_ts, tb_in, tb_out, AV_ROUND_UP | AV_ROUND_PASS_MINMAX); - *max_ts = av_rescale_q_rnd(*max_ts, tb_in, tb_out, AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX); -} - static int coherent_ts(int64_t ts, AVRational in_tb, AVRational out_tb) { int dst_num; @@ -937,13 +930,13 @@ static int imf_seek(AVFormatContext *s, int stream_index, int64_t min_ts, /* rescale timestamps to Composition edit units */ if (stream_index < 0) - rescale_interval(AV_TIME_BASE_Q, - av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), - &min_ts, &ts, &max_ts); + av_rescale_interval(AV_TIME_BASE_Q, + av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), + &min_ts, &ts, &max_ts); else - rescale_interval(s->streams[stream_index]->time_base, - av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), - &min_ts, &ts, &max_ts); + av_rescale_interval(s->streams[stream_index]->time_base, + av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), + &min_ts, &ts, &max_ts); /* requested timestamp bounds are too close */ if (max_ts < min_ts) -- 2.17.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".