// 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
	[StructLayout(LayoutKind.Sequential)]
	public partial struct TypeFind : IEquatable<TypeFind> {

		private IntPtr _peek;
		private IntPtr _suggest;
		private IntPtr _data;
		private IntPtr _get_length;
		[MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
		private IntPtr[] _gstGstReserved;

		public static Gst.TypeFind Zero = new Gst.TypeFind ();

		public static Gst.TypeFind New(IntPtr raw) {
			if (raw == IntPtr.Zero)
				return Gst.TypeFind.Zero;
			return (Gst.TypeFind) Marshal.PtrToStructure (raw, typeof (Gst.TypeFind));
		}

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

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

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

		public ulong Length { 
			get {
				IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
				System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
				ulong raw_ret = gst_type_find_get_length(this_as_native);
				ulong ret = raw_ret;
				ReadNative (this_as_native, ref this);
				System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
				return ret;
			}
		}

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

		public void Suggest(uint probability, Gst.Caps caps) {
			IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
			System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
			gst_type_find_suggest(this_as_native, probability, caps == null ? IntPtr.Zero : caps.Handle);
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
		}

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

		public void SuggestEmptySimple(uint probability, string media_type) {
			IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
			System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
			IntPtr native_media_type = GLib.Marshaller.StringToPtrGStrdup (media_type);
			gst_type_find_suggest_empty_simple(this_as_native, probability, native_media_type);
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			GLib.Marshaller.Free (native_media_type);
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_type_find_register(IntPtr plugin, IntPtr name, uint rank, GstSharp.TypeFindFunctionNative func, IntPtr extensions, IntPtr possible_caps, IntPtr data, GLib.DestroyNotify data_notify);

		public static bool Register(Gst.Plugin plugin, string name, uint rank, Gst.TypeFindFunction func, string extensions, Gst.Caps possible_caps) {
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			GstSharp.TypeFindFunctionWrapper func_wrapper = new GstSharp.TypeFindFunctionWrapper (func);
			IntPtr data;
			GLib.DestroyNotify data_notify;
			if (func == null) {
				data = IntPtr.Zero;
				data_notify = null;
			} else {
				data = (IntPtr) GCHandle.Alloc (func_wrapper);
				data_notify = GLib.DestroyHelper.NotifyHandler;
			}
			IntPtr native_extensions = GLib.Marshaller.StringToPtrGStrdup (extensions);
			bool raw_ret = gst_type_find_register(plugin == null ? IntPtr.Zero : plugin.Handle, native_name, rank, func_wrapper.NativeDelegate, native_extensions, possible_caps == null ? IntPtr.Zero : possible_caps.Handle, IntPtr.Zero, data_notify);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_name);
			GLib.Marshaller.Free (native_extensions);
			return ret;
		}

		public static bool Register(string name, uint rank, Gst.TypeFindFunction func) {
			return Register (null, name, rank, func, null, null);
		}

		static void ReadNative (IntPtr native, ref Gst.TypeFind target)
		{
			target = New (native);
		}

		public bool Equals (TypeFind other)
		{
			return true && _peek.Equals (other._peek) && _suggest.Equals (other._suggest) && _data.Equals (other._data) && _get_length.Equals (other._get_length);
		}

		public override bool Equals (object other)
		{
			return other is TypeFind && Equals ((TypeFind) other);
		}

		public override int GetHashCode ()
		{
			return this.GetType ().FullName.GetHashCode () ^ _peek.GetHashCode () ^ _suggest.GetHashCode () ^ _data.GetHashCode () ^ _get_length.GetHashCode ();
		}

		public static explicit operator GLib.Value (Gst.TypeFind boxed)
		{
			GLib.Value val = GLib.Value.Empty;
			val.Init (Gst.TypeFind.GType);
			val.Val = boxed;
			return val;
		}

		public static explicit operator Gst.TypeFind (GLib.Value val)
		{
			return (Gst.TypeFind) val.Val;
		}
#endregion
	}
}
