Release 1.22.7
[platform/upstream/gstreamer.git] / subprojects / gstreamer-sharp / sources / generated / Gst.Audio / AudioBuffer.cs
1 // This file was generated by the Gtk# code generator.
2 // Any changes made will be lost if regenerated.
3
4 namespace Gst.Audio {
5
6         using System;
7         using System.Collections;
8         using System.Collections.Generic;
9         using System.Runtime.InteropServices;
10
11 #region Autogenerated code
12         [StructLayout(LayoutKind.Sequential)]
13         public partial struct AudioBuffer : IEquatable<AudioBuffer> {
14
15                 private IntPtr _info;
16                 public Gst.Audio.AudioInfo Info {
17                         get {
18                                 return _info == IntPtr.Zero ? null : (Gst.Audio.AudioInfo) GLib.Opaque.GetOpaque (_info, typeof (Gst.Audio.AudioInfo), false);
19                         }
20                         set {
21                                 _info = value == null ? IntPtr.Zero : value.Handle;
22                         }
23                 }
24                 private UIntPtr n_samples;
25                 public ulong NSamples {
26                         get {
27                                 return (ulong) n_samples;
28                         }
29                         set {
30                                 n_samples = new UIntPtr (value);
31                         }
32                 }
33                 public int NPlanes;
34                 private IntPtr _planes;
35                 private IntPtr _buffer;
36                 public Gst.Buffer Buffer {
37                         get {
38                                 return _buffer == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (_buffer, typeof (Gst.Buffer), false);
39                         }
40                         set {
41                                 _buffer = value == null ? IntPtr.Zero : value.Handle;
42                         }
43                 }
44                 private IntPtr _map_infos;
45
46                 [MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
47                 private IntPtr[] _gstGstReserved;
48
49                 public static Gst.Audio.AudioBuffer Zero = new Gst.Audio.AudioBuffer ();
50
51                 public static Gst.Audio.AudioBuffer New(IntPtr raw) {
52                         if (raw == IntPtr.Zero)
53                                 return Gst.Audio.AudioBuffer.Zero;
54                         return (Gst.Audio.AudioBuffer) Marshal.PtrToStructure (raw, typeof (Gst.Audio.AudioBuffer));
55                 }
56
57                 [DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
58                 static extern bool gst_audio_buffer_map(IntPtr raw, IntPtr info, IntPtr gstbuffer, int flags);
59
60                 public bool Map(Gst.Audio.AudioInfo info, Gst.Buffer gstbuffer, Gst.MapFlags flags) {
61                         IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
62                         System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
63                         bool raw_ret = gst_audio_buffer_map(this_as_native, info == null ? IntPtr.Zero : info.Handle, gstbuffer == null ? IntPtr.Zero : gstbuffer.Handle, (int) flags);
64                         bool ret = raw_ret;
65                         ReadNative (this_as_native, ref this);
66                         System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
67                         return ret;
68                 }
69
70                 [DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
71                 static extern void gst_audio_buffer_unmap(IntPtr raw);
72
73                 public void Unmap() {
74                         IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
75                         System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
76                         gst_audio_buffer_unmap(this_as_native);
77                         ReadNative (this_as_native, ref this);
78                         System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
79                 }
80
81                 [DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
82                 static extern IntPtr gst_audio_buffer_clip(IntPtr buffer, IntPtr segment, int rate, int bpf);
83
84                 public static Gst.Buffer Clip(Gst.Buffer buffer, Gst.Segment segment, int rate, int bpf) {
85                         buffer.Owned = false;
86                         IntPtr native_segment = GLib.Marshaller.StructureToPtrAlloc (segment);
87                         IntPtr raw_ret = gst_audio_buffer_clip(buffer == null ? IntPtr.Zero : buffer.Handle, native_segment, rate, bpf);
88                         Gst.Buffer ret = raw_ret == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Buffer), true);
89                         Marshal.FreeHGlobal (native_segment);
90                         return ret;
91                 }
92
93                 [DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
94                 static extern bool gst_audio_buffer_reorder_channels(IntPtr buffer, int format, int channels, int[] from, int[] to);
95
96                 public static bool ReorderChannels(Gst.Buffer buffer, Gst.Audio.AudioFormat format, int channels, Gst.Audio.AudioChannelPosition[] from, Gst.Audio.AudioChannelPosition[] to) {
97                         int cnt_from = from == null ? 0 : from.Length;
98                         int[] native_from = new int [cnt_from];
99                         for (int i = 0; i < cnt_from; i++)
100                                 native_from [i] = (int) from[i];
101                         int cnt_to = to == null ? 0 : to.Length;
102                         int[] native_to = new int [cnt_to];
103                         for (int i = 0; i < cnt_to; i++)
104                                 native_to [i] = (int) to[i];
105                         bool raw_ret = gst_audio_buffer_reorder_channels(buffer == null ? IntPtr.Zero : buffer.Handle, (int) format, channels, native_from, native_to);
106                         bool ret = raw_ret;
107                         return ret;
108                 }
109
110                 [DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
111                 static extern IntPtr gst_audio_buffer_truncate(IntPtr buffer, int bpf, UIntPtr trim, UIntPtr samples);
112
113                 public static Gst.Buffer Truncate(Gst.Buffer buffer, int bpf, ulong trim, ulong samples) {
114                         buffer.Owned = false;
115                         IntPtr raw_ret = gst_audio_buffer_truncate(buffer == null ? IntPtr.Zero : buffer.Handle, bpf, new UIntPtr (trim), new UIntPtr (samples));
116                         Gst.Buffer ret = raw_ret == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Buffer), true);
117                         return ret;
118                 }
119
120                 static void ReadNative (IntPtr native, ref Gst.Audio.AudioBuffer target)
121                 {
122                         target = New (native);
123                 }
124
125                 public bool Equals (AudioBuffer other)
126                 {
127                         return true && Info.Equals (other.Info) && NSamples.Equals (other.NSamples) && NPlanes.Equals (other.NPlanes) && _planes.Equals (other._planes) && Buffer.Equals (other.Buffer) && _map_infos.Equals (other._map_infos);
128                 }
129
130                 public override bool Equals (object other)
131                 {
132                         return other is AudioBuffer && Equals ((AudioBuffer) other);
133                 }
134
135                 public override int GetHashCode ()
136                 {
137                         return this.GetType ().FullName.GetHashCode () ^ Info.GetHashCode () ^ NSamples.GetHashCode () ^ NPlanes.GetHashCode () ^ _planes.GetHashCode () ^ Buffer.GetHashCode () ^ _map_infos.GetHashCode ();
138                 }
139
140                 private static GLib.GType GType {
141                         get { return GLib.GType.Pointer; }
142                 }
143 #endregion
144         }
145 }