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

		private IntPtr _info;
		public Gst.Video.VideoInfo Info {
			get {
				return _info == IntPtr.Zero ? null : (Gst.Video.VideoInfo) GLib.Opaque.GetOpaque (_info, typeof (Gst.Video.VideoInfo), false);
			}
			set {
				_info = value == null ? IntPtr.Zero : value.Handle;
			}
		}
		public Gst.Video.VideoFrameFlags Flags;
		private IntPtr _buffer;
		public Gst.Buffer Buffer {
			get {
				return _buffer == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (_buffer, typeof (Gst.Buffer), false);
			}
			set {
				_buffer = value == null ? IntPtr.Zero : value.Handle;
			}
		}
		private IntPtr _meta;
		public int Id;
		[MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
		public IntPtr[] Data;
		[MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
		public Gst.MapInfo[] MapField;
		[MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
		private IntPtr[] _gstGstReserved;

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

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

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

		public bool Copy(Gst.Video.VideoFrame src) {
			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_src = GLib.Marshaller.StructureToPtrAlloc (src);
			bool raw_ret = gst_video_frame_copy(this_as_native, native_src);
			bool ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			Marshal.FreeHGlobal (native_src);
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_video_frame_copy_plane(IntPtr raw, IntPtr src, uint plane);

		public bool CopyPlane(Gst.Video.VideoFrame src, uint plane) {
			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_src = GLib.Marshaller.StructureToPtrAlloc (src);
			bool raw_ret = gst_video_frame_copy_plane(this_as_native, native_src, plane);
			bool ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			Marshal.FreeHGlobal (native_src);
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_video_frame_map(IntPtr raw, IntPtr info, IntPtr buffer, int flags);

		public bool Map(Gst.Video.VideoInfo info, Gst.Buffer buffer, Gst.MapFlags flags) {
			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_frame_map(this_as_native, info == null ? IntPtr.Zero : info.Handle, buffer == null ? IntPtr.Zero : buffer.Handle, (int) flags);
			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_frame_map_id(IntPtr raw, IntPtr info, IntPtr buffer, int id, int flags);

		public bool MapId(Gst.Video.VideoInfo info, Gst.Buffer buffer, int id, Gst.MapFlags flags) {
			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_frame_map_id(this_as_native, info == null ? IntPtr.Zero : info.Handle, buffer == null ? IntPtr.Zero : buffer.Handle, id, (int) flags);
			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_frame_unmap(IntPtr raw);

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

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

		public bool Equals (VideoFrame other)
		{
			return true && Info.Equals (other.Info) && Flags.Equals (other.Flags) && Buffer.Equals (other.Buffer) && _meta.Equals (other._meta) && Id.Equals (other.Id) && Data.Equals (other.Data) && MapField.Equals (other.MapField);
		}

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

		public override int GetHashCode ()
		{
			return this.GetType ().FullName.GetHashCode () ^ Info.GetHashCode () ^ Flags.GetHashCode () ^ Buffer.GetHashCode () ^ _meta.GetHashCode () ^ Id.GetHashCode () ^ Data.GetHashCode () ^ MapField.GetHashCode ();
		}

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