context: // This file was generated by the Gtk# code generator.
  // Any changes made will be lost if regenerated.
  
  namespace Gst {
  
  	using System;
  	using System.Collections;
  	using System.Collections.Generic;
  	using System.Runtime.InteropServices;
  
  #region Autogenerated code
  	public partial class Clock : Gst.Object {
  
  		protected Clock (IntPtr raw) : base(raw) {}
  
  		protected Clock() : base(IntPtr.Zero)
  		{
  			CreateNativeObject (new string [0], new GLib.Value [0]);
  		}
  
  		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern ulong gst_clock_get_timeout(IntPtr raw);
  
  		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern void gst_clock_set_timeout(IntPtr raw, ulong timeout);
  
  		[GLib.Property ("timeout")]
  		public ulong Timeout {
  			get  {
  				ulong raw_ret = gst_clock_get_timeout(Handle);
  				ulong ret = raw_ret;
  				return ret;
  			}
  			set  {
  				gst_clock_set_timeout(Handle, value);
  			}
  		}
  
  		[GLib.Property ("window-size")]
  		public int WindowSize {
  			get {
  				GLib.Value val = GetProperty ("window-size");
  				int ret = (int) val;
  				val.Dispose ();
  				return ret;
  			}
  			set {
  				GLib.Value val = new GLib.Value(value);
  				SetProperty("window-size", val);
  				val.Dispose ();
  			}
  		}
  
  		[GLib.Property ("window-threshold")]
  		public int WindowThreshold {
  			get {
  				GLib.Value val = GetProperty ("window-threshold");
  				int ret = (int) val;
  				val.Dispose ();
  				return ret;
  			}
  			set {
  				GLib.Value val = new GLib.Value(value);
  				SetProperty("window-threshold", val);
  				val.Dispose ();
  			}
  		}
  
  		[GLib.Signal("synced")]
  		public event Gst.SyncedHandler Synced {
  			add {
  				this.AddSignalHandler ("synced", value, typeof (Gst.SyncedArgs));
  			}
  			remove {
  				this.RemoveSignalHandler ("synced", value);
  			}
  		}
  
  		static SyncedNativeDelegate Synced_cb_delegate;
  		static SyncedNativeDelegate SyncedVMCallback {
  			get {
  				if (Synced_cb_delegate == null)
  					Synced_cb_delegate = new SyncedNativeDelegate (Synced_cb);
  				return Synced_cb_delegate;
  			}
  		}
  
  		static void OverrideSynced (GLib.GType gtype)
  		{
  			OverrideSynced (gtype, SyncedVMCallback);
  		}
  
  		static void OverrideSynced (GLib.GType gtype, SyncedNativeDelegate callback)
  		{
  			OverrideVirtualMethod (gtype, "synced", callback);
  		}
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate void SyncedNativeDelegate (IntPtr inst, bool synced);
  
  		static void Synced_cb (IntPtr inst, bool synced)
  		{
  			try {
  				Clock __obj = GLib.Object.GetObject (inst, false) as Clock;
  				__obj.OnSynced (synced);
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, false);
  			}
  		}
  
  		[GLib.DefaultSignalHandler(Type=typeof(Gst.Clock), ConnectionMethod="OverrideSynced")]
  		protected virtual void OnSynced (bool synced)
  		{
  			InternalSynced (synced);
  		}
  
  		private void InternalSynced (bool synced)
  		{
  			GLib.Value ret = GLib.Value.Empty;
  			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
  			GLib.Value[] vals = new GLib.Value [2];
  			vals [0] = new GLib.Value (this);
  			inst_and_params.Append (vals [0]);
  			vals [1] = new GLib.Value (synced);
  			inst_and_params.Append (vals [1]);
  			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
  			foreach (GLib.Value v in vals)
  				v.Dispose ();
  		}
  
  		static ChangeResolutionNativeDelegate ChangeResolution_cb_delegate;
  		static ChangeResolutionNativeDelegate ChangeResolutionVMCallback {
  			get {
  				if (ChangeResolution_cb_delegate == null)
  					ChangeResolution_cb_delegate = new ChangeResolutionNativeDelegate (ChangeResolution_cb);
  				return ChangeResolution_cb_delegate;
  			}
  		}
  
  		static void OverrideChangeResolution (GLib.GType gtype)
  		{
  			OverrideChangeResolution (gtype, ChangeResolutionVMCallback);
  		}
  
  		static void OverrideChangeResolution (GLib.GType gtype, ChangeResolutionNativeDelegate callback)
  		{
  			unsafe {
  				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("change_resolution"));
  				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate ulong ChangeResolutionNativeDelegate (IntPtr inst, ulong old_resolution, ulong new_resolution);
  
  		static ulong ChangeResolution_cb (IntPtr inst, ulong old_resolution, ulong new_resolution)
  		{
  			try {
  				Clock __obj = GLib.Object.GetObject (inst, false) as Clock;
  				ulong __result;
  				__result = __obj.OnChangeResolution (old_resolution, new_resolution);
  				return __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[GLib.DefaultSignalHandler(Type=typeof(Gst.Clock), ConnectionMethod="OverrideChangeResolution")]
  		protected virtual ulong OnChangeResolution (ulong old_resolution, ulong new_resolution)
  		{
  			return InternalChangeResolution (old_resolution, new_resolution);
  		}
  
  		private ulong InternalChangeResolution (ulong old_resolution, ulong new_resolution)
  		{
  			ChangeResolutionNativeDelegate unmanaged = null;
  			unsafe {
  				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("change_resolution"));
  				unmanaged = (ChangeResolutionNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(ChangeResolutionNativeDelegate));
  			}
  			if (unmanaged == null) return 0;
  
  			ulong __result = unmanaged (this.Handle, old_resolution, new_resolution);
  			return __result;
  		}
  
  		static GetResolutionNativeDelegate GetResolution_cb_delegate;
  		static GetResolutionNativeDelegate GetResolutionVMCallback {
  			get {
  				if (GetResolution_cb_delegate == null)
  					GetResolution_cb_delegate = new GetResolutionNativeDelegate (GetResolution_cb);
  				return GetResolution_cb_delegate;
  			}
  		}
  
  		static void OverrideGetResolution (GLib.GType gtype)
  		{
  			OverrideGetResolution (gtype, GetResolutionVMCallback);
  		}
  
  		static void OverrideGetResolution (GLib.GType gtype, GetResolutionNativeDelegate callback)
  		{
  			unsafe {
  				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("get_resolution"));
  				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate ulong GetResolutionNativeDelegate (IntPtr inst);
  
  		static ulong GetResolution_cb (IntPtr inst)
  		{
  			try {
  				Clock __obj = GLib.Object.GetObject (inst, false) as Clock;
  				ulong __result;
  				__result = __obj.OnGetResolution ();
  				return __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[GLib.DefaultSignalHandler(Type=typeof(Gst.Clock), ConnectionMethod="OverrideGetResolution")]
  		protected virtual ulong OnGetResolution ()
  		{
  			return InternalGetResolution ();
  		}
  
  		private ulong InternalGetResolution ()
  		{
  			GetResolutionNativeDelegate unmanaged = null;
  			unsafe {
  				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("get_resolution"));
  				unmanaged = (GetResolutionNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetResolutionNativeDelegate));
  			}
  			if (unmanaged == null) return 0;
  
  			ulong __result = unmanaged (this.Handle);
  			return __result;
  		}
  
  		static GetInternalTimeNativeDelegate GetInternalTime_cb_delegate;
  		static GetInternalTimeNativeDelegate GetInternalTimeVMCallback {
  			get {
  				if (GetInternalTime_cb_delegate == null)
  					GetInternalTime_cb_delegate = new GetInternalTimeNativeDelegate (GetInternalTime_cb);
  				return GetInternalTime_cb_delegate;
  			}
  		}
  
  		static void OverrideGetInternalTime (GLib.GType gtype)
  		{
  			OverrideGetInternalTime (gtype, GetInternalTimeVMCallback);
  		}
  
  		static void OverrideGetInternalTime (GLib.GType gtype, GetInternalTimeNativeDelegate callback)
  		{
  			unsafe {
  				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("get_internal_time"));
  				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate ulong GetInternalTimeNativeDelegate (IntPtr inst);
  
  		static ulong GetInternalTime_cb (IntPtr inst)
  		{
  			try {
  				Clock __obj = GLib.Object.GetObject (inst, false) as Clock;
  				ulong __result;
  				__result = __obj.OnGetInternalTime ();
  				return __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[GLib.DefaultSignalHandler(Type=typeof(Gst.Clock), ConnectionMethod="OverrideGetInternalTime")]
  		protected virtual ulong OnGetInternalTime ()
  		{
  			return InternalGetInternalTime ();
  		}
  
  		private ulong InternalGetInternalTime ()
  		{
  			GetInternalTimeNativeDelegate unmanaged = null;
  			unsafe {
  				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("get_internal_time"));
  				unmanaged = (GetInternalTimeNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetInternalTimeNativeDelegate));
  			}
  			if (unmanaged == null) return 0;
  
  			ulong __result = unmanaged (this.Handle);
  			return __result;
  		}
  
  		static WaitNativeDelegate Wait_cb_delegate;
  		static WaitNativeDelegate WaitVMCallback {
  			get {
  				if (Wait_cb_delegate == null)
  					Wait_cb_delegate = new WaitNativeDelegate (Wait_cb);
  				return Wait_cb_delegate;
  			}
  		}
  
  		static void OverrideWait (GLib.GType gtype)
  		{
  			OverrideWait (gtype, WaitVMCallback);
  		}
  
  		static void OverrideWait (GLib.GType gtype, WaitNativeDelegate callback)
  		{
  			unsafe {
  				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("wait"));
  				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate int WaitNativeDelegate (IntPtr inst, IntPtr entry, long jitter);
  
  		static int Wait_cb (IntPtr inst, IntPtr entry, long jitter)
  		{
  			try {
  				Clock __obj = GLib.Object.GetObject (inst, false) as Clock;
  				Gst.ClockReturn __result;
  				__result = __obj.OnWait (entry == IntPtr.Zero ? null : (Gst.ClockEntry) GLib.Opaque.GetOpaque (entry, typeof (Gst.ClockEntry), false), jitter);
  				return (int) __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[GLib.DefaultSignalHandler(Type=typeof(Gst.Clock), ConnectionMethod="OverrideWait")]
  		protected virtual Gst.ClockReturn OnWait (Gst.ClockEntry entry, long jitter)
  		{
  			return InternalWait (entry, jitter);
  		}
  
  		private Gst.ClockReturn InternalWait (Gst.ClockEntry entry, long jitter)
  		{
  			WaitNativeDelegate unmanaged = null;
  			unsafe {
  				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("wait"));
  				unmanaged = (WaitNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(WaitNativeDelegate));
  			}
  			if (unmanaged == null) return (Gst.ClockReturn) 0;
  
  			int __result = unmanaged (this.Handle, entry == null ? IntPtr.Zero : entry.Handle, jitter);
  			return (Gst.ClockReturn) __result;
  		}
  
  		static WaitAsyncNativeDelegate WaitAsync_cb_delegate;
  		static WaitAsyncNativeDelegate WaitAsyncVMCallback {
  			get {
  				if (WaitAsync_cb_delegate == null)
  					WaitAsync_cb_delegate = new WaitAsyncNativeDelegate (WaitAsync_cb);
  				return WaitAsync_cb_delegate;
  			}
  		}
  
  		static void OverrideWaitAsync (GLib.GType gtype)
  		{
  			OverrideWaitAsync (gtype, WaitAsyncVMCallback);
  		}
  
  		static void OverrideWaitAsync (GLib.GType gtype, WaitAsyncNativeDelegate callback)
  		{
  			unsafe {
  				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("wait_async"));
  				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate int WaitAsyncNativeDelegate (IntPtr inst, IntPtr entry);
  
  		static int WaitAsync_cb (IntPtr inst, IntPtr entry)
  		{
  			try {
  				Clock __obj = GLib.Object.GetObject (inst, false) as Clock;
  				Gst.ClockReturn __result;
  				__result = __obj.OnWaitAsync (entry == IntPtr.Zero ? null : (Gst.ClockEntry) GLib.Opaque.GetOpaque (entry, typeof (Gst.ClockEntry), false));
  				return (int) __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[GLib.DefaultSignalHandler(Type=typeof(Gst.Clock), ConnectionMethod="OverrideWaitAsync")]
  		protected virtual Gst.ClockReturn OnWaitAsync (Gst.ClockEntry entry)
  		{
  			return InternalWaitAsync (entry);
  		}
  
  		private Gst.ClockReturn InternalWaitAsync (Gst.ClockEntry entry)
  		{
  			WaitAsyncNativeDelegate unmanaged = null;
  			unsafe {
  				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("wait_async"));
  				unmanaged = (WaitAsyncNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(WaitAsyncNativeDelegate));
  			}
  			if (unmanaged == null) return (Gst.ClockReturn) 0;
  
  			int __result = unmanaged (this.Handle, entry == null ? IntPtr.Zero : entry.Handle);
  			return (Gst.ClockReturn) __result;
  		}
  
  		static UnscheduleNativeDelegate Unschedule_cb_delegate;
  		static UnscheduleNativeDelegate UnscheduleVMCallback {
  			get {
  				if (Unschedule_cb_delegate == null)
  					Unschedule_cb_delegate = new UnscheduleNativeDelegate (Unschedule_cb);
  				return Unschedule_cb_delegate;
  			}
  		}
  
  		static void OverrideUnschedule (GLib.GType gtype)
  		{
  			OverrideUnschedule (gtype, UnscheduleVMCallback);
  		}
  
  		static void OverrideUnschedule (GLib.GType gtype, UnscheduleNativeDelegate callback)
  		{
  			unsafe {
  				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("unschedule"));
  				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate void UnscheduleNativeDelegate (IntPtr inst, IntPtr entry);
  
  		static void Unschedule_cb (IntPtr inst, IntPtr entry)
  		{
  			try {
  				Clock __obj = GLib.Object.GetObject (inst, false) as Clock;
  				__obj.OnUnschedule (entry == IntPtr.Zero ? null : (Gst.ClockEntry) GLib.Opaque.GetOpaque (entry, typeof (Gst.ClockEntry), false));
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, false);
  			}
  		}
  
  		[GLib.DefaultSignalHandler(Type=typeof(Gst.Clock), ConnectionMethod="OverrideUnschedule")]
  		protected virtual void OnUnschedule (Gst.ClockEntry entry)
  		{
  			InternalUnschedule (entry);
  		}
  
  		private void InternalUnschedule (Gst.ClockEntry entry)
  		{
  			UnscheduleNativeDelegate unmanaged = null;
  			unsafe {
  				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("unschedule"));
  				unmanaged = (UnscheduleNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(UnscheduleNativeDelegate));
  			}
  			if (unmanaged == null) return;
  
  			unmanaged (this.Handle, entry == null ? IntPtr.Zero : entry.Handle);
  		}
  
  
  		// Internal representation of the wrapped structure ABI.
  		static GLib.AbiStruct _class_abi = null;
  		static public new GLib.AbiStruct class_abi {
  			get {
  				if (_class_abi == null)
  					_class_abi = new GLib.AbiStruct (new List<GLib.AbiField>{ 
  						new GLib.AbiField("change_resolution"
  							, Gst.Object.class_abi.Fields
  							, (uint) Marshal.SizeOf(typeof(IntPtr)) // change_resolution
  							, null
  							, "get_resolution"
  							, (uint) Marshal.SizeOf(typeof(IntPtr))
  							, 0
  							),
  						new GLib.AbiField("get_resolution"
  							, -1
  							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_resolution
  							, "change_resolution"
  							, "get_internal_time"
  							, (uint) Marshal.SizeOf(typeof(IntPtr))
  							, 0
  							),
  						new GLib.AbiField("get_internal_time"
  							, -1
  							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_internal_time
  							, "get_resolution"
  							, "wait"
  							, (uint) Marshal.SizeOf(typeof(IntPtr))
  							, 0
  							),
  						new GLib.AbiField("wait"
  							, -1
  							, (uint) Marshal.SizeOf(typeof(IntPtr)) // wait
  							, "get_internal_time"
  							, "wait_async"
  							, (uint) Marshal.SizeOf(typeof(IntPtr))
  							, 0
  							),
  						new GLib.AbiField("wait_async"
  							, -1
  							, (uint) Marshal.SizeOf(typeof(IntPtr)) // wait_async
  							, "wait"
  							, "unschedule"
  							, (uint) Marshal.SizeOf(typeof(IntPtr))
  							, 0
  							),
  						new GLib.AbiField("unschedule"
  							, -1
  
gt: 							, (uint) Marshal.SizeOf(typeof(IntPtr)) // unschedule