1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD 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 gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gstreamer.SystemClock;
26 
27 private import gobject.ObjectG;
28 private import gstreamer.Clock;
29 private import gstreamerc.gstreamer;
30 public  import gstreamerc.gstreamertypes;
31 
32 
33 /**
34  * The GStreamer core provides a GstSystemClock based on the system time.
35  * Asynchronous callbacks are scheduled from an internal thread.
36  * 
37  * Clock implementors are encouraged to subclass this systemclock as it
38  * implements the async notification.
39  * 
40  * Subclasses can however override all of the important methods for sync and
41  * async notifications to implement their own callback methods or blocking
42  * wait operations.
43  */
44 public class SystemClock : Clock
45 {
46 	/** the main Gtk struct */
47 	protected GstSystemClock* gstSystemClock;
48 
49 	/** Get the main Gtk struct */
50 	public GstSystemClock* getSystemClockStruct()
51 	{
52 		return gstSystemClock;
53 	}
54 
55 	/** the main Gtk struct as a void* */
56 	protected override void* getStruct()
57 	{
58 		return cast(void*)gstSystemClock;
59 	}
60 
61 	protected override void setStruct(GObject* obj)
62 	{
63 		gstSystemClock = cast(GstSystemClock*)obj;
64 		super.setStruct(obj);
65 	}
66 
67 	/**
68 	 * Sets our main struct and passes it to the parent class.
69 	 */
70 	public this (GstSystemClock* gstSystemClock, bool ownedRef = false)
71 	{
72 		this.gstSystemClock = gstSystemClock;
73 		super(cast(GstClock*)gstSystemClock, ownedRef);
74 	}
75 
76 	/**
77 	 */
78 
79 	public static GType getType()
80 	{
81 		return gst_system_clock_get_type();
82 	}
83 
84 	/**
85 	 * Get a handle to the default system clock. The refcount of the
86 	 * clock will be increased so you need to unref the clock after
87 	 * usage.
88 	 *
89 	 * Return: the default clock.
90 	 *
91 	 *     MT safe.
92 	 */
93 	public static Clock obtain()
94 	{
95 		auto p = gst_system_clock_obtain();
96 		
97 		if(p is null)
98 		{
99 			return null;
100 		}
101 		
102 		return ObjectG.getDObject!(Clock)(cast(GstClock*) p, true);
103 	}
104 
105 	/**
106 	 * Sets the default system clock that can be obtained with
107 	 * gst_system_clock_obtain().
108 	 *
109 	 * This is mostly used for testing and debugging purposes when you
110 	 * want to have control over the time reported by the default system
111 	 * clock.
112 	 *
113 	 * MT safe.
114 	 *
115 	 * Params:
116 	 *     newClock = a #GstClock
117 	 *
118 	 * Since: 1.4
119 	 */
120 	public static void setDefault(Clock newClock)
121 	{
122 		gst_system_clock_set_default((newClock is null) ? null : newClock.getClockStruct());
123 	}
124 }