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

namespace Gst.Rtp {

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

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

		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;
			}
		}
		public Gst.MapInfo MapInfo;

		public static Gst.Rtp.RTCPBuffer Zero = new Gst.Rtp.RTCPBuffer ();

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

		[DllImport("gstrtp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_rtcp_buffer_add_packet(IntPtr raw, int type, IntPtr packet);

		public bool AddPacket(Gst.Rtp.RTCPType type, Gst.Rtp.RTCPPacket packet) {
			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_packet = GLib.Marshaller.StructureToPtrAlloc (packet);
			bool raw_ret = gst_rtcp_buffer_add_packet(this_as_native, (int) type, native_packet);
			bool ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			Marshal.FreeHGlobal (native_packet);
			return ret;
		}

		[DllImport("gstrtp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_rtcp_buffer_get_first_packet(IntPtr raw, IntPtr packet);

		public bool GetFirstPacket(Gst.Rtp.RTCPPacket packet) {
			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_packet = GLib.Marshaller.StructureToPtrAlloc (packet);
			bool raw_ret = gst_rtcp_buffer_get_first_packet(this_as_native, native_packet);
			bool ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			Marshal.FreeHGlobal (native_packet);
			return ret;
		}

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

		public uint PacketCount { 
			get {
				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);
				uint raw_ret = gst_rtcp_buffer_get_packet_count(this_as_native);
				uint ret = raw_ret;
				ReadNative (this_as_native, ref this);
				System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
				return ret;
			}
		}

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

		public bool 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);
			bool raw_ret = gst_rtcp_buffer_unmap(this_as_native);
			bool ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[DllImport("gstrtp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_rtcp_buffer_map(IntPtr buffer, int flags, IntPtr rtcp);

		public static bool Map(Gst.Buffer buffer, Gst.MapFlags flags, Gst.Rtp.RTCPBuffer rtcp) {
			IntPtr native_rtcp = GLib.Marshaller.StructureToPtrAlloc (rtcp);
			bool raw_ret = gst_rtcp_buffer_map(buffer == null ? IntPtr.Zero : buffer.Handle, (int) flags, native_rtcp);
			bool ret = raw_ret;
			Marshal.FreeHGlobal (native_rtcp);
			return ret;
		}

		[DllImport("gstrtp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_rtcp_buffer_new(uint mtu);

		public static Gst.Buffer New(uint mtu) {
			IntPtr raw_ret = gst_rtcp_buffer_new(mtu);
			Gst.Buffer ret = raw_ret == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Buffer), true);
			return ret;
		}

		[DllImport("gstrtp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_rtcp_buffer_new_copy_data(byte[] data, uint n_length);

		public static Gst.Buffer NewCopyData(byte[] data) {
			IntPtr raw_ret = gst_rtcp_buffer_new_copy_data(data, (uint) (data == null ? 0 : data.Length));
			Gst.Buffer ret = raw_ret == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Buffer), true);
			return ret;
		}

		[DllImport("gstrtp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_rtcp_buffer_new_take_data(byte[] data, uint n_length);

		public static Gst.Buffer NewTakeData(byte[] data) {
			IntPtr raw_ret = gst_rtcp_buffer_new_take_data(data, (uint) (data == null ? 0 : data.Length));
			Gst.Buffer ret = raw_ret == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Buffer), true);
			return ret;
		}

		[DllImport("gstrtp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_rtcp_buffer_validate(IntPtr buffer);

		public static bool Validate(Gst.Buffer buffer) {
			bool raw_ret = gst_rtcp_buffer_validate(buffer == null ? IntPtr.Zero : buffer.Handle);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstrtp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_rtcp_buffer_validate_data(byte[] data, uint len);

		public static bool ValidateData(byte[] data, uint len) {
			bool raw_ret = gst_rtcp_buffer_validate_data(data, len);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstrtp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_rtcp_buffer_validate_data_reduced(byte[] data, uint len);

		public static bool ValidateDataReduced(byte[] data, uint len) {
			bool raw_ret = gst_rtcp_buffer_validate_data_reduced(data, len);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstrtp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_rtcp_buffer_validate_reduced(IntPtr buffer);

		public static bool ValidateReduced(Gst.Buffer buffer) {
			bool raw_ret = gst_rtcp_buffer_validate_reduced(buffer == null ? IntPtr.Zero : buffer.Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public bool Equals (RTCPBuffer other)
		{
			return true && Buffer.Equals (other.Buffer) && MapInfo.Equals (other.MapInfo);
		}

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

		public override int GetHashCode ()
		{
			return this.GetType ().FullName.GetHashCode () ^ Buffer.GetHashCode () ^ MapInfo.GetHashCode ();
		}

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