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 2DB0740EAF for ; Fri, 11 Mar 2022 17:17:59 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3179268B20E; Fri, 11 Mar 2022 19:17:39 +0200 (EET) Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DF6B468B1AD for ; Fri, 11 Mar 2022 19:17:32 +0200 (EET) Received: by mail-pf1-f171.google.com with SMTP id s42so8419582pfg.0 for ; Fri, 11 Mar 2022 09:17:32 -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=LvwfvNlGVHZuhVtg+lmT5bw4ndoYln0ZV2ufauG2Ems=; b=vm7iTSSTlJwRR10OE7Y+E7kYXgC8A4/rKaUNjzxGYBunpmkH/Q2TrapqQnV7EPy/49 /MenFi8sneltxaVnSqJi70g1o/EJa5J6/DT1pfE9Ni5KI3VEqIy7Fu1jYLUyblca9QeH OPMNG0JC+CKsKp60ucS2OMVN5PBqgB4XnklADeksoVMWAwKJjijy5kY5haG/JWMritqM 8D4C4G+r93GANeDmrNdUyushrP8x64io0QR6O8DIRTX7FF+96HBZT/5lVEwv84uw/4Pt Of3kLQlIAl6EHGTYOp1GN+JMIEDJzCYTexU2S/MiTnVJZ2wfDp2+KNyyssPEDZotaY10 us/w== X-Gm-Message-State: AOAM530uU21nmkd4kDjfTtxWOHJZGkC2g7PAxD05BXCxCuKRKGwqzVpi yXcH/WQI6CwBSeTKD1Pl40t3bnOdfEU= X-Google-Smtp-Source: ABdhPJxspdYqsZVDcuUyZpDPlRoQ1DyBJN2gSIbG2I11rbqH2c3zM9z+Fb2a5nS7Pf1ukTOMsQeQkg== X-Received: by 2002:a05:6a00:a2a:b0:4f7:68db:5e60 with SMTP id p42-20020a056a000a2a00b004f768db5e60mr11249941pfh.58.1647019050550; Fri, 11 Mar 2022 09:17:30 -0800 (PST) Received: from localhost (76-14-89-2.sf-cable.astound.net. [76.14.89.2]) by smtp.gmail.com with ESMTPSA id m8-20020a17090a158800b001bf2cec0377sm14952851pja.3.2022.03.11.09.17.28 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Mar 2022 09:17:30 -0800 (PST) Received: by localhost (sSMTP sendmail emulation); Fri, 11 Mar 2022 09:17:26 -0800 From: pal@sandflow.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 11 Mar 2022 09:16:51 -0800 Message-Id: <20220311171653.17420-5-pal@sandflow.com> X-Mailer: git-send-email 2.35.1.windows.2 In-Reply-To: <20220311171653.17420-1-pal@sandflow.com> References: <20220311171653.17420-1-pal@sandflow.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 5/7] avformat/tests: add test for ff_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/Makefile | 1 + libavformat/tests/.gitignore | 1 + libavformat/tests/seek_utils.c | 57 ++++++++++++++++++++++++++++++++++ tests/fate/libavformat.mak | 5 +++ 4 files changed, 64 insertions(+) create mode 100644 libavformat/tests/seek_utils.c diff --git a/libavformat/Makefile b/libavformat/Makefile index 6566e40cac..3acc939551 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -707,6 +707,7 @@ SKIPHEADERS-$(CONFIG_NETWORK) += network.h rtsp.h TESTPROGS = seek \ url \ + seek_utils # async \ FIFO-MUXER-TESTPROGS-$(CONFIG_NETWORK) += fifo_muxer diff --git a/libavformat/tests/.gitignore b/libavformat/tests/.gitignore index aabf76345e..cdd0cce061 100644 --- a/libavformat/tests/.gitignore +++ b/libavformat/tests/.gitignore @@ -6,3 +6,4 @@ /seek /srtp /url +/seek_utils diff --git a/libavformat/tests/seek_utils.c b/libavformat/tests/seek_utils.c new file mode 100644 index 0000000000..cc679dca05 --- /dev/null +++ b/libavformat/tests/seek_utils.c @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2022 Pierre-Anthony Lemieux + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavformat/internal.h" + +int main(void) +{ + int64_t ts_min; + int64_t ts; + int64_t ts_max; + + ts_min = 10; + ts = 20; + ts_max = 30; + + ff_rescale_interval(av_make_q(1, 1), av_make_q(10, 1), &ts_min, &ts, &ts_max); + + if (ts_min != 1 || ts != 2 || ts_max != 3) + return 1; + + ts_min = 10; + ts = 32; + ts_max = 32; + + ff_rescale_interval(av_make_q(1, 1), av_make_q(3, 1), &ts_min, &ts, &ts_max); + + if (ts_min != 4 || ts != 11 || ts_max != 10) + return 1; + + ts_min = 10; + ts = 10; + ts_max = 32; + + ff_rescale_interval(av_make_q(1, 1), av_make_q(3, 1), &ts_min, &ts, &ts_max); + + if (ts_min != 4 || ts != 3 || ts_max != 10) + return 1; + + return 0; +} diff --git a/tests/fate/libavformat.mak b/tests/fate/libavformat.mak index 59ff0ebc8d..d2acb4c9e0 100644 --- a/tests/fate/libavformat.mak +++ b/tests/fate/libavformat.mak @@ -26,6 +26,11 @@ FATE_LIBAVFORMAT-$(CONFIG_IMF_DEMUXER) += fate-imf fate-imf: libavformat/tests/imf$(EXESUF) fate-imf: CMD = run libavformat/tests/imf$(EXESUF) +FATE_LIBAVFORMAT += fate-seek_utils +fate-seek_utils: libavformat/tests/seek_utils$(EXESUF) +fate-seek_utils: CMD = run libavformat/tests/seek_utils$(EXESUF) +fate-seek_utils: CMP = null + FATE_LIBAVFORMAT += $(FATE_LIBAVFORMAT-yes) FATE-$(CONFIG_AVFORMAT) += $(FATE_LIBAVFORMAT) fate-libavformat: $(FATE_LIBAVFORMAT) -- 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".