/src/vlc/src/clock/clock_internal.h
Line | Count | Source (jump to first uncovered line) |
1 | | /***************************************************************************** |
2 | | * clock_internal.h: Clock internal functions |
3 | | ***************************************************************************** |
4 | | * Copyright (C) 2018 VLC authors and VideoLAN |
5 | | * |
6 | | * Authors: Christophe Massiot <massiot@via.ecp.fr> |
7 | | * Laurent Aimar < fenrir _AT_ videolan _DOT_ org > |
8 | | * |
9 | | * This program is free software; you can redistribute it and/or modify it |
10 | | * under the terms of the GNU Lesser General Public License as published by |
11 | | * the Free Software Foundation; either version 2.1 of the License, or |
12 | | * (at your option) any later version. |
13 | | * |
14 | | * This program is distributed in the hope that it will be useful, |
15 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | | * GNU Lesser General Public License for more details. |
18 | | * |
19 | | * You should have received a copy of the GNU Lesser General Public License |
20 | | * along with this program; if not, write to the Free Software Foundation, |
21 | | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
22 | | *****************************************************************************/ |
23 | | |
24 | | #ifndef CLOCK_INTERNAL_H |
25 | | # define CLOCK_INTERNAL_H |
26 | | |
27 | | #include <vlc_common.h> |
28 | | |
29 | | /* Maximum gap allowed between two CRs. */ |
30 | 0 | #define CR_MAX_GAP VLC_TICK_FROM_SEC(60) |
31 | | |
32 | | /***************************************************************************** |
33 | | * Structures |
34 | | *****************************************************************************/ |
35 | | |
36 | | /** |
37 | | * This structure holds long term moving average |
38 | | */ |
39 | | typedef struct |
40 | | { |
41 | | double value; /* The average value */ |
42 | | int count; /* The number of sample evaluated */ |
43 | | int range; /* The maximum range of sample on which we calculate the average*/ |
44 | | } average_t; |
45 | | |
46 | | void AvgInit(average_t *, int range); |
47 | | void AvgClean(average_t *); |
48 | | |
49 | | void AvgReset(average_t *); |
50 | | void AvgResetAndFill(average_t *, double value); |
51 | | |
52 | | /* calculates (previous_average * (range - 1) + new_value)/range */ |
53 | | void AvgUpdate(average_t *, double value); |
54 | | |
55 | | double AvgGet(average_t *); |
56 | | void AvgRescale(average_t *, int range); |
57 | | |
58 | | /* */ |
59 | | typedef struct |
60 | | { |
61 | | vlc_tick_t system; |
62 | | vlc_tick_t stream; |
63 | | } clock_point_t; |
64 | | |
65 | | static inline clock_point_t clock_point_Create(vlc_tick_t system, vlc_tick_t stream) |
66 | 0 | { |
67 | 0 | return (clock_point_t) { .system = system, .stream = stream }; |
68 | 0 | } Unexecuted instantiation: clock.c:clock_point_Create Unexecuted instantiation: clock_internal.c:clock_point_Create Unexecuted instantiation: input_clock.c:clock_point_Create |
69 | | |
70 | | #endif |