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 A7759402C3 for ; Mon, 21 Feb 2022 06:04:01 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8E5A668B156; Mon, 21 Feb 2022 08:03:10 +0200 (EET) Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E98DA68B148 for ; Mon, 21 Feb 2022 08:03:03 +0200 (EET) Received: by mail-pl1-f174.google.com with SMTP id u12so12016306plf.13 for ; Sun, 20 Feb 2022 22:03:03 -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=jroqvSxaCglERAn03KjWSCqKytpoF/lZZOCVm82M1L8=; b=0MGoIMRY36T3EWlzGPpwAzGcOIgpdkX0xDtjz2mtxGC1N5IFPGU0Z07QdWzJZetWRy wtVRgNxd9/AWoz0bTSSWkEYpVIjZ8/ZfkeYI1pYelfLF6zAKylTXoyXseEVh1Ax7oQcs 977UVTc2+hOxw9tLhesIOt5BkTiqwbnCM6yxWt0MBnQ7crtQ3E+H2A8oNgvzMPjUeFqv NTDvt9VF4btCqVauWptL0FxH63PDQJ9I6my+yijJSTbhnN/x8H0qV+OJ80jrLSU9YwEj zfzSggw/gQ+SxEwS/N2h1dcsWdhXVFwIl+wTvgPONYjKAZwkY6sK08hvWBPxM7zNGVHs fX3A== X-Gm-Message-State: AOAM5316vLs5OOxS09LUmAqHfvYKRsYAR/OZme5XZwwLnAy0+9yrBvXp Sqt2HROfqcnglDLiy/S018ebE/8kLjA= X-Google-Smtp-Source: ABdhPJyCD/B+VgeoUJqhLC39ukBVQVRMrRjI+OQZPun8eKt1h/Ea6FPGKZPH3l1deH/nxDLyRoyuPA== X-Received: by 2002:a17:902:9a0a:b0:14a:199:bc5c with SMTP id v10-20020a1709029a0a00b0014a0199bc5cmr17268578plp.10.1645423382049; Sun, 20 Feb 2022 22:03:02 -0800 (PST) Received: from localhost (76-14-89-2.sf-cable.astound.net. [76.14.89.2]) by smtp.gmail.com with ESMTPSA id e20sm9610626pfv.42.2022.02.20.22.03.00 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 20 Feb 2022 22:03:01 -0800 (PST) Received: by localhost (sSMTP sendmail emulation); Sun, 20 Feb 2022 22:02:48 -0800 From: pal@sandflow.com To: ffmpeg-devel@ffmpeg.org Date: Sun, 20 Feb 2022 22:02:30 -0800 Message-Id: <20220221060230.6665-7-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 7/7] avformat/concat: 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/concatdec.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 0603c6e254..3ddbe833c9 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -22,6 +22,7 @@ #include "libavutil/avassert.h" #include "libavutil/bprint.h" #include "libavutil/intreadwrite.h" +#include "libavutil/mathematics.h" #include "libavutil/opt.h" #include "libavutil/parseutils.h" #include "libavutil/timestamp.h" @@ -816,16 +817,6 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt) return 0; } -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 try_seek(AVFormatContext *avf, int stream, int64_t min_ts, int64_t ts, int64_t max_ts, int flags) { @@ -838,8 +829,8 @@ static int try_seek(AVFormatContext *avf, int stream, if (stream >= 0) { if (stream >= cat->avf->nb_streams) return AVERROR(EIO); - rescale_interval(AV_TIME_BASE_Q, cat->avf->streams[stream]->time_base, - &min_ts, &ts, &max_ts); + av_rescale_interval(AV_TIME_BASE_Q, cat->avf->streams[stream]->time_base, + &min_ts, &ts, &max_ts); } return avformat_seek_file(cat->avf, stream, min_ts, ts, max_ts, flags); } @@ -853,8 +844,8 @@ static int real_seek(AVFormatContext *avf, int stream, if (stream >= 0) { if (stream >= avf->nb_streams) return AVERROR(EINVAL); - rescale_interval(avf->streams[stream]->time_base, AV_TIME_BASE_Q, - &min_ts, &ts, &max_ts); + av_rescale_interval(avf->streams[stream]->time_base, AV_TIME_BASE_Q, + &min_ts, &ts, &max_ts); } left = 0; -- 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".