QtGStreamer  0.10.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
clock.cpp
1 /*
2  Copyright (C) 2010 Collabora Multimedia.
3  @author Mauricio Piacentini <mauricio.piacentini@collabora.co.uk>
4 
5  This library is free software; you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published
7  by the Free Software Foundation; either version 2.1 of the License, or
8  (at your option) any later version.
9 
10  This program 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
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #include "clock.h"
19 
20 #include <QtCore/QTime>
21 #include <gst/gstclock.h>
22 #include <gst/gstsystemclock.h>
23 
24 namespace QGst {
25 
26 ClockPtr Clock::systemClock()
27 {
28  return ClockPtr::wrap(gst_system_clock_obtain(), false);
29 }
30 
31 ClockTime Clock::clockTime() const
32 {
33  GstClockTime t = gst_clock_get_time(object<GstClock>());
34  return t;
35 }
36 
37 ClockTime Clock::resolution() const
38 {
39  GstClockTime t = gst_clock_get_resolution(object<GstClock>());
40  return t;
41 }
42 
43 QTime Clock::time() const
44 {
45  return clockTime().toTime();
46 }
47 
48 }