Debian Codegraph @

gstreamer/src/clockutils.ccg

raw
1 /* gstreamermm - a C++ wrapper for gstreamer
2 *
3 * Copyright 2008-2016 The gstreamermm Development Team
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include <gst/gst.h>
21
22 namespace Gst
23 {
24
25 const ClockTime CLOCK_TIME_NONE = GST_CLOCK_TIME_NONE;
26 const ClockTime SECOND = GST_SECOND;
27 const ClockTime MILLI_SECOND = GST_MSECOND;
28 const ClockTime MICRO_SECOND = GST_USECOND;
29 const ClockTime NANO_SECOND = GST_NSECOND;
30
31
32 guint get_hours(ClockTime time)
33 {
34 return GST_CLOCK_TIME_IS_VALID (time) ? time / (GST_SECOND * 60 * 60) : 99;
35 }
36
37 guint get_minutes(ClockTime time)
38 {
39 return GST_CLOCK_TIME_IS_VALID (time) ? (time / (GST_SECOND * 60)) % 60 : 99;
40 }
41
42 guint get_seconds(ClockTime time)
43 {
44 return GST_CLOCK_TIME_IS_VALID (time) ? (time / GST_SECOND) % 60 : 99;
45 }
46
47 guint get_milliseconds(ClockTime time)
48 {
49 return GST_CLOCK_TIME_IS_VALID (time) ? (time / GST_MSECOND) % 1000 : 999;
50 }
51
52 guint get_microseconds(ClockTime time)
53 {
54 return GST_CLOCK_TIME_IS_VALID (time) ? (time / GST_USECOND) % 1000 : 999;
55 }
56
57 guint get_nanoseconds(ClockTime time)
58 {
59 return GST_CLOCK_TIME_IS_VALID (time) ? (time / GST_NSECOND) % 1000 : 999;
60 }
61
62 guint get_fractional_seconds(ClockTime time)
63 {
64 return GST_CLOCK_TIME_IS_VALID (time) ? time % GST_SECOND : 999999999;
65 }
66
67 } //namespace Gst