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 gstreamer.c.functions;
30 public  import gstreamer.c.types;
31 public  import gstreamerc.gstreamertypes;
32 
33 
34 /**
35  * The GStreamer core provides a GstSystemClock based on the system time.
36  * Asynchronous callbacks are scheduled from an internal thread.
37  * 
38  * Clock implementors are encouraged to subclass this systemclock as it
39  * implements the async notification.
40  * 
41  * Subclasses can however override all of the important methods for sync and
42  * async notifications to implement their own callback methods or blocking
43  * wait operations.
44  */
45 public class SystemClock : Clock
46 {
47 	/** the main Gtk struct */
48 	protected GstSystemClock* gstSystemClock;
49 
50 	/** Get the main Gtk struct */
51 	public GstSystemClock* getSystemClockStruct(bool transferOwnership = false)
52 	{
53 		if (transferOwnership)
54 			ownedRef = false;
55 		return gstSystemClock;
56 	}
57 
58 	/** the main Gtk struct as a void* */
59 	protected override void* getStruct()
60 	{
61 		return cast(void*)gstSystemClock;
62 	}
63 
64 	protected override void setStruct(GObject* obj)
65 	{
66 		gstSystemClock = cast(GstSystemClock*)obj;
67 		super.setStruct(obj);
68 	}
69 
70 	/**
71 	 * Sets our main struct and passes it to the parent class.
72 	 */
73 	public this (GstSystemClock* gstSystemClock, bool ownedRef = false)
74 	{
75 		this.gstSystemClock = gstSystemClock;
76 		super(cast(GstClock*)gstSystemClock, ownedRef);
77 	}
78 
79 
80 	/** */
81 	public static GType getType()
82 	{
83 		return gst_system_clock_get_type();
84 	}
85 
86 	/**
87 	 * Get a handle to the default system clock. The refcount of the
88 	 * clock will be increased so you need to unref the clock after
89 	 * usage.
90 	 *
91 	 * Returns: the default clock.
92 	 *
93 	 *     MT safe.
94 	 */
95 	public static Clock obtain()
96 	{
97 		auto p = gst_system_clock_obtain();
98 
99 		if(p is null)
100 		{
101 			return null;
102 		}
103 
104 		return ObjectG.getDObject!(Clock)(cast(GstClock*) p, true);
105 	}
106 
107 	/**
108 	 * Sets the default system clock that can be obtained with
109 	 * gst_system_clock_obtain().
110 	 *
111 	 * This is mostly used for testing and debugging purposes when you
112 	 * want to have control over the time reported by the default system
113 	 * clock.
114 	 *
115 	 * MT safe.
116 	 *
117 	 * Params:
118 	 *     newClock = a #GstClock
119 	 *
120 	 * Since: 1.4
121 	 */
122 	public static void setDefault(Clock newClock)
123 	{
124 		gst_system_clock_set_default((newClock is null) ? null : newClock.getClockStruct());
125 	}
126 }