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

namespace Gst.Base {

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

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

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

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

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

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

		[GLib.Property ("latency")]
		public ulong Latency {
			get  {
				ulong raw_ret = gst_aggregator_get_latency(Handle);
				ulong ret = raw_ret;
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("latency", val);
				val.Dispose ();
			}
		}

		[GLib.Property ("min-upstream-latency")]
		public ulong MinUpstreamLatency {
			get {
				GLib.Value val = GetProperty ("min-upstream-latency");
				ulong ret = (ulong) val;
				val.Dispose ();
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("min-upstream-latency", val);
				val.Dispose ();
			}
		}

		[GLib.Property ("start-time")]
		public ulong StartTime {
			get {
				GLib.Value val = GetProperty ("start-time");
				ulong ret = (ulong) val;
				val.Dispose ();
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("start-time", val);
				val.Dispose ();
			}
		}

		[GLib.Property ("start-time-selection")]
		public Gst.Base.AggregatorStartTimeSelection StartTimeSelection {
			get {
				GLib.Value val = GetProperty ("start-time-selection");
				Gst.Base.AggregatorStartTimeSelection ret = (Gst.Base.AggregatorStartTimeSelection) (Enum) val;
				val.Dispose ();
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value((Enum) value);
				SetProperty("start-time-selection", val);
				val.Dispose ();
			}
		}

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

		[GLib.Signal("samples-selected")]
		public event Gst.Base.SamplesSelectedHandler SamplesSelected {
			add {
				this.AddSignalHandler ("samples-selected", value, typeof (Gst.Base.SamplesSelectedArgs));
			}
			remove {
				this.RemoveSignalHandler ("samples-selected", value);
			}
		}

		static SamplesSelectedNativeDelegate SamplesSelected_cb_delegate;
		static SamplesSelectedNativeDelegate SamplesSelectedVMCallback {
			get {
				if (SamplesSelected_cb_delegate == null)
					SamplesSelected_cb_delegate = new SamplesSelectedNativeDelegate (SamplesSelected_cb);
				return SamplesSelected_cb_delegate;
			}
		}

		static void OverrideSamplesSelected (GLib.GType gtype)
		{
			OverrideSamplesSelected (gtype, SamplesSelectedVMCallback);
		}

		static void OverrideSamplesSelected (GLib.GType gtype, SamplesSelectedNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "samples-selected", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void SamplesSelectedNativeDelegate (IntPtr inst, IntPtr segment, ulong pts, ulong dts, ulong duration, IntPtr info);

		static void SamplesSelected_cb (IntPtr inst, IntPtr segment, ulong pts, ulong dts, ulong duration, IntPtr info)
		{
			try {
				Aggregator __obj = GLib.Object.GetObject (inst, false) as Aggregator;
				__obj.OnSamplesSelected (Gst.Segment.New (segment), pts, dts, duration, info == IntPtr.Zero ? null : (Gst.Structure) GLib.Opaque.GetOpaque (info, typeof (Gst.Structure), false));
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideSamplesSelected")]
		protected virtual void OnSamplesSelected (Gst.Segment segment, ulong pts, ulong dts, ulong duration, Gst.Structure info)
		{
			InternalSamplesSelected (segment, pts, dts, duration, info);
		}

		private void InternalSamplesSelected (Gst.Segment segment, ulong pts, ulong dts, ulong duration, Gst.Structure info)
		{
			GLib.Value ret = GLib.Value.Empty;
			GLib.ValueArray inst_and_params = new GLib.ValueArray (6);
			GLib.Value[] vals = new GLib.Value [6];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			vals [1] = new GLib.Value (segment);
			inst_and_params.Append (vals [1]);
			vals [2] = new GLib.Value (pts);
			inst_and_params.Append (vals [2]);
			vals [3] = new GLib.Value (dts);
			inst_and_params.Append (vals [3]);
			vals [4] = new GLib.Value (duration);
			inst_and_params.Append (vals [4]);
			vals [5] = new GLib.Value (info);
			inst_and_params.Append (vals [5]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
		}

		static FlushNativeDelegate Flush_cb_delegate;
		static FlushNativeDelegate FlushVMCallback {
			get {
				if (Flush_cb_delegate == null)
					Flush_cb_delegate = new FlushNativeDelegate (Flush_cb);
				return Flush_cb_delegate;
			}
		}

		static void OverrideFlush (GLib.GType gtype)
		{
			OverrideFlush (gtype, FlushVMCallback);
		}

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

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

		static int Flush_cb (IntPtr inst)
		{
			try {
				Aggregator __obj = GLib.Object.GetObject (inst, false) as Aggregator;
				Gst.FlowReturn __result;
				__result = __obj.OnFlush ();
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideFlush")]
		protected virtual Gst.FlowReturn OnFlush ()
		{
			return InternalFlush ();
		}

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

			int __result = unmanaged (this.Handle);
			return (Gst.FlowReturn) __result;
		}

		static ClipNativeDelegate Clip_cb_delegate;
		static ClipNativeDelegate ClipVMCallback {
			get {
				if (Clip_cb_delegate == null)
					Clip_cb_delegate = new ClipNativeDelegate (Clip_cb);
				return Clip_cb_delegate;
			}
		}

		static void OverrideClip (GLib.GType gtype)
		{
			OverrideClip (gtype, ClipVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr ClipNativeDelegate (IntPtr inst, IntPtr aggregator_pad, IntPtr buf);

		static IntPtr Clip_cb (IntPtr inst, IntPtr aggregator_pad, IntPtr buf)
		{
			try {
				Aggregator __obj = GLib.Object.GetObject (inst, false) as Aggregator;
				Gst.Buffer __result;
				__result = __obj.OnClip (GLib.Object.GetObject(aggregator_pad) as Gst.Base.AggregatorPad, buf == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (buf, typeof (Gst.Buffer), false));
				return __result == null ? IntPtr.Zero : __result.OwnedCopy;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideClip")]
		protected virtual Gst.Buffer OnClip (Gst.Base.AggregatorPad aggregator_pad, Gst.Buffer buf)
		{
			return InternalClip (aggregator_pad, buf);
		}

		private Gst.Buffer InternalClip (Gst.Base.AggregatorPad aggregator_pad, Gst.Buffer buf)
		{
			ClipNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("clip"));
				unmanaged = (ClipNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(ClipNativeDelegate));
			}
			if (unmanaged == null) return null;

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

		static FinishBufferNativeDelegate FinishBuffer_cb_delegate;
		static FinishBufferNativeDelegate FinishBufferVMCallback {
			get {
				if (FinishBuffer_cb_delegate == null)
					FinishBuffer_cb_delegate = new FinishBufferNativeDelegate (FinishBuffer_cb);
				return FinishBuffer_cb_delegate;
			}
		}

		static void OverrideFinishBuffer (GLib.GType gtype)
		{
			OverrideFinishBuffer (gtype, FinishBufferVMCallback);
		}

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideFinishBuffer")]
		protected virtual Gst.FlowReturn OnFinishBuffer (Gst.Buffer buffer)
		{
			return InternalFinishBuffer (buffer);
		}

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

			buffer.Owned = false;
			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 aggregator_pad, IntPtr evnt);

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideSinkEvent")]
		protected virtual bool OnSinkEvent (Gst.Base.AggregatorPad aggregator_pad, Gst.Event evnt)
		{
			return InternalSinkEvent (aggregator_pad, evnt);
		}

		private bool InternalSinkEvent (Gst.Base.AggregatorPad aggregator_pad, 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, aggregator_pad == null ? IntPtr.Zero : aggregator_pad.Handle, evnt == null ? IntPtr.Zero : evnt.Handle);
			return __result;
		}

		static SinkQueryNativeDelegate SinkQuery_cb_delegate;
		static SinkQueryNativeDelegate SinkQueryVMCallback {
			get {
				if (SinkQuery_cb_delegate == null)
					SinkQuery_cb_delegate = new SinkQueryNativeDelegate (SinkQuery_cb);
				return SinkQuery_cb_delegate;
			}
		}

		static void OverrideSinkQuery (GLib.GType gtype)
		{
			OverrideSinkQuery (gtype, SinkQueryVMCallback);
		}

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideSinkQuery")]
		protected virtual bool OnSinkQuery (Gst.Base.AggregatorPad aggregator_pad, Gst.Query query)
		{
			return InternalSinkQuery (aggregator_pad, query);
		}

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

			bool __result = unmanaged (this.Handle, aggregator_pad == null ? IntPtr.Zero : aggregator_pad.Handle, query == null ? IntPtr.Zero : query.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 {
				Aggregator __obj = GLib.Object.GetObject (inst, false) as Aggregator;
				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.Base.Aggregator), 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 SrcQueryNativeDelegate SrcQuery_cb_delegate;
		static SrcQueryNativeDelegate SrcQueryVMCallback {
			get {
				if (SrcQuery_cb_delegate == null)
					SrcQuery_cb_delegate = new SrcQueryNativeDelegate (SrcQuery_cb);
				return SrcQuery_cb_delegate;
			}
		}

		static void OverrideSrcQuery (GLib.GType gtype)
		{
			OverrideSrcQuery (gtype, SrcQueryVMCallback);
		}

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideSrcQuery")]
		protected virtual bool OnSrcQuery (Gst.Query query)
		{
			return InternalSrcQuery (query);
		}

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

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

		static SrcActivateNativeDelegate SrcActivate_cb_delegate;
		static SrcActivateNativeDelegate SrcActivateVMCallback {
			get {
				if (SrcActivate_cb_delegate == null)
					SrcActivate_cb_delegate = new SrcActivateNativeDelegate (SrcActivate_cb);
				return SrcActivate_cb_delegate;
			}
		}

		static void OverrideSrcActivate (GLib.GType gtype)
		{
			OverrideSrcActivate (gtype, SrcActivateVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool SrcActivateNativeDelegate (IntPtr inst, int mode, bool active);

		static bool SrcActivate_cb (IntPtr inst, int mode, bool active)
		{
			try {
				Aggregator __obj = GLib.Object.GetObject (inst, false) as Aggregator;
				bool __result;
				__result = __obj.OnSrcActivate ((Gst.PadMode) mode, active);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideSrcActivate")]
		protected virtual bool OnSrcActivate (Gst.PadMode mode, bool active)
		{
			return InternalSrcActivate (mode, active);
		}

		private bool InternalSrcActivate (Gst.PadMode mode, bool active)
		{
			SrcActivateNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("src_activate"));
				unmanaged = (SrcActivateNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SrcActivateNativeDelegate));
			}
			if (unmanaged == null) return false;

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

		static AggregateNativeDelegate Aggregate_cb_delegate;
		static AggregateNativeDelegate AggregateVMCallback {
			get {
				if (Aggregate_cb_delegate == null)
					Aggregate_cb_delegate = new AggregateNativeDelegate (Aggregate_cb);
				return Aggregate_cb_delegate;
			}
		}

		static void OverrideAggregate (GLib.GType gtype)
		{
			OverrideAggregate (gtype, AggregateVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int AggregateNativeDelegate (IntPtr inst, bool timeout);

		static int Aggregate_cb (IntPtr inst, bool timeout)
		{
			try {
				Aggregator __obj = GLib.Object.GetObject (inst, false) as Aggregator;
				Gst.FlowReturn __result;
				__result = __obj.OnAggregate (timeout);
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideAggregate")]
		protected virtual Gst.FlowReturn OnAggregate (bool timeout)
		{
			return InternalAggregate (timeout);
		}

		private Gst.FlowReturn InternalAggregate (bool timeout)
		{
			AggregateNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("aggregate"));
				unmanaged = (AggregateNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(AggregateNativeDelegate));
			}
			if (unmanaged == null) return (Gst.FlowReturn) 0;

			int __result = unmanaged (this.Handle, timeout);
			return (Gst.FlowReturn) __result;
		}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		static GetNextTimeNativeDelegate GetNextTime_cb_delegate;
		static GetNextTimeNativeDelegate GetNextTimeVMCallback {
			get {
				if (GetNextTime_cb_delegate == null)
					GetNextTime_cb_delegate = new GetNextTimeNativeDelegate (GetNextTime_cb);
				return GetNextTime_cb_delegate;
			}
		}

		static void OverrideGetNextTime (GLib.GType gtype)
		{
			OverrideGetNextTime (gtype, GetNextTimeVMCallback);
		}

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideGetNextTime")]
		protected virtual ulong OnGetNextTime ()
		{
			return InternalGetNextTime ();
		}

		private ulong InternalGetNextTime ()
		{
			GetNextTimeNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("get_next_time"));
				unmanaged = (GetNextTimeNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(GetNextTimeNativeDelegate));
			}
			if (unmanaged == null) return 0;

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

		static UpdateSrcCapsNativeDelegate UpdateSrcCaps_cb_delegate;
		static UpdateSrcCapsNativeDelegate UpdateSrcCapsVMCallback {
			get {
				if (UpdateSrcCaps_cb_delegate == null)
					UpdateSrcCaps_cb_delegate = new UpdateSrcCapsNativeDelegate (UpdateSrcCaps_cb);
				return UpdateSrcCaps_cb_delegate;
			}
		}

		static void OverrideUpdateSrcCaps (GLib.GType gtype)
		{
			OverrideUpdateSrcCaps (gtype, UpdateSrcCapsVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int UpdateSrcCapsNativeDelegate (IntPtr inst, IntPtr caps, out IntPtr _ret);

		static int UpdateSrcCaps_cb (IntPtr inst, IntPtr caps, out IntPtr _ret)
		{
			try {
				Aggregator __obj = GLib.Object.GetObject (inst, false) as Aggregator;
				Gst.FlowReturn __result;
				Gst.Caps my_ret;
				__result = __obj.OnUpdateSrcCaps (caps == IntPtr.Zero ? null : (Gst.Caps) GLib.Opaque.GetOpaque (caps, typeof (Gst.Caps), false), out my_ret);
				_ret = my_ret == null ? IntPtr.Zero : my_ret.Handle;
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideUpdateSrcCaps")]
		protected virtual Gst.FlowReturn OnUpdateSrcCaps (Gst.Caps caps, out Gst.Caps _ret)
		{
			return InternalUpdateSrcCaps (caps, out _ret);
		}

		private Gst.FlowReturn InternalUpdateSrcCaps (Gst.Caps caps, out Gst.Caps _ret)
		{
			UpdateSrcCapsNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("update_src_caps"));
				unmanaged = (UpdateSrcCapsNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(UpdateSrcCapsNativeDelegate));
			}
			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");

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

		static FixateSrcCapsNativeDelegate FixateSrcCaps_cb_delegate;
		static FixateSrcCapsNativeDelegate FixateSrcCapsVMCallback {
			get {
				if (FixateSrcCaps_cb_delegate == null)
					FixateSrcCaps_cb_delegate = new FixateSrcCapsNativeDelegate (FixateSrcCaps_cb);
				return FixateSrcCaps_cb_delegate;
			}
		}

		static void OverrideFixateSrcCaps (GLib.GType gtype)
		{
			OverrideFixateSrcCaps (gtype, FixateSrcCapsVMCallback);
		}

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideFixateSrcCaps")]
		protected virtual Gst.Caps OnFixateSrcCaps (Gst.Caps caps)
		{
			return InternalFixateSrcCaps (caps);
		}

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

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

		static NegotiatedSrcCapsNativeDelegate NegotiatedSrcCaps_cb_delegate;
		static NegotiatedSrcCapsNativeDelegate NegotiatedSrcCapsVMCallback {
			get {
				if (NegotiatedSrcCaps_cb_delegate == null)
					NegotiatedSrcCaps_cb_delegate = new NegotiatedSrcCapsNativeDelegate (NegotiatedSrcCaps_cb);
				return NegotiatedSrcCaps_cb_delegate;
			}
		}

		static void OverrideNegotiatedSrcCaps (GLib.GType gtype)
		{
			OverrideNegotiatedSrcCaps (gtype, NegotiatedSrcCapsVMCallback);
		}

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideNegotiatedSrcCaps")]
		protected virtual bool OnNegotiatedSrcCaps (Gst.Caps caps)
		{
			return InternalNegotiatedSrcCaps (caps);
		}

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

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

		static DecideAllocationNativeDelegate DecideAllocation_cb_delegate;
		static DecideAllocationNativeDelegate DecideAllocationVMCallback {
			get {
				if (DecideAllocation_cb_delegate == null)
					DecideAllocation_cb_delegate = new DecideAllocationNativeDelegate (DecideAllocation_cb);
				return DecideAllocation_cb_delegate;
			}
		}

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

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideDecideAllocation")]
		protected virtual bool OnDecideAllocation (Gst.Query query)
		{
			return InternalDecideAllocation (query);
		}

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

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

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

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

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

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

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

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

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

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

		static NegotiateNativeDelegate Negotiate_cb_delegate;
		static NegotiateNativeDelegate NegotiateVMCallback {
			get {
				if (Negotiate_cb_delegate == null)
					Negotiate_cb_delegate = new NegotiateNativeDelegate (Negotiate_cb);
				return Negotiate_cb_delegate;
			}
		}

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

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

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

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

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

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

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

		static SinkEventPreQueueNativeDelegate SinkEventPreQueue_cb_delegate;
		static SinkEventPreQueueNativeDelegate SinkEventPreQueueVMCallback {
			get {
				if (SinkEventPreQueue_cb_delegate == null)
					SinkEventPreQueue_cb_delegate = new SinkEventPreQueueNativeDelegate (SinkEventPreQueue_cb);
				return SinkEventPreQueue_cb_delegate;
			}
		}

		static void OverrideSinkEventPreQueue (GLib.GType gtype)
		{
			OverrideSinkEventPreQueue (gtype, SinkEventPreQueueVMCallback);
		}

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

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

		static int SinkEventPreQueue_cb (IntPtr inst, IntPtr aggregator_pad, IntPtr evnt)
		{
			try {
				Aggregator __obj = GLib.Object.GetObject (inst, false) as Aggregator;
				Gst.FlowReturn __result;
				__result = __obj.OnSinkEventPreQueue (GLib.Object.GetObject(aggregator_pad) as Gst.Base.AggregatorPad, evnt == IntPtr.Zero ? null : (Gst.Event) GLib.Opaque.GetOpaque (evnt, typeof (Gst.Event), false));
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideSinkEventPreQueue")]
		protected virtual Gst.FlowReturn OnSinkEventPreQueue (Gst.Base.AggregatorPad aggregator_pad, Gst.Event evnt)
		{
			return InternalSinkEventPreQueue (aggregator_pad, evnt);
		}

		private Gst.FlowReturn InternalSinkEventPreQueue (Gst.Base.AggregatorPad aggregator_pad, Gst.Event evnt)
		{
			SinkEventPreQueueNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("sink_event_pre_queue"));
				unmanaged = (SinkEventPreQueueNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SinkEventPreQueueNativeDelegate));
			}
			if (unmanaged == null) return (Gst.FlowReturn) 0;

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

		static SinkQueryPreQueueNativeDelegate SinkQueryPreQueue_cb_delegate;
		static SinkQueryPreQueueNativeDelegate SinkQueryPreQueueVMCallback {
			get {
				if (SinkQueryPreQueue_cb_delegate == null)
					SinkQueryPreQueue_cb_delegate = new SinkQueryPreQueueNativeDelegate (SinkQueryPreQueue_cb);
				return SinkQueryPreQueue_cb_delegate;
			}
		}

		static void OverrideSinkQueryPreQueue (GLib.GType gtype)
		{
			OverrideSinkQueryPreQueue (gtype, SinkQueryPreQueueVMCallback);
		}

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

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

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideSinkQueryPreQueue")]
		protected virtual bool OnSinkQueryPreQueue (Gst.Base.AggregatorPad aggregator_pad, Gst.Query query)
		{
			return InternalSinkQueryPreQueue (aggregator_pad, query);
		}

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

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

		static FinishBufferListNativeDelegate FinishBufferList_cb_delegate;
		static FinishBufferListNativeDelegate FinishBufferListVMCallback {
			get {
				if (FinishBufferList_cb_delegate == null)
					FinishBufferList_cb_delegate = new FinishBufferListNativeDelegate (FinishBufferList_cb);
				return FinishBufferList_cb_delegate;
			}
		}

		static void OverrideFinishBufferList (GLib.GType gtype)
		{
			OverrideFinishBufferList (gtype, FinishBufferListVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int FinishBufferListNativeDelegate (IntPtr inst, IntPtr bufferlist);

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

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverrideFinishBufferList")]
		protected virtual Gst.FlowReturn OnFinishBufferList (Gst.BufferList bufferlist)
		{
			return InternalFinishBufferList (bufferlist);
		}

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

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

		static PeekNextSampleNativeDelegate PeekNextSample_cb_delegate;
		static PeekNextSampleNativeDelegate PeekNextSampleVMCallback {
			get {
				if (PeekNextSample_cb_delegate == null)
					PeekNextSample_cb_delegate = new PeekNextSampleNativeDelegate (PeekNextSample_cb);
				return PeekNextSample_cb_delegate;
			}
		}

		static void OverridePeekNextSample (GLib.GType gtype)
		{
			OverridePeekNextSample (gtype, PeekNextSampleVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr PeekNextSampleNativeDelegate (IntPtr inst, IntPtr aggregator_pad);

		static IntPtr PeekNextSample_cb (IntPtr inst, IntPtr aggregator_pad)
		{
			try {
				Aggregator __obj = GLib.Object.GetObject (inst, false) as Aggregator;
				Gst.Sample __result;
				__result = __obj.OnPeekNextSample (GLib.Object.GetObject(aggregator_pad) as Gst.Base.AggregatorPad);
				return __result == null ? IntPtr.Zero : __result.OwnedCopy;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Base.Aggregator), ConnectionMethod="OverridePeekNextSample")]
		protected virtual Gst.Sample OnPeekNextSample (Gst.Base.AggregatorPad aggregator_pad)
		{
			return InternalPeekNextSample (aggregator_pad);
		}

		private Gst.Sample InternalPeekNextSample (Gst.Base.AggregatorPad aggregator_pad)
		{
			PeekNextSampleNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("peek_next_sample"));
				unmanaged = (PeekNextSampleNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(PeekNextSampleNativeDelegate));
			}
			if (unmanaged == null) return null;

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


		// 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("flush"
							, Gst.Element.class_abi.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // flush
							, null
							, "clip"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("clip"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // clip
							, "flush"
							, "finish_buffer"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("finish_buffer"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // finish_buffer
							, "clip"
							, "sink_event"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("sink_event"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // sink_event
							, "finish_buffer"
							, "sink_query"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("sink_query"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // sink_query
							, "sink_event"
							, "src_event"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("src_event"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // src_event
							, "sink_query"
							, "src_query"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("src_query"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // src_query
							, "src_event"
							, "src_activate"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("src_activate"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // src_activate
							, "src_query"
							, "aggregate"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("aggregate"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // aggregate
							, "src_activate"
							, "stop"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("stop"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // stop
							, "aggregate"
							, "start"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("start"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // start
							, "stop"
							, "get_next_time"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("get_next_time"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_next_time
							, "start"
							, "create_new_pad"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("create_new_pad"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // create_new_pad
							, "get_next_time"
							, "update_src_caps"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("update_src_caps"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // update_src_caps
							, "create_new_pad"
							, "fixate_src_caps"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("fixate_src_caps"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // fixate_src_caps
							, "update_src_caps"
							, "negotiated_src_caps"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("negotiated_src_caps"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // negotiated_src_caps
							, "fixate_src_caps"
							, "decide_allocation"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("decide_allocation"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // decide_allocation
							, "negotiated_src_caps"
							, "propose_allocation"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("propose_allocation"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // propose_allocation
							, "decide_allocation"
							, "negotiate"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("negotiate"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // negotiate
							, "propose_allocation"
							, "sink_event_pre_queue"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("sink_event_pre_queue"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // sink_event_pre_queue
							, "negotiate"
							, "sink_query_pre_queue"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("sink_query_pre_queue"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // sink_query_pre_queue
							, "sink_event_pre_queue"
							, "finish_buffer_list"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("finish_buffer_list"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // finish_buffer_list
							, "sink_query_pre_queue"
							, "peek_next_sample"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("peek_next_sample"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // peek_next_sample
							, "finish_buffer_list"
							, "_gst_reserved"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 15 // _gst_reserved
							, "peek_next_sample"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

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

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

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

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

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

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

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

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

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

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

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

		public bool Negotiate() {
			bool raw_ret = gst_aggregator_negotiate(Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public Gst.Sample PeekNextSample(Gst.Base.AggregatorPad pad) {
			IntPtr raw_ret = gst_aggregator_peek_next_sample(Handle, pad == null ? IntPtr.Zero : pad.Handle);
			Gst.Sample ret = raw_ret == IntPtr.Zero ? null : (Gst.Sample) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Sample), true);
			return ret;
		}

		[DllImport("gstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_aggregator_selected_samples(IntPtr raw, ulong pts, ulong dts, ulong duration, IntPtr info);

		public void SelectedSamples(ulong pts, ulong dts, ulong duration, Gst.Structure info) {
			gst_aggregator_selected_samples(Handle, pts, dts, duration, info == null ? IntPtr.Zero : info.Handle);
		}

		public void SelectedSamples(ulong pts, ulong dts, ulong duration) {
			SelectedSamples (pts, dts, duration, null);
		}

		[DllImport("gstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_aggregator_set_latency(IntPtr raw, ulong min_latency, ulong max_latency);

		public void SetLatency(ulong min_latency, ulong max_latency) {
			gst_aggregator_set_latency(Handle, min_latency, max_latency);
		}

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

		public Gst.Caps SrcCaps { 
			set {
				gst_aggregator_set_src_caps(Handle, value == null ? IntPtr.Zero : value.Handle);
			}
		}

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

		public ulong SimpleGetNextTime() {
			ulong raw_ret = gst_aggregator_simple_get_next_time(Handle);
			ulong ret = raw_ret;
			return ret;
		}

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

		public void UpdateSegment(Gst.Segment segment) {
			IntPtr native_segment = GLib.Marshaller.StructureToPtrAlloc (segment);
			gst_aggregator_update_segment(Handle, native_segment);
			Marshal.FreeHGlobal (native_segment);
		}


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

		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public new GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("srcpad"
							, Gst.Element.abi_info.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // srcpad
							, null
							, "priv"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("priv"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // priv
							, "srcpad"
							, "_gst_reserved"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 20 // _gst_reserved
							, "priv"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
