// 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 TypeFind : GLib.Opaque {

		public IntPtr Data {
			get {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("data"));
					return (*raw_ptr);
				}
			}
			set {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("data"));
					*raw_ptr = value;
				}
			}
		}

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

		public ulong Length { 
			get {
				ulong raw_ret = gst_type_find_get_length(Handle);
				ulong ret = raw_ret;
				return ret;
			}
		}

		[DllImport("libgstreamer-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) {
			gst_type_find_suggest(Handle, probability, caps == null ? IntPtr.Zero : caps.Handle);
		}

		[DllImport("libgstreamer-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, Gst.Caps possible_caps) {
			return Register (null, name, rank, func, null, possible_caps);
		}

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


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("peek"
							, 0
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // peek
							, null
							, "suggest"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("suggest"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // suggest
							, "peek"
							, "data"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("data"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // data
							, "suggest"
							, "get_length"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("get_length"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // get_length
							, "data"
							, "_gst_reserved"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 4 // _gst_reserved
							, "get_length"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
