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

namespace Gst {

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

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

		public Gst.SegmentFlags Flags;
		public double Rate;
		public double AppliedRate;
		public Gst.Format Format;
		public ulong Base;
		public ulong Offset;
		public ulong Start;
		public ulong Stop;
		public ulong Time;
		public ulong Position;
		public ulong Duration;
		[MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
		private IntPtr[] _gstGstReserved;

		public static Gst.Segment Zero = new Gst.Segment ();

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

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

		public static Segment New()
		{
			Segment result = Segment.New (gst_segment_new());
			return result;
		}

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

		public static GLib.GType GType { 
			get {
				IntPtr raw_ret = gst_segment_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);
				return ret;
			}
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_segment_clip(IntPtr raw, int format, ulong start, ulong stop, out ulong clip_start, out ulong clip_stop);

		public bool Clip(Gst.Format format, ulong start, ulong stop, out ulong clip_start, out ulong clip_stop) {
			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_segment_clip(this_as_native, (int) format, start, stop, out clip_start, out clip_stop);
			bool ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

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

		public void CopyInto(Gst.Segment dest) {
			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_dest = GLib.Marshaller.StructureToPtrAlloc (dest);
			gst_segment_copy_into(this_as_native, native_dest);
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			Marshal.FreeHGlobal (native_dest);
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_segment_do_seek(IntPtr raw, double rate, int format, int flags, int start_type, ulong start, int stop_type, ulong stop, out bool update);

		public bool DoSeek(double rate, Gst.Format format, Gst.SeekFlags flags, Gst.SeekType start_type, ulong start, Gst.SeekType stop_type, ulong stop, out bool update) {
			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_segment_do_seek(this_as_native, rate, (int) format, (int) flags, (int) start_type, start, (int) stop_type, stop, out update);
			bool ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_segment_init(IntPtr raw, int format);

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

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

		public bool IsEqual(Gst.Segment s1) {
			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_s1 = GLib.Marshaller.StructureToPtrAlloc (s1);
			bool raw_ret = gst_segment_is_equal(this_as_native, native_s1);
			bool ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			Marshal.FreeHGlobal (native_s1);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_segment_offset_running_time(IntPtr raw, int format, long offset);

		public bool OffsetRunningTime(Gst.Format format, long offset) {
			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_segment_offset_running_time(this_as_native, (int) format, offset);
			bool ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern ulong gst_segment_position_from_running_time(IntPtr raw, int format, ulong running_time);

		public ulong PositionFromRunningTime(Gst.Format format, ulong running_time) {
			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);
			ulong raw_ret = gst_segment_position_from_running_time(this_as_native, (int) format, running_time);
			ulong ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_segment_position_from_running_time_full(IntPtr raw, int format, ulong running_time, out ulong position);

		public int PositionFromRunningTimeFull(Gst.Format format, ulong running_time, out ulong position) {
			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);
			int raw_ret = gst_segment_position_from_running_time_full(this_as_native, (int) format, running_time, out position);
			int ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern ulong gst_segment_position_from_stream_time(IntPtr raw, int format, ulong stream_time);

		public ulong PositionFromStreamTime(Gst.Format format, ulong stream_time) {
			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);
			ulong raw_ret = gst_segment_position_from_stream_time(this_as_native, (int) format, stream_time);
			ulong ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_segment_position_from_stream_time_full(IntPtr raw, int format, ulong stream_time, out ulong position);

		public int PositionFromStreamTimeFull(Gst.Format format, ulong stream_time, out ulong position) {
			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);
			int raw_ret = gst_segment_position_from_stream_time_full(this_as_native, (int) format, stream_time, out position);
			int ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_segment_set_running_time(IntPtr raw, int format, ulong running_time);

		public bool SetRunningTime(Gst.Format format, ulong running_time) {
			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_segment_set_running_time(this_as_native, (int) format, running_time);
			bool ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern ulong gst_segment_to_position(IntPtr raw, int format, ulong running_time);

		[Obsolete]
		public ulong ToPosition(Gst.Format format, ulong running_time) {
			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);
			ulong raw_ret = gst_segment_to_position(this_as_native, (int) format, running_time);
			ulong ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern ulong gst_segment_to_running_time(IntPtr raw, int format, ulong position);

		public ulong ToRunningTime(Gst.Format format, ulong position) {
			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);
			ulong raw_ret = gst_segment_to_running_time(this_as_native, (int) format, position);
			ulong ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_segment_to_running_time_full(IntPtr raw, int format, ulong position, out ulong running_time);

		public int ToRunningTimeFull(Gst.Format format, ulong position, out ulong running_time) {
			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);
			int raw_ret = gst_segment_to_running_time_full(this_as_native, (int) format, position, out running_time);
			int ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern ulong gst_segment_to_stream_time(IntPtr raw, int format, ulong position);

		public ulong ToStreamTime(Gst.Format format, ulong position) {
			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);
			ulong raw_ret = gst_segment_to_stream_time(this_as_native, (int) format, position);
			ulong ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_segment_to_stream_time_full(IntPtr raw, int format, ulong position, out ulong stream_time);

		public int ToStreamTimeFull(Gst.Format format, ulong position, out ulong stream_time) {
			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);
			int raw_ret = gst_segment_to_stream_time_full(this_as_native, (int) format, position, out stream_time);
			int ret = raw_ret;
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

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

		public bool Equals (Segment other)
		{
			return true && Flags.Equals (other.Flags) && Rate.Equals (other.Rate) && AppliedRate.Equals (other.AppliedRate) && Format.Equals (other.Format) && Base.Equals (other.Base) && Offset.Equals (other.Offset) && Start.Equals (other.Start) && Stop.Equals (other.Stop) && Time.Equals (other.Time) && Position.Equals (other.Position) && Duration.Equals (other.Duration);
		}

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

		public override int GetHashCode ()
		{
			return this.GetType ().FullName.GetHashCode () ^ Flags.GetHashCode () ^ Rate.GetHashCode () ^ AppliedRate.GetHashCode () ^ Format.GetHashCode () ^ Base.GetHashCode () ^ Offset.GetHashCode () ^ Start.GetHashCode () ^ Stop.GetHashCode () ^ Time.GetHashCode () ^ Position.GetHashCode () ^ Duration.GetHashCode ();
		}

		public static explicit operator GLib.Value (Gst.Segment boxed)
		{
			GLib.Value val = GLib.Value.Empty;
			val.Init (Gst.Segment.GType);
			val.Val = boxed;
			return val;
		}

		public static explicit operator Gst.Segment (GLib.Value val)
		{
			return (Gst.Segment) val.Val;
		}
#endregion
	}
}
