// 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 DsdInfo : IEquatable<DsdInfo> {

		public Gst.Audio.DsdFormat Format;
		public int Rate;
		public int Channels;
		public Gst.Audio.AudioLayout Layout;
		public bool ReversedBytes;
		[MarshalAs (UnmanagedType.ByValArray, SizeConst=64)]
		public Gst.Audio.AudioChannelPosition[] Positions;
		public Gst.Audio.AudioFlags Flags;
		[MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
		private IntPtr[] _gstGstReserved;

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

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

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

		public static DsdInfo New()
		{
			DsdInfo result = DsdInfo.New (gst_dsd_info_new());
			return result;
		}

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

		public static DsdInfo NewFromCaps(Gst.Caps caps)
		{
			DsdInfo result = DsdInfo.New (gst_dsd_info_new_from_caps(caps == null ? IntPtr.Zero : caps.Handle));
			return result;
		}

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

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

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

		public bool IsEqual(Gst.Audio.DsdInfo other) {
			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_other = GLib.Marshaller.StructureToPtrAlloc (other);
			bool raw_ret = gst_dsd_info_is_equal(this_as_native, native_other);
			bool ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			Marshal.FreeHGlobal (native_other);
			return ret;
		}

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

		public Gst.Caps ToCaps() {
			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 raw_ret = gst_dsd_info_to_caps(this_as_native);
			Gst.Caps ret = raw_ret == IntPtr.Zero ? null : (Gst.Caps) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Caps), true);
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

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

		public static bool FromCaps(out Gst.Audio.DsdInfo info, Gst.Caps caps) {
			IntPtr native_info = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (Gst.Audio.DsdInfo)));
			bool raw_ret = gst_dsd_info_from_caps(native_info, caps == null ? IntPtr.Zero : caps.Handle);
			bool ret = raw_ret;
			info = Gst.Audio.DsdInfo.New (native_info);
			Marshal.FreeHGlobal (native_info);
			return ret;
		}

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

		public static Gst.Audio.DsdInfo Init() {
			Gst.Audio.DsdInfo info;
			IntPtr native_info = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (Gst.Audio.DsdInfo)));
			gst_dsd_info_init(native_info);
			info = Gst.Audio.DsdInfo.New (native_info);
			Marshal.FreeHGlobal (native_info);
			return info;
		}

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

		public bool Equals (DsdInfo other)
		{
			return true && Format.Equals (other.Format) && Rate.Equals (other.Rate) && Channels.Equals (other.Channels) && Layout.Equals (other.Layout) && ReversedBytes.Equals (other.ReversedBytes) && Positions.Equals (other.Positions) && Flags.Equals (other.Flags);
		}

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

		public override int GetHashCode ()
		{
			return this.GetType ().FullName.GetHashCode () ^ Format.GetHashCode () ^ Rate.GetHashCode () ^ Channels.GetHashCode () ^ Layout.GetHashCode () ^ ReversedBytes.GetHashCode () ^ Positions.GetHashCode () ^ Flags.GetHashCode ();
		}

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

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