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

		public Gst.Meta Meta;
		public uint Ssrc;
		public bool SsrcValid;
		[MarshalAs (UnmanagedType.ByValArray, SizeConst=15)]
		public uint[] Csrc;
		public uint CsrcCount;

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

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

		[DllImport("gstrtp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_rtp_source_meta_append_csrc(IntPtr raw, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=2)]uint[] csrc, uint csrc_count);

		public bool AppendCsrc(uint[] csrc) {
			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 csrc_count = (uint)(csrc == null ? 0 : csrc.Length);
			bool raw_ret = gst_rtp_source_meta_append_csrc(this_as_native, csrc, csrc_count);
			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 uint gst_rtp_source_meta_get_source_count(IntPtr raw);

		public uint SourceCount { 
			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_rtp_source_meta_get_source_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_rtp_source_meta_set_ssrc(IntPtr raw, uint ssrc);

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

		public bool SetSsrc() {
			return SetSsrc (0);
		}

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

		public static Gst.MetaInfo Info { 
			get {
				IntPtr raw_ret = gst_rtp_source_meta_get_info();
				Gst.MetaInfo ret = Gst.MetaInfo.New (raw_ret);
				return ret;
			}
		}

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

		public bool Equals (RTPSourceMeta other)
		{
			return true && Meta.Equals (other.Meta) && Ssrc.Equals (other.Ssrc) && SsrcValid.Equals (other.SsrcValid) && Csrc.Equals (other.Csrc) && CsrcCount.Equals (other.CsrcCount);
		}

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

		public override int GetHashCode ()
		{
			return this.GetType ().FullName.GetHashCode () ^ Meta.GetHashCode () ^ Ssrc.GetHashCode () ^ SsrcValid.GetHashCode () ^ Csrc.GetHashCode () ^ CsrcCount.GetHashCode ();
		}

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