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

namespace Gst.Audio {

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

#region Autogenerated code
	public partial class AudioInfo : GLib.Opaque {

		public Gst.Audio.AudioFormatInfo Finfo {
			get {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("finfo"));
					return Gst.Audio.AudioFormatInfo.New ((*raw_ptr));
				}
			}
			set {
				unsafe {
					IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + abi_info.GetFieldOffset("finfo"));
					*raw_ptr = GLib.Marshaller.StructureToPtrAlloc (value);
				}
			}
		}

		public Gst.Audio.AudioFlags Flags {
			get {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("flags"));
					return (Gst.Audio.AudioFlags) (*raw_ptr);
				}
			}
			set {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("flags"));
					*raw_ptr = (int) value;
				}
			}
		}

		public Gst.Audio.AudioLayout Layout {
			get {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("layout"));
					return (Gst.Audio.AudioLayout) (*raw_ptr);
				}
			}
			set {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("layout"));
					*raw_ptr = (int) value;
				}
			}
		}

		public int Rate {
			get {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("rate"));
					return (*raw_ptr);
				}
			}
			set {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("rate"));
					*raw_ptr = value;
				}
			}
		}

		public int Channels {
			get {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("channels"));
					return (*raw_ptr);
				}
			}
			set {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("channels"));
					*raw_ptr = value;
				}
			}
		}

		public int Bpf {
			get {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("bpf"));
					return (*raw_ptr);
				}
			}
			set {
				unsafe {
					int* raw_ptr = (int*)(((byte*)Handle) + abi_info.GetFieldOffset("bpf"));
					*raw_ptr = value;
				}
			}
		}

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

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

		[DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_audio_info_convert(IntPtr raw, int src_fmt, long src_val, int dest_fmt, out long dest_val);

		public bool Convert(Gst.Format src_fmt, long src_val, Gst.Format dest_fmt, out long dest_val) {
			bool raw_ret = gst_audio_info_convert(Handle, (int) src_fmt, src_val, (int) dest_fmt, out dest_val);
			bool ret = raw_ret;
			return ret;
		}

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

		public Gst.Audio.AudioInfo Copy() {
			IntPtr raw_ret = gst_audio_info_copy(Handle);
			Gst.Audio.AudioInfo ret = raw_ret == IntPtr.Zero ? null : (Gst.Audio.AudioInfo) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Audio.AudioInfo), true);
			return ret;
		}

		[DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_audio_info_from_caps(IntPtr raw, IntPtr caps);

		public bool FromCaps(Gst.Caps caps) {
			bool raw_ret = gst_audio_info_from_caps(Handle, caps == null ? IntPtr.Zero : caps.Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public void Init() {
			gst_audio_info_init(Handle);
		}

		[DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_audio_info_is_equal(IntPtr raw, IntPtr other);

		public bool IsEqual(Gst.Audio.AudioInfo other) {
			bool raw_ret = gst_audio_info_is_equal(Handle, other == null ? IntPtr.Zero : other.Handle);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_audio_info_set_format(IntPtr raw, int format, int rate, int channels, int[] position);

		public void SetFormat(Gst.Audio.AudioFormat format, int rate, int channels, Gst.Audio.AudioChannelPosition[] position) {
			int cnt_position = position == null ? 0 : position.Length;
			int[] native_position = new int [cnt_position];
			for (int i = 0; i < cnt_position; i++)
				native_position [i] = (int) position[i];
			gst_audio_info_set_format(Handle, (int) format, rate, channels, native_position);
		}

		public void SetFormat(Gst.Audio.AudioFormat format, int rate, int channels) {
			SetFormat (format, rate, channels, null);
		}

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

		public Gst.Caps ToCaps() {
			IntPtr raw_ret = gst_audio_info_to_caps(Handle);
			Gst.Caps ret = raw_ret == IntPtr.Zero ? null : (Gst.Caps) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Caps), true);
			return ret;
		}

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

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

		public AudioInfo () 
		{
			Raw = gst_audio_info_new();
		}

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

		protected override void Free (IntPtr raw)
		{
			gst_audio_info_free (raw);
		}

		protected override Action<IntPtr> DisposeUnmanagedFunc {
			get {
				return gst_audio_info_free;
			}
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("finfo"
							, 0
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // finfo
							, null
							, "flags"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("flags"
							, -1
							, (uint) Marshal.SizeOf(System.Enum.GetUnderlyingType(typeof(Gst.Audio.AudioFlags))) // flags
							, "finfo"
							, "layout"
							, (long) Marshal.OffsetOf(typeof(GstAudioInfo_flagsAlign), "flags")
							, 0
							),
						new GLib.AbiField("layout"
							, -1
							, (uint) Marshal.SizeOf(System.Enum.GetUnderlyingType(typeof(Gst.Audio.AudioLayout))) // layout
							, "flags"
							, "rate"
							, (long) Marshal.OffsetOf(typeof(GstAudioInfo_layoutAlign), "layout")
							, 0
							),
						new GLib.AbiField("rate"
							, -1
							, (uint) Marshal.SizeOf(typeof(int)) // rate
							, "layout"
							, "channels"
							, (long) Marshal.OffsetOf(typeof(GstAudioInfo_rateAlign), "rate")
							, 0
							),
						new GLib.AbiField("channels"
							, -1
							, (uint) Marshal.SizeOf(typeof(int)) // channels
							, "rate"
							, "bpf"
							, (long) Marshal.OffsetOf(typeof(GstAudioInfo_channelsAlign), "channels")
							, 0
							),
						new GLib.AbiField("bpf"
							, -1
							, (uint) Marshal.SizeOf(typeof(int)) // bpf
							, "channels"
							, "position"
							, (long) Marshal.OffsetOf(typeof(GstAudioInfo_bpfAlign), "bpf")
							, 0
							),
						new GLib.AbiField("position"
							, -1
							, (uint) Marshal.SizeOf(System.Enum.GetUnderlyingType(typeof(Gst.Audio.AudioChannelPosition))) * 64 // position
							, "bpf"
							, "_gst_reserved"
							, (long) Marshal.OffsetOf(typeof(GstAudioInfo_positionAlign), "position")
							, 0
							),
						new GLib.AbiField("_gst_reserved"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) * 4 // _gst_reserved
							, "position"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _abi_info;
			}
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstAudioInfo_flagsAlign
		{
			sbyte f1;
			private Gst.Audio.AudioFlags flags;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstAudioInfo_layoutAlign
		{
			sbyte f1;
			private Gst.Audio.AudioLayout layout;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstAudioInfo_rateAlign
		{
			sbyte f1;
			private int rate;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstAudioInfo_channelsAlign
		{
			sbyte f1;
			private int channels;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstAudioInfo_bpfAlign
		{
			sbyte f1;
			private int bpf;
		}

		[StructLayout(LayoutKind.Sequential)]
		public struct GstAudioInfo_positionAlign
		{
			sbyte f1;
			[MarshalAs (UnmanagedType.ByValArray, SizeConst=64)]
			private Gst.Audio.AudioChannelPosition[] position;
		}


		// End of the ABI representation.

#endregion
	}
}
