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

namespace Gst {

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

#region Autogenerated code
	public partial class Object : GLib.InitiallyUnowned {

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

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

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

		[GLib.Property ("name")]
		public string Name {
			get  {
				IntPtr raw_ret = gst_object_get_name(Handle);
				string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("name", val);
				val.Dispose ();
			}
		}

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

		[GLib.Property ("parent")]
		public Gst.Object Parent {
			get  {
				IntPtr raw_ret = gst_object_get_parent(Handle);
				Gst.Object ret = GLib.Object.GetObject(raw_ret, true) as Gst.Object;
				return ret;
			}
			set {
				GLib.Value val = new GLib.Value(value);
				SetProperty("parent", val);
				val.Dispose ();
			}
		}

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

		public string NameField {
			get {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("name"));
					return GLib.Marshaller.Utf8PtrToString ((*raw_ptr));
				}
			}
		}

		public uint Flags {
			get {
				unsafe {
					uint* raw_ptr = (uint*)(((byte*)Handle) + abi_info.GetFieldOffset("flags"));
					return (*raw_ptr);
				}
			}
			set {
				unsafe {
					uint* raw_ptr = (uint*)(((byte*)Handle) + abi_info.GetFieldOffset("flags"));
					*raw_ptr = value;
				}
			}
		}

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

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

		public ulong ControlRate {
			get  {
				ulong raw_ret = gst_object_get_control_rate(Handle);
				ulong ret = raw_ret;
				return ret;
			}
			set  {
				gst_object_set_control_rate(Handle, value);
			}
		}

		[GLib.Signal("deep-notify")]
		public event Gst.DeepNotifyHandler DeepNotify {
			add {
				this.AddSignalHandler ("deep-notify", value, typeof (Gst.DeepNotifyArgs));
			}
			remove {
				this.RemoveSignalHandler ("deep-notify", value);
			}
		}

		static DeepNotifyNativeDelegate DeepNotify_cb_delegate;
		static DeepNotifyNativeDelegate DeepNotifyVMCallback {
			get {
				if (DeepNotify_cb_delegate == null)
					DeepNotify_cb_delegate = new DeepNotifyNativeDelegate (DeepNotify_cb);
				return DeepNotify_cb_delegate;
			}
		}

		static void OverrideDeepNotify (GLib.GType gtype)
		{
			OverrideDeepNotify (gtype, DeepNotifyVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void DeepNotifyNativeDelegate (IntPtr inst, IntPtr prop_object, IntPtr prop);

		static void DeepNotify_cb (IntPtr inst, IntPtr prop_object, IntPtr prop)
		{
			try {
				Object __obj = GLib.Object.GetObject (inst, false) as Object;
				__obj.OnDeepNotify (GLib.Object.GetObject(prop_object) as Gst.Object, prop);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gst.Object), ConnectionMethod="OverrideDeepNotify")]
		protected virtual void OnDeepNotify (Gst.Object prop_object, IntPtr prop)
		{
			InternalDeepNotify (prop_object, prop);
		}

		private void InternalDeepNotify (Gst.Object prop_object, IntPtr prop)
		{
			DeepNotifyNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("deep_notify"));
				unmanaged = (DeepNotifyNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(DeepNotifyNativeDelegate));
			}
			if (unmanaged == null) return;

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


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

				return _class_abi;
			}
		}


		// End of the ABI representation.

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

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

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

		public static bool CheckUniqueness(GLib.List list, string name) {
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			bool raw_ret = gst_object_check_uniqueness(list == null ? IntPtr.Zero : list.Handle, native_name);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_name);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_object_default_deep_notify(IntPtr _object, IntPtr orig, IntPtr pspec, IntPtr excluded_props);

		public static void DefaultDeepNotify(GLib.Object _object, Gst.Object orig, IntPtr pspec, string[] excluded_props) {
			IntPtr native_excluded_props = GLib.Marshaller.StringArrayToStrvPtr(excluded_props, true);
			gst_object_default_deep_notify(_object == null ? IntPtr.Zero : _object.Handle, orig == null ? IntPtr.Zero : orig.Handle, pspec, native_excluded_props);
			GLib.Marshaller.StrFreeV (native_excluded_props);
		}

		public static void DefaultDeepNotify(GLib.Object _object, Gst.Object orig, IntPtr pspec) {
			DefaultDeepNotify (_object, orig, pspec, null);
		}

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

		public static bool Replace(Gst.Object oldobj, Gst.Object newobj) {
			bool raw_ret = gst_object_replace(oldobj == null ? IntPtr.Zero : oldobj.OwnedHandle, newobj == null ? IntPtr.Zero : newobj.Handle);
			bool ret = raw_ret;
			return ret;
		}

		public static bool Replace() {
			return Replace (null, null);
		}

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

		public bool AddControlBinding(Gst.ControlBinding binding) {
			bool raw_ret = gst_object_add_control_binding(Handle, binding == null ? IntPtr.Zero : binding.Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public void DefaultError(IntPtr error, string debug) {
			IntPtr native_debug = GLib.Marshaller.StringToPtrGStrdup (debug);
			gst_object_default_error(Handle, error, native_debug);
			GLib.Marshaller.Free (native_debug);
		}

		public void DefaultError(IntPtr error) {
			DefaultError (error, null);
		}

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

		public Gst.ControlBinding GetControlBinding(string property_name) {
			IntPtr native_property_name = GLib.Marshaller.StringToPtrGStrdup (property_name);
			IntPtr raw_ret = gst_object_get_control_binding(Handle, native_property_name);
			Gst.ControlBinding ret = GLib.Object.GetObject(raw_ret, true) as Gst.ControlBinding;
			GLib.Marshaller.Free (native_property_name);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_object_get_g_value_array(IntPtr raw, IntPtr property_name, ulong timestamp, ulong interval, uint n_values, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=4)]IntPtr[] values);

		public bool GetGValueArray(string property_name, ulong timestamp, ulong interval, GLib.Value[] values) {
			IntPtr native_property_name = GLib.Marshaller.StringToPtrGStrdup (property_name);
			uint n_values = (uint)(values == null ? 0 : values.Length);
			IntPtr[] native_values = new IntPtr [n_values];
			for (int i = 0; i < n_values; i++)
				native_values [i] = GLib.Marshaller.StructureToPtrAlloc (values[i]);
			bool raw_ret = gst_object_get_g_value_array(Handle, native_property_name, timestamp, interval, n_values, native_values);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_property_name);
			for (int i = 0; i < native_values.Length; i++) {
				Marshal.FreeHGlobal (native_values[i]);
			}
			return ret;
		}

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

		public string PathString { 
			get {
				IntPtr raw_ret = gst_object_get_path_string(Handle);
				string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
				return ret;
			}
		}

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

		public GLib.Value GetValue(string property_name, ulong timestamp) {
			IntPtr native_property_name = GLib.Marshaller.StringToPtrGStrdup (property_name);
			IntPtr raw_ret = gst_object_get_value(Handle, native_property_name, timestamp);
			GLib.Value ret = (GLib.Value) Marshal.PtrToStructure (raw_ret, typeof (GLib.Value));
			GLib.Marshaller.Free (native_property_name);
			return ret;
		}

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

		public bool HasActiveControlBindings { 
			get {
				bool raw_ret = gst_object_has_active_control_bindings(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

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

		[Obsolete]
		public bool HasAncestor(Gst.Object ancestor) {
			bool raw_ret = gst_object_has_ancestor(Handle, ancestor == null ? IntPtr.Zero : ancestor.Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public bool HasAsAncestor(Gst.Object ancestor) {
			bool raw_ret = gst_object_has_as_ancestor(Handle, ancestor == null ? IntPtr.Zero : ancestor.Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public bool HasAsParent(Gst.Object parent) {
			bool raw_ret = gst_object_has_as_parent(Handle, parent == null ? IntPtr.Zero : parent.Handle);
			bool ret = raw_ret;
			return ret;
		}

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

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

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

		public bool RemoveControlBinding(Gst.ControlBinding binding) {
			bool raw_ret = gst_object_remove_control_binding(Handle, binding == null ? IntPtr.Zero : binding.Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public void SetControlBindingDisabled(string property_name, bool disabled) {
			IntPtr native_property_name = GLib.Marshaller.StringToPtrGStrdup (property_name);
			gst_object_set_control_binding_disabled(Handle, native_property_name, disabled);
			GLib.Marshaller.Free (native_property_name);
		}

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

		public bool ControlBindingsDisabled { 
			set {
				gst_object_set_control_bindings_disabled(Handle, value);
			}
		}

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

		public bool SetName(string name) {
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			bool raw_ret = gst_object_set_name(Handle, native_name);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_name);
			return ret;
		}

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

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

		public bool SetParent(Gst.Object parent) {
			bool raw_ret = gst_object_set_parent(Handle, parent == null ? IntPtr.Zero : parent.Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public ulong SuggestNextSync() {
			ulong raw_ret = gst_object_suggest_next_sync(Handle);
			ulong ret = raw_ret;
			return ret;
		}

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

		public bool SyncValues(ulong timestamp) {
			bool raw_ret = gst_object_sync_values(Handle, timestamp);
			bool ret = raw_ret;
			return ret;
		}

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

		public void Unparent() {
			gst_object_unparent(Handle);
		}

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

		public void Unref() {
			gst_object_unref(Handle);
		}


		// 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("lock"
							, GLib.Object.abi_info.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // lock
							, null
							, "name"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("name"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // name
							, "lock"
							, "parent"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("parent"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // parent
							, "name"
							, "flags"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("flags"
							, -1
							, (uint) Marshal.SizeOf(typeof(uint)) // flags
							, "parent"
							, "control_bindings"
							, (long) Marshal.OffsetOf(typeof(GstObject_flagsAlign), "flags")
							, 0
							),
						new GLib.AbiField("control_bindings"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // control_bindings
							, "flags"
							, "control_rate"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("control_rate"
							, -1
							, (uint) Marshal.SizeOf(typeof(ulong)) // control_rate
							, "control_bindings"
							, "last_sync"
							, (long) Marshal.OffsetOf(typeof(GstObject_control_rateAlign), "control_rate")
							, 0
							),
						new GLib.AbiField("last_sync"
							, -1
							, (uint) Marshal.SizeOf(typeof(ulong)) // last_sync
							, "control_rate"
							, "_gst_reserved"
							, (long) Marshal.OffsetOf(typeof(GstObject_last_syncAlign), "last_sync")
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // _gst_reserved
							, "last_sync"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _abi_info;
			}
		}

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

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

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


		// End of the ABI representation.

#endregion
	}
}
