// 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 BaseSrc : Gst.Element {

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

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

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

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

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

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

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

		[GLib.Property ("do-timestamp")]
		public bool DoTimestamp {
			get  {
				bool raw_ret = gst_base_src_get_do_timestamp(Handle);
				bool ret = raw_ret;
				return ret;
			}
			set  {
				gst_base_src_set_do_timestamp(Handle, value);
			}
		}

		[GLib.Property ("num-buffers")]
		public int NumBuffers {
			get {
				GLib.Value val = GetProperty ("num-buffers");
				int ret = (int) val;
				val.Dispose ();
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("num-buffers", val);
				val.Dispose ();
			}
		}

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

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

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

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

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

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

		public uint BlocksizeField {
			get {
				unsafe {
					uint* raw_ptr = (uint*)(((byte*)Handle) + abi_info.GetFieldOffset("blocksize"));
					return (*raw_ptr);
				}
			}
		}

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

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

		public IntPtr ClockId {
			get {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("clock_id"));
					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));
				}
			}
		}

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

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

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

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

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

		public Gst.Event PendingSeek {
			get {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("pending_seek"));
					return (*raw_ptr) == IntPtr.Zero ? null : (Gst.Event) GLib.Opaque.GetOpaque ((*raw_ptr), typeof (Gst.Event), false);
				}
			}
		}

		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 {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				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.BaseSrc), 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 NegotiateNativeDelegate Negotiate_cb_delegate;
		static NegotiateNativeDelegate NegotiateVMCallback {
			get {
				if (Negotiate_cb_delegate == null)
					Negotiate_cb_delegate = new NegotiateNativeDelegate (Negotiate_cb);
				return Negotiate_cb_delegate;
			}
		}

		static void OverrideNegotiate (GLib.GType gtype)
		{
			OverrideNegotiate (gtype, NegotiateVMCallback);
		}

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSrc), ConnectionMethod="OverrideNegotiate")]
		protected virtual bool OnNegotiate ()
		{
			return InternalNegotiate ();
		}

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

			bool __result = unmanaged (this.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 {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				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.BaseSrc), 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 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 {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				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.BaseSrc), 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 DecideAllocationNativeDelegate DecideAllocation_cb_delegate;
		static DecideAllocationNativeDelegate DecideAllocationVMCallback {
			get {
				if (DecideAllocation_cb_delegate == null)
					DecideAllocation_cb_delegate = new DecideAllocationNativeDelegate (DecideAllocation_cb);
				return DecideAllocation_cb_delegate;
			}
		}

		static void OverrideDecideAllocation (GLib.GType gtype)
		{
			OverrideDecideAllocation (gtype, DecideAllocationVMCallback);
		}

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

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

		static bool DecideAllocation_cb (IntPtr inst, IntPtr query)
		{
			try {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				bool __result;
				__result = __obj.OnDecideAllocation (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.BaseSrc), ConnectionMethod="OverrideDecideAllocation")]
		protected virtual bool OnDecideAllocation (Gst.Query query)
		{
			return InternalDecideAllocation (query);
		}

		private bool InternalDecideAllocation (Gst.Query query)
		{
			DecideAllocationNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("decide_allocation"));
				unmanaged = (DecideAllocationNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(DecideAllocationNativeDelegate));
			}
			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 {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				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.BaseSrc), 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 {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				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.BaseSrc), 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 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, out ulong start, out ulong end);

		static void GetTimes_cb (IntPtr inst, IntPtr buffer, out ulong start, out ulong end)
		{
			try {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				__obj.OnGetTimes (buffer == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (buffer, typeof (Gst.Buffer), false), out start, out end);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

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

		private void InternalGetTimes (Gst.Buffer buffer, out ulong start, out 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) throw new InvalidOperationException ("No base method to invoke");

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

		static GetSizeNativeDelegate GetSize_cb_delegate;
		static GetSizeNativeDelegate GetSizeVMCallback {
			get {
				if (GetSize_cb_delegate == null)
					GetSize_cb_delegate = new GetSizeNativeDelegate (GetSize_cb);
				return GetSize_cb_delegate;
			}
		}

		static void OverrideGetSize (GLib.GType gtype)
		{
			OverrideGetSize (gtype, GetSizeVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool GetSizeNativeDelegate (IntPtr inst, ulong size);

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSrc), ConnectionMethod="OverrideGetSize")]
		protected virtual bool OnGetSize (ulong size)
		{
			return InternalGetSize (size);
		}

		private bool InternalGetSize (ulong size)
		{
			GetSizeNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("get_size"));
				unmanaged = (GetSizeNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetSizeNativeDelegate));
			}
			if (unmanaged == null) return false;

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

		static IsSeekableNativeDelegate IsSeekable_cb_delegate;
		static IsSeekableNativeDelegate IsSeekableVMCallback {
			get {
				if (IsSeekable_cb_delegate == null)
					IsSeekable_cb_delegate = new IsSeekableNativeDelegate (IsSeekable_cb);
				return IsSeekable_cb_delegate;
			}
		}

		static void OverrideIsSeekable (GLib.GType gtype)
		{
			OverrideIsSeekable (gtype, IsSeekableVMCallback);
		}

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSrc), ConnectionMethod="OverrideIsSeekable")]
		protected virtual bool OnIsSeekable ()
		{
			return InternalIsSeekable ();
		}

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

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

		static PrepareSeekSegmentNativeDelegate PrepareSeekSegment_cb_delegate;
		static PrepareSeekSegmentNativeDelegate PrepareSeekSegmentVMCallback {
			get {
				if (PrepareSeekSegment_cb_delegate == null)
					PrepareSeekSegment_cb_delegate = new PrepareSeekSegmentNativeDelegate (PrepareSeekSegment_cb);
				return PrepareSeekSegment_cb_delegate;
			}
		}

		static void OverridePrepareSeekSegment (GLib.GType gtype)
		{
			OverridePrepareSeekSegment (gtype, PrepareSeekSegmentVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool PrepareSeekSegmentNativeDelegate (IntPtr inst, IntPtr seek, IntPtr segment);

		static bool PrepareSeekSegment_cb (IntPtr inst, IntPtr seek, IntPtr segment)
		{
			try {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				bool __result;
				__result = __obj.OnPrepareSeekSegment (seek == IntPtr.Zero ? null : (Gst.Event) GLib.Opaque.GetOpaque (seek, typeof (Gst.Event), false), Gst.Segment.New (segment));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSrc), ConnectionMethod="OverridePrepareSeekSegment")]
		protected virtual bool OnPrepareSeekSegment (Gst.Event seek, Gst.Segment segment)
		{
			return InternalPrepareSeekSegment (seek, segment);
		}

		private bool InternalPrepareSeekSegment (Gst.Event seek, Gst.Segment segment)
		{
			PrepareSeekSegmentNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("prepare_seek_segment"));
				unmanaged = (PrepareSeekSegmentNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(PrepareSeekSegmentNativeDelegate));
			}
			if (unmanaged == null) return false;

			IntPtr native_segment = GLib.Marshaller.StructureToPtrAlloc (segment);
			bool __result = unmanaged (this.Handle, seek == null ? IntPtr.Zero : seek.Handle, native_segment);
			Marshal.FreeHGlobal (native_segment);
			return __result;
		}

		static DoSeekNativeDelegate DoSeek_cb_delegate;
		static DoSeekNativeDelegate DoSeekVMCallback {
			get {
				if (DoSeek_cb_delegate == null)
					DoSeek_cb_delegate = new DoSeekNativeDelegate (DoSeek_cb);
				return DoSeek_cb_delegate;
			}
		}

		static void OverrideDoSeek (GLib.GType gtype)
		{
			OverrideDoSeek (gtype, DoSeekVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool DoSeekNativeDelegate (IntPtr inst, IntPtr segment);

		static bool DoSeek_cb (IntPtr inst, IntPtr segment)
		{
			try {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				bool __result;
				__result = __obj.OnDoSeek (Gst.Segment.New (segment));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.BaseSrc), ConnectionMethod="OverrideDoSeek")]
		protected virtual bool OnDoSeek (Gst.Segment segment)
		{
			return InternalDoSeek (segment);
		}

		private bool InternalDoSeek (Gst.Segment segment)
		{
			DoSeekNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("do_seek"));
				unmanaged = (DoSeekNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(DoSeekNativeDelegate));
			}
			if (unmanaged == null) return false;

			IntPtr native_segment = GLib.Marshaller.StructureToPtrAlloc (segment);
			bool __result = unmanaged (this.Handle, native_segment);
			Marshal.FreeHGlobal (native_segment);
			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 {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				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.BaseSrc), 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 {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				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.BaseSrc), 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 {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				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.BaseSrc), 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 {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				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.BaseSrc), 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 CreateNativeDelegate Create_cb_delegate;
		static CreateNativeDelegate CreateVMCallback {
			get {
				if (Create_cb_delegate == null)
					Create_cb_delegate = new CreateNativeDelegate (Create_cb);
				return Create_cb_delegate;
			}
		}

		static void OverrideCreate (GLib.GType gtype)
		{
			OverrideCreate (gtype, CreateVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int CreateNativeDelegate (IntPtr inst, ulong offset, uint size, out IntPtr buf);

		static int Create_cb (IntPtr inst, ulong offset, uint size, out IntPtr buf)
		{
			try {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				Gst.FlowReturn __result;
				Gst.Buffer mybuf;
				__result = __obj.OnCreate (offset, size, out mybuf);
				buf = mybuf == null ? IntPtr.Zero : mybuf.Handle;
				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.BaseSrc), ConnectionMethod="OverrideCreate")]
		protected virtual Gst.FlowReturn OnCreate (ulong offset, uint size, out Gst.Buffer buf)
		{
			return InternalCreate (offset, size, out buf);
		}

		private Gst.FlowReturn InternalCreate (ulong offset, uint size, out Gst.Buffer buf)
		{
			CreateNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("create"));
				unmanaged = (CreateNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(CreateNativeDelegate));
			}
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			IntPtr native_buf;
			int __result = unmanaged (this.Handle, offset, size, out native_buf);
			buf = native_buf == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (native_buf, typeof (Gst.Buffer), true);
			return (Gst.FlowReturn) __result;
		}

		static AllocNativeDelegate Alloc_cb_delegate;
		static AllocNativeDelegate AllocVMCallback {
			get {
				if (Alloc_cb_delegate == null)
					Alloc_cb_delegate = new AllocNativeDelegate (Alloc_cb);
				return Alloc_cb_delegate;
			}
		}

		static void OverrideAlloc (GLib.GType gtype)
		{
			OverrideAlloc (gtype, AllocVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int AllocNativeDelegate (IntPtr inst, ulong offset, uint size, IntPtr buf);

		static int Alloc_cb (IntPtr inst, ulong offset, uint size, IntPtr buf)
		{
			try {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				Gst.FlowReturn __result;
				__result = __obj.OnAlloc (offset, size, buf == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (buf, 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.BaseSrc), ConnectionMethod="OverrideAlloc")]
		protected virtual Gst.FlowReturn OnAlloc (ulong offset, uint size, Gst.Buffer buf)
		{
			return InternalAlloc (offset, size, buf);
		}

		private Gst.FlowReturn InternalAlloc (ulong offset, uint size, Gst.Buffer buf)
		{
			AllocNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("alloc"));
				unmanaged = (AllocNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(AllocNativeDelegate));
			}
			if (unmanaged == null) return (Gst.FlowReturn) 0;

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

		static FillNativeDelegate Fill_cb_delegate;
		static FillNativeDelegate FillVMCallback {
			get {
				if (Fill_cb_delegate == null)
					Fill_cb_delegate = new FillNativeDelegate (Fill_cb);
				return Fill_cb_delegate;
			}
		}

		static void OverrideFill (GLib.GType gtype)
		{
			OverrideFill (gtype, FillVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int FillNativeDelegate (IntPtr inst, ulong offset, uint size, IntPtr buf);

		static int Fill_cb (IntPtr inst, ulong offset, uint size, IntPtr buf)
		{
			try {
				BaseSrc __obj = GLib.Object.GetObject (inst, false) as BaseSrc;
				Gst.FlowReturn __result;
				__result = __obj.OnFill (offset, size, buf == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (buf, 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.BaseSrc), ConnectionMethod="OverrideFill")]
		protected virtual Gst.FlowReturn OnFill (ulong offset, uint size, Gst.Buffer buf)
		{
			return InternalFill (offset, size, buf);
		}

		private Gst.FlowReturn InternalFill (ulong offset, uint size, Gst.Buffer buf)
		{
			FillNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("fill"));
				unmanaged = (FillNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(FillNativeDelegate));
			}
			if (unmanaged == null) return (Gst.FlowReturn) 0;

			int __result = unmanaged (this.Handle, offset, size, buf == null ? IntPtr.Zero : buf.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
							, "negotiate"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("negotiate"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // negotiate
							, "get_caps"
							, "fixate"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("fixate"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // fixate
							, "negotiate"
							, "set_caps"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_caps"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_caps
							, "fixate"
							, "decide_allocation"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("decide_allocation"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // decide_allocation
							, "set_caps"
							, "start"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("start"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // start
							, "decide_allocation"
							, "stop"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("stop"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // stop
							, "start"
							, "get_times"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("get_times"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_times
							, "stop"
							, "get_size"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("get_size"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_size
							, "get_times"
							, "is_seekable"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("is_seekable"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // is_seekable
							, "get_size"
							, "prepare_seek_segment"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("prepare_seek_segment"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // prepare_seek_segment
							, "is_seekable"
							, "do_seek"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("do_seek"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // do_seek
							, "prepare_seek_segment"
							, "unlock"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("unlock"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // unlock
							, "do_seek"
							, "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"
							, "create"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("create"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // create
							, "event"
							, "alloc"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("alloc"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // alloc
							, "create"
							, "fill"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("fill"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // fill
							, "alloc"
							, "_gst_reserved"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 20 // _gst_reserved
							, "fill"
							, 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_src_get_type();

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

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_base_src_get_allocator(IntPtr raw, out IntPtr allocator, IntPtr parms);

		public void GetAllocator(out Gst.Allocator allocator, out Gst.AllocationParams parms) {
			IntPtr native_allocator;
			IntPtr native_parms = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (Gst.AllocationParams)));
			gst_base_src_get_allocator(Handle, out native_allocator, native_parms);
			allocator = GLib.Object.GetObject(native_allocator, true) as Gst.Allocator;
			parms = Gst.AllocationParams.New (native_parms);
			Marshal.FreeHGlobal (native_parms);
		}

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

		public Gst.BufferPool BufferPool { 
			get {
				IntPtr raw_ret = gst_base_src_get_buffer_pool(Handle);
				Gst.BufferPool ret = GLib.Object.GetObject(raw_ret, true) as Gst.BufferPool;
				return ret;
			}
		}

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

		public bool IsAsync { 
			get {
				bool raw_ret = gst_base_src_is_async(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

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

		public bool IsLive { 
			get {
				bool raw_ret = gst_base_src_is_live(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

		[DllImport("libgstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_base_src_new_seamless_segment(IntPtr raw, long start, long stop, long time);

		public bool NewSeamlessSegment(long start, long stop, long time) {
			bool raw_ret = gst_base_src_new_seamless_segment(Handle, start, stop, time);
			bool ret = raw_ret;
			return ret;
		}

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

		public bool QueryLatency(out bool live, out ulong min_latency, out ulong max_latency) {
			bool raw_ret = gst_base_src_query_latency(Handle, out 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_src_set_async(IntPtr raw, bool async);

		public bool Async { 
			set {
				gst_base_src_set_async(Handle, value);
			}
		}

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

		public bool AutomaticEos { 
			set {
				gst_base_src_set_automatic_eos(Handle, value);
			}
		}

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

		public bool SetCaps(Gst.Caps caps) {
			bool raw_ret = gst_base_src_set_caps(Handle, caps == null ? IntPtr.Zero : caps.Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public bool DynamicSize { 
			set {
				gst_base_src_set_dynamic_size(Handle, value);
			}
		}

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

		public Gst.Format Format { 
			set {
				gst_base_src_set_format(Handle, (int) value);
			}
		}

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

		public bool Live { 
			set {
				gst_base_src_set_live(Handle, value);
			}
		}

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

		public void StartComplete(Gst.FlowReturn _ret) {
			gst_base_src_start_complete(Handle, (int) _ret);
		}

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

		public Gst.FlowReturn StartWait() {
			int raw_ret = gst_base_src_start_wait(Handle);
			Gst.FlowReturn ret = (Gst.FlowReturn) raw_ret;
			return ret;
		}

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

		public void SubmitBufferList(Gst.BufferList buffer_list) {
			buffer_list.Owned = false;
			gst_base_src_submit_buffer_list(Handle, buffer_list == null ? IntPtr.Zero : buffer_list.Handle);
		}

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

		public Gst.FlowReturn WaitPlaying() {
			int raw_ret = gst_base_src_wait_playing(Handle);
			Gst.FlowReturn ret = (Gst.FlowReturn) raw_ret;
			return ret;
		}


		static BaseSrc ()
		{
			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("srcpad"
							, Gst.Element.abi_info.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // srcpad
							, null
							, "live_lock"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("live_lock"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // live_lock
							, "srcpad"
							, "live_cond"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("live_cond"
							, -1
							, (uint) Marshal.SizeOf(typeof(GLib.Cond.ABI)) // live_cond
							, "live_lock"
							, "is_live"
							, (long) Marshal.OffsetOf(typeof(GstBaseSrc_live_condAlign), "live_cond")
							, 0
							),
						new GLib.AbiField("is_live"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // is_live
							, "live_cond"
							, "live_running"
							, (long) Marshal.OffsetOf(typeof(GstBaseSrc_is_liveAlign), "is_live")
							, 0
							),
						new GLib.AbiField("live_running"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // live_running
							, "is_live"
							, "blocksize"
							, (long) Marshal.OffsetOf(typeof(GstBaseSrc_live_runningAlign), "live_running")
							, 0
							),
						new GLib.AbiField("blocksize"
							, -1
							, (uint) Marshal.SizeOf(typeof(uint)) // blocksize
							, "live_running"
							, "can_activate_push"
							, (long) Marshal.OffsetOf(typeof(GstBaseSrc_blocksizeAlign), "blocksize")
							, 0
							),
						new GLib.AbiField("can_activate_push"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // can_activate_push
							, "blocksize"
							, "random_access"
							, (long) Marshal.OffsetOf(typeof(GstBaseSrc_can_activate_pushAlign), "can_activate_push")
							, 0
							),
						new GLib.AbiField("random_access"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // random_access
							, "can_activate_push"
							, "clock_id"
							, (long) Marshal.OffsetOf(typeof(GstBaseSrc_random_accessAlign), "random_access")
							, 0
							),
						new GLib.AbiField("clock_id"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // clock_id
							, "random_access"
							, "segment"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("segment"
							, -1
							, (uint) Marshal.SizeOf(typeof(Gst.Segment)) // segment
							, "clock_id"
							, "need_newsegment"
							, (long) Marshal.OffsetOf(typeof(GstBaseSrc_segmentAlign), "segment")
							, 0
							),
						new GLib.AbiField("need_newsegment"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // need_newsegment
							, "segment"
							, "num_buffers"
							, (long) Marshal.OffsetOf(typeof(GstBaseSrc_need_newsegmentAlign), "need_newsegment")
							, 0
							),
						new GLib.AbiField("num_buffers"
							, -1
							, (uint) Marshal.SizeOf(typeof(int)) // num_buffers
							, "need_newsegment"
							, "num_buffers_left"
							, (long) Marshal.OffsetOf(typeof(GstBaseSrc_num_buffersAlign), "num_buffers")
							, 0
							),
						new GLib.AbiField("num_buffers_left"
							, -1
							, (uint) Marshal.SizeOf(typeof(int)) // num_buffers_left
							, "num_buffers"
							, "typefind"
							, (long) Marshal.OffsetOf(typeof(GstBaseSrc_num_buffers_leftAlign), "num_buffers_left")
							, 0
							),
						new GLib.AbiField("typefind"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // typefind
							, "num_buffers_left"
							, "running"
							, (long) Marshal.OffsetOf(typeof(GstBaseSrc_typefindAlign), "typefind")
							, 0
							),
						new GLib.AbiField("running"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // running
							, "typefind"
							, "pending_seek"
							, (long) Marshal.OffsetOf(typeof(GstBaseSrc_runningAlign), "running")
							, 0
							),
						new GLib.AbiField("pending_seek"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // pending_seek
							, "running"
							, "priv"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("priv"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // priv
							, "pending_seek"
							, "_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 GstBaseSrc_live_condAlign
		{
			sbyte f1;
			private GLib.Cond.ABI live_cond;
		}

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

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

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSrc_blocksizeAlign
		{
			sbyte f1;
			private uint blocksize;
		}

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

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

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

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

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSrc_num_buffersAlign
		{
			sbyte f1;
			private int num_buffers;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstBaseSrc_num_buffers_leftAlign
		{
			sbyte f1;
			private int num_buffers_left;
		}

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

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


		// End of the ABI representation.

#endregion
	}
}
