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

namespace Gst.Video {

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

#region Autogenerated code
	[StructLayout(LayoutKind.Sequential)]
	public partial struct VideoMasteringDisplayInfo : IEquatable<VideoMasteringDisplayInfo> {

		[MarshalAs (UnmanagedType.ByValArray, SizeConst=3)]
		public Gst.Video.VideoMasteringDisplayInfoCoordinates[] DisplayPrimaries;
		public Gst.Video.VideoMasteringDisplayInfoCoordinates WhitePoint;
		public uint MaxDisplayMasteringLuminance;
		public uint MinDisplayMasteringLuminance;
		[MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
		private IntPtr[] _gstGstReserved;

		public static Gst.Video.VideoMasteringDisplayInfo Zero = new Gst.Video.VideoMasteringDisplayInfo ();

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

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

		public bool AddToCaps(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);
			bool raw_ret = gst_video_mastering_display_info_add_to_caps(this_as_native, caps == null ? IntPtr.Zero : caps.Handle);
			bool ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

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

		public bool FromCaps(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);
			bool raw_ret = gst_video_mastering_display_info_from_caps(this_as_native, caps == null ? IntPtr.Zero : caps.Handle);
			bool ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

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

		public void Init() {
			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_video_mastering_display_info_init(this_as_native);
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
		}

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

		public bool IsEqual(Gst.Video.VideoMasteringDisplayInfo 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_video_mastering_display_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("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_video_mastering_display_info_to_string(IntPtr raw);

		public override string ToString() {
			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_video_mastering_display_info_to_string(this_as_native);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_video_mastering_display_info_from_string(IntPtr minfo, IntPtr mastering);

		public static bool FromString(out Gst.Video.VideoMasteringDisplayInfo minfo, string mastering) {
			IntPtr native_minfo = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (Gst.Video.VideoMasteringDisplayInfo)));
			IntPtr native_mastering = GLib.Marshaller.StringToPtrGStrdup (mastering);
			bool raw_ret = gst_video_mastering_display_info_from_string(native_minfo, native_mastering);
			bool ret = raw_ret;
			minfo = Gst.Video.VideoMasteringDisplayInfo.New (native_minfo);
			Marshal.FreeHGlobal (native_minfo);
			GLib.Marshaller.Free (native_mastering);
			return ret;
		}

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

		public bool Equals (VideoMasteringDisplayInfo other)
		{
			return true && DisplayPrimaries.Equals (other.DisplayPrimaries) && WhitePoint.Equals (other.WhitePoint) && MaxDisplayMasteringLuminance.Equals (other.MaxDisplayMasteringLuminance) && MinDisplayMasteringLuminance.Equals (other.MinDisplayMasteringLuminance);
		}

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

		public override int GetHashCode ()
		{
			return this.GetType ().FullName.GetHashCode () ^ DisplayPrimaries.GetHashCode () ^ WhitePoint.GetHashCode () ^ MaxDisplayMasteringLuminance.GetHashCode () ^ MinDisplayMasteringLuminance.GetHashCode ();
		}

		private static GLib.GType GType {
			get { return GLib.GType.Pointer; }
		}
#endregion
	}
}
