// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace Gst.Base {

	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public partial class BaseSink : Gst.Element {

		protected BaseSink (IntPtr raw) : base(raw) {}

		protected BaseSink() : base(IntPtr.Zero)
		{
			CreateNativeObject (new string [0], new GLib.Value [0]);
		}

		[GLib.Property ("async")]
		public bool Async {
			get {
				GLib.Value val = GetProperty ("async");
				bool ret = (bool) val;
				val.Dispose ();
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("async", val);
				val.Dispose ();
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern uint gst_base_sink_get_blocksize(IntPtr raw);

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_base_sink_set_blocksize(IntPtr raw, uint blocksize);

		[GLib.Property ("blocksize")]
		public uint Blocksize {
			get  {
				uint raw_ret = gst_base_sink_get_blocksize(Handle);
				uint ret = raw_ret;
				return ret;
			}
			set  {
				gst_base_sink_set_blocksize(Handle, value);
			}
		}

		[GLib.Property ("enable-last-sample")]
		public bool EnableLastSample {
			get {
				GLib.Value val = GetProperty ("enable-last-sample");
				bool ret = (bool) val;
				val.Dispose ();
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("enable-last-sample", val);
				val.Dispose ();
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_base_sink_get_last_sample(IntPtr raw);

		[GLib.Property ("last-sample")]
		public Gst.Sample LastSample {
			get  {
				IntPtr raw_ret = gst_base_sink_get_last_sample(Handle);
				Gst.Sample ret = raw_ret == IntPtr.Zero ? null : (Gst.Sample) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Sample), true);
				return ret;
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern ulong gst_base_sink_get_max_bitrate(IntPtr raw);

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_base_sink_set_max_bitrate(IntPtr raw, ulong max_bitrate);

		[GLib.Property ("max-bitrate")]
		public ulong MaxBitrate {
			get  {
				ulong raw_ret = gst_base_sink_get_max_bitrate(Handle);
				ulong ret = raw_ret;
				return ret;
			}
			set  {
				gst_base_sink_set_max_bitrate(Handle, value);
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern long gst_base_sink_get_max_lateness(IntPtr raw);

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_base_sink_set_max_lateness(IntPtr raw, long max_lateness);

		[GLib.Property ("max-lateness")]
		public long MaxLateness {
			get  {
				long raw_ret = gst_base_sink_get_max_lateness(Handle);
				long ret = raw_ret;
				return ret;
			}
			set  {
				gst_base_sink_set_max_lateness(Handle, value);
			}
		}

		[GLib.Property ("qos")]
		public bool Qos {
			get {
				GLib.Value val = GetProperty ("qos");
				bool ret = (bool) val;
				val.Dispose ();
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("qos", val);
				val.Dispose ();
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern ulong gst_base_sink_get_render_delay(IntPtr raw);

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_base_sink_set_render_delay(IntPtr raw, ulong delay);

		[GLib.Property ("render-delay")]
		public ulong RenderDelay {
			get  {
				ulong raw_ret = gst_base_sink_get_render_delay(Handle);
				ulong ret = raw_ret;
				return ret;
			}
			set  {
				gst_base_sink_set_render_delay(Handle, value);
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_base_sink_get_sync(IntPtr raw);

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_base_sink_set_sync(IntPtr raw, bool sync);

		[GLib.Property ("sync")]
		public bool Sync {
			get  {
				bool raw_ret = gst_base_sink_get_sync(Handle);
				bool ret = raw_ret;
				return ret;
			}
			set  {
				gst_base_sink_set_sync(Handle, value);
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern ulong gst_base_sink_get_throttle_time(IntPtr raw);

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_base_sink_set_throttle_time(IntPtr raw, ulong throttle);

		[GLib.Property ("throttle-time")]
		public ulong ThrottleTime {
			get  {
				ulong raw_ret = gst_base_sink_get_throttle_time(Handle);
				ulong ret = raw_ret;
				return ret;
			}
			set  {
				gst_base_sink_set_throttle_time(Handle, value);
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern long gst_base_sink_get_ts_offset(IntPtr raw);

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_base_sink_set_ts_offset(IntPtr raw, long offset);

		[GLib.Property ("ts-offset")]
		public long TsOffset {
			get  {
				long raw_ret = gst_base_sink_get_ts_offset(Handle);
				long ret = raw_ret;
				return ret;
			}
			set  {
				gst_base_sink_set_ts_offset(Handle, value);
			}
		}

		public Gst.Pad Sinkpad {
			get {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("sinkpad"));
					return GLib.Object.GetObject((*raw_ptr)) as Gst.Pad;
				}
			}
		}

		public Gst.PadMode PadMode {
			get {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("pad_mode"));
					return (Gst.PadMode) (*raw_ptr);
				}
			}
		}

		public ulong Offset {
			get {
				unsafe {
					ulong* raw_ptr = (ulong*)(((byte*)Handle) + abi_info.GetFieldOffset("offset"));
					return (*raw_ptr);
				}
			}
		}

		public bool CanActivatePull {
			get {
				unsafe {
					bool* raw_ptr = (bool*)(((byte*)Handle) + abi_info.GetFieldOffset("can_activate_pull"));
					return (*raw_ptr);
				}
			}
		}

		public bool CanActivatePush {
			get {
				unsafe {
					bool* raw_ptr = (bool*)(((byte*)Handle) + abi_info.GetFieldOffset("can_activate_push"));
					return (*raw_ptr);
				}
			}
		}

		public GLib.Mutex PrerollLock {
			get {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("preroll_lock"));
					return new GLib.Mutex((*raw_ptr));
				}
			}
		}

		public GLib.Cond PrerollCond {
			get {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("preroll_cond"));
					return new GLib.Cond((*raw_ptr));
				}
			}
		}

		public bool Eos {
			get {
				unsafe {
					bool* raw_ptr = (bool*)(((byte*)Handle) + abi_info.GetFieldOffset("eos"));
					return (*raw_ptr);
				}
			}
		}

		public bool NeedPreroll {
			get {
				unsafe {
					bool* raw_ptr = (bool*)(((byte*)Handle) + abi_info.GetFieldOffset("need_preroll"));
					return (*raw_ptr);
				}
			}
		}

		public bool HavePreroll {
			get {
				unsafe {
					bool* raw_ptr = (bool*)(((byte*)Handle) + abi_info.GetFieldOffset("have_preroll"));
					return (*raw_ptr);
				}
			}
		}

		public bool PlayingAsync {
			get {
				unsafe {
					bool* raw_ptr = (bool*)(((byte*)Handle) + abi_info.GetFieldOffset("playing_async"));
					return (*raw_ptr);
				}
			}
		}

		public bool HaveNewsegment {
			get {
				unsafe {
					bool* raw_ptr = (bool*)(((byte*)Handle) + abi_info.GetFieldOffset("have_newsegment"));
					return (*raw_ptr);
				}
			}
		}

		public Gst.Segment Segment {
			get {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("segment"));
					return Gst.Segment.New ((*raw_ptr));
				}
			}
		}

		static GetCapsNativeDelegate GetCaps_cb_delegate;
		static GetCapsNativeDelegate GetCapsVMCallback {
			get {
				if (GetCaps_cb_delegate == null)
					GetCaps_cb_delegate = new GetCapsNativeDelegate (GetCaps_cb);
				return GetCaps_cb_delegate;
			}
		}

		static void OverrideGetCaps (GLib.GType gtype)
		{
			OverrideGetCaps (gtype, GetCapsVMCallback);
		}

		static void OverrideGetCaps (GLib.GType gtype, GetCapsNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("get_caps"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetCapsNativeDelegate (IntPtr inst, IntPtr filter);

		static IntPtr GetCaps_cb (IntPtr inst, IntPtr filter)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				Gst.Caps __result;
				__result = __obj.OnGetCaps (filter == IntPtr.Zero ? null : (Gst.Caps) GLib.Opaque.GetOpaque (filter, typeof (Gst.Caps), false));
				return __result == null ? IntPtr.Zero : __result.OwnedCopy;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSink), ConnectionMethod="OverrideGetCaps")]
		protected virtual Gst.Caps OnGetCaps (Gst.Caps filter)
		{
			return InternalGetCaps (filter);
		}

		private Gst.Caps InternalGetCaps (Gst.Caps filter)
		{
			GetCapsNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("get_caps"));
				unmanaged = (GetCapsNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetCapsNativeDelegate));
			}
			if (unmanaged == null) return null;

			IntPtr __result = unmanaged (this.Handle, filter == null ? IntPtr.Zero : filter.Handle);
			return __result == IntPtr.Zero ? null : (Gst.Caps) GLib.Opaque.GetOpaque (__result, typeof (Gst.Caps), true);
		}

		static SetCapsNativeDelegate SetCaps_cb_delegate;
		static SetCapsNativeDelegate SetCapsVMCallback {
			get {
				if (SetCaps_cb_delegate == null)
					SetCaps_cb_delegate = new SetCapsNativeDelegate (SetCaps_cb);
				return SetCaps_cb_delegate;
			}
		}

		static void OverrideSetCaps (GLib.GType gtype)
		{
			OverrideSetCaps (gtype, SetCapsVMCallback);
		}

		static void OverrideSetCaps (GLib.GType gtype, SetCapsNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("set_caps"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool SetCapsNativeDelegate (IntPtr inst, IntPtr caps);

		static bool SetCaps_cb (IntPtr inst, IntPtr caps)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				bool __result;
				__result = __obj.OnSetCaps (caps == IntPtr.Zero ? null : (Gst.Caps) GLib.Opaque.GetOpaque (caps, typeof (Gst.Caps), false));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSink), ConnectionMethod="OverrideSetCaps")]
		protected virtual bool OnSetCaps (Gst.Caps caps)
		{
			return InternalSetCaps (caps);
		}

		private bool InternalSetCaps (Gst.Caps caps)
		{
			SetCapsNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("set_caps"));
				unmanaged = (SetCapsNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SetCapsNativeDelegate));
			}
			if (unmanaged == null) return false;

			bool __result = unmanaged (this.Handle, caps == null ? IntPtr.Zero : caps.Handle);
			return __result;
		}

		static FixateNativeDelegate Fixate_cb_delegate;
		static FixateNativeDelegate FixateVMCallback {
			get {
				if (Fixate_cb_delegate == null)
					Fixate_cb_delegate = new FixateNativeDelegate (Fixate_cb);
				return Fixate_cb_delegate;
			}
		}

		static void OverrideFixate (GLib.GType gtype)
		{
			OverrideFixate (gtype, FixateVMCallback);
		}

		static void OverrideFixate (GLib.GType gtype, FixateNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("fixate"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr FixateNativeDelegate (IntPtr inst, IntPtr caps);

		static IntPtr Fixate_cb (IntPtr inst, IntPtr caps)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				Gst.Caps __result;
				__result = __obj.OnFixate (caps == IntPtr.Zero ? null : (Gst.Caps) GLib.Opaque.GetOpaque (caps, typeof (Gst.Caps), false));
				return __result == null ? IntPtr.Zero : __result.OwnedCopy;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSink), ConnectionMethod="OverrideFixate")]
		protected virtual Gst.Caps OnFixate (Gst.Caps caps)
		{
			return InternalFixate (caps);
		}

		private Gst.Caps InternalFixate (Gst.Caps caps)
		{
			FixateNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("fixate"));
				unmanaged = (FixateNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(FixateNativeDelegate));
			}
			if (unmanaged == null) return null;

			IntPtr __result = unmanaged (this.Handle, caps == null ? IntPtr.Zero : caps.Handle);
			return __result == IntPtr.Zero ? null : (Gst.Caps) GLib.Opaque.GetOpaque (__result, typeof (Gst.Caps), true);
		}

		static ActivatePullNativeDelegate ActivatePull_cb_delegate;
		static ActivatePullNativeDelegate ActivatePullVMCallback {
			get {
				if (ActivatePull_cb_delegate == null)
					ActivatePull_cb_delegate = new ActivatePullNativeDelegate (ActivatePull_cb);
				return ActivatePull_cb_delegate;
			}
		}

		static void OverrideActivatePull (GLib.GType gtype)
		{
			OverrideActivatePull (gtype, ActivatePullVMCallback);
		}

		static void OverrideActivatePull (GLib.GType gtype, ActivatePullNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("activate_pull"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool ActivatePullNativeDelegate (IntPtr inst, bool active);

		static bool ActivatePull_cb (IntPtr inst, bool active)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				bool __result;
				__result = __obj.OnActivatePull (active);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSink), ConnectionMethod="OverrideActivatePull")]
		protected virtual bool OnActivatePull (bool active)
		{
			return InternalActivatePull (active);
		}

		private bool InternalActivatePull (bool active)
		{
			ActivatePullNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("activate_pull"));
				unmanaged = (ActivatePullNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(ActivatePullNativeDelegate));
			}
			if (unmanaged == null) return false;

			bool __result = unmanaged (this.Handle, active);
			return __result;
		}

		static GetTimesNativeDelegate GetTimes_cb_delegate;
		static GetTimesNativeDelegate GetTimesVMCallback {
			get {
				if (GetTimes_cb_delegate == null)
					GetTimes_cb_delegate = new GetTimesNativeDelegate (GetTimes_cb);
				return GetTimes_cb_delegate;
			}
		}

		static void OverrideGetTimes (GLib.GType gtype)
		{
			OverrideGetTimes (gtype, GetTimesVMCallback);
		}

		static void OverrideGetTimes (GLib.GType gtype, GetTimesNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("get_times"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void GetTimesNativeDelegate (IntPtr inst, IntPtr buffer, ulong start, ulong end);

		static void GetTimes_cb (IntPtr inst, IntPtr buffer, ulong start, ulong end)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				__obj.OnGetTimes (buffer == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (buffer, typeof (Gst.Buffer), false), start, end);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSink), ConnectionMethod="OverrideGetTimes")]
		protected virtual void OnGetTimes (Gst.Buffer buffer, ulong start, ulong end)
		{
			InternalGetTimes (buffer, start, end);
		}

		private void InternalGetTimes (Gst.Buffer buffer, ulong start, ulong end)
		{
			GetTimesNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("get_times"));
				unmanaged = (GetTimesNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetTimesNativeDelegate));
			}
			if (unmanaged == null) return;

			unmanaged (this.Handle, buffer == null ? IntPtr.Zero : buffer.Handle, start, end);
		}

		static ProposeAllocationNativeDelegate ProposeAllocation_cb_delegate;
		static ProposeAllocationNativeDelegate ProposeAllocationVMCallback {
			get {
				if (ProposeAllocation_cb_delegate == null)
					ProposeAllocation_cb_delegate = new ProposeAllocationNativeDelegate (ProposeAllocation_cb);
				return ProposeAllocation_cb_delegate;
			}
		}

		static void OverrideProposeAllocation (GLib.GType gtype)
		{
			OverrideProposeAllocation (gtype, ProposeAllocationVMCallback);
		}

		static void OverrideProposeAllocation (GLib.GType gtype, ProposeAllocationNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("propose_allocation"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool ProposeAllocationNativeDelegate (IntPtr inst, IntPtr query);

		static bool ProposeAllocation_cb (IntPtr inst, IntPtr query)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				bool __result;
				__result = __obj.OnProposeAllocation (query == IntPtr.Zero ? null : (Gst.Query) GLib.Opaque.GetOpaque (query, typeof (Gst.Query), false));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSink), ConnectionMethod="OverrideProposeAllocation")]
		protected virtual bool OnProposeAllocation (Gst.Query query)
		{
			return InternalProposeAllocation (query);
		}

		private bool InternalProposeAllocation (Gst.Query query)
		{
			ProposeAllocationNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("propose_allocation"));
				unmanaged = (ProposeAllocationNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(ProposeAllocationNativeDelegate));
			}
			if (unmanaged == null) return false;

			bool __result = unmanaged (this.Handle, query == null ? IntPtr.Zero : query.Handle);
			return __result;
		}

		static StartNativeDelegate Start_cb_delegate;
		static StartNativeDelegate StartVMCallback {
			get {
				if (Start_cb_delegate == null)
					Start_cb_delegate = new StartNativeDelegate (Start_cb);
				return Start_cb_delegate;
			}
		}

		static void OverrideStart (GLib.GType gtype)
		{
			OverrideStart (gtype, StartVMCallback);
		}

		static void OverrideStart (GLib.GType gtype, StartNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("start"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool StartNativeDelegate (IntPtr inst);

		static bool Start_cb (IntPtr inst)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				bool __result;
				__result = __obj.OnStart ();
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSink), ConnectionMethod="OverrideStart")]
		protected virtual bool OnStart ()
		{
			return InternalStart ();
		}

		private bool InternalStart ()
		{
			StartNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("start"));
				unmanaged = (StartNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(StartNativeDelegate));
			}
			if (unmanaged == null) return false;

			bool __result = unmanaged (this.Handle);
			return __result;
		}

		static StopNativeDelegate Stop_cb_delegate;
		static StopNativeDelegate StopVMCallback {
			get {
				if (Stop_cb_delegate == null)
					Stop_cb_delegate = new StopNativeDelegate (Stop_cb);
				return Stop_cb_delegate;
			}
		}

		static void OverrideStop (GLib.GType gtype)
		{
			OverrideStop (gtype, StopVMCallback);
		}

		static void OverrideStop (GLib.GType gtype, StopNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("stop"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool StopNativeDelegate (IntPtr inst);

		static bool Stop_cb (IntPtr inst)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				bool __result;
				__result = __obj.OnStop ();
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSink), ConnectionMethod="OverrideStop")]
		protected virtual bool OnStop ()
		{
			return InternalStop ();
		}

		private bool InternalStop ()
		{
			StopNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("stop"));
				unmanaged = (StopNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(StopNativeDelegate));
			}
			if (unmanaged == null) return false;

			bool __result = unmanaged (this.Handle);
			return __result;
		}

		static UnlockNativeDelegate Unlock_cb_delegate;
		static UnlockNativeDelegate UnlockVMCallback {
			get {
				if (Unlock_cb_delegate == null)
					Unlock_cb_delegate = new UnlockNativeDelegate (Unlock_cb);
				return Unlock_cb_delegate;
			}
		}

		static void OverrideUnlock (GLib.GType gtype)
		{
			OverrideUnlock (gtype, UnlockVMCallback);
		}

		static void OverrideUnlock (GLib.GType gtype, UnlockNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("unlock"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool UnlockNativeDelegate (IntPtr inst);

		static bool Unlock_cb (IntPtr inst)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				bool __result;
				__result = __obj.OnUnlock ();
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSink), ConnectionMethod="OverrideUnlock")]
		protected virtual bool OnUnlock ()
		{
			return InternalUnlock ();
		}

		private bool InternalUnlock ()
		{
			UnlockNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("unlock"));
				unmanaged = (UnlockNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(UnlockNativeDelegate));
			}
			if (unmanaged == null) return false;

			bool __result = unmanaged (this.Handle);
			return __result;
		}

		static UnlockStopNativeDelegate UnlockStop_cb_delegate;
		static UnlockStopNativeDelegate UnlockStopVMCallback {
			get {
				if (UnlockStop_cb_delegate == null)
					UnlockStop_cb_delegate = new UnlockStopNativeDelegate (UnlockStop_cb);
				return UnlockStop_cb_delegate;
			}
		}

		static void OverrideUnlockStop (GLib.GType gtype)
		{
			OverrideUnlockStop (gtype, UnlockStopVMCallback);
		}

		static void OverrideUnlockStop (GLib.GType gtype, UnlockStopNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("unlock_stop"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool UnlockStopNativeDelegate (IntPtr inst);

		static bool UnlockStop_cb (IntPtr inst)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				bool __result;
				__result = __obj.OnUnlockStop ();
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSink), ConnectionMethod="OverrideUnlockStop")]
		protected virtual bool OnUnlockStop ()
		{
			return InternalUnlockStop ();
		}

		private bool InternalUnlockStop ()
		{
			UnlockStopNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("unlock_stop"));
				unmanaged = (UnlockStopNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(UnlockStopNativeDelegate));
			}
			if (unmanaged == null) return false;

			bool __result = unmanaged (this.Handle);
			return __result;
		}

		static QueryNativeDelegate Query_cb_delegate;
		static QueryNativeDelegate QueryVMCallback {
			get {
				if (Query_cb_delegate == null)
					Query_cb_delegate = new QueryNativeDelegate (Query_cb);
				return Query_cb_delegate;
			}
		}

		static void OverrideQuery (GLib.GType gtype)
		{
			OverrideQuery (gtype, QueryVMCallback);
		}

		static void OverrideQuery (GLib.GType gtype, QueryNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("query"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool QueryNativeDelegate (IntPtr inst, IntPtr query);

		static bool Query_cb (IntPtr inst, IntPtr query)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				bool __result;
				__result = __obj.OnQuery (query == IntPtr.Zero ? null : (Gst.Query) GLib.Opaque.GetOpaque (query, typeof (Gst.Query), false));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSink), ConnectionMethod="OverrideQuery")]
		protected virtual bool OnQuery (Gst.Query query)
		{
			return InternalQuery (query);
		}

		private bool InternalQuery (Gst.Query query)
		{
			QueryNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("query"));
				unmanaged = (QueryNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(QueryNativeDelegate));
			}
			if (unmanaged == null) return false;

			bool __result = unmanaged (this.Handle, query == null ? IntPtr.Zero : query.Handle);
			return __result;
		}

		static EventNativeDelegate Event_cb_delegate;
		static EventNativeDelegate EventVMCallback {
			get {
				if (Event_cb_delegate == null)
					Event_cb_delegate = new EventNativeDelegate (Event_cb);
				return Event_cb_delegate;
			}
		}

		static void OverrideEvent (GLib.GType gtype)
		{
			OverrideEvent (gtype, EventVMCallback);
		}

		static void OverrideEvent (GLib.GType gtype, EventNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("evnt"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool EventNativeDelegate (IntPtr inst, IntPtr evnt);

		static bool Event_cb (IntPtr inst, IntPtr evnt)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				bool __result;
				__result = __obj.OnEvent (evnt == IntPtr.Zero ? null : (Gst.Event) GLib.Opaque.GetOpaque (evnt, typeof (Gst.Event), false));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSink), ConnectionMethod="OverrideEvent")]
		protected virtual bool OnEvent (Gst.Event evnt)
		{
			return InternalEvent (evnt);
		}

		private bool InternalEvent (Gst.Event evnt)
		{
			EventNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("evnt"));
				unmanaged = (EventNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(EventNativeDelegate));
			}
			if (unmanaged == null) return false;

			bool __result = unmanaged (this.Handle, evnt == null ? IntPtr.Zero : evnt.Handle);
			return __result;
		}

		static WaitEventNativeDelegate WaitEvent_cb_delegate;
		static WaitEventNativeDelegate WaitEventVMCallback {
			get {
				if (WaitEvent_cb_delegate == null)
					WaitEvent_cb_delegate = new WaitEventNativeDelegate (WaitEvent_cb);
				return WaitEvent_cb_delegate;
			}
		}

		static void OverrideWaitEvent (GLib.GType gtype)
		{
			OverrideWaitEvent (gtype, WaitEventVMCallback);
		}

		static void OverrideWaitEvent (GLib.GType gtype, WaitEventNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("wait_event"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int WaitEventNativeDelegate (IntPtr inst, IntPtr evnt);

		static int WaitEvent_cb (IntPtr inst, IntPtr evnt)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				Gst.FlowReturn __result;
				__result = __obj.OnWaitEvent (evnt == IntPtr.Zero ? null : (Gst.Event) GLib.Opaque.GetOpaque (evnt, typeof (Gst.Event), 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.Base.BaseSink), ConnectionMethod="OverrideWaitEvent")]
		protected virtual Gst.FlowReturn OnWaitEvent (Gst.Event evnt)
		{
			return InternalWaitEvent (evnt);
		}

		private Gst.FlowReturn InternalWaitEvent (Gst.Event evnt)
		{
			WaitEventNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("wait_event"));
				unmanaged = (WaitEventNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(WaitEventNativeDelegate));
			}
			if (unmanaged == null) return (Gst.FlowReturn) 0;

			int __result = unmanaged (this.Handle, evnt == null ? IntPtr.Zero : evnt.Handle);
			return (Gst.FlowReturn) __result;
		}

		static PrepareNativeDelegate Prepare_cb_delegate;
		static PrepareNativeDelegate PrepareVMCallback {
			get {
				if (Prepare_cb_delegate == null)
					Prepare_cb_delegate = new PrepareNativeDelegate (Prepare_cb);
				return Prepare_cb_delegate;
			}
		}

		static void OverridePrepare (GLib.GType gtype)
		{
			OverridePrepare (gtype, PrepareVMCallback);
		}

		static void OverridePrepare (GLib.GType gtype, PrepareNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("prepare"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int PrepareNativeDelegate (IntPtr inst, IntPtr buffer);

		static int Prepare_cb (IntPtr inst, IntPtr buffer)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				Gst.FlowReturn __result;
				__result = __obj.OnPrepare (buffer == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (buffer, typeof (Gst.Buffer), 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.Base.BaseSink), ConnectionMethod="OverridePrepare")]
		protected virtual Gst.FlowReturn OnPrepare (Gst.Buffer buffer)
		{
			return InternalPrepare (buffer);
		}

		private Gst.FlowReturn InternalPrepare (Gst.Buffer buffer)
		{
			PrepareNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("prepare"));
				unmanaged = (PrepareNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(PrepareNativeDelegate));
			}
			if (unmanaged == null) return (Gst.FlowReturn) 0;

			int __result = unmanaged (this.Handle, buffer == null ? IntPtr.Zero : buffer.Handle);
			return (Gst.FlowReturn) __result;
		}

		static PrepareListNativeDelegate PrepareList_cb_delegate;
		static PrepareListNativeDelegate PrepareListVMCallback {
			get {
				if (PrepareList_cb_delegate == null)
					PrepareList_cb_delegate = new PrepareListNativeDelegate (PrepareList_cb);
				return PrepareList_cb_delegate;
			}
		}

		static void OverridePrepareList (GLib.GType gtype)
		{
			OverridePrepareList (gtype, PrepareListVMCallback);
		}

		static void OverridePrepareList (GLib.GType gtype, PrepareListNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("prepare_list"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int PrepareListNativeDelegate (IntPtr inst, IntPtr buffer_list);

		static int PrepareList_cb (IntPtr inst, IntPtr buffer_list)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				Gst.FlowReturn __result;
				__result = __obj.OnPrepareList (buffer_list == IntPtr.Zero ? null : (Gst.BufferList) GLib.Opaque.GetOpaque (buffer_list, typeof (Gst.BufferList), 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.Base.BaseSink), ConnectionMethod="OverridePrepareList")]
		protected virtual Gst.FlowReturn OnPrepareList (Gst.BufferList buffer_list)
		{
			return InternalPrepareList (buffer_list);
		}

		private Gst.FlowReturn InternalPrepareList (Gst.BufferList buffer_list)
		{
			PrepareListNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("prepare_list"));
				unmanaged = (PrepareListNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(PrepareListNativeDelegate));
			}
			if (unmanaged == null) return (Gst.FlowReturn) 0;

			int __result = unmanaged (this.Handle, buffer_list == null ? IntPtr.Zero : buffer_list.Handle);
			return (Gst.FlowReturn) __result;
		}

		static PrerollNativeDelegate Preroll_cb_delegate;
		static PrerollNativeDelegate PrerollVMCallback {
			get {
				if (Preroll_cb_delegate == null)
					Preroll_cb_delegate = new PrerollNativeDelegate (Preroll_cb);
				return Preroll_cb_delegate;
			}
		}

		static void OverridePreroll (GLib.GType gtype)
		{
			OverridePreroll (gtype, PrerollVMCallback);
		}

		static void OverridePreroll (GLib.GType gtype, PrerollNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("preroll"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int PrerollNativeDelegate (IntPtr inst, IntPtr buffer);

		static int Preroll_cb (IntPtr inst, IntPtr buffer)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				Gst.FlowReturn __result;
				__result = __obj.OnPreroll (buffer == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (buffer, typeof (Gst.Buffer), 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.Base.BaseSink), ConnectionMethod="OverridePreroll")]
		protected virtual Gst.FlowReturn OnPreroll (Gst.Buffer buffer)
		{
			return InternalPreroll (buffer);
		}

		private Gst.FlowReturn InternalPreroll (Gst.Buffer buffer)
		{
			PrerollNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("preroll"));
				unmanaged = (PrerollNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(PrerollNativeDelegate));
			}
			if (unmanaged == null) return (Gst.FlowReturn) 0;

			int __result = unmanaged (this.Handle, buffer == null ? IntPtr.Zero : buffer.Handle);
			return (Gst.FlowReturn) __result;
		}

		static RenderNativeDelegate Render_cb_delegate;
		static RenderNativeDelegate RenderVMCallback {
			get {
				if (Render_cb_delegate == null)
					Render_cb_delegate = new RenderNativeDelegate (Render_cb);
				return Render_cb_delegate;
			}
		}

		static void OverrideRender (GLib.GType gtype)
		{
			OverrideRender (gtype, RenderVMCallback);
		}

		static void OverrideRender (GLib.GType gtype, RenderNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("render"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int RenderNativeDelegate (IntPtr inst, IntPtr buffer);

		static int Render_cb (IntPtr inst, IntPtr buffer)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				Gst.FlowReturn __result;
				__result = __obj.OnRender (buffer == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (buffer, typeof (Gst.Buffer), 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.Base.BaseSink), ConnectionMethod="OverrideRender")]
		protected virtual Gst.FlowReturn OnRender (Gst.Buffer buffer)
		{
			return InternalRender (buffer);
		}

		private Gst.FlowReturn InternalRender (Gst.Buffer buffer)
		{
			RenderNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("render"));
				unmanaged = (RenderNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(RenderNativeDelegate));
			}
			if (unmanaged == null) return (Gst.FlowReturn) 0;

			int __result = unmanaged (this.Handle, buffer == null ? IntPtr.Zero : buffer.Handle);
			return (Gst.FlowReturn) __result;
		}

		static RenderListNativeDelegate RenderList_cb_delegate;
		static RenderListNativeDelegate RenderListVMCallback {
			get {
				if (RenderList_cb_delegate == null)
					RenderList_cb_delegate = new RenderListNativeDelegate (RenderList_cb);
				return RenderList_cb_delegate;
			}
		}

		static void OverrideRenderList (GLib.GType gtype)
		{
			OverrideRenderList (gtype, RenderListVMCallback);
		}

		static void OverrideRenderList (GLib.GType gtype, RenderListNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("render_list"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int RenderListNativeDelegate (IntPtr inst, IntPtr buffer_list);

		static int RenderList_cb (IntPtr inst, IntPtr buffer_list)
		{
			try {
				BaseSink __obj = GLib.Object.GetObject (inst, false) as BaseSink;
				Gst.FlowReturn __result;
				__result = __obj.OnRenderList (buffer_list == IntPtr.Zero ? null : (Gst.BufferList) GLib.Opaque.GetOpaque (buffer_list, typeof (Gst.BufferList), 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.Base.BaseSink), ConnectionMethod="OverrideRenderList")]
		protected virtual Gst.FlowReturn OnRenderList (Gst.BufferList buffer_list)
		{
			return InternalRenderList (buffer_list);
		}

		private Gst.FlowReturn InternalRenderList (Gst.BufferList buffer_list)
		{
			RenderListNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("render_list"));
				unmanaged = (RenderListNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(RenderListNativeDelegate));
			}
			if (unmanaged == null) return (Gst.FlowReturn) 0;

			int __result = unmanaged (this.Handle, buffer_list == null ? IntPtr.Zero : buffer_list.Handle);
			return (Gst.FlowReturn) __result;
		}


		// 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("get_caps"
							, Gst.Element.class_abi.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_caps
							, null
							, "set_caps"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_caps"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_caps
							, "get_caps"
							, "fixate"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("fixate"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // fixate
							, "set_caps"
							, "activate_pull"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("activate_pull"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // activate_pull
							, "fixate"
							, "get_times"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("get_times"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_times
							, "activate_pull"
							, "propose_allocation"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("propose_allocation"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // propose_allocation
							, "get_times"
							, "start"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("start"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // start
							, "propose_allocation"
							, "stop"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("stop"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // stop
							, "start"
							, "unlock"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("unlock"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // unlock
							, "stop"
							, "unlock_stop"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("unlock_stop"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // unlock_stop
							, "unlock"
							, "query"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("query"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // query
							, "unlock_stop"
							, "event"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("event"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // event
							, "query"
							, "wait_event"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("wait_event"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // wait_event
							, "event"
							, "prepare"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("prepare"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // prepare
							, "wait_event"
							, "prepare_list"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("prepare_list"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // prepare_list
							, "prepare"
							, "preroll"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("preroll"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // preroll
							, "prepare_list"
							, "render"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("render"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // render
							, "preroll"
							, "render_list"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("render_list"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // render_list
							, "render"
							, "_gst_reserved"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 20 // _gst_reserved
							, "render_list"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_base_sink_get_type();

		public static new GLib.GType GType { 
			get {
				IntPtr raw_ret = gst_base_sink_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);
				return ret;
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_base_sink_do_preroll(IntPtr raw, IntPtr obj);

		public Gst.FlowReturn DoPreroll(Gst.MiniObject obj) {
			int raw_ret = gst_base_sink_do_preroll(Handle, obj == null ? IntPtr.Zero : obj.Handle);
			Gst.FlowReturn ret = (Gst.FlowReturn) raw_ret;
			return ret;
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_base_sink_get_drop_out_of_segment(IntPtr raw);

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_base_sink_set_drop_out_of_segment(IntPtr raw, bool drop_out_of_segment);

		public bool DropOutOfSegment { 
			get {
				bool raw_ret = gst_base_sink_get_drop_out_of_segment(Handle);
				bool ret = raw_ret;
				return ret;
			}
			set {
				gst_base_sink_set_drop_out_of_segment(Handle, value);
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern ulong gst_base_sink_get_latency(IntPtr raw);

		public ulong Latency { 
			get {
				ulong raw_ret = gst_base_sink_get_latency(Handle);
				ulong ret = raw_ret;
				return ret;
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_base_sink_is_async_enabled(IntPtr raw);

		public bool IsAsyncEnabled { 
			get {
				bool raw_ret = gst_base_sink_is_async_enabled(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_base_sink_is_last_sample_enabled(IntPtr raw);

		public bool IsLastSampleEnabled { 
			get {
				bool raw_ret = gst_base_sink_is_last_sample_enabled(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_base_sink_is_qos_enabled(IntPtr raw);

		public bool IsQosEnabled { 
			get {
				bool raw_ret = gst_base_sink_is_qos_enabled(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_base_sink_query_latency(IntPtr raw, out bool live, out bool upstream_live, out ulong min_latency, out ulong max_latency);

		public bool QueryLatency(out bool live, out bool upstream_live, out ulong min_latency, out ulong max_latency) {
			bool raw_ret = gst_base_sink_query_latency(Handle, out live, out upstream_live, out min_latency, out max_latency);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_base_sink_set_async_enabled(IntPtr raw, bool enabled);

		public bool AsyncEnabled { 
			set {
				gst_base_sink_set_async_enabled(Handle, value);
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_base_sink_set_last_sample_enabled(IntPtr raw, bool enabled);

		public bool LastSampleEnabled { 
			set {
				gst_base_sink_set_last_sample_enabled(Handle, value);
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_base_sink_set_qos_enabled(IntPtr raw, bool enabled);

		public bool QosEnabled { 
			set {
				gst_base_sink_set_qos_enabled(Handle, value);
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_base_sink_wait(IntPtr raw, ulong time, out long jitter);

		public Gst.FlowReturn Wait(ulong time, out long jitter) {
			int raw_ret = gst_base_sink_wait(Handle, time, out jitter);
			Gst.FlowReturn ret = (Gst.FlowReturn) raw_ret;
			return ret;
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_base_sink_wait_clock(IntPtr raw, ulong time, out long jitter);

		public Gst.ClockReturn WaitClock(ulong time, out long jitter) {
			int raw_ret = gst_base_sink_wait_clock(Handle, time, out jitter);
			Gst.ClockReturn ret = (Gst.ClockReturn) raw_ret;
			return ret;
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_base_sink_wait_preroll(IntPtr raw);

		public Gst.FlowReturn WaitPreroll() {
			int raw_ret = gst_base_sink_wait_preroll(Handle);
			Gst.FlowReturn ret = (Gst.FlowReturn) raw_ret;
			return ret;
		}


		static BaseSink ()
		{
			GtkSharp.GstreamerSharp.ObjectManager.Initialize ();
		}

		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public new GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("sinkpad"
							, Gst.Element.abi_info.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // sinkpad
							, null
							, "pad_mode"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("pad_mode"
							, -1
							, (uint) Marshal.SizeOf(System.Enum.GetUnderlyingType(typeof(Gst.PadMode))) // pad_mode
							, "sinkpad"
							, "offset"
							, (long) Marshal.OffsetOf(typeof(GstBaseSink_pad_modeAlign), "pad_mode")
							, 0
							),
						new GLib.AbiField("offset"
							, -1
							, (uint) Marshal.SizeOf(typeof(ulong)) // offset
							, "pad_mode"
							, "can_activate_pull"
							, (long) Marshal.OffsetOf(typeof(GstBaseSink_offsetAlign), "offset")
							, 0
							),
						new GLib.AbiField("can_activate_pull"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // can_activate_pull
							, "offset"
							, "can_activate_push"
							, (long) Marshal.OffsetOf(typeof(GstBaseSink_can_activate_pullAlign), "can_activate_pull")
							, 0
							),
						new GLib.AbiField("can_activate_push"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // can_activate_push
							, "can_activate_pull"
							, "preroll_lock"
							, (long) Marshal.OffsetOf(typeof(GstBaseSink_can_activate_pushAlign), "can_activate_push")
							, 0
							),
						new GLib.AbiField("preroll_lock"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // preroll_lock
							, "can_activate_push"
							, "preroll_cond"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("preroll_cond"
							, -1
							, (uint) Marshal.SizeOf(typeof(GLib.Cond.ABI)) // preroll_cond
							, "preroll_lock"
							, "eos"
							, (long) Marshal.OffsetOf(typeof(GstBaseSink_preroll_condAlign), "preroll_cond")
							, 0
							),
						new GLib.AbiField("eos"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // eos
							, "preroll_cond"
							, "need_preroll"
							, (long) Marshal.OffsetOf(typeof(GstBaseSink_eosAlign), "eos")
							, 0
							),
						new GLib.AbiField("need_preroll"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // need_preroll
							, "eos"
							, "have_preroll"
							, (long) Marshal.OffsetOf(typeof(GstBaseSink_need_prerollAlign), "need_preroll")
							, 0
							),
						new GLib.AbiField("have_preroll"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // have_preroll
							, "need_preroll"
							, "playing_async"
							, (long) Marshal.OffsetOf(typeof(GstBaseSink_have_prerollAlign), "have_preroll")
							, 0
							),
						new GLib.AbiField("playing_async"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // playing_async
							, "have_preroll"
							, "have_newsegment"
							, (long) Marshal.OffsetOf(typeof(GstBaseSink_playing_asyncAlign), "playing_async")
							, 0
							),
						new GLib.AbiField("have_newsegment"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // have_newsegment
							, "playing_async"
							, "segment"
							, (long) Marshal.OffsetOf(typeof(GstBaseSink_have_newsegmentAlign), "have_newsegment")
							, 0
							),
						new GLib.AbiField("segment"
							, -1
							, (uint) Marshal.SizeOf(typeof(Gst.Segment)) // segment
							, "have_newsegment"
							, "clock_id"
							, (long) Marshal.OffsetOf(typeof(GstBaseSink_segmentAlign), "segment")
							, 0
							),
						new GLib.AbiField("clock_id"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // clock_id
							, "segment"
							, "sync"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("sync"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // sync
							, "clock_id"
							, "flushing"
							, (long) Marshal.OffsetOf(typeof(GstBaseSink_syncAlign), "sync")
							, 0
							),
						new GLib.AbiField("flushing"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // flushing
							, "sync"
							, "running"
							, (long) Marshal.OffsetOf(typeof(GstBaseSink_flushingAlign), "flushing")
							, 0
							),
						new GLib.AbiField("running"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // running
							, "flushing"
							, "max_lateness"
							, (long) Marshal.OffsetOf(typeof(GstBaseSink_runningAlign), "running")
							, 0
							),
						new GLib.AbiField("max_lateness"
							, -1
							, (uint) Marshal.SizeOf(typeof(long)) // max_lateness
							, "running"
							, "priv"
							, (long) Marshal.OffsetOf(typeof(GstBaseSink_max_latenessAlign), "max_lateness")
							, 0
							),
						new GLib.AbiField("priv"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // priv
							, "max_lateness"
							, "_gst_reserved"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 20 // _gst_reserved
							, "priv"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _abi_info;
			}
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSink_pad_modeAlign
		{
			sbyte f1;
			private Gst.PadMode pad_mode;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSink_offsetAlign
		{
			sbyte f1;
			private ulong offset;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSink_can_activate_pullAlign
		{
			sbyte f1;
			private bool can_activate_pull;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSink_can_activate_pushAlign
		{
			sbyte f1;
			private bool can_activate_push;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSink_preroll_condAlign
		{
			sbyte f1;
			private GLib.Cond.ABI preroll_cond;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSink_eosAlign
		{
			sbyte f1;
			private bool eos;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSink_need_prerollAlign
		{
			sbyte f1;
			private bool need_preroll;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSink_have_prerollAlign
		{
			sbyte f1;
			private bool have_preroll;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSink_playing_asyncAlign
		{
			sbyte f1;
			private bool playing_async;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSink_have_newsegmentAlign
		{
			sbyte f1;
			private bool have_newsegment;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSink_segmentAlign
		{
			sbyte f1;
			private Gst.Segment segment;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSink_syncAlign
		{
			sbyte f1;
			private bool sync;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSink_flushingAlign
		{
			sbyte f1;
			private bool flushing;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSink_runningAlign
		{
			sbyte f1;
			private bool running;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSink_max_latenessAlign
		{
			sbyte f1;
			private long max_lateness;
		}


		// End of the ABI representation.

#endregion
	}
}
