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

namespace TotemPlParser {

	using System;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public class CD {

		[DllImport("totem-plparser.so.1")]
		static extern IntPtr totem_cd_mrl_from_type(IntPtr scheme, IntPtr dir);

		public static string MrlFromType(string scheme, string dir) {
			IntPtr scheme_as_native = GLib.Marshaller.StringToPtrGStrdup (scheme);
			IntPtr dir_as_native = GLib.Marshaller.StringToPtrGStrdup (dir);
			IntPtr raw_ret = totem_cd_mrl_from_type(scheme_as_native, dir_as_native);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			GLib.Marshaller.Free (scheme_as_native);
			GLib.Marshaller.Free (dir_as_native);
			return ret;
		}

		[DllImport("totem-plparser.so.1")]
		static extern unsafe int totem_cd_detect_type_from_dir(IntPtr dir, IntPtr url, out IntPtr error);

		public static unsafe TotemPlParser.MediaType DetectType(string dir, string url) {
			IntPtr dir_as_native = GLib.Marshaller.StringToPtrGStrdup (dir);
			IntPtr error = IntPtr.Zero;
			int raw_ret = totem_cd_detect_type_from_dir(dir_as_native, GLib.Marshaller.StringToPtrGStrdup(url), out error);
			TotemPlParser.MediaType ret = (TotemPlParser.MediaType) raw_ret;
			GLib.Marshaller.Free (dir_as_native);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[DllImport("totem-plparser.so.1")]
		static extern unsafe int totem_cd_detect_type(IntPtr device, out IntPtr error);

		public static unsafe TotemPlParser.MediaType DetectType(string device) {
			IntPtr device_as_native = GLib.Marshaller.StringToPtrGStrdup (device);
			IntPtr error = IntPtr.Zero;
			int raw_ret = totem_cd_detect_type(device_as_native, out error);
			TotemPlParser.MediaType ret = (TotemPlParser.MediaType) raw_ret;
			GLib.Marshaller.Free (device_as_native);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[DllImport("totem-plparser.so.1")]
		static extern unsafe int totem_cd_detect_type_with_url(IntPtr device, IntPtr url, out IntPtr error);

		public static unsafe TotemPlParser.MediaType DetectTypeWithUrl(string device, string url) {
			IntPtr device_as_native = GLib.Marshaller.StringToPtrGStrdup (device);
			IntPtr error = IntPtr.Zero;
			int raw_ret = totem_cd_detect_type_with_url(device_as_native, GLib.Marshaller.StringToPtrGStrdup(url), out error);
			TotemPlParser.MediaType ret = (TotemPlParser.MediaType) raw_ret;
			GLib.Marshaller.Free (device_as_native);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[DllImport("totem-plparser.so.1")]
		static extern IntPtr totem_cd_get_human_readable_name(int type);

		public static string GetHumanReadableName(TotemPlParser.MediaType type) {
			IntPtr raw_ret = totem_cd_get_human_readable_name((int) type);
			string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
			return ret;
		}

#endregion
	}
}
