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

namespace Gst.Rtp {

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

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

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

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

		[GLib.Property ("auto-header-extension")]
		public bool AutoHeaderExtension {
			get {
				GLib.Value val = GetProperty ("auto-header-extension");
				bool ret = (bool) val;
				val.Dispose ();
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("auto-header-extension", val);
				val.Dispose ();
			}
		}

		[GLib.Property ("max-ptime")]
		public long MaxPtime {
			get {
				GLib.Value val = GetProperty ("max-ptime");
				long ret = (long) val;
				val.Dispose ();
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("max-ptime", val);
				val.Dispose ();
			}
		}

		[GLib.Property ("min-ptime")]
		public long MinPtime {
			get {
				GLib.Value val = GetProperty ("min-ptime");
				long ret = (long) val;
				val.Dispose ();
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("min-ptime", val);
				val.Dispose ();
			}
		}

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

		[GLib.Property ("onvif-no-rate-control")]
		public bool OnvifNoRateControl {
			get {
				GLib.Value val = GetProperty ("onvif-no-rate-control");
				bool ret = (bool) val;
				val.Dispose ();
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("onvif-no-rate-control", val);
				val.Dispose ();
			}
		}

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

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

		[GLib.Property ("ptime-multiple")]
		public long PtimeMultiple {
			get {
				GLib.Value val = GetProperty ("ptime-multiple");
				long ret = (long) val;
				val.Dispose ();
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("ptime-multiple", val);
				val.Dispose ();
			}
		}

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

		[GLib.Property ("seqnum")]
		public uint Seqnum {
			get {
				GLib.Value val = GetProperty ("seqnum");
				uint ret = (uint) val;
				val.Dispose ();
				return ret;
			}
		}

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

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

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

		[GLib.Property ("stats")]
		public Gst.Structure Stats {
			get {
				GLib.Value val = GetProperty ("stats");
				Gst.Structure ret = (Gst.Structure) val;
				val.Dispose ();
				return ret;
			}
		}

		[GLib.Property ("timestamp")]
		public uint Timestamp {
			get {
				GLib.Value val = GetProperty ("timestamp");
				uint ret = (uint) val;
				val.Dispose ();
				return ret;
			}
		}

		[GLib.Property ("timestamp-offset")]
		public uint TimestampOffset {
			get {
				GLib.Value val = GetProperty ("timestamp-offset");
				uint ret = (uint) val;
				val.Dispose ();
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("timestamp-offset", val);
				val.Dispose ();
			}
		}

		[GLib.Signal("clear-extensions")]
		public event System.EventHandler ClearExtensions {
			add {
				this.AddSignalHandler ("clear-extensions", value);
			}
			remove {
				this.RemoveSignalHandler ("clear-extensions", value);
			}
		}

		[GLib.Signal("add-extension")]
		public event Gst.Rtp.AddExtensionHandler AddExtension {
			add {
				this.AddSignalHandler ("add-extension", value, typeof (Gst.Rtp.AddExtensionArgs));
			}
			remove {
				this.RemoveSignalHandler ("add-extension", value);
			}
		}

		[GLib.Signal("request-extension")]
		public event Gst.Rtp.RequestExtensionHandler RequestExtension {
			add {
				this.AddSignalHandler ("request-extension", value, typeof (Gst.Rtp.RequestExtensionArgs));
			}
			remove {
				this.RemoveSignalHandler ("request-extension", value);
			}
		}

		static AddExtensionNativeDelegate AddExtension_cb_delegate;
		static AddExtensionNativeDelegate AddExtensionVMCallback {
			get {
				if (AddExtension_cb_delegate == null)
					AddExtension_cb_delegate = new AddExtensionNativeDelegate (AddExtension_cb);
				return AddExtension_cb_delegate;
			}
		}

		static void OverrideAddExtension (GLib.GType gtype)
		{
			OverrideAddExtension (gtype, AddExtensionVMCallback);
		}

		static void OverrideAddExtension (GLib.GType gtype, AddExtensionNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "add-extension", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void AddExtensionNativeDelegate (IntPtr inst, IntPtr ext);

		static void AddExtension_cb (IntPtr inst, IntPtr ext)
		{
			try {
				RTPBasePayload __obj = GLib.Object.GetObject (inst, false) as RTPBasePayload;
				__obj.OnAddExtension (GLib.Object.GetObject(ext, true) as Gst.Rtp.RTPHeaderExtension);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Rtp.RTPBasePayload), ConnectionMethod="OverrideAddExtension")]
		protected virtual void OnAddExtension (Gst.Rtp.RTPHeaderExtension ext)
		{
			InternalAddExtension (ext);
		}

		private void InternalAddExtension (Gst.Rtp.RTPHeaderExtension ext)
		{
			GLib.Value ret = GLib.Value.Empty;
			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
			GLib.Value[] vals = new GLib.Value [2];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			vals [1] = new GLib.Value (ext);
			inst_and_params.Append (vals [1]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
		}

		static ClearExtensionsNativeDelegate ClearExtensions_cb_delegate;
		static ClearExtensionsNativeDelegate ClearExtensionsVMCallback {
			get {
				if (ClearExtensions_cb_delegate == null)
					ClearExtensions_cb_delegate = new ClearExtensionsNativeDelegate (ClearExtensions_cb);
				return ClearExtensions_cb_delegate;
			}
		}

		static void OverrideClearExtensions (GLib.GType gtype)
		{
			OverrideClearExtensions (gtype, ClearExtensionsVMCallback);
		}

		static void OverrideClearExtensions (GLib.GType gtype, ClearExtensionsNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "clear-extensions", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void ClearExtensionsNativeDelegate (IntPtr inst);

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Rtp.RTPBasePayload), ConnectionMethod="OverrideClearExtensions")]
		protected virtual void OnClearExtensions ()
		{
			InternalClearExtensions ();
		}

		private void InternalClearExtensions ()
		{
			GLib.Value ret = GLib.Value.Empty;
			GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
			GLib.Value[] vals = new GLib.Value [1];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
		}

		static RequestExtensionNativeDelegate RequestExtension_cb_delegate;
		static RequestExtensionNativeDelegate RequestExtensionVMCallback {
			get {
				if (RequestExtension_cb_delegate == null)
					RequestExtension_cb_delegate = new RequestExtensionNativeDelegate (RequestExtension_cb);
				return RequestExtension_cb_delegate;
			}
		}

		static void OverrideRequestExtension (GLib.GType gtype)
		{
			OverrideRequestExtension (gtype, RequestExtensionVMCallback);
		}

		static void OverrideRequestExtension (GLib.GType gtype, RequestExtensionNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "request-extension", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr RequestExtensionNativeDelegate (IntPtr inst, uint ext_id, IntPtr ext_uri);

		static IntPtr RequestExtension_cb (IntPtr inst, uint ext_id, IntPtr ext_uri)
		{
			try {
				RTPBasePayload __obj = GLib.Object.GetObject (inst, false) as RTPBasePayload;
				Gst.Rtp.RTPHeaderExtension __result;
				__result = __obj.OnRequestExtension (ext_id, GLib.Marshaller.Utf8PtrToString (ext_uri));
				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.Rtp.RTPBasePayload), ConnectionMethod="OverrideRequestExtension")]
		protected virtual Gst.Rtp.RTPHeaderExtension OnRequestExtension (uint ext_id, string ext_uri)
		{
			return InternalRequestExtension (ext_id, ext_uri);
		}

		private Gst.Rtp.RTPHeaderExtension InternalRequestExtension (uint ext_id, string ext_uri)
		{
			GLib.Value ret = new GLib.Value (GLib.GType.Object);
			GLib.ValueArray inst_and_params = new GLib.ValueArray (3);
			GLib.Value[] vals = new GLib.Value [3];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			vals [1] = new GLib.Value (ext_id);
			inst_and_params.Append (vals [1]);
			vals [2] = new GLib.Value (ext_uri);
			inst_and_params.Append (vals [2]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
			Gst.Rtp.RTPHeaderExtension result = (Gst.Rtp.RTPHeaderExtension) ret;
			ret.Dispose ();
			return result;
		}

		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 pad, IntPtr filter);

		static IntPtr GetCaps_cb (IntPtr inst, IntPtr pad, IntPtr filter)
		{
			try {
				RTPBasePayload __obj = GLib.Object.GetObject (inst, false) as RTPBasePayload;
				Gst.Caps __result;
				__result = __obj.OnGetCaps (GLib.Object.GetObject(pad) as Gst.Pad, 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.Rtp.RTPBasePayload), ConnectionMethod="OverrideGetCaps")]
		protected virtual Gst.Caps OnGetCaps (Gst.Pad pad, Gst.Caps filter)
		{
			return InternalGetCaps (pad, filter);
		}

		private Gst.Caps InternalGetCaps (Gst.Pad pad, 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, pad == null ? IntPtr.Zero : pad.Handle, filter == null ? IntPtr.Zero : filter.Handle);
			return __result == IntPtr.Zero ? null : (Gst.Caps) GLib.Opaque.GetOpaque (__result, typeof (Gst.Caps), true);
		}

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

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

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

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

		static bool SetCaps_cb (IntPtr inst, IntPtr caps)
		{
			try {
				RTPBasePayload __obj = GLib.Object.GetObject (inst, false) as RTPBasePayload;
				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.Rtp.RTPBasePayload), 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 HandleBufferNativeDelegate HandleBuffer_cb_delegate;
		static HandleBufferNativeDelegate HandleBufferVMCallback {
			get {
				if (HandleBuffer_cb_delegate == null)
					HandleBuffer_cb_delegate = new HandleBufferNativeDelegate (HandleBuffer_cb);
				return HandleBuffer_cb_delegate;
			}
		}

		static void OverrideHandleBuffer (GLib.GType gtype)
		{
			OverrideHandleBuffer (gtype, HandleBufferVMCallback);
		}

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

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

		static int HandleBuffer_cb (IntPtr inst, IntPtr buffer)
		{
			try {
				RTPBasePayload __obj = GLib.Object.GetObject (inst, false) as RTPBasePayload;
				Gst.FlowReturn __result;
				__result = __obj.OnHandleBuffer (buffer == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (buffer, typeof (Gst.Buffer), false));
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Rtp.RTPBasePayload), ConnectionMethod="OverrideHandleBuffer")]
		protected virtual Gst.FlowReturn OnHandleBuffer (Gst.Buffer buffer)
		{
			return InternalHandleBuffer (buffer);
		}

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

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

		static SinkEventNativeDelegate SinkEvent_cb_delegate;
		static SinkEventNativeDelegate SinkEventVMCallback {
			get {
				if (SinkEvent_cb_delegate == null)
					SinkEvent_cb_delegate = new SinkEventNativeDelegate (SinkEvent_cb);
				return SinkEvent_cb_delegate;
			}
		}

		static void OverrideSinkEvent (GLib.GType gtype)
		{
			OverrideSinkEvent (gtype, SinkEventVMCallback);
		}

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

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

		static bool SinkEvent_cb (IntPtr inst, IntPtr evnt)
		{
			try {
				RTPBasePayload __obj = GLib.Object.GetObject (inst, false) as RTPBasePayload;
				bool __result;
				__result = __obj.OnSinkEvent (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.Rtp.RTPBasePayload), ConnectionMethod="OverrideSinkEvent")]
		protected virtual bool OnSinkEvent (Gst.Event evnt)
		{
			return InternalSinkEvent (evnt);
		}

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

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

		static SrcEventNativeDelegate SrcEvent_cb_delegate;
		static SrcEventNativeDelegate SrcEventVMCallback {
			get {
				if (SrcEvent_cb_delegate == null)
					SrcEvent_cb_delegate = new SrcEventNativeDelegate (SrcEvent_cb);
				return SrcEvent_cb_delegate;
			}
		}

		static void OverrideSrcEvent (GLib.GType gtype)
		{
			OverrideSrcEvent (gtype, SrcEventVMCallback);
		}

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

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

		static bool SrcEvent_cb (IntPtr inst, IntPtr evnt)
		{
			try {
				RTPBasePayload __obj = GLib.Object.GetObject (inst, false) as RTPBasePayload;
				bool __result;
				__result = __obj.OnSrcEvent (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.Rtp.RTPBasePayload), ConnectionMethod="OverrideSrcEvent")]
		protected virtual bool OnSrcEvent (Gst.Event evnt)
		{
			return InternalSrcEvent (evnt);
		}

		private bool InternalSrcEvent (Gst.Event evnt)
		{
			SrcEventNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("src_event"));
				unmanaged = (SrcEventNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SrcEventNativeDelegate));
			}
			if (unmanaged == null) return 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 pad, IntPtr query);

		static bool Query_cb (IntPtr inst, IntPtr pad, IntPtr query)
		{
			try {
				RTPBasePayload __obj = GLib.Object.GetObject (inst, false) as RTPBasePayload;
				bool __result;
				__result = __obj.OnQuery (GLib.Object.GetObject(pad) as Gst.Pad, 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.Rtp.RTPBasePayload), ConnectionMethod="OverrideQuery")]
		protected virtual bool OnQuery (Gst.Pad pad, Gst.Query query)
		{
			return InternalQuery (pad, query);
		}

		private bool InternalQuery (Gst.Pad pad, 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, pad == null ? IntPtr.Zero : pad.Handle, query == null ? IntPtr.Zero : query.Handle);
			return __result;
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _class_abi = null;
		static public new GLib.AbiStruct class_abi {
			get {
				if (_class_abi == null)
					_class_abi = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("get_caps"
							, Gst.Element.class_abi.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_caps
							, null
							, "set_caps"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("set_caps"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // set_caps
							, "get_caps"
							, "handle_buffer"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("handle_buffer"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // handle_buffer
							, "set_caps"
							, "sink_event"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("sink_event"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // sink_event
							, "handle_buffer"
							, "src_event"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("src_event"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // src_event
							, "sink_event"
							, "query"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("query"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // query
							, "src_event"
							, "_gst_reserved"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 4 // _gst_reserved
							, "query"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

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

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

		[DllImport("gstrtp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_rtp_base_payload_allocate_output_buffer(IntPtr raw, uint payload_len, byte pad_len, byte csrc_count);

		public Gst.Buffer AllocateOutputBuffer(uint payload_len, byte pad_len, byte csrc_count) {
			IntPtr raw_ret = gst_rtp_base_payload_allocate_output_buffer(Handle, payload_len, pad_len, csrc_count);
			Gst.Buffer ret = raw_ret == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Buffer), true);
			return ret;
		}

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

		public uint GetSourceCount(Gst.Buffer buffer) {
			uint raw_ret = gst_rtp_base_payload_get_source_count(Handle, buffer == null ? IntPtr.Zero : buffer.Handle);
			uint ret = raw_ret;
			return ret;
		}

		[DllImport("gstrtp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_rtp_base_payload_is_filled(IntPtr raw, uint size, ulong duration);

		public bool IsFilled(uint size, ulong duration) {
			bool raw_ret = gst_rtp_base_payload_is_filled(Handle, size, duration);
			bool ret = raw_ret;
			return ret;
		}

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

		public bool IsSourceInfoEnabled { 
			get {
				bool raw_ret = gst_rtp_base_payload_is_source_info_enabled(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

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

		public Gst.FlowReturn Push(Gst.Buffer buffer) {
			buffer.Owned = false;
			int raw_ret = gst_rtp_base_payload_push(Handle, buffer == null ? IntPtr.Zero : buffer.Handle);
			Gst.FlowReturn ret = (Gst.FlowReturn) raw_ret;
			return ret;
		}

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

		public Gst.FlowReturn PushList(Gst.BufferList list) {
			list.Owned = false;
			int raw_ret = gst_rtp_base_payload_push_list(Handle, list == null ? IntPtr.Zero : list.Handle);
			Gst.FlowReturn ret = (Gst.FlowReturn) raw_ret;
			return ret;
		}

		[DllImport("gstrtp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_rtp_base_payload_set_options(IntPtr raw, IntPtr media, bool dynamic, IntPtr encoding_name, uint clock_rate);

		public void SetOptions(string media, bool dynamic, string encoding_name, uint clock_rate) {
			IntPtr native_media = GLib.Marshaller.StringToPtrGStrdup (media);
			IntPtr native_encoding_name = GLib.Marshaller.StringToPtrGStrdup (encoding_name);
			gst_rtp_base_payload_set_options(Handle, native_media, dynamic, native_encoding_name, clock_rate);
			GLib.Marshaller.Free (native_media);
			GLib.Marshaller.Free (native_encoding_name);
		}

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

		public bool SetOutcapsStructure(Gst.Structure s) {
			bool raw_ret = gst_rtp_base_payload_set_outcaps_structure(Handle, s == null ? IntPtr.Zero : s.Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		[DllImport("gstrtp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_rtp_base_payload_set_source_info_enabled(IntPtr raw, bool enable);

		public bool SourceInfoEnabled { 
			set {
				gst_rtp_base_payload_set_source_info_enabled(Handle, value);
			}
		}


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

		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public new GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("sinkpad"
							, Gst.Element.abi_info.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // sinkpad
							, null
							, "srcpad"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("srcpad"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // srcpad
							, "sinkpad"
							, "ts_base"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("ts_base"
							, -1
							, (uint) Marshal.SizeOf(typeof(uint)) // ts_base
							, "srcpad"
							, "seqnum_base"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_ts_baseAlign), "ts_base")
							, 0
							),
						new GLib.AbiField("seqnum_base"
							, -1
							, (uint) Marshal.SizeOf(typeof(ushort)) // seqnum_base
							, "ts_base"
							, "media"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_seqnum_baseAlign), "seqnum_base")
							, 0
							),
						new GLib.AbiField("media"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // media
							, "seqnum_base"
							, "encoding_name"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("encoding_name"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // encoding_name
							, "media"
							, "dynamic"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("dynamic"
							, -1
							, (uint) Marshal.SizeOf(typeof(bool)) // dynamic
							, "encoding_name"
							, "clock_rate"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_dynamicAlign), "dynamic")
							, 0
							),
						new GLib.AbiField("clock_rate"
							, -1
							, (uint) Marshal.SizeOf(typeof(uint)) // clock_rate
							, "dynamic"
							, "ts_offset"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_clock_rateAlign), "clock_rate")
							, 0
							),
						new GLib.AbiField("ts_offset"
							, -1
							, (uint) Marshal.SizeOf(typeof(int)) // ts_offset
							, "clock_rate"
							, "timestamp"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_ts_offsetAlign), "ts_offset")
							, 0
							),
						new GLib.AbiField("timestamp"
							, -1
							, (uint) Marshal.SizeOf(typeof(uint)) // timestamp
							, "ts_offset"
							, "seqnum_offset"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_timestampAlign), "timestamp")
							, 0
							),
						new GLib.AbiField("seqnum_offset"
							, -1
							, (uint) Marshal.SizeOf(typeof(short)) // seqnum_offset
							, "timestamp"
							, "seqnum"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_seqnum_offsetAlign), "seqnum_offset")
							, 0
							),
						new GLib.AbiField("seqnum"
							, -1
							, (uint) Marshal.SizeOf(typeof(ushort)) // seqnum
							, "seqnum_offset"
							, "max_ptime"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_seqnumAlign), "seqnum")
							, 0
							),
						new GLib.AbiField("max_ptime"
							, -1
							, (uint) Marshal.SizeOf(typeof(long)) // max_ptime
							, "seqnum"
							, "pt"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_max_ptimeAlign), "max_ptime")
							, 0
							),
						new GLib.AbiField("pt"
							, -1
							, (uint) Marshal.SizeOf(typeof(uint)) // pt
							, "max_ptime"
							, "ssrc"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_ptAlign), "pt")
							, 0
							),
						new GLib.AbiField("ssrc"
							, -1
							, (uint) Marshal.SizeOf(typeof(uint)) // ssrc
							, "pt"
							, "current_ssrc"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_ssrcAlign), "ssrc")
							, 0
							),
						new GLib.AbiField("current_ssrc"
							, -1
							, (uint) Marshal.SizeOf(typeof(uint)) // current_ssrc
							, "ssrc"
							, "mtu"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_current_ssrcAlign), "current_ssrc")
							, 0
							),
						new GLib.AbiField("mtu"
							, -1
							, (uint) Marshal.SizeOf(typeof(uint)) // mtu
							, "current_ssrc"
							, "segment"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_mtuAlign), "mtu")
							, 0
							),
						new GLib.AbiField("segment"
							, -1
							, (uint) Marshal.SizeOf(typeof(Gst.Segment)) // segment
							, "mtu"
							, "min_ptime"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_segmentAlign), "segment")
							, 0
							),
						new GLib.AbiField("min_ptime"
							, -1
							, (uint) Marshal.SizeOf(typeof(ulong)) // min_ptime
							, "segment"
							, "ptime"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_min_ptimeAlign), "min_ptime")
							, 0
							),
						new GLib.AbiField("ptime"
							, -1
							, (uint) Marshal.SizeOf(typeof(ulong)) // ptime
							, "min_ptime"
							, "ptime_multiple"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_ptimeAlign), "ptime")
							, 0
							),
						new GLib.AbiField("ptime_multiple"
							, -1
							, (uint) Marshal.SizeOf(typeof(ulong)) // ptime_multiple
							, "ptime"
							, "priv"
							, (long) Marshal.OffsetOf(typeof(GstRTPBasePayload_ptime_multipleAlign), "ptime_multiple")
							, 0
							),
						new GLib.AbiField("priv"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // priv
							, "ptime_multiple"
							, "_gst_reserved"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 4 // _gst_reserved
							, "priv"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _abi_info;
			}
		}

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

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

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

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

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

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

		[StructLayout(LayoutKind.Sequential)]
		public struct GstRTPBasePayload_seqnum_offsetAlign
		{
			sbyte f1;
			private short seqnum_offset;
		}

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

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

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

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

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

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

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

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

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

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


		// End of the ABI representation.

#endregion
	}
}
