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

namespace Gst.Audio {

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

#region Autogenerated code
	public partial class AudioBaseSrc : Gst.Base.PushSrc {

		public AudioBaseSrc (IntPtr raw) : base(raw) {}

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

		[GLib.Property ("actual-buffer-time")]
		public long ActualBufferTime {
			get {
				GLib.Value val = GetProperty ("actual-buffer-time");
				long ret = (long) val;
				val.Dispose ();
				return ret;
			}
		}

		[GLib.Property ("actual-latency-time")]
		public long ActualLatencyTime {
			get {
				GLib.Value val = GetProperty ("actual-latency-time");
				long ret = (long) val;
				val.Dispose ();
				return ret;
			}
		}

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

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

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

		[DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_audio_base_src_set_provide_clock(IntPtr raw, bool provide);

		[GLib.Property ("provide-clock")]
		public bool ProvideClock {
			get  {
				bool raw_ret = gst_audio_base_src_get_provide_clock(Handle);
				bool ret = raw_ret;
				return ret;
			}
			set  {
				gst_audio_base_src_set_provide_clock(Handle, value);
			}
		}

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

		[DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_audio_base_src_set_slave_method(IntPtr raw, int method);

		[GLib.Property ("slave-method")]
		public Gst.Audio.AudioBaseSrcSlaveMethod SlaveMethod {
			get  {
				int raw_ret = gst_audio_base_src_get_slave_method(Handle);
				Gst.Audio.AudioBaseSrcSlaveMethod ret = (Gst.Audio.AudioBaseSrcSlaveMethod) raw_ret;
				return ret;
			}
			set  {
				gst_audio_base_src_set_slave_method(Handle, (int) value);
			}
		}

		public Gst.Audio.AudioRingBuffer Ringbuffer {
			get {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("ringbuffer"));
					return GLib.Object.GetObject((*raw_ptr)) as Gst.Audio.AudioRingBuffer;
				}
			}
		}

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

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

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

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

		static CreateRingbufferNativeDelegate CreateRingbuffer_cb_delegate;
		static CreateRingbufferNativeDelegate CreateRingbufferVMCallback {
			get {
				if (CreateRingbuffer_cb_delegate == null)
					CreateRingbuffer_cb_delegate = new CreateRingbufferNativeDelegate (CreateRingbuffer_cb);
				return CreateRingbuffer_cb_delegate;
			}
		}

		static void OverrideCreateRingbuffer (GLib.GType gtype)
		{
			OverrideCreateRingbuffer (gtype, CreateRingbufferVMCallback);
		}

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

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

		static IntPtr CreateRingbuffer_cb (IntPtr inst)
		{
			try {
				AudioBaseSrc __obj = GLib.Object.GetObject (inst, false) as AudioBaseSrc;
				Gst.Audio.AudioRingBuffer __result;
				__result = __obj.OnCreateRingbuffer ();
				return __result == null ? IntPtr.Zero : __result.Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Audio.AudioBaseSrc), ConnectionMethod="OverrideCreateRingbuffer")]
		protected virtual Gst.Audio.AudioRingBuffer OnCreateRingbuffer ()
		{
			return InternalCreateRingbuffer ();
		}

		private Gst.Audio.AudioRingBuffer InternalCreateRingbuffer ()
		{
			CreateRingbufferNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("create_ringbuffer"));
				unmanaged = (CreateRingbufferNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(CreateRingbufferNativeDelegate));
			}
			if (unmanaged == null) return null;

			IntPtr __result = unmanaged (this.Handle);
			return GLib.Object.GetObject(__result) as Gst.Audio.AudioRingBuffer;
		}


		// 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("create_ringbuffer"
							, Gst.Base.PushSrc.class_abi.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // create_ringbuffer
							, null
							, "_gst_reserved"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 4 // _gst_reserved
							, "create_ringbuffer"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

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

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

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

		public Gst.Audio.AudioRingBuffer CreateRingbuffer() {
			IntPtr raw_ret = gst_audio_base_src_create_ringbuffer(Handle);
			Gst.Audio.AudioRingBuffer ret = GLib.Object.GetObject(raw_ret) as Gst.Audio.AudioRingBuffer;
			return ret;
		}


		static AudioBaseSrc ()
		{
			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("ringbuffer"
							, Gst.Base.PushSrc.abi_info.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // ringbuffer
							, null
							, "buffer_time"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("buffer_time"
							, -1
							, (uint) Marshal.SizeOf(typeof(ulong)) // buffer_time
							, "ringbuffer"
							, "latency_time"
							, (long) Marshal.OffsetOf(typeof(GstAudioBaseSrc_buffer_timeAlign), "buffer_time")
							, 0
							),
						new GLib.AbiField("latency_time"
							, -1
							, (uint) Marshal.SizeOf(typeof(ulong)) // latency_time
							, "buffer_time"
							, "next_sample"
							, (long) Marshal.OffsetOf(typeof(GstAudioBaseSrc_latency_timeAlign), "latency_time")
							, 0
							),
						new GLib.AbiField("next_sample"
							, -1
							, (uint) Marshal.SizeOf(typeof(ulong)) // next_sample
							, "latency_time"
							, "clock"
							, (long) Marshal.OffsetOf(typeof(GstAudioBaseSrc_next_sampleAlign), "next_sample")
							, 0
							),
						new GLib.AbiField("clock"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // clock
							, "next_sample"
							, "priv"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("priv"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // priv
							, "clock"
							, "_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 GstAudioBaseSrc_buffer_timeAlign
		{
			sbyte f1;
			private ulong buffer_time;
		}

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

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


		// End of the ABI representation.

#endregion
	}
}
