summaryrefslogtreecommitdiff
path: root/sources/generated/Gst/PresetAdapter.cs
blob: 40e2b020f1431e34ba1596a3ae936dca701ca8c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace Gst {

	using System;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public partial class PresetAdapter : GLib.GInterfaceAdapter, Gst.IPreset {

		[StructLayout (LayoutKind.Sequential)]
		struct GstPresetInterface {
			public GetPresetNamesNativeDelegate GetPresetNames;
			public GetPropertyNamesNativeDelegate GetPropertyNames;
			public LoadPresetNativeDelegate LoadPreset;
			public SavePresetNativeDelegate SavePreset;
			public RenamePresetNativeDelegate RenamePreset;
			public DeletePresetNativeDelegate DeletePreset;
			public SetMetaNativeDelegate SetMeta;
			public GetMetaNativeDelegate GetMeta;
			[MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
			private IntPtr[] _gstGstReserved;
		}

		static GstPresetInterface iface;

		static PresetAdapter ()
		{
			GLib.GType.Register (_gtype, typeof (PresetAdapter));
			iface.GetPresetNames = new GetPresetNamesNativeDelegate (GetPresetNames_cb);
			iface.GetPropertyNames = new GetPropertyNamesNativeDelegate (GetPropertyNames_cb);
			iface.LoadPreset = new LoadPresetNativeDelegate (LoadPreset_cb);
			iface.SavePreset = new SavePresetNativeDelegate (SavePreset_cb);
			iface.RenamePreset = new RenamePresetNativeDelegate (RenamePreset_cb);
			iface.DeletePreset = new DeletePresetNativeDelegate (DeletePreset_cb);
			iface.SetMeta = new SetMetaNativeDelegate (SetMeta_cb);
			iface.GetMeta = new GetMetaNativeDelegate (GetMeta_cb);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetPresetNamesNativeDelegate (IntPtr inst);

		static IntPtr GetPresetNames_cb (IntPtr inst)
		{
			try {
				IPresetImplementor __obj = GLib.Object.GetObject (inst, false) as IPresetImplementor;
				string[] __result;
				__result = __obj.PresetNames;
				return GLib.Marshaller.StringArrayToNullTermStrvPointer (__result);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetPropertyNamesNativeDelegate (IntPtr inst);

		static IntPtr GetPropertyNames_cb (IntPtr inst)
		{
			try {
				IPresetImplementor __obj = GLib.Object.GetObject (inst, false) as IPresetImplementor;
				string[] __result;
				__result = __obj.PropertyNames;
				return GLib.Marshaller.StringArrayToNullTermStrvPointer (__result);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool LoadPresetNativeDelegate (IntPtr inst, IntPtr name);

		static bool LoadPreset_cb (IntPtr inst, IntPtr name)
		{
			try {
				IPresetImplementor __obj = GLib.Object.GetObject (inst, false) as IPresetImplementor;
				bool __result;
				__result = __obj.LoadPreset (GLib.Marshaller.Utf8PtrToString (name));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool SavePresetNativeDelegate (IntPtr inst, IntPtr name);

		static bool SavePreset_cb (IntPtr inst, IntPtr name)
		{
			try {
				IPresetImplementor __obj = GLib.Object.GetObject (inst, false) as IPresetImplementor;
				bool __result;
				__result = __obj.SavePreset (GLib.Marshaller.Utf8PtrToString (name));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool RenamePresetNativeDelegate (IntPtr inst, IntPtr old_name, IntPtr new_name);

		static bool RenamePreset_cb (IntPtr inst, IntPtr old_name, IntPtr new_name)
		{
			try {
				IPresetImplementor __obj = GLib.Object.GetObject (inst, false) as IPresetImplementor;
				bool __result;
				__result = __obj.RenamePreset (GLib.Marshaller.Utf8PtrToString (old_name), GLib.Marshaller.Utf8PtrToString (new_name));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool DeletePresetNativeDelegate (IntPtr inst, IntPtr name);

		static bool DeletePreset_cb (IntPtr inst, IntPtr name)
		{
			try {
				IPresetImplementor __obj = GLib.Object.GetObject (inst, false) as IPresetImplementor;
				bool __result;
				__result = __obj.DeletePreset (GLib.Marshaller.Utf8PtrToString (name));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool SetMetaNativeDelegate (IntPtr inst, IntPtr name, IntPtr tag, IntPtr value);

		static bool SetMeta_cb (IntPtr inst, IntPtr name, IntPtr tag, IntPtr value)
		{
			try {
				IPresetImplementor __obj = GLib.Object.GetObject (inst, false) as IPresetImplementor;
				bool __result;
				__result = __obj.SetMeta (GLib.Marshaller.Utf8PtrToString (name), GLib.Marshaller.Utf8PtrToString (tag), GLib.Marshaller.Utf8PtrToString (value));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool GetMetaNativeDelegate (IntPtr inst, IntPtr name, IntPtr tag, out IntPtr value);

		static bool GetMeta_cb (IntPtr inst, IntPtr name, IntPtr tag, out IntPtr value)
		{
			try {
				IPresetImplementor __obj = GLib.Object.GetObject (inst, false) as IPresetImplementor;
				bool __result;
				string myvalue;
				__result = __obj.GetMeta (GLib.Marshaller.Utf8PtrToString (name), GLib.Marshaller.Utf8PtrToString (tag), out myvalue);
				value = GLib.Marshaller.StringToPtrGStrdup(myvalue);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		static int class_offset = 2 * IntPtr.Size;

		static void Initialize (IntPtr ptr, IntPtr data)
		{
			IntPtr ifaceptr = new IntPtr (ptr.ToInt64 () + class_offset);
			GstPresetInterface native_iface = (GstPresetInterface) Marshal.PtrToStructure (ifaceptr, typeof (GstPresetInterface));
			native_iface.GetPresetNames = iface.GetPresetNames;
			native_iface.GetPropertyNames = iface.GetPropertyNames;
			native_iface.LoadPreset = iface.LoadPreset;
			native_iface.SavePreset = iface.SavePreset;
			native_iface.RenamePreset = iface.RenamePreset;
			native_iface.DeletePreset = iface.DeletePreset;
			native_iface.SetMeta = iface.SetMeta;
			native_iface.GetMeta = iface.GetMeta;
			Marshal.StructureToPtr (native_iface, ifaceptr, false);
		}

		GLib.Object implementor;

		public PresetAdapter ()
		{
			InitHandler = new GLib.GInterfaceInitHandler (Initialize);
		}

		public PresetAdapter (IPresetImplementor implementor)
		{
			if (implementor == null)
				throw new ArgumentNullException ("implementor");
			else if (!(implementor is GLib.Object))
				throw new ArgumentException ("implementor must be a subclass of GLib.Object");
			this.implementor = implementor as GLib.Object;
		}

		public PresetAdapter (IntPtr handle)
		{
			if (!_gtype.IsInstance (handle))
				throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle");
			implementor = GLib.Object.GetObject (handle);
		}

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

		private static GLib.GType _gtype = new GLib.GType (gst_preset_get_type ());

		public static GLib.GType GType {
			get {
				return _gtype;
			}
		}

		public override GLib.GType GInterfaceGType {
			get {
				return _gtype;
			}
		}

		public override IntPtr Handle {
			get {
				return implementor.Handle;
			}
		}

		public IntPtr OwnedHandle {
			get {
				return implementor.OwnedHandle;
			}
		}

		public static IPreset GetObject (IntPtr handle, bool owned)
		{
			GLib.Object obj = GLib.Object.GetObject (handle, owned);
			return GetObject (obj);
		}

		public static IPreset GetObject (GLib.Object obj)
		{
			if (obj == null)
				return null;
			else if (obj is IPresetImplementor)
				return new PresetAdapter (obj as IPresetImplementor);
			else if (obj as IPreset == null)
				return new PresetAdapter (obj.Handle);
			else
				return obj as IPreset;
		}

		public IPresetImplementor Implementor {
			get {
				return implementor as IPresetImplementor;
			}
		}

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

		public static string AppDir { 
			get {
				IntPtr raw_ret = gst_preset_get_app_dir();
				string ret = GLib.Marshaller.FilenamePtrToString (raw_ret);
				return ret;
			}
		}

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

		public static bool SetAppDir(string app_dir) {
			IntPtr native_app_dir = GLib.Marshaller.StringToFilenamePtr (app_dir);
			bool raw_ret = gst_preset_set_app_dir(native_app_dir);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_app_dir);
			return ret;
		}

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

		public bool DeletePreset(string name) {
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			bool raw_ret = gst_preset_delete_preset(Handle, native_name);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_name);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_preset_get_meta(IntPtr raw, IntPtr name, IntPtr tag, out IntPtr value);

		public bool GetMeta(string name, string tag, out string value) {
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			IntPtr native_tag = GLib.Marshaller.StringToPtrGStrdup (tag);
			IntPtr native_value;
			bool raw_ret = gst_preset_get_meta(Handle, native_name, native_tag, out native_value);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_name);
			GLib.Marshaller.Free (native_tag);
			value = GLib.Marshaller.PtrToStringGFree(native_value);
			return ret;
		}

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

		public string[] PresetNames { 
			get {
				IntPtr raw_ret = gst_preset_get_preset_names(Handle);
				string[] ret = GLib.Marshaller.NullTermPtrToStringArray (raw_ret, true);
				return ret;
			}
		}

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

		public string[] PropertyNames { 
			get {
				IntPtr raw_ret = gst_preset_get_property_names(Handle);
				string[] ret = GLib.Marshaller.NullTermPtrToStringArray (raw_ret, true);
				return ret;
			}
		}

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

		public bool IsEditable { 
			get {
				bool raw_ret = gst_preset_is_editable(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

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

		public bool LoadPreset(string name) {
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			bool raw_ret = gst_preset_load_preset(Handle, native_name);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_name);
			return ret;
		}

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

		public bool RenamePreset(string old_name, string new_name) {
			IntPtr native_old_name = GLib.Marshaller.StringToPtrGStrdup (old_name);
			IntPtr native_new_name = GLib.Marshaller.StringToPtrGStrdup (new_name);
			bool raw_ret = gst_preset_rename_preset(Handle, native_old_name, native_new_name);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_old_name);
			GLib.Marshaller.Free (native_new_name);
			return ret;
		}

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

		public bool SavePreset(string name) {
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			bool raw_ret = gst_preset_save_preset(Handle, native_name);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_name);
			return ret;
		}

		[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_preset_set_meta(IntPtr raw, IntPtr name, IntPtr tag, IntPtr value);

		public bool SetMeta(string name, string tag, string value) {
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			IntPtr native_tag = GLib.Marshaller.StringToPtrGStrdup (tag);
			IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
			bool raw_ret = gst_preset_set_meta(Handle, native_name, native_tag, native_value);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_name);
			GLib.Marshaller.Free (native_tag);
			GLib.Marshaller.Free (native_value);
			return ret;
		}

		public bool SetMeta(string name, string tag) {
			return SetMeta (name, tag, null);
		}

#endregion
	}
}