12024
|
1 /*
|
|
2 The mediastreamer library aims at providing modular media processing and I/O
|
|
3 for linphone, but also for any telephony application.
|
|
4 Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
|
|
5
|
|
6 This library 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 This library 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 this library; if not, write to the Free Software
|
|
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19 */
|
|
20 #ifndef MSTIMER_H
|
|
21 #define MSTIMER_H
|
|
22
|
|
23 #include "mssync.h"
|
|
24 #include <sys/time.h>
|
|
25
|
|
26 #define MSTIMER_MAX_FILTERS 10
|
|
27
|
|
28 /* MSTimer derivates from MSSync base class*/
|
|
29
|
|
30 typedef struct _MSTimer
|
|
31 {
|
|
32 /* the MSSync must be the first field of the object in order to the object mechanism to work*/
|
|
33 MSSync sync;
|
|
34 MSFilter *filters[MSTIMER_MAX_FILTERS];
|
|
35 gint milisec; /* the interval */
|
|
36 struct timeval interval;
|
|
37 struct timeval orig;
|
|
38 gint state;
|
|
39 } MSTimer;
|
|
40
|
|
41
|
|
42 typedef struct _MSTimerClass
|
|
43 {
|
|
44 /* the MSSyncClass must be the first field of the class in order to the class mechanism to work*/
|
|
45 MSSyncClass parent_class;
|
|
46 } MSTimerClass;
|
|
47
|
|
48
|
|
49 /*private*/
|
|
50 #define MS_TIMER_RUNNING 1
|
|
51 #define MS_TIMER_STOPPED 0
|
|
52 void ms_timer_init(MSTimer *sync);
|
|
53 void ms_timer_class_init(MSTimerClass *sync);
|
|
54
|
|
55 void ms_timer_destroy(MSTimer *timer);
|
|
56 void ms_timer_synchronize(MSTimer *timer);
|
|
57
|
|
58 /*public*/
|
|
59 void ms_timer_set_interval(MSTimer *timer, gint milisec);
|
|
60
|
|
61 /* casts a MSSync object into a MSTimer */
|
|
62 #define MS_TIMER(sync) ((MSTimer*)(sync))
|
|
63 /* casts a MSSync class into a MSTimer class */
|
|
64 #define MS_TIMER_CLASS(klass) ((MSTimerClass*)(klass))
|
|
65
|
|
66 MSSync *ms_timer_new();
|
|
67
|
|
68 #endif
|