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

namespace Gst.Rtsp {

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

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

		public int Min;
		public int Max;

		public static Gst.Rtsp.RTSPRange Zero = new Gst.Rtsp.RTSPRange ();

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

		[DllImport("gstrtsp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_rtsp_range_convert_units(IntPtr range, int unit);

		public static bool ConvertUnits(Gst.Rtsp.RTSPTimeRange range, Gst.Rtsp.RTSPRangeUnit unit) {
			IntPtr native_range = GLib.Marshaller.StructureToPtrAlloc (range);
			bool raw_ret = gst_rtsp_range_convert_units(native_range, (int) unit);
			bool ret = raw_ret;
			Marshal.FreeHGlobal (native_range);
			return ret;
		}

		[DllImport("gstrtsp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_rtsp_range_free(IntPtr range);

		public static void Free(Gst.Rtsp.RTSPTimeRange range) {
			IntPtr native_range = GLib.Marshaller.StructureToPtrAlloc (range);
			gst_rtsp_range_free(native_range);
			Marshal.FreeHGlobal (native_range);
		}

		[DllImport("gstrtsp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_rtsp_range_get_times(IntPtr range, out ulong min, out ulong max);

		public static bool GetTimes(Gst.Rtsp.RTSPTimeRange range, out ulong min, out ulong max) {
			IntPtr native_range = GLib.Marshaller.StructureToPtrAlloc (range);
			bool raw_ret = gst_rtsp_range_get_times(native_range, out min, out max);
			bool ret = raw_ret;
			Marshal.FreeHGlobal (native_range);
			return ret;
		}

		[DllImport("gstrtsp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_rtsp_range_parse(IntPtr rangestr, IntPtr range);

		public static Gst.Rtsp.RTSPResult Parse(string rangestr, out Gst.Rtsp.RTSPTimeRange range) {
			IntPtr native_rangestr = GLib.Marshaller.StringToPtrGStrdup (rangestr);
			IntPtr native_range = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (Gst.Rtsp.RTSPTimeRange)));
			int raw_ret = gst_rtsp_range_parse(native_rangestr, native_range);
			Gst.Rtsp.RTSPResult ret = (Gst.Rtsp.RTSPResult) raw_ret;
			GLib.Marshaller.Free (native_rangestr);
			range = Gst.Rtsp.RTSPTimeRange.New (native_range);
			Marshal.FreeHGlobal (native_range);
			return ret;
		}

		[DllImport("gstrtsp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_rtsp_range_to_string(IntPtr range);

		public static string ToString(Gst.Rtsp.RTSPTimeRange range) {
			IntPtr native_range = GLib.Marshaller.StructureToPtrAlloc (range);
			IntPtr raw_ret = gst_rtsp_range_to_string(native_range);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			Marshal.FreeHGlobal (native_range);
			return ret;
		}

		public bool Equals (RTSPRange other)
		{
			return true && Min.Equals (other.Min) && Max.Equals (other.Max);
		}

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

		public override int GetHashCode ()
		{
			return this.GetType ().FullName.GetHashCode () ^ Min.GetHashCode () ^ Max.GetHashCode ();
		}

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