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

namespace Gst.RtspServer {

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

#region Autogenerated code
	public partial class RTSPSessionMedia : GLib.Object {

		public RTSPSessionMedia (IntPtr raw) : base(raw) {}

		[DllImport("gstrtspserver-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_rtsp_session_media_new(IntPtr path, IntPtr media);

		public RTSPSessionMedia (string path, Gst.RtspServer.RTSPMedia media) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (RTSPSessionMedia)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_path = GLib.Marshaller.StringToPtrGStrdup (path);
			Raw = gst_rtsp_session_media_new(native_path, media == null ? IntPtr.Zero : media.OwnedHandle);
			GLib.Marshaller.Free (native_path);
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _class_abi = null;
		static public new GLib.AbiStruct class_abi {
			get {
				if (_class_abi == null)
					_class_abi = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("_gst_reserved"
							, GLib.Object.class_abi.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 4 // _gst_reserved
							, null
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

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

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

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

		public bool AllocChannels(out Gst.Rtsp.RTSPRange range) {
			IntPtr native_range = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (Gst.Rtsp.RTSPRange)));
			bool raw_ret = gst_rtsp_session_media_alloc_channels(Handle, native_range);
			bool ret = raw_ret;
			range = Gst.Rtsp.RTSPRange.New (native_range);
			Marshal.FreeHGlobal (native_range);
			return ret;
		}

		[DllImport("gstrtspserver-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern ulong gst_rtsp_session_media_get_base_time(IntPtr raw);

		public ulong BaseTime { 
			get {
				ulong raw_ret = gst_rtsp_session_media_get_base_time(Handle);
				ulong ret = raw_ret;
				return ret;
			}
		}

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

		public Gst.RtspServer.RTSPMedia Media { 
			get {
				IntPtr raw_ret = gst_rtsp_session_media_get_media(Handle);
				Gst.RtspServer.RTSPMedia ret = GLib.Object.GetObject(raw_ret) as Gst.RtspServer.RTSPMedia;
				return ret;
			}
		}

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

		public string Rtpinfo { 
			get {
				IntPtr raw_ret = gst_rtsp_session_media_get_rtpinfo(Handle);
				string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
				return ret;
			}
		}

		[DllImport("gstrtspserver-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_rtsp_session_media_get_rtsp_state(IntPtr raw);

		[DllImport("gstrtspserver-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_rtsp_session_media_set_rtsp_state(IntPtr raw, int state);

		public Gst.Rtsp.RTSPState RtspState { 
			get {
				int raw_ret = gst_rtsp_session_media_get_rtsp_state(Handle);
				Gst.Rtsp.RTSPState ret = (Gst.Rtsp.RTSPState) raw_ret;
				return ret;
			}
			set {
				gst_rtsp_session_media_set_rtsp_state(Handle, (int) value);
			}
		}

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

		public Gst.RtspServer.RTSPStreamTransport GetTransport(uint idx) {
			IntPtr raw_ret = gst_rtsp_session_media_get_transport(Handle, idx);
			Gst.RtspServer.RTSPStreamTransport ret = GLib.Object.GetObject(raw_ret) as Gst.RtspServer.RTSPStreamTransport;
			return ret;
		}

		[DllImport("gstrtspserver-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_rtsp_session_media_matches(IntPtr raw, IntPtr path, out int matched);

		public bool Matches(string path, out int matched) {
			IntPtr native_path = GLib.Marshaller.StringToPtrGStrdup (path);
			bool raw_ret = gst_rtsp_session_media_matches(Handle, native_path, out matched);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_path);
			return ret;
		}

		[DllImport("gstrtspserver-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_rtsp_session_media_set_state(IntPtr raw, int state);

		public bool SetState(Gst.State state) {
			bool raw_ret = gst_rtsp_session_media_set_state(Handle, (int) state);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstrtspserver-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_rtsp_session_media_set_transport(IntPtr raw, IntPtr stream, IntPtr tr);

		public Gst.RtspServer.RTSPStreamTransport SetTransport(Gst.RtspServer.RTSPStream stream, Gst.Rtsp.RTSPTransport tr) {
			IntPtr native_tr = GLib.Marshaller.StructureToPtrAlloc (tr);
			IntPtr raw_ret = gst_rtsp_session_media_set_transport(Handle, stream == null ? IntPtr.Zero : stream.Handle, native_tr);
			Gst.RtspServer.RTSPStreamTransport ret = GLib.Object.GetObject(raw_ret) as Gst.RtspServer.RTSPStreamTransport;
			Marshal.FreeHGlobal (native_tr);
			return ret;
		}


		static RTSPSessionMedia ()
		{
			GtkSharp.GstreamerSharp.ObjectManager.Initialize ();
		}

		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public new GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("priv"
							, GLib.Object.abi_info.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // priv
							, null
							, "_gst_reserved"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 4 // _gst_reserved
							, "priv"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
