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

		public Gst.Audio.AudioFormat Format;
		public string Name;
		public string Description;
		public Gst.Audio.AudioFormatFlags Flags;
		public int Endianness;
		public int Width;
		public int Depth;
		[MarshalAs (UnmanagedType.ByValArray, SizeConst=8)]
		public byte[] Silence;
		public Gst.Audio.AudioFormat UnpackFormat;
		private Gst.AudioSharp.AudioFormatUnpackNative _unpack_func;
		public Gst.Audio.AudioFormatUnpack UnpackFunc {
			get {
				return Gst.AudioSharp.AudioFormatUnpackWrapper.GetManagedDelegate (_unpack_func);
			}
		}
		private Gst.AudioSharp.AudioFormatPackNative _pack_func;
		public Gst.Audio.AudioFormatPack PackFunc {
			get {
				return Gst.AudioSharp.AudioFormatPackWrapper.GetManagedDelegate (_pack_func);
			}
		}
		[MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
		private IntPtr[] _gstGstReserved;

		public static Gst.Audio.AudioFormatInfo Zero = new Gst.Audio.AudioFormatInfo ();

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

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

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

		[DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_audio_format_info_fill_silence(IntPtr raw, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=2)]IntPtr[] dest, UIntPtr length);

		public void FillSilence(IntPtr[] dest) {
			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 length = (ulong)(dest == null ? 0 : dest.Length);
			gst_audio_format_info_fill_silence(this_as_native, dest, new UIntPtr ((uint)length));
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
		}

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

		public bool Equals (AudioFormatInfo other)
		{
			return true && Format.Equals (other.Format) && Name.Equals (other.Name) && Description.Equals (other.Description) && Flags.Equals (other.Flags) && Endianness.Equals (other.Endianness) && Width.Equals (other.Width) && Depth.Equals (other.Depth) && Silence.Equals (other.Silence) && UnpackFormat.Equals (other.UnpackFormat) && UnpackFunc.Equals (other.UnpackFunc) && PackFunc.Equals (other.PackFunc);
		}

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

		public override int GetHashCode ()
		{
			return this.GetType ().FullName.GetHashCode () ^ Format.GetHashCode () ^ Name.GetHashCode () ^ Description.GetHashCode () ^ Flags.GetHashCode () ^ Endianness.GetHashCode () ^ Width.GetHashCode () ^ Depth.GetHashCode () ^ Silence.GetHashCode () ^ UnpackFormat.GetHashCode () ^ UnpackFunc.GetHashCode () ^ PackFunc.GetHashCode ();
		}

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

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