Coverage Report

Created: 2026-09-03 07:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/vlc/modules/demux/mpeg/timestamps.h
Line
Count
Source
1
/*****************************************************************************
2
 * timestamps.h: MPEG TS/PS Timestamps helpers
3
 *****************************************************************************
4
 * Copyright (C) 2004-2016 VLC authors and VideoLAN
5
 *
6
 * This program is free software; you can redistribute it and/or modify it
7
 * under the terms of the GNU Lesser General Public License as published by
8
 * the Free Software Foundation; either version 2.1 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program 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
14
 * GNU Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 *****************************************************************************/
19
#ifndef VLC_MPEG_TIMESTAMPS_H
20
#define VLC_MPEG_TIMESTAMPS_H
21
22
#ifndef __cplusplus
23
_Static_assert(CLOCK_FREQ == 1000000, "FROM|TO_SCALE_NZ not matching CLOCK_FREQ");
24
#endif
25
26
4.89M
#define FROM_SCALE_NZ(x) (((vlc_tick_t)(x) * 100 / 9))
27
1.25M
#define TO_SCALE_NZ(x)   ((x) * 9 / 100)
28
29
3.67M
#define FROM_SCALE(x) (VLC_TICK_0 + FROM_SCALE_NZ(x))
30
1.25M
#define TO_SCALE(x)   TO_SCALE_NZ((x) - VLC_TICK_0)
31
32
typedef int64_t ts_90khz_t;
33
36.4M
#define TS_90KHZ_INVALID -1
34
35
254k
#define TS_33BITS_ROLL_NZ      FROM_SCALE_NZ(0x1FFFFFFFF)
36
136k
#define TS_33BITS_HALF_ROLL_NZ FROM_SCALE_NZ(0x0FFFFFFFF)
37
38
static inline vlc_tick_t TimeStampWrapAround( vlc_tick_t i_past_pcr, vlc_tick_t i_time )
39
336k
{
40
336k
    if( i_past_pcr == VLC_TICK_INVALID || i_time >= i_past_pcr )
41
199k
        return i_time;
42
43
136k
    vlc_tick_t delta = i_past_pcr - i_time;
44
136k
    if( delta >= TS_33BITS_HALF_ROLL_NZ )
45
84.7k
    {
46
84.7k
        vlc_tick_t rolls = (delta + TS_33BITS_ROLL_NZ - 1) / TS_33BITS_ROLL_NZ;
47
84.7k
        i_time += rolls * TS_33BITS_ROLL_NZ;
48
84.7k
    }
49
50
136k
    return i_time;
51
336k
}
Unexecuted instantiation: ps.c:TimeStampWrapAround
Unexecuted instantiation: pva.c:TimeStampWrapAround
Unexecuted instantiation: ty.c:TimeStampWrapAround
Unexecuted instantiation: vobsub.c:TimeStampWrapAround
ts.c:TimeStampWrapAround
Line
Count
Source
39
335k
{
40
335k
    if( i_past_pcr == VLC_TICK_INVALID || i_time >= i_past_pcr )
41
199k
        return i_time;
42
43
135k
    vlc_tick_t delta = i_past_pcr - i_time;
44
135k
    if( delta >= TS_33BITS_HALF_ROLL_NZ )
45
84.1k
    {
46
84.1k
        vlc_tick_t rolls = (delta + TS_33BITS_ROLL_NZ - 1) / TS_33BITS_ROLL_NZ;
47
84.1k
        i_time += rolls * TS_33BITS_ROLL_NZ;
48
84.1k
    }
49
50
135k
    return i_time;
51
335k
}
Unexecuted instantiation: ts_pid.c:TimeStampWrapAround
ts_psi.c:TimeStampWrapAround
Line
Count
Source
39
1.42k
{
40
1.42k
    if( i_past_pcr == VLC_TICK_INVALID || i_time >= i_past_pcr )
41
0
        return i_time;
42
43
1.42k
    vlc_tick_t delta = i_past_pcr - i_time;
44
1.42k
    if( delta >= TS_33BITS_HALF_ROLL_NZ )
45
536
    {
46
536
        vlc_tick_t rolls = (delta + TS_33BITS_ROLL_NZ - 1) / TS_33BITS_ROLL_NZ;
47
536
        i_time += rolls * TS_33BITS_ROLL_NZ;
48
536
    }
49
50
1.42k
    return i_time;
51
1.42k
}
Unexecuted instantiation: ts_si.c:TimeStampWrapAround
Unexecuted instantiation: ts_psip.c:TimeStampWrapAround
Unexecuted instantiation: ts_streams.c:TimeStampWrapAround
Unexecuted instantiation: ts_scte.c:TimeStampWrapAround
Unexecuted instantiation: ts_arib.c:TimeStampWrapAround
Unexecuted instantiation: ts_sl.c:TimeStampWrapAround
Unexecuted instantiation: ts_metadata.c:TimeStampWrapAround
Unexecuted instantiation: ts_hotfixes.c:TimeStampWrapAround
Unexecuted instantiation: ts_pes.c:TimeStampWrapAround
Unexecuted instantiation: cvdsub.c:TimeStampWrapAround
Unexecuted instantiation: svcdsub.c:TimeStampWrapAround
Unexecuted instantiation: textst.c:TimeStampWrapAround
52
53
#endif