VLC
2.1.0-git
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
src
video_output
statistic.h
Go to the documentation of this file.
1
/*****************************************************************************
2
* statistic.h : vout statistic
3
*****************************************************************************
4
* Copyright (C) 2009 Laurent Aimar
5
* $Id: 083b0d7aa74f1c8c5cf0dba1c67c5d6febb272db $
6
*
7
* Authors: 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 LIBVLC_VOUT_STATISTIC_H
25
# define LIBVLC_VOUT_STATISTIC_H
26
# include <
vlc_atomic.h
>
27
28
/* NOTE: Both statistics are atomic on their own, so one might be older than
29
* the other one. Currently, only one of them is updated at a time, so this
30
* is a non-issue. */
31
typedef
struct
{
32
atomic_uint
displayed
;
33
atomic_uint
lost
;
34
}
vout_statistic_t
;
35
36
static
inline
void
vout_statistic_Init
(
vout_statistic_t
*stat)
37
{
38
atomic_init
(&stat->
displayed
, 0);
39
atomic_init
(&stat->
lost
, 0);
40
}
41
42
static
inline
void
vout_statistic_Clean
(
vout_statistic_t
*stat)
43
{
44
(void) stat;
45
}
46
47
static
inline
void
vout_statistic_GetReset
(
vout_statistic_t
*stat,
int
*displayed,
int
*lost)
48
{
49
*displayed = atomic_exchange(&stat->
displayed
, 0);
50
*lost = atomic_exchange(&stat->
lost
, 0);
51
}
52
53
static
inline
void
vout_statistic_AddDisplayed
(
vout_statistic_t
*stat,
54
int
displayed)
55
{
56
atomic_fetch_add(&stat->
displayed
, displayed);
57
}
58
59
static
inline
void
vout_statistic_AddLost
(
vout_statistic_t
*stat,
int
lost)
60
{
61
atomic_fetch_add(&stat->
lost
, lost);
62
}
63
64
#endif
Generated by
1.8.1.2