FFmpeg
libavformat
tests
seek_utils.c
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2022 Pierre-Anthony Lemieux <pal@palemieux.com>
3
*
4
* This file is part of FFmpeg.
5
*
6
* FFmpeg is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2.1 of the License, or (at your option) any later version.
10
*
11
* FFmpeg is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with FFmpeg; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
21
#include "
libavformat/demux.h
"
22
23
int
main
(
void
)
24
{
25
int64_t
ts_min;
26
int64_t
ts;
27
int64_t
ts_max;
28
29
ts_min = 10;
30
ts = 20;
31
ts_max = 30;
32
33
ff_rescale_interval
(
av_make_q
(1, 1),
av_make_q
(10, 1), &ts_min, &ts, &ts_max);
34
35
if
(ts_min != 1 || ts != 2 || ts_max != 3)
36
return
1;
37
38
ts_min = 10;
39
ts = 32;
40
ts_max = 32;
41
42
ff_rescale_interval
(
av_make_q
(1, 1),
av_make_q
(3, 1), &ts_min, &ts, &ts_max);
43
44
if
(ts_min != 4 || ts != 11 || ts_max != 10)
45
return
1;
46
47
ts_min = 10;
48
ts = 10;
49
ts_max = 32;
50
51
ff_rescale_interval
(
av_make_q
(1, 1),
av_make_q
(3, 1), &ts_min, &ts, &ts_max);
52
53
if
(ts_min != 4 || ts != 3 || ts_max != 10)
54
return
1;
55
56
return
0;
57
}
int64_t
long long int64_t
Definition:
coverity.c:34
ff_rescale_interval
void ff_rescale_interval(AVRational tb_in, AVRational tb_out, int64_t *min_ts, int64_t *ts, int64_t *max_ts)
Rescales a timestamp and the endpoints of an interval to which the temstamp belongs,...
Definition:
seek.c:765
av_make_q
static AVRational av_make_q(int num, int den)
Create an AVRational.
Definition:
rational.h:71
demux.h
main
int main(void)
Definition:
seek_utils.c:23
Generated on Thu Nov 21 2024 19:22:47 for FFmpeg by
1.8.17