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

namespace Gst {

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

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

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

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

		public GLib.RecMutex StateLock {
			get {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("state_lock"));
					return new GLib.RecMutex((*raw_ptr));
				}
			}
		}

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

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

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

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

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

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

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

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

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_element_set_bus(IntPtr raw, IntPtr bus);

		public Gst.Bus Bus {
			get  {
				IntPtr raw_ret = gst_element_get_bus(Handle);
				Gst.Bus ret = GLib.Object.GetObject(raw_ret, true) as Gst.Bus;
				return ret;
			}
			set  {
				gst_element_set_bus(Handle, value == null ? IntPtr.Zero : value.Handle);
			}
		}

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

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

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

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_element_set_base_time(IntPtr raw, ulong time);

		public ulong BaseTime {
			get  {
				ulong raw_ret = gst_element_get_base_time(Handle);
				ulong ret = raw_ret;
				return ret;
			}
			set  {
				gst_element_set_base_time(Handle, value);
			}
		}

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

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_element_set_start_time(IntPtr raw, ulong time);

		public ulong StartTime {
			get  {
				ulong raw_ret = gst_element_get_start_time(Handle);
				ulong ret = raw_ret;
				return ret;
			}
			set  {
				gst_element_set_start_time(Handle, value);
			}
		}

		public ushort Numpads {
			get {
				unsafe {
					ushort* raw_ptr = (ushort*)(((byte*)Handle) + abi_info.GetFieldOffset("numpads"));
					return (*raw_ptr);
				}
			}
		}

		public GLib.List Pads {
			get {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("pads"));
					return new GLib.List((*raw_ptr));
				}
			}
		}

		public ushort Numsrcpads {
			get {
				unsafe {
					ushort* raw_ptr = (ushort*)(((byte*)Handle) + abi_info.GetFieldOffset("numsrcpads"));
					return (*raw_ptr);
				}
			}
		}

		public GLib.List Srcpads {
			get {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("srcpads"));
					return new GLib.List((*raw_ptr));
				}
			}
		}

		public ushort Numsinkpads {
			get {
				unsafe {
					ushort* raw_ptr = (ushort*)(((byte*)Handle) + abi_info.GetFieldOffset("numsinkpads"));
					return (*raw_ptr);
				}
			}
		}

		public GLib.List Sinkpads {
			get {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("sinkpads"));
					return new GLib.List((*raw_ptr));
				}
			}
		}

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

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

		public GLib.List[] Contexts {
			get  {
				IntPtr raw_ret = gst_element_get_contexts(Handle);
				GLib.List[] ret = (GLib.List[]) GLib.Marshaller.ListPtrToArray (raw_ret, typeof(GLib.List), true, true, typeof(GLib.List));
				return ret;
			}
		}

		[GLib.Signal("no-more-pads")]
		public event System.EventHandler NoMorePadsEvent {
			add {
				this.AddSignalHandler ("no-more-pads", value);
			}
			remove {
				this.RemoveSignalHandler ("no-more-pads", value);
			}
		}

		[GLib.Signal("pad-removed")]
		public event Gst.PadRemovedHandler PadRemoved {
			add {
				this.AddSignalHandler ("pad-removed", value, typeof (Gst.PadRemovedArgs));
			}
			remove {
				this.RemoveSignalHandler ("pad-removed", value);
			}
		}

		[GLib.Signal("pad-added")]
		public event Gst.PadAddedHandler PadAdded {
			add {
				this.AddSignalHandler ("pad-added", value, typeof (Gst.PadAddedArgs));
			}
			remove {
				this.RemoveSignalHandler ("pad-added", value);
			}
		}

		static PadAddedNativeDelegate PadAdded_cb_delegate;
		static PadAddedNativeDelegate PadAddedVMCallback {
			get {
				if (PadAdded_cb_delegate == null)
					PadAdded_cb_delegate = new PadAddedNativeDelegate (PadAdded_cb);
				return PadAdded_cb_delegate;
			}
		}

		static void OverridePadAdded (GLib.GType gtype)
		{
			OverridePadAdded (gtype, PadAddedVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void PadAddedNativeDelegate (IntPtr inst, IntPtr new_pad);

		static void PadAdded_cb (IntPtr inst, IntPtr new_pad)
		{
			try {
				Element __obj = GLib.Object.GetObject (inst, false) as Element;
				__obj.OnPadAdded (GLib.Object.GetObject(new_pad) as Gst.Pad);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Element), ConnectionMethod="OverridePadAdded")]
		protected virtual void OnPadAdded (Gst.Pad new_pad)
		{
			InternalPadAdded (new_pad);
		}

		private void InternalPadAdded (Gst.Pad new_pad)
		{
			PadAddedNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("pad_added"));
				unmanaged = (PadAddedNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(PadAddedNativeDelegate));
			}
			if (unmanaged == null) return;

			unmanaged (this.Handle, new_pad == null ? IntPtr.Zero : new_pad.Handle);
		}

		static PadRemovedNativeDelegate PadRemoved_cb_delegate;
		static PadRemovedNativeDelegate PadRemovedVMCallback {
			get {
				if (PadRemoved_cb_delegate == null)
					PadRemoved_cb_delegate = new PadRemovedNativeDelegate (PadRemoved_cb);
				return PadRemoved_cb_delegate;
			}
		}

		static void OverridePadRemoved (GLib.GType gtype)
		{
			OverridePadRemoved (gtype, PadRemovedVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void PadRemovedNativeDelegate (IntPtr inst, IntPtr old_pad);

		static void PadRemoved_cb (IntPtr inst, IntPtr old_pad)
		{
			try {
				Element __obj = GLib.Object.GetObject (inst, false) as Element;
				__obj.OnPadRemoved (GLib.Object.GetObject(old_pad) as Gst.Pad);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Element), ConnectionMethod="OverridePadRemoved")]
		protected virtual void OnPadRemoved (Gst.Pad old_pad)
		{
			InternalPadRemoved (old_pad);
		}

		private void InternalPadRemoved (Gst.Pad old_pad)
		{
			PadRemovedNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("pad_removed"));
				unmanaged = (PadRemovedNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(PadRemovedNativeDelegate));
			}
			if (unmanaged == null) return;

			unmanaged (this.Handle, old_pad == null ? IntPtr.Zero : old_pad.Handle);
		}

		static NoMorePadsEventNativeDelegate NoMorePadsEvent_cb_delegate;
		static NoMorePadsEventNativeDelegate NoMorePadsEventVMCallback {
			get {
				if (NoMorePadsEvent_cb_delegate == null)
					NoMorePadsEvent_cb_delegate = new NoMorePadsEventNativeDelegate (NoMorePadsEvent_cb);
				return NoMorePadsEvent_cb_delegate;
			}
		}

		static void OverrideNoMorePadsEvent (GLib.GType gtype)
		{
			OverrideNoMorePadsEvent (gtype, NoMorePadsEventVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void NoMorePadsEventNativeDelegate (IntPtr inst);

		static void NoMorePadsEvent_cb (IntPtr inst)
		{
			try {
				Element __obj = GLib.Object.GetObject (inst, false) as Element;
				__obj.OnNoMorePadsEvent ();
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Element), ConnectionMethod="OverrideNoMorePadsEvent")]
		protected virtual void OnNoMorePadsEvent ()
		{
			InternalNoMorePadsEvent ();
		}

		private void InternalNoMorePadsEvent ()
		{
			NoMorePadsEventNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("no_more_pads"));
				unmanaged = (NoMorePadsEventNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(NoMorePadsEventNativeDelegate));
			}
			if (unmanaged == null) return;

			unmanaged (this.Handle);
		}

		static RequestNewPadNativeDelegate RequestNewPad_cb_delegate;
		static RequestNewPadNativeDelegate RequestNewPadVMCallback {
			get {
				if (RequestNewPad_cb_delegate == null)
					RequestNewPad_cb_delegate = new RequestNewPadNativeDelegate (RequestNewPad_cb);
				return RequestNewPad_cb_delegate;
			}
		}

		static void OverrideRequestNewPad (GLib.GType gtype)
		{
			OverrideRequestNewPad (gtype, RequestNewPadVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr RequestNewPadNativeDelegate (IntPtr inst, IntPtr templ, IntPtr name, IntPtr caps);

		static IntPtr RequestNewPad_cb (IntPtr inst, IntPtr templ, IntPtr name, IntPtr caps)
		{
			try {
				Element __obj = GLib.Object.GetObject (inst, false) as Element;
				Gst.Pad __result;
				__result = __obj.OnRequestNewPad (GLib.Object.GetObject(templ) as Gst.PadTemplate, GLib.Marshaller.Utf8PtrToString (name), caps == IntPtr.Zero ? null : (Gst.Caps) GLib.Opaque.GetOpaque (caps, typeof (Gst.Caps), false));
				return __result == null ? IntPtr.Zero : __result.OwnedHandle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Element), ConnectionMethod="OverrideRequestNewPad")]
		protected virtual Gst.Pad OnRequestNewPad (Gst.PadTemplate templ, string name, Gst.Caps caps)
		{
			return InternalRequestNewPad (templ, name, caps);
		}

		private Gst.Pad InternalRequestNewPad (Gst.PadTemplate templ, string name, Gst.Caps caps)
		{
			RequestNewPadNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("request_new_pad"));
				unmanaged = (RequestNewPadNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(RequestNewPadNativeDelegate));
			}
			if (unmanaged == null) return null;

			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			IntPtr __result = unmanaged (this.Handle, templ == null ? IntPtr.Zero : templ.Handle, native_name, caps == null ? IntPtr.Zero : caps.Handle);
			GLib.Marshaller.Free (native_name);
			return GLib.Object.GetObject(__result, true) as Gst.Pad;
		}

		static ReleasePadNativeDelegate ReleasePad_cb_delegate;
		static ReleasePadNativeDelegate ReleasePadVMCallback {
			get {
				if (ReleasePad_cb_delegate == null)
					ReleasePad_cb_delegate = new ReleasePadNativeDelegate (ReleasePad_cb);
				return ReleasePad_cb_delegate;
			}
		}

		static void OverrideReleasePad (GLib.GType gtype)
		{
			OverrideReleasePad (gtype, ReleasePadVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void ReleasePadNativeDelegate (IntPtr inst, IntPtr pad);

		static void ReleasePad_cb (IntPtr inst, IntPtr pad)
		{
			try {
				Element __obj = GLib.Object.GetObject (inst, false) as Element;
				__obj.OnReleasePad (GLib.Object.GetObject(pad) as Gst.Pad);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Element), ConnectionMethod="OverrideReleasePad")]
		protected virtual void OnReleasePad (Gst.Pad pad)
		{
			InternalReleasePad (pad);
		}

		private void InternalReleasePad (Gst.Pad pad)
		{
			ReleasePadNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("release_pad"));
				unmanaged = (ReleasePadNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(ReleasePadNativeDelegate));
			}
			if (unmanaged == null) return;

			unmanaged (this.Handle, pad == null ? IntPtr.Zero : pad.Handle);
		}

		static GetStateNativeDelegate GetState_cb_delegate;
		static GetStateNativeDelegate GetStateVMCallback {
			get {
				if (GetState_cb_delegate == null)
					GetState_cb_delegate = new GetStateNativeDelegate (GetState_cb);
				return GetState_cb_delegate;
			}
		}

		static void OverrideGetState (GLib.GType gtype)
		{
			OverrideGetState (gtype, GetStateVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int GetStateNativeDelegate (IntPtr inst, out int state, out int pending, ulong timeout);

		static int GetState_cb (IntPtr inst, out int state, out int pending, ulong timeout)
		{
			try {
				Element __obj = GLib.Object.GetObject (inst, false) as Element;
				Gst.StateChangeReturn __result;
				Gst.State mystate;
				Gst.State mypending;
				__result = __obj.OnGetState (out mystate, out mypending, timeout);
				state = (int) mystate;
				pending = (int) mypending;
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Element), ConnectionMethod="OverrideGetState")]
		protected virtual Gst.StateChangeReturn OnGetState (out Gst.State state, out Gst.State pending, ulong timeout)
		{
			return InternalGetState (out state, out pending, timeout);
		}

		private Gst.StateChangeReturn InternalGetState (out Gst.State state, out Gst.State pending, ulong timeout)
		{
			GetStateNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("get_state"));
				unmanaged = (GetStateNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetStateNativeDelegate));
			}
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

			int native_state;
			int native_pending;
			int __result = unmanaged (this.Handle, out native_state, out native_pending, timeout);
			state = (Gst.State) native_state;
			pending = (Gst.State) native_pending;
			return (Gst.StateChangeReturn) __result;
		}

		static SetStateNativeDelegate SetState_cb_delegate;
		static SetStateNativeDelegate SetStateVMCallback {
			get {
				if (SetState_cb_delegate == null)
					SetState_cb_delegate = new SetStateNativeDelegate (SetState_cb);
				return SetState_cb_delegate;
			}
		}

		static void OverrideSetState (GLib.GType gtype)
		{
			OverrideSetState (gtype, SetStateVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int SetStateNativeDelegate (IntPtr inst, int state);

		static int SetState_cb (IntPtr inst, int state)
		{
			try {
				Element __obj = GLib.Object.GetObject (inst, false) as Element;
				Gst.StateChangeReturn __result;
				__result = __obj.OnSetState ((Gst.State) state);
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Element), ConnectionMethod="OverrideSetState")]
		protected virtual Gst.StateChangeReturn OnSetState (Gst.State state)
		{
			return InternalSetState (state);
		}

		private Gst.StateChangeReturn InternalSetState (Gst.State state)
		{
			SetStateNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("set_state"));
				unmanaged = (SetStateNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SetStateNativeDelegate));
			}
			if (unmanaged == null) return (Gst.StateChangeReturn) 0;

			int __result = unmanaged (this.Handle, (int) state);
			return (Gst.StateChangeReturn) __result;
		}

		static ChangeStateNativeDelegate ChangeState_cb_delegate;
		static ChangeStateNativeDelegate ChangeStateVMCallback {
			get {
				if (ChangeState_cb_delegate == null)
					ChangeState_cb_delegate = new ChangeStateNativeDelegate (ChangeState_cb);
				return ChangeState_cb_delegate;
			}
		}

		static void OverrideChangeState (GLib.GType gtype)
		{
			OverrideChangeState (gtype, ChangeStateVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int ChangeStateNativeDelegate (IntPtr inst, int transition);

		static int ChangeState_cb (IntPtr inst, int transition)
		{
			try {
				Element __obj = GLib.Object.GetObject (inst, false) as Element;
				Gst.StateChangeReturn __result;
				__result = __obj.OnChangeState ((Gst.StateChange) transition);
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Element), ConnectionMethod="OverrideChangeState")]
		protected virtual Gst.StateChangeReturn OnChangeState (Gst.StateChange transition)
		{
			return InternalChangeState (transition);
		}

		private Gst.StateChangeReturn InternalChangeState (Gst.StateChange transition)
		{
			ChangeStateNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("change_state"));
				unmanaged = (ChangeStateNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(ChangeStateNativeDelegate));
			}
			if (unmanaged == null) return (Gst.StateChangeReturn) 0;

			int __result = unmanaged (this.Handle, (int) transition);
			return (Gst.StateChangeReturn) __result;
		}

		static StateChangedNativeDelegate StateChanged_cb_delegate;
		static StateChangedNativeDelegate StateChangedVMCallback {
			get {
				if (StateChanged_cb_delegate == null)
					StateChanged_cb_delegate = new StateChangedNativeDelegate (StateChanged_cb);
				return StateChanged_cb_delegate;
			}
		}

		static void OverrideStateChanged (GLib.GType gtype)
		{
			OverrideStateChanged (gtype, StateChangedVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void StateChangedNativeDelegate (IntPtr inst, int oldstate, int newstate, int pending);

		static void StateChanged_cb (IntPtr inst, int oldstate, int newstate, int pending)
		{
			try {
				Element __obj = GLib.Object.GetObject (inst, false) as Element;
				__obj.OnStateChanged ((Gst.State) oldstate, (Gst.State) newstate, (Gst.State) pending);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Element), ConnectionMethod="OverrideStateChanged")]
		protected virtual void OnStateChanged (Gst.State oldstate, Gst.State newstate, Gst.State pending)
		{
			InternalStateChanged (oldstate, newstate, pending);
		}

		private void InternalStateChanged (Gst.State oldstate, Gst.State newstate, Gst.State pending)
		{
			StateChangedNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("state_changed"));
				unmanaged = (StateChangedNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(StateChangedNativeDelegate));
			}
			if (unmanaged == null) return;

			unmanaged (this.Handle, (int) oldstate, (int) newstate, (int) pending);
		}

		static SetBusNativeDelegate SetBus_cb_delegate;
		static SetBusNativeDelegate SetBusVMCallback {
			get {
				if (SetBus_cb_delegate == null)
					SetBus_cb_delegate = new SetBusNativeDelegate (SetBus_cb);
				return SetBus_cb_delegate;
			}
		}

		static void OverrideSetBus (GLib.GType gtype)
		{
			OverrideSetBus (gtype, SetBusVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void SetBusNativeDelegate (IntPtr inst, IntPtr bus);

		static void SetBus_cb (IntPtr inst, IntPtr bus)
		{
			try {
				Element __obj = GLib.Object.GetObject (inst, false) as Element;
				__obj.OnSetBus (GLib.Object.GetObject(bus) as Gst.Bus);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Element), ConnectionMethod="OverrideSetBus")]
		protected virtual void OnSetBus (Gst.Bus bus)
		{
			InternalSetBus (bus);
		}

		private void InternalSetBus (Gst.Bus bus)
		{
			SetBusNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("set_bus"));
				unmanaged = (SetBusNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SetBusNativeDelegate));
			}
			if (unmanaged == null) return;

			unmanaged (this.Handle, bus == null ? IntPtr.Zero : bus.Handle);
		}

		static ProvideClockNativeDelegate ProvideClock_cb_delegate;
		static ProvideClockNativeDelegate ProvideClockVMCallback {
			get {
				if (ProvideClock_cb_delegate == null)
					ProvideClock_cb_delegate = new ProvideClockNativeDelegate (ProvideClock_cb);
				return ProvideClock_cb_delegate;
			}
		}

		static void OverrideProvideClock (GLib.GType gtype)
		{
			OverrideProvideClock (gtype, ProvideClockVMCallback);
		}

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

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

		static IntPtr ProvideClock_cb (IntPtr inst)
		{
			try {
				Element __obj = GLib.Object.GetObject (inst, false) as Element;
				Gst.Clock __result;
				__result = __obj.OnProvideClock ();
				return __result == null ? IntPtr.Zero : __result.OwnedHandle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Element), ConnectionMethod="OverrideProvideClock")]
		protected virtual Gst.Clock OnProvideClock ()
		{
			return InternalProvideClock ();
		}

		private Gst.Clock InternalProvideClock ()
		{
			ProvideClockNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("provide_clock"));
				unmanaged = (ProvideClockNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(ProvideClockNativeDelegate));
			}
			if (unmanaged == null) return null;

			IntPtr __result = unmanaged (this.Handle);
			return GLib.Object.GetObject(__result, true) as Gst.Clock;
		}

		static SetClockNativeDelegate SetClock_cb_delegate;
		static SetClockNativeDelegate SetClockVMCallback {
			get {
				if (SetClock_cb_delegate == null)
					SetClock_cb_delegate = new SetClockNativeDelegate (SetClock_cb);
				return SetClock_cb_delegate;
			}
		}

		static void OverrideSetClock (GLib.GType gtype)
		{
			OverrideSetClock (gtype, SetClockVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool SetClockNativeDelegate (IntPtr inst, IntPtr clock);

		static bool SetClock_cb (IntPtr inst, IntPtr clock)
		{
			try {
				Element __obj = GLib.Object.GetObject (inst, false) as Element;
				bool __result;
				__result = __obj.OnSetClock (GLib.Object.GetObject(clock) as Gst.Clock);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Element), ConnectionMethod="OverrideSetClock")]
		protected virtual bool OnSetClock (Gst.Clock clock)
		{
			return InternalSetClock (clock);
		}

		private bool InternalSetClock (Gst.Clock clock)
		{
			SetClockNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("set_clock"));
				unmanaged = (SetClockNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SetClockNativeDelegate));
			}
			if (unmanaged == null) return false;

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

		static SendEventNativeDelegate SendEvent_cb_delegate;
		static SendEventNativeDelegate SendEventVMCallback {
			get {
				if (SendEvent_cb_delegate == null)
					SendEvent_cb_delegate = new SendEventNativeDelegate (SendEvent_cb);
				return SendEvent_cb_delegate;
			}
		}

		static void OverrideSendEvent (GLib.GType gtype)
		{
			OverrideSendEvent (gtype, SendEventVMCallback);
		}

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Element), ConnectionMethod="OverrideSendEvent")]
		protected virtual bool OnSendEvent (Gst.Event evnt)
		{
			return InternalSendEvent (evnt);
		}

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

			evnt.Owned = false;
			bool __result = unmanaged (this.Handle, evnt == null ? IntPtr.Zero : evnt.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 {
				Element __obj = GLib.Object.GetObject (inst, false) as Element;
				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.Element), 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 PostMessageNativeDelegate PostMessage_cb_delegate;
		static PostMessageNativeDelegate PostMessageVMCallback {
			get {
				if (PostMessage_cb_delegate == null)
					PostMessage_cb_delegate = new PostMessageNativeDelegate (PostMessage_cb);
				return PostMessage_cb_delegate;
			}
		}

		static void OverridePostMessage (GLib.GType gtype)
		{
			OverridePostMessage (gtype, PostMessageVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool PostMessageNativeDelegate (IntPtr inst, IntPtr message);

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Element), ConnectionMethod="OverridePostMessage")]
		protected virtual bool OnPostMessage (Gst.Message message)
		{
			return InternalPostMessage (message);
		}

		private bool InternalPostMessage (Gst.Message message)
		{
			PostMessageNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("post_message"));
				unmanaged = (PostMessageNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(PostMessageNativeDelegate));
			}
			if (unmanaged == null) return false;

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

		static SetContextNativeDelegate SetContext_cb_delegate;
		static SetContextNativeDelegate SetContextVMCallback {
			get {
				if (SetContext_cb_delegate == null)
					SetContext_cb_delegate = new SetContextNativeDelegate (SetContext_cb);
				return SetContext_cb_delegate;
			}
		}

		static void OverrideSetContext (GLib.GType gtype)
		{
			OverrideSetContext (gtype, SetContextVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void SetContextNativeDelegate (IntPtr inst, IntPtr context);

		static void SetContext_cb (IntPtr inst, IntPtr context)
		{
			try {
				Element __obj = GLib.Object.GetObject (inst, false) as Element;
				__obj.OnSetContext (Gst.Context.New (context));
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Element), ConnectionMethod="OverrideSetContext")]
		protected virtual void OnSetContext (Gst.Context context)
		{
			InternalSetContext (context);
		}

		private void InternalSetContext (Gst.Context context)
		{
			SetContextNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("set_context"));
				unmanaged = (SetContextNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SetContextNativeDelegate));
			}
			if (unmanaged == null) return;

			IntPtr native_context = GLib.Marshaller.StructureToPtrAlloc (context);
			unmanaged (this.Handle, native_context);
			Marshal.FreeHGlobal (native_context);
		}


		// 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("metadata"
							, Gst.Object.class_abi.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // metadata
							, null
							, "elementfactory"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("elementfactory"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // elementfactory
							, "metadata"
							, "padtemplates"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("padtemplates"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // padtemplates
							, "elementfactory"
							, "numpadtemplates"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("numpadtemplates"
							, -1
							, (uint) Marshal.SizeOf(typeof(int)) // numpadtemplates
							, "padtemplates"
							, "pad_templ_cookie"
							, (long) Marshal.OffsetOf(typeof(GstElement_numpadtemplatesAlign), "numpadtemplates")
							, 0
							),
						new GLib.AbiField("pad_templ_cookie"
							, -1
							, (uint) Marshal.SizeOf(typeof(uint)) // pad_templ_cookie
							, "numpadtemplates"
							, "pad_added"
							, (long) Marshal.OffsetOf(typeof(GstElement_pad_templ_cookieAlign), "pad_templ_cookie")
							, 0
							),
						new GLib.AbiField("pad_added"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // pad_added
							, "pad_templ_cookie"
							, "pad_removed"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("pad_removed"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // pad_removed
							, "pad_added"
							, "no_more_pads"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("no_more_pads"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // no_more_pads
							, "pad_removed"
							, "request_new_pad"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("request_new_pad"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // request_new_pad
							, "no_more_pads"
							, "release_pad"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("release_pad"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // release_pad
							, "request_new_pad"
							, "get_state"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("get_state"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_state
							, "release_pad"
							, "set_state"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_state"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_state
							, "get_state"
							, "change_state"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("change_state"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // change_state
							, "set_state"
							, "state_changed"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("state_changed"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // state_changed
							, "change_state"
							, "set_bus"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_bus"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_bus
							, "state_changed"
							, "provide_clock"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("provide_clock"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // provide_clock
							, "set_bus"
							, "set_clock"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_clock"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_clock
							, "provide_clock"
							, "send_event"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("send_event"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // send_event
							, "set_clock"
							, "query"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("query"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // query
							, "send_event"
							, "post_message"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("post_message"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // post_message
							, "query"
							, "set_context"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_context"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_context
							, "post_message"
							, "_gst_reserved"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 18 // _gst_reserved
							, "set_context"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _class_abi;
			}
		}

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

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


		// End of the ABI representation.

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

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

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern unsafe IntPtr gst_element_make_from_uri(int type, IntPtr uri, IntPtr elementname, out IntPtr error);

		public static unsafe Gst.Element MakeFromUri(Gst.URIType type, string uri, string elementname) {
			IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
			IntPtr native_elementname = GLib.Marshaller.StringToPtrGStrdup (elementname);
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = gst_element_make_from_uri((int) type, native_uri, native_elementname, out error);
			Gst.Element ret = GLib.Object.GetObject(raw_ret) as Gst.Element;
			GLib.Marshaller.Free (native_uri);
			GLib.Marshaller.Free (native_elementname);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		public static Gst.Element MakeFromUri(Gst.URIType type, string uri) {
			return MakeFromUri (type, uri, null);
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_element_register(IntPtr plugin, IntPtr name, uint rank, IntPtr type);

		public static bool Register(Gst.Plugin plugin, string name, uint rank, GLib.GType type) {
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			bool raw_ret = gst_element_register(plugin == null ? IntPtr.Zero : plugin.Handle, native_name, rank, type.Val);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_name);
			return ret;
		}

		public static bool Register(string name, uint rank, GLib.GType type) {
			return Register (null, name, rank, type);
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_element_state_change_return_get_name(int state_ret);

		public static string StateChangeReturnGetName(Gst.StateChangeReturn state_ret) {
			IntPtr raw_ret = gst_element_state_change_return_get_name((int) state_ret);
			string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_element_state_get_name(int state);

		public static string StateGetName(Gst.State state) {
			IntPtr raw_ret = gst_element_state_get_name((int) state);
			string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
			return ret;
		}

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

		public void AbortState() {
			gst_element_abort_state(Handle);
		}

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

		public bool AddPad(Gst.Pad pad) {
			bool raw_ret = gst_element_add_pad(Handle, pad == null ? IntPtr.Zero : pad.Handle);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern UIntPtr gst_element_add_property_deep_notify_watch(IntPtr raw, IntPtr property_name, bool include_value);

		public ulong AddPropertyDeepNotifyWatch(string property_name, bool include_value) {
			IntPtr native_property_name = GLib.Marshaller.StringToPtrGStrdup (property_name);
			UIntPtr raw_ret = gst_element_add_property_deep_notify_watch(Handle, native_property_name, include_value);
			ulong ret = (ulong) raw_ret;
			GLib.Marshaller.Free (native_property_name);
			return ret;
		}

		public ulong AddPropertyDeepNotifyWatch(bool include_value) {
			return AddPropertyDeepNotifyWatch (null, include_value);
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern UIntPtr gst_element_add_property_notify_watch(IntPtr raw, IntPtr property_name, bool include_value);

		public ulong AddPropertyNotifyWatch(string property_name, bool include_value) {
			IntPtr native_property_name = GLib.Marshaller.StringToPtrGStrdup (property_name);
			UIntPtr raw_ret = gst_element_add_property_notify_watch(Handle, native_property_name, include_value);
			ulong ret = (ulong) raw_ret;
			GLib.Marshaller.Free (native_property_name);
			return ret;
		}

		public ulong AddPropertyNotifyWatch(bool include_value) {
			return AddPropertyNotifyWatch (null, include_value);
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_element_call_async(IntPtr raw, GstSharp.ElementCallAsyncFuncNative func, IntPtr user_data, GLib.DestroyNotify destroy_notify);

		public void CallAsync(Gst.ElementCallAsyncFunc func) {
			GstSharp.ElementCallAsyncFuncWrapper func_wrapper = new GstSharp.ElementCallAsyncFuncWrapper (func);
			IntPtr user_data;
			GLib.DestroyNotify destroy_notify;
			if (func == null) {
				user_data = IntPtr.Zero;
				destroy_notify = null;
			} else {
				user_data = (IntPtr) GCHandle.Alloc (func_wrapper);
				destroy_notify = GLib.DestroyHelper.NotifyHandler;
			}
			gst_element_call_async(Handle, func_wrapper.NativeDelegate, user_data, destroy_notify);
		}

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

		public Gst.StateChangeReturn ChangeState(Gst.StateChange transition) {
			int raw_ret = gst_element_change_state(Handle, (int) transition);
			Gst.StateChangeReturn ret = (Gst.StateChangeReturn) raw_ret;
			return ret;
		}

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

		public Gst.StateChangeReturn ContinueState(Gst.StateChangeReturn _ret) {
			int raw_ret = gst_element_continue_state(Handle, (int) _ret);
			Gst.StateChangeReturn ret = (Gst.StateChangeReturn) raw_ret;
			return ret;
		}

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

		public void CreateAllPads() {
			gst_element_create_all_pads(Handle);
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_element_foreach_pad(IntPtr raw, GstSharp.ElementForeachPadFuncNative func, IntPtr user_data);

		public bool ForeachPad(Gst.ElementForeachPadFunc func) {
			GstSharp.ElementForeachPadFuncWrapper func_wrapper = new GstSharp.ElementForeachPadFuncWrapper (func);
			bool raw_ret = gst_element_foreach_pad(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_element_foreach_sink_pad(IntPtr raw, GstSharp.ElementForeachPadFuncNative func, IntPtr user_data);

		public bool ForeachSinkPad(Gst.ElementForeachPadFunc func) {
			GstSharp.ElementForeachPadFuncWrapper func_wrapper = new GstSharp.ElementForeachPadFuncWrapper (func);
			bool raw_ret = gst_element_foreach_sink_pad(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_element_foreach_src_pad(IntPtr raw, GstSharp.ElementForeachPadFuncNative func, IntPtr user_data);

		public bool ForeachSrcPad(Gst.ElementForeachPadFunc func) {
			GstSharp.ElementForeachPadFuncWrapper func_wrapper = new GstSharp.ElementForeachPadFuncWrapper (func);
			bool raw_ret = gst_element_foreach_src_pad(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_element_get_compatible_pad(IntPtr raw, IntPtr pad, IntPtr caps);

		public Gst.Pad GetCompatiblePad(Gst.Pad pad, Gst.Caps caps) {
			IntPtr raw_ret = gst_element_get_compatible_pad(Handle, pad == null ? IntPtr.Zero : pad.Handle, caps == null ? IntPtr.Zero : caps.Handle);
			Gst.Pad ret = GLib.Object.GetObject(raw_ret, true) as Gst.Pad;
			return ret;
		}

		public Gst.Pad GetCompatiblePad(Gst.Pad pad) {
			return GetCompatiblePad (pad, null);
		}

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

		public Gst.PadTemplate GetCompatiblePadTemplate(Gst.PadTemplate compattempl) {
			IntPtr raw_ret = gst_element_get_compatible_pad_template(Handle, compattempl == null ? IntPtr.Zero : compattempl.Handle);
			Gst.PadTemplate ret = GLib.Object.GetObject(raw_ret) as Gst.PadTemplate;
			return ret;
		}

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

		public Gst.Context GetContext(string context_type) {
			IntPtr native_context_type = GLib.Marshaller.StringToPtrGStrdup (context_type);
			IntPtr raw_ret = gst_element_get_context(Handle, native_context_type);
			Gst.Context ret = Gst.Context.New (raw_ret);
			GLib.Marshaller.Free (native_context_type);
			return ret;
		}

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

		public Gst.Context GetContextUnlocked(string context_type) {
			IntPtr native_context_type = GLib.Marshaller.StringToPtrGStrdup (context_type);
			IntPtr raw_ret = gst_element_get_context_unlocked(Handle, native_context_type);
			Gst.Context ret = Gst.Context.New (raw_ret);
			GLib.Marshaller.Free (native_context_type);
			return ret;
		}

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

		public ulong CurrentClockTime { 
			get {
				ulong raw_ret = gst_element_get_current_clock_time(Handle);
				ulong ret = raw_ret;
				return ret;
			}
		}

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

		public ulong CurrentRunningTime { 
			get {
				ulong raw_ret = gst_element_get_current_running_time(Handle);
				ulong ret = raw_ret;
				return ret;
			}
		}

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

		public Gst.ElementFactory Factory { 
			get {
				IntPtr raw_ret = gst_element_get_factory(Handle);
				Gst.ElementFactory ret = GLib.Object.GetObject(raw_ret) as Gst.ElementFactory;
				return ret;
			}
		}

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

		public string GetMetadata(string key) {
			IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key);
			IntPtr raw_ret = gst_element_get_metadata(Handle, native_key);
			string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
			GLib.Marshaller.Free (native_key);
			return ret;
		}

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

		public Gst.PadTemplate GetPadTemplate(string name) {
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			IntPtr raw_ret = gst_element_get_pad_template(Handle, native_name);
			Gst.PadTemplate ret = GLib.Object.GetObject(raw_ret) as Gst.PadTemplate;
			GLib.Marshaller.Free (native_name);
			return ret;
		}

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

		public Gst.PadTemplate[] PadTemplateList { 
			get {
				IntPtr raw_ret = gst_element_get_pad_template_list(Handle);
				Gst.PadTemplate[] ret = (Gst.PadTemplate[]) GLib.Marshaller.ListPtrToArray (raw_ret, typeof(GLib.List), false, false, typeof(Gst.PadTemplate));
				return ret;
			}
		}

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

		public Gst.Pad GetRequestPad(string name) {
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			IntPtr raw_ret = gst_element_get_request_pad(Handle, native_name);
			Gst.Pad ret = GLib.Object.GetObject(raw_ret, true) as Gst.Pad;
			GLib.Marshaller.Free (native_name);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_element_get_state(IntPtr raw, out int state, out int pending, ulong timeout);

		public Gst.StateChangeReturn GetState(out Gst.State state, out Gst.State pending, ulong timeout) {
			int native_state;
			int native_pending;
			int raw_ret = gst_element_get_state(Handle, out native_state, out native_pending, timeout);
			Gst.StateChangeReturn ret = (Gst.StateChangeReturn) raw_ret;
			state = (Gst.State) native_state;
			pending = (Gst.State) native_pending;
			return ret;
		}

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

		public Gst.Pad GetStaticPad(string name) {
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			IntPtr raw_ret = gst_element_get_static_pad(Handle, native_name);
			Gst.Pad ret = GLib.Object.GetObject(raw_ret, true) as Gst.Pad;
			GLib.Marshaller.Free (native_name);
			return ret;
		}

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

		public bool IsLockedState { 
			get {
				bool raw_ret = gst_element_is_locked_state(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

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

		public Gst.Iterator IteratePads() {
			IntPtr raw_ret = gst_element_iterate_pads(Handle);
			Gst.Iterator ret = raw_ret == IntPtr.Zero ? null : (Gst.Iterator) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Iterator), true);
			return ret;
		}

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

		public Gst.Iterator IterateSinkPads() {
			IntPtr raw_ret = gst_element_iterate_sink_pads(Handle);
			Gst.Iterator ret = raw_ret == IntPtr.Zero ? null : (Gst.Iterator) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Iterator), true);
			return ret;
		}

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

		public Gst.Iterator IterateSrcPads() {
			IntPtr raw_ret = gst_element_iterate_src_pads(Handle);
			Gst.Iterator ret = raw_ret == IntPtr.Zero ? null : (Gst.Iterator) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Iterator), true);
			return ret;
		}

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

		public bool Link(Gst.Element dest) {
			bool raw_ret = gst_element_link(Handle, dest == null ? IntPtr.Zero : dest.Handle);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_element_link_filtered(IntPtr raw, IntPtr dest, IntPtr filter);

		public bool LinkFiltered(Gst.Element dest, Gst.Caps filter) {
			bool raw_ret = gst_element_link_filtered(Handle, dest == null ? IntPtr.Zero : dest.Handle, filter == null ? IntPtr.Zero : filter.Handle);
			bool ret = raw_ret;
			return ret;
		}

		public bool LinkFiltered(Gst.Element dest) {
			return LinkFiltered (dest, null);
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_element_link_pads(IntPtr raw, IntPtr srcpadname, IntPtr dest, IntPtr destpadname);

		public bool LinkPads(string srcpadname, Gst.Element dest, string destpadname) {
			IntPtr native_srcpadname = GLib.Marshaller.StringToPtrGStrdup (srcpadname);
			IntPtr native_destpadname = GLib.Marshaller.StringToPtrGStrdup (destpadname);
			bool raw_ret = gst_element_link_pads(Handle, native_srcpadname, dest == null ? IntPtr.Zero : dest.Handle, native_destpadname);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_srcpadname);
			GLib.Marshaller.Free (native_destpadname);
			return ret;
		}

		public bool LinkPads(Gst.Element dest) {
			return LinkPads (null, dest, null);
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_element_link_pads_filtered(IntPtr raw, IntPtr srcpadname, IntPtr dest, IntPtr destpadname, IntPtr filter);

		public bool LinkPadsFiltered(string srcpadname, Gst.Element dest, string destpadname, Gst.Caps filter) {
			IntPtr native_srcpadname = GLib.Marshaller.StringToPtrGStrdup (srcpadname);
			IntPtr native_destpadname = GLib.Marshaller.StringToPtrGStrdup (destpadname);
			bool raw_ret = gst_element_link_pads_filtered(Handle, native_srcpadname, dest == null ? IntPtr.Zero : dest.Handle, native_destpadname, filter == null ? IntPtr.Zero : filter.Handle);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_srcpadname);
			GLib.Marshaller.Free (native_destpadname);
			return ret;
		}

		public bool LinkPadsFiltered(Gst.Element dest) {
			return LinkPadsFiltered (null, dest, null, null);
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_element_link_pads_full(IntPtr raw, IntPtr srcpadname, IntPtr dest, IntPtr destpadname, int flags);

		public bool LinkPadsFull(string srcpadname, Gst.Element dest, string destpadname, Gst.PadLinkCheck flags) {
			IntPtr native_srcpadname = GLib.Marshaller.StringToPtrGStrdup (srcpadname);
			IntPtr native_destpadname = GLib.Marshaller.StringToPtrGStrdup (destpadname);
			bool raw_ret = gst_element_link_pads_full(Handle, native_srcpadname, dest == null ? IntPtr.Zero : dest.Handle, native_destpadname, (int) flags);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_srcpadname);
			GLib.Marshaller.Free (native_destpadname);
			return ret;
		}

		public bool LinkPadsFull(Gst.Element dest, Gst.PadLinkCheck flags) {
			return LinkPadsFull (null, dest, null, flags);
		}

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

		public void LostState() {
			gst_element_lost_state(Handle);
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_element_message_full(IntPtr raw, int type, uint domain, int code, IntPtr text, IntPtr debug, IntPtr file, IntPtr function, int line);

		public void MessageFull(Gst.MessageType type, uint domain, int code, string text, string debug, string file, string function, int line) {
			IntPtr native_file = GLib.Marshaller.StringToPtrGStrdup (file);
			IntPtr native_function = GLib.Marshaller.StringToPtrGStrdup (function);
			gst_element_message_full(Handle, (int) type, domain, code, GLib.Marshaller.StringToPtrGStrdup(text), GLib.Marshaller.StringToPtrGStrdup(debug), native_file, native_function, line);
			GLib.Marshaller.Free (native_file);
			GLib.Marshaller.Free (native_function);
		}

		public void MessageFull(Gst.MessageType type, uint domain, int code, string file, string function, int line) {
			MessageFull (type, domain, code, null, null, file, function, line);
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_element_message_full_with_details(IntPtr raw, int type, uint domain, int code, IntPtr text, IntPtr debug, IntPtr file, IntPtr function, int line, IntPtr structure);

		public void MessageFullWithDetails(Gst.MessageType type, uint domain, int code, string text, string debug, string file, string function, int line, Gst.Structure structure) {
			IntPtr native_file = GLib.Marshaller.StringToPtrGStrdup (file);
			IntPtr native_function = GLib.Marshaller.StringToPtrGStrdup (function);
			structure.Owned = false;
			gst_element_message_full_with_details(Handle, (int) type, domain, code, GLib.Marshaller.StringToPtrGStrdup(text), GLib.Marshaller.StringToPtrGStrdup(debug), native_file, native_function, line, structure == null ? IntPtr.Zero : structure.Handle);
			GLib.Marshaller.Free (native_file);
			GLib.Marshaller.Free (native_function);
		}

		public void MessageFullWithDetails(Gst.MessageType type, uint domain, int code, string file, string function, int line, Gst.Structure structure) {
			MessageFullWithDetails (type, domain, code, null, null, file, function, line, structure);
		}

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

		public void NoMorePads() {
			gst_element_no_more_pads(Handle);
		}

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

		public bool PostMessage(Gst.Message message) {
			message.Owned = false;
			bool raw_ret = gst_element_post_message(Handle, message == null ? IntPtr.Zero : message.Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public Gst.Clock ProvideClock() {
			IntPtr raw_ret = gst_element_provide_clock(Handle);
			Gst.Clock ret = GLib.Object.GetObject(raw_ret, true) as Gst.Clock;
			return ret;
		}

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

		public bool Query(Gst.Query query) {
			bool raw_ret = gst_element_query(Handle, query == null ? IntPtr.Zero : query.Handle);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_element_query_convert(IntPtr raw, int src_format, long src_val, int dest_format, out long dest_val);

		public bool QueryConvert(Gst.Format src_format, long src_val, Gst.Format dest_format, out long dest_val) {
			bool raw_ret = gst_element_query_convert(Handle, (int) src_format, src_val, (int) dest_format, out dest_val);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_element_query_duration(IntPtr raw, int format, out long duration);

		public bool QueryDuration(Gst.Format format, out long duration) {
			bool raw_ret = gst_element_query_duration(Handle, (int) format, out duration);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_element_query_position(IntPtr raw, int format, out long cur);

		public bool QueryPosition(Gst.Format format, out long cur) {
			bool raw_ret = gst_element_query_position(Handle, (int) format, out cur);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_element_release_request_pad(IntPtr raw, IntPtr pad);

		public void ReleaseRequestPad(Gst.Pad pad) {
			gst_element_release_request_pad(Handle, pad == null ? IntPtr.Zero : pad.Handle);
		}

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

		public bool RemovePad(Gst.Pad pad) {
			bool raw_ret = gst_element_remove_pad(Handle, pad == null ? IntPtr.Zero : pad.Handle);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_element_remove_property_notify_watch(IntPtr raw, UIntPtr watch_id);

		public void RemovePropertyNotifyWatch(ulong watch_id) {
			gst_element_remove_property_notify_watch(Handle, new UIntPtr (watch_id));
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_element_request_pad(IntPtr raw, IntPtr templ, IntPtr name, IntPtr caps);

		public Gst.Pad RequestPad(Gst.PadTemplate templ, string name, Gst.Caps caps) {
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			IntPtr raw_ret = gst_element_request_pad(Handle, templ == null ? IntPtr.Zero : templ.Handle, native_name, caps == null ? IntPtr.Zero : caps.Handle);
			Gst.Pad ret = GLib.Object.GetObject(raw_ret, true) as Gst.Pad;
			GLib.Marshaller.Free (native_name);
			return ret;
		}

		public Gst.Pad RequestPad(Gst.PadTemplate templ) {
			return RequestPad (templ, null, null);
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_element_seek(IntPtr raw, double rate, int format, int flags, int start_type, long start, int stop_type, long stop);

		public bool Seek(double rate, Gst.Format format, Gst.SeekFlags flags, Gst.SeekType start_type, long start, Gst.SeekType stop_type, long stop) {
			bool raw_ret = gst_element_seek(Handle, rate, (int) format, (int) flags, (int) start_type, start, (int) stop_type, stop);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_element_seek_simple(IntPtr raw, int format, int seek_flags, long seek_pos);

		public bool SeekSimple(Gst.Format format, Gst.SeekFlags seek_flags, long seek_pos) {
			bool raw_ret = gst_element_seek_simple(Handle, (int) format, (int) seek_flags, seek_pos);
			bool ret = raw_ret;
			return ret;
		}

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

		public bool SendEvent(Gst.Event evnt) {
			evnt.Owned = false;
			bool raw_ret = gst_element_send_event(Handle, evnt == null ? IntPtr.Zero : evnt.Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public bool SetClock(Gst.Clock clock) {
			bool raw_ret = gst_element_set_clock(Handle, clock == null ? IntPtr.Zero : clock.Handle);
			bool ret = raw_ret;
			return ret;
		}

		public bool SetClock() {
			return SetClock (null);
		}

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

		public bool SetLockedState(bool locked_state) {
			bool raw_ret = gst_element_set_locked_state(Handle, locked_state);
			bool ret = raw_ret;
			return ret;
		}

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

		public Gst.StateChangeReturn SetState(Gst.State state) {
			int raw_ret = gst_element_set_state(Handle, (int) state);
			Gst.StateChangeReturn ret = (Gst.StateChangeReturn) raw_ret;
			return ret;
		}

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

		public bool SyncStateWithParent() {
			bool raw_ret = gst_element_sync_state_with_parent(Handle);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_element_unlink(IntPtr raw, IntPtr dest);

		public void Unlink(Gst.Element dest) {
			gst_element_unlink(Handle, dest == null ? IntPtr.Zero : dest.Handle);
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_element_unlink_pads(IntPtr raw, IntPtr srcpadname, IntPtr dest, IntPtr destpadname);

		public void UnlinkPads(string srcpadname, Gst.Element dest, string destpadname) {
			IntPtr native_srcpadname = GLib.Marshaller.StringToPtrGStrdup (srcpadname);
			IntPtr native_destpadname = GLib.Marshaller.StringToPtrGStrdup (destpadname);
			gst_element_unlink_pads(Handle, native_srcpadname, dest == null ? IntPtr.Zero : dest.Handle, native_destpadname);
			GLib.Marshaller.Free (native_srcpadname);
			GLib.Marshaller.Free (native_destpadname);
		}


		// 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("state_lock"
							, Gst.Object.abi_info.Fields
							, (uint) Marshal.SizeOf(typeof(GLib.RecMutex.ABI)) // state_lock
							, null
							, "state_cond"
							, (long) Marshal.OffsetOf(typeof(GstElement_state_lockAlign), "state_lock")
							, 0
							),
						new GLib.AbiField("state_cond"
							, -1
							, (uint) Marshal.SizeOf(typeof(GLib.Cond.ABI)) // state_cond
							, "state_lock"
							, "state_cookie"
							, (long) Marshal.OffsetOf(typeof(GstElement_state_condAlign), "state_cond")
							, 0
							),
						new GLib.AbiField("state_cookie"
							, -1
							, (uint) Marshal.SizeOf(typeof(uint)) // state_cookie
							, "state_cond"
							, "target_state"
							, (long) Marshal.OffsetOf(typeof(GstElement_state_cookieAlign), "state_cookie")
							, 0
							),
						new GLib.AbiField("target_state"
							, -1
							, (uint) Marshal.SizeOf(System.Enum.GetUnderlyingType(typeof(Gst.State))) // target_state
							, "state_cookie"
							, "current_state"
							, (long) Marshal.OffsetOf(typeof(GstElement_target_stateAlign), "target_state")
							, 0
							),
						new GLib.AbiField("current_state"
							, -1
							, (uint) Marshal.SizeOf(System.Enum.GetUnderlyingType(typeof(Gst.State))) // current_state
							, "target_state"
							, "next_state"
							, (long) Marshal.OffsetOf(typeof(GstElement_current_stateAlign), "current_state")
							, 0
							),
						new GLib.AbiField("next_state"
							, -1
							, (uint) Marshal.SizeOf(System.Enum.GetUnderlyingType(typeof(Gst.State))) // next_state
							, "current_state"
							, "pending_state"
							, (long) Marshal.OffsetOf(typeof(GstElement_next_stateAlign), "next_state")
							, 0
							),
						new GLib.AbiField("pending_state"
							, -1
							, (uint) Marshal.SizeOf(System.Enum.GetUnderlyingType(typeof(Gst.State))) // pending_state
							, "next_state"
							, "last_return"
							, (long) Marshal.OffsetOf(typeof(GstElement_pending_stateAlign), "pending_state")
							, 0
							),
						new GLib.AbiField("last_return"
							, -1
							, (uint) Marshal.SizeOf(System.Enum.GetUnderlyingType(typeof(Gst.StateChangeReturn))) // last_return
							, "pending_state"
							, "bus"
							, (long) Marshal.OffsetOf(typeof(GstElement_last_returnAlign), "last_return")
							, 0
							),
						new GLib.AbiField("bus"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // bus
							, "last_return"
							, "clock"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("clock"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // clock
							, "bus"
							, "base_time"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("base_time"
							, -1
							, (uint) Marshal.SizeOf(typeof(long)) // base_time
							, "clock"
							, "start_time"
							, (long) Marshal.OffsetOf(typeof(GstElement_base_timeAlign), "base_time")
							, 0
							),
						new GLib.AbiField("start_time"
							, -1
							, (uint) Marshal.SizeOf(typeof(ulong)) // start_time
							, "base_time"
							, "numpads"
							, (long) Marshal.OffsetOf(typeof(GstElement_start_timeAlign), "start_time")
							, 0
							),
						new GLib.AbiField("numpads"
							, -1
							, (uint) Marshal.SizeOf(typeof(ushort)) // numpads
							, "start_time"
							, "pads"
							, (long) Marshal.OffsetOf(typeof(GstElement_numpadsAlign), "numpads")
							, 0
							),
						new GLib.AbiField("pads"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // pads
							, "numpads"
							, "numsrcpads"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("numsrcpads"
							, -1
							, (uint) Marshal.SizeOf(typeof(ushort)) // numsrcpads
							, "pads"
							, "srcpads"
							, (long) Marshal.OffsetOf(typeof(GstElement_numsrcpadsAlign), "numsrcpads")
							, 0
							),
						new GLib.AbiField("srcpads"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // srcpads
							, "numsrcpads"
							, "numsinkpads"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("numsinkpads"
							, -1
							, (uint) Marshal.SizeOf(typeof(ushort)) // numsinkpads
							, "srcpads"
							, "sinkpads"
							, (long) Marshal.OffsetOf(typeof(GstElement_numsinkpadsAlign), "numsinkpads")
							, 0
							),
						new GLib.AbiField("sinkpads"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // sinkpads
							, "numsinkpads"
							, "pads_cookie"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("pads_cookie"
							, -1
							, (uint) Marshal.SizeOf(typeof(uint)) // pads_cookie
							, "sinkpads"
							, "contexts"
							, (long) Marshal.OffsetOf(typeof(GstElement_pads_cookieAlign), "pads_cookie")
							, 0
							),
						new GLib.AbiField("contexts"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // contexts
							, "pads_cookie"
							, "_gst_reserved"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 3 // _gst_reserved
							, "contexts"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _abi_info;
			}
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstElement_state_lockAlign
		{
			sbyte f1;
			private GLib.RecMutex.ABI state_lock;
		}

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

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

		[StructLayout(LayoutKind.Sequential)]
		public struct GstElement_target_stateAlign
		{
			sbyte f1;
			private Gst.State target_state;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstElement_current_stateAlign
		{
			sbyte f1;
			private Gst.State current_state;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstElement_next_stateAlign
		{
			sbyte f1;
			private Gst.State next_state;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstElement_pending_stateAlign
		{
			sbyte f1;
			private Gst.State pending_state;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstElement_last_returnAlign
		{
			sbyte f1;
			private Gst.StateChangeReturn last_return;
		}

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

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

		[StructLayout(LayoutKind.Sequential)]
		public struct GstElement_numpadsAlign
		{
			sbyte f1;
			private ushort numpads;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstElement_numsrcpadsAlign
		{
			sbyte f1;
			private ushort numsrcpads;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstElement_numsinkpadsAlign
		{
			sbyte f1;
			private ushort numsinkpads;
		}

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


		// End of the ABI representation.

#endregion
	}
}
