Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/983>
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301 USA
-namespace Gst.Base {
+namespace Gst.Base {
using System;
using System.Runtime.InteropServices;
- public partial class Adapter
- {
+ public partial class Adapter {
[DllImport("gstbase-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_adapter_copy(IntPtr raw, out IntPtr dest, int offset, int size);
public byte[] Copy(int offset, int size) {
- IntPtr mem = Marshal.AllocHGlobal (size);
+ IntPtr mem = Marshal.AllocHGlobal(size);
gst_adapter_copy(Handle, out mem, offset, size);
byte[] bytes = new byte[size];
- Marshal.Copy (mem, bytes, 0, size);
+ Marshal.Copy(mem, bytes, 0, size);
return bytes;
}
public byte[] Map() {
int size;
- IntPtr mem = gst_adapter_map (Handle, out size);
+ IntPtr mem = gst_adapter_map(Handle, out size);
byte[] ret = new byte[size];
- Marshal.Copy (mem, ret , 0, size);
+ Marshal.Copy(mem, ret, 0, size);
return ret;
}
}
-}
+}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
- partial class AppSink
- {
- public AppSink (String name) : base(IntPtr.Zero) {
+ partial class AppSink {
+ public AppSink(String name) : base(IntPtr.Zero) {
Raw = ElementFactory.MakeRaw("appsink", name);
}
}
-}
+}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
- partial class AppSrc
- {
- public AppSrc (String name) : base(IntPtr.Zero) {
- Raw = ElementFactory.MakeRaw ("appsrc", name);
+ partial class AppSrc {
+ public AppSrc(String name) : base(IntPtr.Zero) {
+ Raw = ElementFactory.MakeRaw("appsrc", name);
}
}
-}
+}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
- partial class Application
- {
+ partial class Application {
// Because of: https://bugzilla.gnome.org/show_bug.cgi?id=743062#c30
private static uint MIN_GSTREAMER_MINOR = 14;
- static Application () {
- GLib.GType.Register (List.GType, typeof(List));
- GLib.GType.Register (Fraction.GType, typeof(Fraction));
- GLib.GType.Register (DoubleRange.GType, typeof(DoubleRange));
- GLib.GType.Register (IntRange.GType, typeof(IntRange));
- GLib.GType.Register (FractionRange.GType, typeof(FractionRange));
- GLib.GType.Register (DateTime.GType, typeof(DateTime));
- GLib.GType.Register (Gst.Array.GType, typeof(Gst.Array));
+ static Application() {
+ GLib.GType.Register(List.GType, typeof(List));
+ GLib.GType.Register(Fraction.GType, typeof(Fraction));
+ GLib.GType.Register(DoubleRange.GType, typeof(DoubleRange));
+ GLib.GType.Register(IntRange.GType, typeof(IntRange));
+ GLib.GType.Register(FractionRange.GType, typeof(FractionRange));
+ GLib.GType.Register(DateTime.GType, typeof(DateTime));
+ GLib.GType.Register(Gst.Array.GType, typeof(Gst.Array));
GLib.GType.Register(Promise.GType, typeof(Promise));
GLib.GType.Register(Gst.WebRTC.WebRTCSessionDescription.GType, typeof(Gst.WebRTC.WebRTCSessionDescription));
}
}
public static void Init() {
- gst_init (IntPtr.Zero, IntPtr.Zero);
+ gst_init(IntPtr.Zero, IntPtr.Zero);
CheckVersion();
}
-
+
public static void Init(ref string[] argv) {
int cnt_argv = argv == null ? 0 : argv.Length;
System.Collections.Generic.List<IntPtr> native_arg_list = new System.Collections.Generic.List<IntPtr>();
for (int i = 0; i < cnt_argv; i++)
- native_arg_list.Add (GLib.Marshaller.StringToPtrGStrdup(argv[i]));
+ native_arg_list.Add(GLib.Marshaller.StringToPtrGStrdup(argv[i]));
IntPtr[] native_argv = native_arg_list.ToArray();
gst_init(ref cnt_argv, ref native_argv);
foreach (var native_arg in native_arg_list)
- GLib.Marshaller.Free (native_arg);
+ GLib.Marshaller.Free(native_arg);
CheckVersion();
}
public static bool InitCheck() {
IntPtr error = IntPtr.Zero;
- bool ret = gst_init_check (IntPtr.Zero, IntPtr.Zero, out error);
+ bool ret = gst_init_check(IntPtr.Zero, IntPtr.Zero, out error);
CheckVersion();
- if (error != IntPtr.Zero) throw new GLib.GException (error);
+ if (error != IntPtr.Zero) throw new GLib.GException(error);
return ret;
}
int cnt_argv = argv == null ? 0 : argv.Length;
System.Collections.Generic.List<IntPtr> native_arg_list = new System.Collections.Generic.List<IntPtr>();
for (int i = 0; i < cnt_argv; i++)
- native_arg_list.Add (GLib.Marshaller.StringToPtrGStrdup(argv[i]));
+ native_arg_list.Add(GLib.Marshaller.StringToPtrGStrdup(argv[i]));
IntPtr[] native_argv = native_arg_list.ToArray();
IntPtr error = IntPtr.Zero;
bool ret = gst_init_check(ref cnt_argv, ref native_argv, out error);
foreach (var native_arg in native_arg_list)
- GLib.Marshaller.Free (native_arg);
- if (error != IntPtr.Zero) throw new GLib.GException (error);
+ GLib.Marshaller.Free(native_arg);
+ if (error != IntPtr.Zero) throw new GLib.GException(error);
CheckVersion();
return ret;
}
}
-}
+}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
- partial class AudioFilter
- {
+ partial class AudioFilter {
[DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_audio_filter_class_add_pad_templates(IntPtr klass, IntPtr allowed_caps);
public void AddPadTemplates(Gst.Caps allowed_caps) {
- gst_audio_filter_class_add_pad_templates(LookupGType().GetClassPtr (), allowed_caps == null ? IntPtr.Zero : allowed_caps.Handle);
+ gst_audio_filter_class_add_pad_templates(LookupGType().GetClassPtr(), allowed_caps == null ? IntPtr.Zero : allowed_caps.Handle);
}
}
-}
+}
\ No newline at end of file
using System.Runtime.InteropServices;
partial class Bin {
- public Bin () : this (null) {}
+ public Bin() : this(null) { }
- public void Add (params Element [] elements) {
+ public void Add(params Element[] elements) {
foreach (var elem in elements) {
- Add (elem);
+ Add(elem);
}
}
- public void Remove (params Element [] elements) {
+ public void Remove(params Element[] elements) {
foreach (var elem in elements) {
- Remove (elem);
+ Remove(elem);
}
}
}
-}
+}
\ No newline at end of file
static extern UIntPtr gst_buffer_extract(IntPtr raw, UIntPtr offset, byte[] dest, UIntPtr size);
public ulong Extract(ulong offset, ref byte[] dest) {
- UIntPtr raw_ret = gst_buffer_extract(Handle, new UIntPtr (offset), dest, new UIntPtr ((ulong)dest.Length));
- ulong ret = (ulong) raw_ret;
+ UIntPtr raw_ret = gst_buffer_extract(Handle, new UIntPtr(offset), dest, new UIntPtr((ulong)dest.Length));
+ ulong ret = (ulong)raw_ret;
return ret;
}
public ulong ExtractDup(ulong offset, ulong size, out byte[] dest) {
UIntPtr native_dest_size;
IntPtr ptr;
- gst_buffer_extract_dup(Handle, new UIntPtr (offset), new UIntPtr (size), out ptr, out native_dest_size);
+ gst_buffer_extract_dup(Handle, new UIntPtr(offset), new UIntPtr(size), out ptr, out native_dest_size);
byte[] bytes = new byte[(ulong)native_dest_size];
- Marshal.Copy (ptr, bytes, 0, (int)native_dest_size);
+ Marshal.Copy(ptr, bytes, 0, (int)native_dest_size);
dest = bytes;
- GLib.Marshaller.Free (ptr);
+ GLib.Marshaller.Free(ptr);
- return (ulong) native_dest_size;
+ return (ulong)native_dest_size;
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gst_buffer_new_wrapped(IntPtr data, UIntPtr n_length);
- public Buffer (byte[] data)
- {
- IntPtr ptr = GLib.Marshaller.Malloc((ulong) data.Length);
+ public Buffer(byte[] data) {
+ IntPtr ptr = GLib.Marshaller.Malloc((ulong)data.Length);
Marshal.Copy(data, 0, ptr, data.Length);
- Raw = gst_buffer_new_wrapped(ptr, new UIntPtr((ulong) data.Length));
+ Raw = gst_buffer_new_wrapped(ptr, new UIntPtr((ulong)data.Length));
}
}
-}
+}
\ No newline at end of file
using System;
-namespace Gst
-{
- partial class Bus
- {
- public uint AddWatch (Gst.BusFunc func) {
+namespace Gst {
+ partial class Bus {
+ public uint AddWatch(Gst.BusFunc func) {
// https://developer.gnome.org/glib/unstable/glib-The-Main-Event-Loop.html#G-PRIORITY-DEFAULT:CAPS
int G_PRIORITY_DEFAULT = 0;
- return AddWatchFull (G_PRIORITY_DEFAULT, func);
+ return AddWatchFull(G_PRIORITY_DEFAULT, func);
}
}
-}
-
+}
\ No newline at end of file
using System.Collections;
using System.Runtime.InteropServices;
- partial class Caps : IEnumerable
- {
- public Structure this [uint index] {
+ partial class Caps : IEnumerable {
+ public Structure this[uint index] {
get {
if (index >= Size)
- throw new ArgumentOutOfRangeException ();
+ throw new ArgumentOutOfRangeException();
- Structure structure = GetStructure ((uint) index);
+ Structure structure = GetStructure((uint)index);
return structure;
}
}
Gst.Caps caps;
long index;
- public StructureEnumerator (Gst.Caps caps) {
+ public StructureEnumerator(Gst.Caps caps) {
this.caps = caps;
index = -1;
}
public object Current {
get {
if (index >= caps.Size)
- throw new ArgumentOutOfRangeException ();
+ throw new ArgumentOutOfRangeException();
if (index == -1)
- throw new ArgumentException ();
+ throw new ArgumentException();
- return caps[ (uint) index];
+ return caps[(uint)index];
}
}
- public bool MoveNext () {
+ public bool MoveNext() {
index += 1;
return (index < caps.Size);
}
- public void Reset () {
+ public void Reset() {
index = -1;
}
}
public IEnumerator GetEnumerator() {
- return new StructureEnumerator (this);
+ return new StructureEnumerator(this);
}
}
}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
- partial class DeviceProvider
- {
+ partial class DeviceProvider {
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_device_provider_class_add_metadata(IntPtr klass, IntPtr key, IntPtr value);
public void AddMetadata(string key, string value) {
- IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key);
- IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
- gst_device_provider_class_add_metadata(LookupGType().GetClassPtr (), native_key, native_value);
- GLib.Marshaller.Free (native_key);
- GLib.Marshaller.Free (native_value);
+ IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup(key);
+ IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup(value);
+ gst_device_provider_class_add_metadata(LookupGType().GetClassPtr(), native_key, native_value);
+ GLib.Marshaller.Free(native_key);
+ GLib.Marshaller.Free(native_value);
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_device_provider_class_add_static_metadata(IntPtr klass, IntPtr key, IntPtr value);
public void AddStaticMetadata(string key, string value) {
- IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key);
- IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
- gst_device_provider_class_add_static_metadata(LookupGType().GetClassPtr (), native_key, native_value);
+ IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup(key);
+ IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup(value);
+ gst_device_provider_class_add_static_metadata(LookupGType().GetClassPtr(), native_key, native_value);
- GLib.Marshaller.Free (native_key);
- GLib.Marshaller.Free (native_value);
+ GLib.Marshaller.Free(native_key);
+ GLib.Marshaller.Free(native_value);
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_device_provider_class_set_metadata(IntPtr klass, IntPtr longname, IntPtr classification, IntPtr description, IntPtr author);
public void SetMetadata(string longname, string classification, string description, string author) {
- IntPtr native_longname = GLib.Marshaller.StringToPtrGStrdup (longname);
- IntPtr native_classification = GLib.Marshaller.StringToPtrGStrdup (classification);
- IntPtr native_description = GLib.Marshaller.StringToPtrGStrdup (description);
- IntPtr native_author = GLib.Marshaller.StringToPtrGStrdup (author);
- gst_device_provider_class_set_metadata(LookupGType().GetClassPtr (), native_longname, native_classification, native_description, native_author);
- GLib.Marshaller.Free (native_longname);
- GLib.Marshaller.Free (native_classification);
- GLib.Marshaller.Free (native_description);
- GLib.Marshaller.Free (native_author);
+ IntPtr native_longname = GLib.Marshaller.StringToPtrGStrdup(longname);
+ IntPtr native_classification = GLib.Marshaller.StringToPtrGStrdup(classification);
+ IntPtr native_description = GLib.Marshaller.StringToPtrGStrdup(description);
+ IntPtr native_author = GLib.Marshaller.StringToPtrGStrdup(author);
+ gst_device_provider_class_set_metadata(LookupGType().GetClassPtr(), native_longname, native_classification, native_description, native_author);
+ GLib.Marshaller.Free(native_longname);
+ GLib.Marshaller.Free(native_classification);
+ GLib.Marshaller.Free(native_description);
+ GLib.Marshaller.Free(native_author);
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_device_provider_class_set_static_metadata(IntPtr klass, IntPtr longname, IntPtr classification, IntPtr description, IntPtr author);
public void SetStaticMetadata(string longname, string classification, string description, string author) {
- IntPtr native_longname = GLib.Marshaller.StringToPtrGStrdup (longname);
- IntPtr native_classification = GLib.Marshaller.StringToPtrGStrdup (classification);
- IntPtr native_description = GLib.Marshaller.StringToPtrGStrdup (description);
- IntPtr native_author = GLib.Marshaller.StringToPtrGStrdup (author);
+ IntPtr native_longname = GLib.Marshaller.StringToPtrGStrdup(longname);
+ IntPtr native_classification = GLib.Marshaller.StringToPtrGStrdup(classification);
+ IntPtr native_description = GLib.Marshaller.StringToPtrGStrdup(description);
+ IntPtr native_author = GLib.Marshaller.StringToPtrGStrdup(author);
- gst_device_provider_class_set_static_metadata(LookupGType().GetClassPtr (), native_longname, native_classification, native_description, native_author);
+ gst_device_provider_class_set_static_metadata(LookupGType().GetClassPtr(), native_longname, native_classification, native_description, native_author);
- GLib.Marshaller.Free (native_longname);
- GLib.Marshaller.Free (native_classification);
- GLib.Marshaller.Free (native_description);
- GLib.Marshaller.Free (native_author);
+ GLib.Marshaller.Free(native_longname);
+ GLib.Marshaller.Free(native_classification);
+ GLib.Marshaller.Free(native_description);
+ GLib.Marshaller.Free(native_author);
}
}
-}
+}
\ No newline at end of file
using GLib;
using System;
+using System.Collections;
using System.Reflection;
using System.Runtime.InteropServices;
-using System.Collections;
-namespace Gst
-{
+namespace Gst {
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- delegate void GClosureMarshal (IntPtr closure, ref GLib.Value retval, uint argc, IntPtr argsPtr,
- IntPtr invocation_hint, IntPtr data);
+ delegate void GClosureMarshal(IntPtr closure, ref GLib.Value retval, uint argc, IntPtr argsPtr,
+ IntPtr invocation_hint, IntPtr data);
- public delegate void SignalHandler (object o, SignalArgs args);
+ public delegate void SignalHandler(object o, SignalArgs args);
- public static class DynamicSignal
- {
+ public static class DynamicSignal {
- private static readonly int gvalue_struct_size = Marshal.SizeOf (typeof(GLib.Value));
+ private static readonly int gvalue_struct_size = Marshal.SizeOf(typeof(GLib.Value));
- class ObjectSignalKey
- {
+ class ObjectSignalKey {
object o;
string signal_name;
- public ObjectSignalKey (object o, string name)
- {
+ public ObjectSignalKey(object o, string name) {
this.o = o;
signal_name = name;
}
- public override bool Equals (object o)
- {
+ public override bool Equals(object o) {
if (o is ObjectSignalKey) {
ObjectSignalKey k = (ObjectSignalKey)o;
- return k.o.Equals (this.o) && signal_name.Equals (k.signal_name);
+ return k.o.Equals(this.o) && signal_name.Equals(k.signal_name);
}
- return base.Equals (o);
+ return base.Equals(o);
}
- public override int GetHashCode ()
- {
- return o.GetHashCode () ^ signal_name.GetHashCode ();
+ public override int GetHashCode() {
+ return o.GetHashCode() ^ signal_name.GetHashCode();
}
}
- class SignalInfo : IDisposable
- {
+ class SignalInfo : IDisposable {
uint handlerId;
IntPtr closure;
Delegate registeredHandler;
}
}
- public SignalInfo (uint handlerId, IntPtr closure, Delegate registeredHandler, GCHandle gch)
- {
+ public SignalInfo(uint handlerId, IntPtr closure, Delegate registeredHandler, GCHandle gch) {
this.handlerId = handlerId;
this.closure = closure;
this.registeredHandler = registeredHandler;
this.gch = gch;
- if (!IsValidDelegate (registeredHandler))
- throw new Exception ("Invalid delegate");
+ if (!IsValidDelegate(registeredHandler))
+ throw new Exception("Invalid delegate");
MethodInfo mi = registeredHandler.Method;
- ParameterInfo[] parms = mi.GetParameters ();
- this.argsType = parms [1].ParameterType;
+ ParameterInfo[] parms = mi.GetParameters();
+ this.argsType = parms[1].ParameterType;
}
- public void UpdateArgsType (Delegate d)
- {
- if (!IsCompatibleDelegate (d))
- throw new Exception ("Incompatible delegate");
+ public void UpdateArgsType(Delegate d) {
+ if (!IsCompatibleDelegate(d))
+ throw new Exception("Incompatible delegate");
MethodInfo mi = d.Method;
- ParameterInfo[] parms = mi.GetParameters ();
+ ParameterInfo[] parms = mi.GetParameters();
- Type t1 = parms [1].ParameterType;
+ Type t1 = parms[1].ParameterType;
Type t2 = argsType;
if (t1 == t2)
return;
- if (t1.IsSubclassOf (t2))
+ if (t1.IsSubclassOf(t2))
argsType = t1;
- else if (t2.IsSubclassOf (t1))
+ else if (t2.IsSubclassOf(t1))
argsType = t2;
else
- throw new Exception ("Incompatible delegate");
+ throw new Exception("Incompatible delegate");
}
- public bool IsCompatibleDelegate (Delegate d)
- {
- if (!IsValidDelegate (d))
+ public bool IsCompatibleDelegate(Delegate d) {
+ if (!IsValidDelegate(d))
return false;
MethodInfo mi = d.Method;
- ParameterInfo[] parms = mi.GetParameters ();
+ ParameterInfo[] parms = mi.GetParameters();
- if (parms [1].ParameterType != this.argsType &&
- !parms [1].ParameterType.IsSubclassOf (this.argsType) &&
- !this.argsType.IsSubclassOf (parms [1].ParameterType))
+ if (parms[1].ParameterType != this.argsType &&
+ !parms[1].ParameterType.IsSubclassOf(this.argsType) &&
+ !this.argsType.IsSubclassOf(parms[1].ParameterType))
return false;
return true;
}
- public void Dispose ()
- {
+ public void Dispose() {
registeredHandler = null;
- gch.Free ();
- GC.SuppressFinalize (this);
+ gch.Free();
+ GC.SuppressFinalize(this);
}
- public static bool IsValidDelegate (Delegate d)
- {
+ public static bool IsValidDelegate(Delegate d) {
MethodInfo mi = d.Method;
if (mi.ReturnType != typeof(void))
return false;
- ParameterInfo[] parms = mi.GetParameters ();
+ ParameterInfo[] parms = mi.GetParameters();
if (parms.Length != 2)
return false;
- if (parms [1].ParameterType != typeof(GLib.SignalArgs) &&
- !parms [1].ParameterType.IsSubclassOf (typeof(GLib.SignalArgs)))
+ if (parms[1].ParameterType != typeof(GLib.SignalArgs) &&
+ !parms[1].ParameterType.IsSubclassOf(typeof(GLib.SignalArgs)))
return false;
return true;
}
}
- static Hashtable SignalHandlers = new Hashtable ();
+ static Hashtable SignalHandlers = new Hashtable();
- static GClosureMarshal marshalHandler = new GClosureMarshal (OnMarshal);
+ static GClosureMarshal marshalHandler = new GClosureMarshal(OnMarshal);
- public static void Connect (GLib.Object o, string name, SignalHandler handler)
- {
- Connect (o, name, false, (Delegate)handler);
+ public static void Connect(GLib.Object o, string name, SignalHandler handler) {
+ Connect(o, name, false, (Delegate)handler);
}
- public static void Connect (GLib.Object o, string name,
- bool after, SignalHandler handler)
- {
- Connect (o, name, after, (Delegate)handler);
+ public static void Connect(GLib.Object o, string name,
+ bool after, SignalHandler handler) {
+ Connect(o, name, after, (Delegate)handler);
}
- public static void Connect (GLib.Object o, string name, Delegate handler)
- {
- Connect (o, name, false, handler);
+ public static void Connect(GLib.Object o, string name, Delegate handler) {
+ Connect(o, name, false, handler);
}
- public static void Connect (GLib.Object o, string name,
- bool after, Delegate handler)
- {
+ public static void Connect(GLib.Object o, string name,
+ bool after, Delegate handler) {
Delegate newHandler;
- ObjectSignalKey k = new ObjectSignalKey (o, name);
+ ObjectSignalKey k = new ObjectSignalKey(o, name);
- if (!SignalInfo.IsValidDelegate (handler))
- throw new Exception ("Invalid delegate");
+ if (!SignalInfo.IsValidDelegate(handler))
+ throw new Exception("Invalid delegate");
- if (SignalHandlers [k] != null) {
- SignalInfo si = (SignalInfo)SignalHandlers [k];
- if (!si.IsCompatibleDelegate (handler))
- throw new Exception ("Incompatible delegate");
+ if (SignalHandlers[k] != null) {
+ SignalInfo si = (SignalInfo)SignalHandlers[k];
+ if (!si.IsCompatibleDelegate(handler))
+ throw new Exception("Incompatible delegate");
- newHandler = Delegate.Combine (si.RegisteredHandler, handler);
- si.UpdateArgsType (handler);
+ newHandler = Delegate.Combine(si.RegisteredHandler, handler);
+ si.UpdateArgsType(handler);
si.RegisteredHandler = newHandler;
- } else {
- if (!SignalInfo.IsValidDelegate (handler))
- throw new Exception ("Invalid delegate");
+ }
+ else {
+ if (!SignalInfo.IsValidDelegate(handler))
+ throw new Exception("Invalid delegate");
// Let's allocate 64bytes for the GClosure, it should be more than necessary.
- IntPtr closure = g_closure_new_simple (64, IntPtr.Zero);
- GCHandle gch = GCHandle.Alloc (k);
- g_closure_set_meta_marshal (closure, (IntPtr)gch, marshalHandler);
- uint signalId = g_signal_connect_closure (o.Handle, name, closure, after);
- SignalHandlers.Add (k, new SignalInfo (signalId, closure, handler, gch));
+ IntPtr closure = g_closure_new_simple(64, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc(k);
+ g_closure_set_meta_marshal(closure, (IntPtr)gch, marshalHandler);
+ uint signalId = g_signal_connect_closure(o.Handle, name, closure, after);
+ SignalHandlers.Add(k, new SignalInfo(signalId, closure, handler, gch));
}
}
- public static void Disconnect (GLib.Object o, string name, Delegate handler)
- {
- ObjectSignalKey k = new ObjectSignalKey (o, name);
- if (SignalHandlers [k] != null) {
- SignalInfo si = (SignalInfo)SignalHandlers [k];
- Delegate newHandler = Delegate.Remove (si.RegisteredHandler, handler);
+ public static void Disconnect(GLib.Object o, string name, Delegate handler) {
+ ObjectSignalKey k = new ObjectSignalKey(o, name);
+ if (SignalHandlers[k] != null) {
+ SignalInfo si = (SignalInfo)SignalHandlers[k];
+ Delegate newHandler = Delegate.Remove(si.RegisteredHandler, handler);
if (newHandler == null || handler == null) {
- g_signal_handler_disconnect (o.Handle, si.HandlerId);
- SignalHandlers.Remove (k);
- si.Dispose ();
- } else {
+ g_signal_handler_disconnect(o.Handle, si.HandlerId);
+ SignalHandlers.Remove(k);
+ si.Dispose();
+ }
+ else {
si.RegisteredHandler = newHandler;
}
}
}
- static void OnMarshal (IntPtr closure, ref GLib.Value retval, uint argc, IntPtr argsPtr,
- IntPtr ihint, IntPtr data)
- {
+ static void OnMarshal(IntPtr closure, ref GLib.Value retval, uint argc, IntPtr argsPtr,
+ IntPtr ihint, IntPtr data) {
object[] args = new object[argc - 1];
- object o = ((GLib.Value)Marshal.PtrToStructure (argsPtr, typeof(GLib.Value))).Val;
+ object o = ((GLib.Value)Marshal.PtrToStructure(argsPtr, typeof(GLib.Value))).Val;
for (int i = 1; i < argc; i++) {
IntPtr struct_ptr = (IntPtr)((long)argsPtr + (i * gvalue_struct_size));
- GLib.Value argument = (GLib.Value)Marshal.PtrToStructure (struct_ptr, typeof(GLib.Value));
- args [i - 1] = argument.Val;
+ GLib.Value argument = (GLib.Value)Marshal.PtrToStructure(struct_ptr, typeof(GLib.Value));
+ args[i - 1] = argument.Val;
}
if (data == IntPtr.Zero) {
- Console.Error.WriteLine ("No available data");
+ Console.Error.WriteLine("No available data");
return;
}
ObjectSignalKey k = (ObjectSignalKey)((GCHandle)data).Target;
if (k != null) {
- SignalInfo si = (SignalInfo)SignalHandlers [k];
- GLib.SignalArgs arg = (GLib.SignalArgs)Activator.CreateInstance (si.ArgsType);
+ SignalInfo si = (SignalInfo)SignalHandlers[k];
+ GLib.SignalArgs arg = (GLib.SignalArgs)Activator.CreateInstance(si.ArgsType);
arg.Args = args;
- si.RegisteredHandler.DynamicInvoke (new object[] { o, arg });
+ si.RegisteredHandler.DynamicInvoke(new object[] { o, arg });
if (arg.RetVal != null) {
retval.Val = arg.RetVal;
}
}
- [DllImport ("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern IntPtr g_closure_new_simple (int size, IntPtr data);
+ [DllImport("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern IntPtr g_closure_new_simple(int size, IntPtr data);
- [DllImport ("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern uint g_signal_connect_closure (IntPtr instance,
- string name, IntPtr closure, bool after);
+ [DllImport("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern uint g_signal_connect_closure(IntPtr instance,
+ string name, IntPtr closure, bool after);
- [DllImport ("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void g_closure_set_meta_marshal (IntPtr closure, IntPtr data, GClosureMarshal marshal);
+ [DllImport("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern void g_closure_set_meta_marshal(IntPtr closure, IntPtr data, GClosureMarshal marshal);
- class GTypeSignalKey
- {
+ class GTypeSignalKey {
GType type;
string signal_name;
- public GTypeSignalKey (GType type, string name)
- {
+ public GTypeSignalKey(GType type, string name) {
this.type = type;
signal_name = name;
}
- public override bool Equals (object o)
- {
+ public override bool Equals(object o) {
if (o is GTypeSignalKey) {
GTypeSignalKey k = (GTypeSignalKey)o;
- return k.type.Equals (this.type) && signal_name.Equals (k.signal_name);
+ return k.type.Equals(this.type) && signal_name.Equals(k.signal_name);
}
- return base.Equals (o);
+ return base.Equals(o);
}
- public override int GetHashCode ()
- {
- return type.GetHashCode () ^ signal_name.GetHashCode ();
+ public override int GetHashCode() {
+ return type.GetHashCode() ^ signal_name.GetHashCode();
}
}
- struct SignalQuery
- {
+ struct SignalQuery {
public uint signal_id;
public string signal_name;
public GType itype;
public Type[] param_types;
}
- static Hashtable SignalEmitInfo = new Hashtable ();
+ static Hashtable SignalEmitInfo = new Hashtable();
- public static object Emit (GLib.Object o, string name, params object[] parameters)
- {
+ public static object Emit(GLib.Object o, string name, params object[] parameters) {
SignalQuery query;
GType gtype = o.NativeType;
IntPtr type = gtype.Val;
uint signal_detail_quark = 0;
int colon;
- colon = name.LastIndexOf ("::");
+ colon = name.LastIndexOf("::");
if (colon == -1) {
signal_name = name;
signal_detail = String.Empty;
- } else {
- signal_name = name.Substring (0, colon);
- signal_detail = name.Substring (colon + 2);
+ }
+ else {
+ signal_name = name.Substring(0, colon);
+ signal_detail = name.Substring(colon + 2);
}
- GTypeSignalKey key = new GTypeSignalKey (gtype, signal_name);
+ GTypeSignalKey key = new GTypeSignalKey(gtype, signal_name);
- if (SignalEmitInfo [key] == null) {
- IntPtr native_string = GLib.Marshaller.StringToPtrGStrdup (signal_name);
- uint signal_id = g_signal_lookup (native_string, type);
- GLib.Marshaller.Free (native_string);
+ if (SignalEmitInfo[key] == null) {
+ IntPtr native_string = GLib.Marshaller.StringToPtrGStrdup(signal_name);
+ uint signal_id = g_signal_lookup(native_string, type);
+ GLib.Marshaller.Free(native_string);
if (signal_id == 0)
- throw new NotSupportedException (String.Format ("{0} has no signal of name {1}", o, name));
- GSignalQuery q = new GSignalQuery ();
- g_signal_query (signal_id, ref q);
+ throw new NotSupportedException(String.Format("{0} has no signal of name {1}", o, name));
+ GSignalQuery q = new GSignalQuery();
+ g_signal_query(signal_id, ref q);
if (q.signal_id == 0)
- throw new NotSupportedException (String.Format ("{0} couldn't be queried for signal with name {1}", o, name));
+ throw new NotSupportedException(String.Format("{0} couldn't be queried for signal with name {1}", o, name));
- query = new SignalQuery ();
+ query = new SignalQuery();
query.signal_id = signal_id;
- query.signal_name = GLib.Marshaller.Utf8PtrToString (q.signal_name);
- query.itype = new GType (q.itype);
+ query.signal_name = GLib.Marshaller.Utf8PtrToString(q.signal_name);
+ query.itype = new GType(q.itype);
query.signal_flags = q.signal_flags;
- query.return_type = new GType (q.return_type);
+ query.return_type = new GType(q.return_type);
query.n_params = q.n_params;
query.param_types = new Type[q.n_params];
for (int i = 0; i < query.n_params; i++) {
- IntPtr t = Marshal.ReadIntPtr (q.param_types, i * IntPtr.Size);
- GType g = new GType (t);
+ IntPtr t = Marshal.ReadIntPtr(q.param_types, i * IntPtr.Size);
+ GType g = new GType(t);
- query.param_types [i] = (Type)g;
+ query.param_types[i] = (Type)g;
}
- SignalEmitInfo.Add (key, query);
+ SignalEmitInfo.Add(key, query);
}
- query = (SignalQuery)SignalEmitInfo [key];
+ query = (SignalQuery)SignalEmitInfo[key];
GLib.Value[] signal_parameters = new GLib.Value[query.n_params + 1];
- signal_parameters [0] = new GLib.Value (o);
+ signal_parameters[0] = new GLib.Value(o);
if (parameters.Length != query.n_params)
- throw new ApplicationException (String.Format ("Invalid number of parameters: expected {0}, got {1}", query.n_params, parameters.Length));
+ throw new ApplicationException(String.Format("Invalid number of parameters: expected {0}, got {1}", query.n_params, parameters.Length));
for (int i = 0; i < query.n_params; i++) {
- Type expected_type = (Type)query.param_types [i];
- Type given_type = parameters [i].GetType ();
+ Type expected_type = (Type)query.param_types[i];
+ Type given_type = parameters[i].GetType();
- if (expected_type != given_type && !given_type.IsSubclassOf (given_type))
- throw new ApplicationException (String.Format ("Invalid parameter type: expected {0}, got {1}", expected_type, given_type));
+ if (expected_type != given_type && !given_type.IsSubclassOf(given_type))
+ throw new ApplicationException(String.Format("Invalid parameter type: expected {0}, got {1}", expected_type, given_type));
- signal_parameters [i + 1] = new GLib.Value (parameters [i]);
+ signal_parameters[i + 1] = new GLib.Value(parameters[i]);
}
- GLib.Value return_value = new GLib.Value ();
+ GLib.Value return_value = new GLib.Value();
if (query.return_type != GType.Invalid && query.return_type != GType.None)
- return_value.Init (query.return_type);
+ return_value.Init(query.return_type);
if (signal_detail != String.Empty) {
- IntPtr native_string = GLib.Marshaller.StringToPtrGStrdup (signal_detail);
- signal_detail_quark = g_quark_from_string (native_string);
- GLib.Marshaller.Free (native_string);
+ IntPtr native_string = GLib.Marshaller.StringToPtrGStrdup(signal_detail);
+ signal_detail_quark = g_quark_from_string(native_string);
+ GLib.Marshaller.Free(native_string);
}
- g_signal_emitv (signal_parameters, query.signal_id, signal_detail_quark, ref return_value);
+ g_signal_emitv(signal_parameters, query.signal_id, signal_detail_quark, ref return_value);
foreach (GLib.Value v in signal_parameters)
- v.Dispose ();
+ v.Dispose();
object ret = (query.return_type != GType.Invalid && query.return_type != GType.None) ? return_value.Val : null;
if (ret != null)
- return_value.Dispose ();
+ return_value.Dispose();
return ret;
}
- [DllImport ("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern int g_signal_handler_disconnect (IntPtr o, uint handler_id);
+ [DllImport("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern int g_signal_handler_disconnect(IntPtr o, uint handler_id);
- [DllImport ("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern uint g_signal_lookup (IntPtr name, IntPtr itype);
+ [DllImport("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern uint g_signal_lookup(IntPtr name, IntPtr itype);
- [DllImport ("glib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern uint g_quark_from_string (IntPtr str);
+ [DllImport("glib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern uint g_quark_from_string(IntPtr str);
- [DllImport ("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void g_signal_emitv (GLib.Value[] parameters, uint signal_id, uint detail, ref GLib.Value return_value);
+ [DllImport("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern void g_signal_emitv(GLib.Value[] parameters, uint signal_id, uint detail, ref GLib.Value return_value);
- [StructLayout (LayoutKind.Sequential)]
- struct GSignalQuery
- {
+ [StructLayout(LayoutKind.Sequential)]
+ struct GSignalQuery {
public uint signal_id;
public IntPtr signal_name;
public IntPtr itype;
public IntPtr param_types;
}
- [DllImport ("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void g_signal_query (uint signal_id, ref GSignalQuery query);
+ [DllImport("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern void g_signal_query(uint signal_id, ref GSignalQuery query);
}
-}
+}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
- partial class Element
- {
- public static bool Link (params Element [] elements) {
+ partial class Element {
+ public static bool Link(params Element[] elements) {
for (int i = 0; i < elements.Length - 1; i++) {
- if (!elements[i].Link (elements[i+1]))
+ if (!elements[i].Link(elements[i + 1]))
return false;
}
return true;
}
- public static void Unlink (params Element [] elements) {
+ public static void Unlink(params Element[] elements) {
for (int i = 0; i < elements.Length - 1; i++) {
- elements[i].Unlink (elements[i+1]);
+ elements[i].Unlink(elements[i + 1]);
}
}
static extern void gst_element_class_add_metadata(IntPtr klass, IntPtr key, IntPtr value);
public void AddMetadata(string key, string value) {
- IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key);
- IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
- gst_element_class_add_metadata(LookupGType().GetClassPtr (), native_key, native_value);
- GLib.Marshaller.Free (native_key);
- GLib.Marshaller.Free (native_value);
+ IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup(key);
+ IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup(value);
+ gst_element_class_add_metadata(LookupGType().GetClassPtr(), native_key, native_value);
+ GLib.Marshaller.Free(native_key);
+ GLib.Marshaller.Free(native_value);
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_element_class_add_pad_template(IntPtr klass, IntPtr templ);
public void AddPadTemplate(Gst.PadTemplate templ) {
- gst_element_class_add_pad_template(LookupGType().GetClassPtr (), templ == null ? IntPtr.Zero : templ.OwnedHandle);
+ gst_element_class_add_pad_template(LookupGType().GetClassPtr(), templ == null ? IntPtr.Zero : templ.OwnedHandle);
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_element_class_add_static_metadata(IntPtr klass, IntPtr key, IntPtr value);
public void AddStaticMetadata(string key, string value) {
- IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key);
- IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
- gst_element_class_add_static_metadata(LookupGType().GetClassPtr (), native_key, native_value);
- GLib.Marshaller.Free (native_key);
- GLib.Marshaller.Free (native_value);
+ IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup(key);
+ IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup(value);
+ gst_element_class_add_static_metadata(LookupGType().GetClassPtr(), native_key, native_value);
+ GLib.Marshaller.Free(native_key);
+ GLib.Marshaller.Free(native_value);
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_element_class_set_metadata(IntPtr klass, IntPtr longname, IntPtr classification, IntPtr description, IntPtr author);
public void SetMetadata(string longname, string classification, string description, string author) {
- IntPtr native_longname = GLib.Marshaller.StringToPtrGStrdup (longname);
- IntPtr native_classification = GLib.Marshaller.StringToPtrGStrdup (classification);
- IntPtr native_description = GLib.Marshaller.StringToPtrGStrdup (description);
- IntPtr native_author = GLib.Marshaller.StringToPtrGStrdup (author);
- gst_element_class_set_metadata(LookupGType().GetClassPtr (), native_longname, native_classification, native_description, native_author);
- GLib.Marshaller.Free (native_longname);
- GLib.Marshaller.Free (native_classification);
- GLib.Marshaller.Free (native_description);
- GLib.Marshaller.Free (native_author);
+ IntPtr native_longname = GLib.Marshaller.StringToPtrGStrdup(longname);
+ IntPtr native_classification = GLib.Marshaller.StringToPtrGStrdup(classification);
+ IntPtr native_description = GLib.Marshaller.StringToPtrGStrdup(description);
+ IntPtr native_author = GLib.Marshaller.StringToPtrGStrdup(author);
+ gst_element_class_set_metadata(LookupGType().GetClassPtr(), native_longname, native_classification, native_description, native_author);
+ GLib.Marshaller.Free(native_longname);
+ GLib.Marshaller.Free(native_classification);
+ GLib.Marshaller.Free(native_description);
+ GLib.Marshaller.Free(native_author);
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_element_class_set_static_metadata(IntPtr klass, IntPtr longname, IntPtr classification, IntPtr description, IntPtr author);
public void SetStaticMetadata(string longname, string classification, string description, string author) {
- IntPtr native_longname = GLib.Marshaller.StringToPtrGStrdup (longname);
- IntPtr native_classification = GLib.Marshaller.StringToPtrGStrdup (classification);
- IntPtr native_description = GLib.Marshaller.StringToPtrGStrdup (description);
- IntPtr native_author = GLib.Marshaller.StringToPtrGStrdup (author);
- gst_element_class_set_static_metadata(LookupGType().GetClassPtr (), native_longname, native_classification, native_description, native_author);
- GLib.Marshaller.Free (native_longname);
- GLib.Marshaller.Free (native_classification);
- GLib.Marshaller.Free (native_description);
- GLib.Marshaller.Free (native_author);
+ IntPtr native_longname = GLib.Marshaller.StringToPtrGStrdup(longname);
+ IntPtr native_classification = GLib.Marshaller.StringToPtrGStrdup(classification);
+ IntPtr native_description = GLib.Marshaller.StringToPtrGStrdup(description);
+ IntPtr native_author = GLib.Marshaller.StringToPtrGStrdup(author);
+ gst_element_class_set_static_metadata(LookupGType().GetClassPtr(), native_longname, native_classification, native_description, native_author);
+ GLib.Marshaller.Free(native_longname);
+ GLib.Marshaller.Free(native_classification);
+ GLib.Marshaller.Free(native_description);
+ GLib.Marshaller.Free(native_author);
}
}
-}
+}
\ No newline at end of file
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301 USA
-namespace Gst
-{
+namespace Gst {
using System;
using System.Runtime.InteropServices;
- public partial class ElementFactory
- {
- public static IntPtr MakeRaw(string factoryname, string name)
- {
+ public partial class ElementFactory {
+ public static IntPtr MakeRaw(string factoryname, string name) {
IntPtr native_factoryname = GLib.Marshaller.StringToPtrGStrdup(factoryname);
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup(name);
IntPtr raw_ret = gst_element_factory_make(native_factoryname, native_name);
return raw_ret;
}
}
-}
+}
\ No newline at end of file
public partial class FFTF32 : GLib.Opaque {
[DllImport("gstfft-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern IntPtr gst_fft_f32_new (int len, bool inverse);
+ static extern IntPtr gst_fft_f32_new(int len, bool inverse);
- public FFTF32 (int len, bool inverse) {
- Raw = gst_fft_f32_new (len, inverse);
+ public FFTF32(int len, bool inverse) {
+ Raw = gst_fft_f32_new(len, inverse);
}
[DllImport("gstfft-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void gst_fft_f32_fft(IntPtr raw, float[] timedata, [MarshalAs (UnmanagedType.LPArray, ArraySubType=UnmanagedType.Struct)] FFTF32Complex[] freqdata);
+ static extern void gst_fft_f32_fft(IntPtr raw, float[] timedata, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Struct)] FFTF32Complex[] freqdata);
public void Fft(float[] timedata, Gst.FFT.FFTF32Complex[] freqdata) {
gst_fft_f32_fft(Handle, timedata, freqdata);
static extern void gst_fft_f32_window(IntPtr raw, float[] timedata, int window);
public void Window(float[] timedata, Gst.FFT.FFTWindow window) {
- gst_fft_f32_window(Handle, timedata, (int) window);
+ gst_fft_f32_window(Handle, timedata, (int)window);
}
}
-}
+}
\ No newline at end of file
// 02110-1301 USA
namespace Gst {
- using System;
- using System.Runtime.InteropServices;
+ using System;
+ using System.Runtime.InteropServices;
- partial class Global
- {
- public static string TimeFormat(ulong time) {
- return (time / (Gst.Constants.SECOND * 60 * 60)) + ":" +
- (time / (Gst.Constants.SECOND * 60)) % 60 + ":" +
- (time / (Gst.Constants.SECOND)) % 60 + ":" +
- (time % 60);
- }
+ partial class Global {
+ public static string TimeFormat(ulong time) {
+ return (time / (Gst.Constants.SECOND * 60 * 60)) + ":" +
+ (time / (Gst.Constants.SECOND * 60)) % 60 + ":" +
+ (time / (Gst.Constants.SECOND)) % 60 + ":" +
+ (time % 60);
+ }
- public static string TimeFormat(long time) {
- return (time / (Gst.Constants.SECOND * 60 * 60)) + ":" +
- (time / (Gst.Constants.SECOND * 60)) % 60 + ":" +
- (time / (Gst.Constants.SECOND)) % 60 + ":" +
- (time % 60);
- }
-
- }
-}
+ public static string TimeFormat(long time) {
+ return (time / (Gst.Constants.SECOND * 60 * 60)) + ":" +
+ (time / (Gst.Constants.SECOND * 60)) % 60 + ":" +
+ (time / (Gst.Constants.SECOND)) % 60 + ":" +
+ (time % 60);
+ }
+ }
+}
\ No newline at end of file
namespace Gst {
+ using GLib;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
- using GLib;
public partial class Iterator : IEnumerable {
- [DllImport ("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern IntPtr g_value_reset (ref GLib.Value val);
+ [DllImport("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern IntPtr g_value_reset(ref GLib.Value val);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern int gst_iterator_next(IntPtr raw, ref GLib.Value elem);
public Gst.IteratorResult Next(ref GLib.Value elem) {
int raw_ret = gst_iterator_next(Handle, ref elem);
- Gst.IteratorResult ret = (Gst.IteratorResult) raw_ret;
+ Gst.IteratorResult ret = (Gst.IteratorResult)raw_ret;
return ret;
}
private class Enumerator : IEnumerator {
Iterator iterator;
- Hashtable seen = new Hashtable ();
+ Hashtable seen = new Hashtable();
private object current = null;
public object Current {
}
}
- public bool MoveNext () {
+ public bool MoveNext() {
IntPtr raw_ret;
bool retry = false;
return false;
do {
- GLib.Value value = new GLib.Value (GLib.GType.Boolean);
- value.Dispose ();
+ GLib.Value value = new GLib.Value(GLib.GType.Boolean);
+ value.Dispose();
- IteratorResult ret = iterator.Next (ref value);
+ IteratorResult ret = iterator.Next(ref value);
switch (ret) {
- case IteratorResult.Done:
- return false;
- case IteratorResult.Ok:
- if (seen.Contains (value)) {
+ case IteratorResult.Done:
+ return false;
+ case IteratorResult.Ok:
+ if (seen.Contains(value)) {
+ retry = true;
+ break;
+ }
+ seen.Add(value, null);
+ current = value.Val;
+ return true;
+ case IteratorResult.Resync:
+ iterator.Resync();
retry = true;
break;
- }
- seen.Add (value , null);
- current = value.Val;
- return true;
- case IteratorResult.Resync:
- iterator.Resync ();
- retry = true;
- break;
default:
- case IteratorResult.Error:
- throw new Exception ("Error while iterating");
+ case IteratorResult.Error:
+ throw new Exception("Error while iterating");
}
} while (retry);
return false;
}
- public void Reset () {
- seen.Clear ();
+ public void Reset() {
+ seen.Clear();
if (iterator.Handle != IntPtr.Zero)
- iterator.Resync ();
+ iterator.Resync();
}
- public Enumerator (Iterator iterator) {
+ public Enumerator(Iterator iterator) {
this.iterator = iterator;
}
}
private Enumerator enumerator = null;
- public IEnumerator GetEnumerator () {
+ public IEnumerator GetEnumerator() {
if (this.enumerator == null)
- this.enumerator = new Enumerator (this);
+ this.enumerator = new Enumerator(this);
return this.enumerator;
}
}
-}
+}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
- partial struct MapInfo
- {
+ partial struct MapInfo {
public byte[] Data {
get {
byte[] data = new byte[Size];
- Marshal.Copy (_data, data, 0, (int)Size);
+ Marshal.Copy(_data, data, 0, (int)Size);
return data;
}
set {
- Marshal.Copy (value, 0, _data, value.Length);
+ Marshal.Copy(value, 0, _data, value.Length);
}
}
}
}
}
-}
+}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
- partial class Message
- {
- [DllImport ("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern void gst_message_parse_error (IntPtr msg, out IntPtr err, out IntPtr debug);
+ partial class Message {
+ [DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern void gst_message_parse_error(IntPtr msg, out IntPtr err, out IntPtr debug);
- public void ParseError (out GLib.GException error, out string debug) {
+ public void ParseError(out GLib.GException error, out string debug) {
IntPtr err;
IntPtr dbg;
- gst_message_parse_error (Handle, out err, out dbg);
+ gst_message_parse_error(Handle, out err, out dbg);
if (dbg != IntPtr.Zero)
- debug = GLib.Marshaller.Utf8PtrToString (dbg);
+ debug = GLib.Marshaller.Utf8PtrToString(dbg);
else
debug = null;
if (err == IntPtr.Zero)
- throw new Exception ();
+ throw new Exception();
- error = new GLib.GException (err);
+ error = new GLib.GException(err);
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_message_set_stream_status_object(IntPtr raw, IntPtr value);
- public GLib.Value StreamStatusObject {
+ public GLib.Value StreamStatusObject {
get {
IntPtr raw_ret = gst_message_get_stream_status_object(Handle);
- GLib.Value ret = (GLib.Value) Marshal.PtrToStructure (raw_ret, typeof (GLib.Value));
+ GLib.Value ret = (GLib.Value)Marshal.PtrToStructure(raw_ret, typeof(GLib.Value));
return ret;
}
set {
- IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
+ IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc(value);
gst_message_set_stream_status_object(Handle, native_value);
- value = (GLib.Value) Marshal.PtrToStructure (native_value, typeof (GLib.Value));
- Marshal.FreeHGlobal (native_value);
+ value = (GLib.Value)Marshal.PtrToStructure(native_value, typeof(GLib.Value));
+ Marshal.FreeHGlobal(native_value);
}
}
}
-}
+}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
- partial class MiniObject
- {
- protected MiniObject () {}
+ partial class MiniObject {
+ protected MiniObject() { }
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern bool gst_mini_object_replace(IntPtr olddata, IntPtr newdata);
}
public static bool Replace(ref Gst.MiniObject olddata) {
- return Replace (ref olddata, null);
+ return Replace(ref olddata, null);
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gst_mini_object_make_writable(IntPtr mini_object);
public void MakeWritable() {
- IntPtr raw = gst_mini_object_make_writable (Raw);
+ IntPtr raw = gst_mini_object_make_writable(Raw);
if (raw == Raw)
return;
Raw = raw;
if (raw != IntPtr.Zero)
- Unref (raw);
+ Unref(raw);
}
}
-}
+}
\ No newline at end of file
public partial class NavigationAdapter {
- public static bool ParseCommands (Gst.Query query, out NavigationCommand[] cmds) {
+ public static bool ParseCommands(Gst.Query query, out NavigationCommand[] cmds) {
uint len;
cmds = null;
- if (!QueryParseCommandsLength (query, out len))
+ if (!QueryParseCommandsLength(query, out len))
return false;
cmds = new NavigationCommand[len];
for (uint i = 0; i < len; i++) {
NavigationCommand cmd;
- if (!QueryParseCommandsNth (query, i, out cmd))
+ if (!QueryParseCommandsNth(query, i, out cmd))
return false;
cmds[i] = cmd;
}
return true;
}
}
-}
+}
\ No newline at end of file
namespace Gst {
- public class PropertyNotFoundException : Exception {}
-
- [StructLayout (LayoutKind.Sequential)]
- struct GstObject {
- IntPtr _lock;
- public string name;
- public Object parent;
- public uint flags;
- IntPtr controlBindings;
- public int control_rate;
- public int last_sync;
-
- private IntPtr[] _gstGstReserved;
- }
-
- partial class Object
- {
- private Dictionary <string, bool> PropertyNameCache = new Dictionary<string, bool> ();
-
- [DllImport ("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern IntPtr g_object_class_find_property (IntPtr klass, IntPtr name);
-
- bool PropertyExists (string name) {
- if (PropertyNameCache.ContainsKey (name))
- return PropertyNameCache [name];
-
- IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
- var ptr = g_object_class_find_property (Marshal.ReadIntPtr (Handle), native_name);
+ public class PropertyNotFoundException : Exception { }
+
+ [StructLayout(LayoutKind.Sequential)]
+ struct GstObject {
+ IntPtr _lock;
+ public string name;
+ public Object parent;
+ public uint flags;
+ IntPtr controlBindings;
+ public int control_rate;
+ public int last_sync;
+
+ private IntPtr[] _gstGstReserved;
+ }
+
+ partial class Object {
+ private Dictionary<string, bool> PropertyNameCache = new Dictionary<string, bool>();
+
+ [DllImport("gobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern IntPtr g_object_class_find_property(IntPtr klass, IntPtr name);
+
+ bool PropertyExists(string name) {
+ if (PropertyNameCache.ContainsKey(name))
+ return PropertyNameCache[name];
+
+ IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup(name);
+ var ptr = g_object_class_find_property(Marshal.ReadIntPtr(Handle), native_name);
var result = ptr != IntPtr.Zero;
// just cache the positive results because there might
// actually be new properties getting installed
if (result)
- PropertyNameCache [name] = result;
+ PropertyNameCache[name] = result;
- GLib.Marshaller.Free (native_name);
+ GLib.Marshaller.Free(native_name);
return result;
}
public object this[string property] {
- get {
- if (PropertyExists (property)) {
- using (GLib.Value v = GetProperty (property)) {
+ get {
+ if (PropertyExists(property)) {
+ using (GLib.Value v = GetProperty(property)) {
return v.Val;
}
- } else
- throw new PropertyNotFoundException ();
- } set {
- if (PropertyExists (property)) {
+ }
+ else
+ throw new PropertyNotFoundException();
+ }
+ set {
+ if (PropertyExists(property)) {
if (value == null) {
- throw new ArgumentNullException ();
+ throw new ArgumentNullException();
}
- var type = value.GetType ();
+ var type = value.GetType();
var gtype = (GLib.GType)type;
if (gtype == null) {
- throw new Exception ("Could not find a GType for type " + type.FullName);
+ throw new Exception("Could not find a GType for type " + type.FullName);
}
- GLib.Value v = new GLib.Value ((GLib.GType)value.GetType ());
+ GLib.Value v = new GLib.Value((GLib.GType)value.GetType());
v.Val = value;
- SetProperty (property, v);
- v.Dispose ();
- } else
- throw new PropertyNotFoundException ();
- }
+ SetProperty(property, v);
+ v.Dispose();
+ }
+ else
+ throw new PropertyNotFoundException();
+ }
}
- public void Connect (string signal, SignalHandler handler) {
- DynamicSignal.Connect (this, signal, handler);
+ public void Connect(string signal, SignalHandler handler) {
+ DynamicSignal.Connect(this, signal, handler);
}
- public void Disconnect (string signal, SignalHandler handler) {
- DynamicSignal.Disconnect (this, signal, handler);
+ public void Disconnect(string signal, SignalHandler handler) {
+ DynamicSignal.Disconnect(this, signal, handler);
}
- public void Connect (string signal, Delegate handler) {
- DynamicSignal.Connect (this, signal, handler);
+ public void Connect(string signal, Delegate handler) {
+ DynamicSignal.Connect(this, signal, handler);
}
- public void Disconnect (string signal, Delegate handler) {
- DynamicSignal.Disconnect (this, signal, handler);
+ public void Disconnect(string signal, Delegate handler) {
+ DynamicSignal.Disconnect(this, signal, handler);
}
- public object Emit (string signal, params object[] parameters) {
- return DynamicSignal.Emit (this, signal, parameters);
+ public object Emit(string signal, params object[] parameters) {
+ return DynamicSignal.Emit(this, signal, parameters);
}
}
-}
+}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
- partial class Pad
- {
- [GLib.Property ("caps")]
+ partial class Pad {
+ [GLib.Property("caps")]
public Gst.Caps Caps {
get {
- GLib.Value val = GetProperty ("caps");
- Gst.Caps ret = (Gst.Caps) val.Val;
- val.Dispose ();
+ GLib.Value val = GetProperty("caps");
+ Gst.Caps ret = (Gst.Caps)val.Val;
+ val.Dispose();
return ret;
}
}
}
}
}
-}
+}
\ No newline at end of file
namespace Gst {
partial class Pipeline {
- public Pipeline () : this (null) {}
+ public Pipeline() : this(null) { }
}
-}
+}
\ No newline at end of file
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301 USA
-namespace Gst
-{
+namespace Gst {
using System;
using System.Runtime.InteropServices;
- public partial class TagList
- {
- public object this [string tag, uint index] {
- get { return GetValueIndex (tag, index).Val; }
+ public partial class TagList {
+ public object this[string tag, uint index] {
+ get { return GetValueIndex(tag, index).Val; }
}
- public object this [string tag] {
+ public object this[string tag] {
get {
var v = GLib.Value.Empty;
bool success;
- success = CopyValue (ref v, this, tag);
+ success = CopyValue(ref v, this, tag);
if (!success)
return null;
object ret = (object)v.Val;
- v.Dispose ();
+ v.Dispose();
return ret;
}
public string[] Tags {
get {
- int size = NTags ();
+ int size = NTags();
string[] tags = new string[size];
for (uint i = 0; i < size; i++)
- tags [i] = NthTagName (i);
+ tags[i] = NthTagName(i);
return tags;
}
}
- public void Add (Gst.TagMergeMode mode, string tag, object value)
- {
- if (!Tag.Exists (tag))
- throw new ArgumentException (String.Format ("Invalid tag name '{0}'", tag));
+ public void Add(Gst.TagMergeMode mode, string tag, object value) {
+ if (!Tag.Exists(tag))
+ throw new ArgumentException(String.Format("Invalid tag name '{0}'", tag));
- GLib.Value v = new GLib.Value (value);
+ GLib.Value v = new GLib.Value(value);
- AddValue (mode, tag, v);
- v.Dispose ();
+ AddValue(mode, tag, v);
+ v.Dispose();
}
}
-}
+}
\ No newline at end of file
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
// Wrapper for GLib.Value to add support for GstFraction, GstFourcc, Gst*Range, ...
+using GLib;
using System;
-using System.Text;
using System.Collections;
using System.Runtime.InteropServices;
-using GLib;
+using System.Text;
/* TODO: intersect, compare, substract, .... */
-namespace Gst
-{
- public struct Fraction
- {
+namespace Gst {
+ public struct Fraction {
public int Numerator {
get {
return numerator;
set {
numerator = value;
- Reduce ();
+ Reduce();
}
}
set {
if (denominator == 0)
- throw new ArgumentException ();
+ throw new ArgumentException();
denominator = value;
- Reduce ();
+ Reduce();
}
}
public static GLib.GType GType {
get {
- return new GType (gst_fraction_get_type ());
+ return new GType(gst_fraction_get_type());
}
}
- private void Reduce ()
- {
- int gcd = GreatestCommonDivisor (this);
+ private void Reduce() {
+ int gcd = GreatestCommonDivisor(this);
if (gcd != 0) {
this.numerator /= gcd;
}
}
- private static int GreatestCommonDivisor (Fraction fraction)
- {
+ private static int GreatestCommonDivisor(Fraction fraction) {
int a = fraction.numerator;
int b = fraction.denominator;
a = b;
b = temp % b;
}
- return Math.Abs (a);
+ return Math.Abs(a);
}
- public Fraction (int numerator, int denominator)
- {
+ public Fraction(int numerator, int denominator) {
if (denominator == 0)
- throw new ArgumentException ();
+ throw new ArgumentException();
this.numerator = numerator;
this.denominator = denominator;
- Reduce ();
+ Reduce();
}
- public Fraction (GLib.Value val) : this ()
- {
- this.numerator = gst_value_get_fraction_numerator (ref val);
- this.denominator = gst_value_get_fraction_denominator (ref val);
+ public Fraction(GLib.Value val) : this() {
+ this.numerator = gst_value_get_fraction_numerator(ref val);
+ this.denominator = gst_value_get_fraction_denominator(ref val);
}
- public void SetGValue (ref GLib.Value val)
- {
- gst_value_set_fraction (ref val, Numerator, Denominator);
+ public void SetGValue(ref GLib.Value val) {
+ gst_value_set_fraction(ref val, Numerator, Denominator);
}
- public override string ToString ()
- {
- return String.Format ("{0}/{1}", numerator, denominator);
+ public override string ToString() {
+ return String.Format("{0}/{1}", numerator, denominator);
}
- public static explicit operator GLib.Value (Fraction fraction)
- {
- GLib.Value val = new GLib.Value (Fraction.GType);
- gst_value_set_fraction (ref val, fraction.Numerator, fraction.Denominator);
+ public static explicit operator GLib.Value(Fraction fraction) {
+ GLib.Value val = new GLib.Value(Fraction.GType);
+ gst_value_set_fraction(ref val, fraction.Numerator, fraction.Denominator);
return val;
}
- public static explicit operator double (Fraction fraction)
- {
+ public static explicit operator double(Fraction fraction) {
return ((double)fraction.numerator) / ((double)fraction.denominator);
}
- public static Fraction operator + (Fraction a, Fraction b)
- {
- return new Fraction ((a.Numerator * b.Denominator) + (b.Numerator * a.Denominator), a.Denominator * b.Denominator);
+ public static Fraction operator +(Fraction a, Fraction b) {
+ return new Fraction((a.Numerator * b.Denominator) + (b.Numerator * a.Denominator), a.Denominator * b.Denominator);
}
- public static Fraction operator - (Fraction a, Fraction b)
- {
- return new Fraction ((a.Numerator * b.Denominator) - (b.Numerator * a.Denominator), a.Denominator * b.Denominator);
+ public static Fraction operator -(Fraction a, Fraction b) {
+ return new Fraction((a.Numerator * b.Denominator) - (b.Numerator * a.Denominator), a.Denominator * b.Denominator);
}
- public static Fraction operator * (Fraction a, Fraction b)
- {
- return new Fraction (a.Numerator * b.Numerator, a.Denominator * b.Denominator);
+ public static Fraction operator *(Fraction a, Fraction b) {
+ return new Fraction(a.Numerator * b.Numerator, a.Denominator * b.Denominator);
}
- public static Fraction operator / (Fraction a, Fraction b)
- {
- return new Fraction (a.Numerator * b.Denominator, a.Denominator * b.Numerator);
+ public static Fraction operator /(Fraction a, Fraction b) {
+ return new Fraction(a.Numerator * b.Denominator, a.Denominator * b.Numerator);
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern void gst_value_set_fraction (ref GLib.Value v, int numerator, int denominator);
+ private static extern void gst_value_set_fraction(ref GLib.Value v, int numerator, int denominator);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int gst_value_get_fraction_numerator (ref GLib.Value v);
+ private static extern int gst_value_get_fraction_numerator(ref GLib.Value v);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int gst_value_get_fraction_denominator (ref GLib.Value v);
+ private static extern int gst_value_get_fraction_denominator(ref GLib.Value v);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr gst_fraction_get_type ();
+ private static extern IntPtr gst_fraction_get_type();
}
- public struct DoubleRange
- {
+ public struct DoubleRange {
public double Min;
public double Max;
public static GLib.GType GType {
get {
- return new GType (gst_double_range_get_type ());
+ return new GType(gst_double_range_get_type());
}
}
- public DoubleRange (double min, double max)
- {
+ public DoubleRange(double min, double max) {
if (min > max)
- throw new ArgumentException ();
+ throw new ArgumentException();
this.Min = min;
this.Max = max;
}
- public DoubleRange (GLib.Value val) : this ()
- {
- this.Min = gst_value_get_double_range_min (ref val);
- this.Max = gst_value_get_double_range_max (ref val);
+ public DoubleRange(GLib.Value val) : this() {
+ this.Min = gst_value_get_double_range_min(ref val);
+ this.Max = gst_value_get_double_range_max(ref val);
}
- public override string ToString ()
- {
- return String.Format ("[{0}, {1}]", Min, Max);
+ public override string ToString() {
+ return String.Format("[{0}, {1}]", Min, Max);
}
- public void SetGValue (ref GLib.Value val)
- {
- gst_value_set_double_range (ref val, Min, Max);
+ public void SetGValue(ref GLib.Value val) {
+ gst_value_set_double_range(ref val, Min, Max);
}
- public static explicit operator GLib.Value (DoubleRange range)
- {
- GLib.Value val = new GLib.Value (DoubleRange.GType);
+ public static explicit operator GLib.Value(DoubleRange range) {
+ GLib.Value val = new GLib.Value(DoubleRange.GType);
- gst_value_set_double_range (ref val, range.Min, range.Max);
+ gst_value_set_double_range(ref val, range.Min, range.Max);
return val;
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr gst_double_range_get_type ();
+ private static extern IntPtr gst_double_range_get_type();
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern void gst_value_set_double_range (ref GLib.Value v, double min, double max);
+ private static extern void gst_value_set_double_range(ref GLib.Value v, double min, double max);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern double gst_value_get_double_range_min (ref GLib.Value v);
+ private static extern double gst_value_get_double_range_min(ref GLib.Value v);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern double gst_value_get_double_range_max (ref GLib.Value v);
+ private static extern double gst_value_get_double_range_max(ref GLib.Value v);
}
- public struct IntRange
- {
+ public struct IntRange {
public int Min;
public int Max;
public static GLib.GType GType {
get {
- return new GType (gst_int_range_get_type ());
+ return new GType(gst_int_range_get_type());
}
}
- public IntRange (int min, int max)
- {
+ public IntRange(int min, int max) {
if (min > max)
- throw new ArgumentException ();
+ throw new ArgumentException();
this.Min = min;
this.Max = max;
}
- public IntRange (GLib.Value val) : this ()
- {
- this.Min = gst_value_get_int_range_min (ref val);
- this.Max = gst_value_get_int_range_max (ref val);
+ public IntRange(GLib.Value val) : this() {
+ this.Min = gst_value_get_int_range_min(ref val);
+ this.Max = gst_value_get_int_range_max(ref val);
}
- public void SetGValue (ref GLib.Value val)
- {
- gst_value_set_int_range (ref val, Min, Max);
+ public void SetGValue(ref GLib.Value val) {
+ gst_value_set_int_range(ref val, Min, Max);
}
- public override string ToString ()
- {
- return String.Format ("[{0}, {1}]", Min, Max);
+ public override string ToString() {
+ return String.Format("[{0}, {1}]", Min, Max);
}
- public static explicit operator GLib.Value (IntRange range)
- {
- GLib.Value val = new GLib.Value (IntRange.GType);
+ public static explicit operator GLib.Value(IntRange range) {
+ GLib.Value val = new GLib.Value(IntRange.GType);
- gst_value_set_int_range (ref val, range.Min, range.Max);
+ gst_value_set_int_range(ref val, range.Min, range.Max);
return val;
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr gst_int_range_get_type ();
+ private static extern IntPtr gst_int_range_get_type();
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern void gst_value_set_int_range (ref GLib.Value v, int min, int max);
+ private static extern void gst_value_set_int_range(ref GLib.Value v, int min, int max);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int gst_value_get_int_range_min (ref GLib.Value v);
+ private static extern int gst_value_get_int_range_min(ref GLib.Value v);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int gst_value_get_int_range_max (ref GLib.Value v);
+ private static extern int gst_value_get_int_range_max(ref GLib.Value v);
}
- public struct FractionRange
- {
+ public struct FractionRange {
public Fraction Min;
public Fraction Max;
public static GLib.GType GType {
get {
- return new GType (gst_fraction_range_get_type ());
+ return new GType(gst_fraction_range_get_type());
}
}
- public FractionRange (Fraction min, Fraction max)
- {
+ public FractionRange(Fraction min, Fraction max) {
double a = (double)min, b = (double)max;
if (a > b)
- throw new ArgumentException ();
+ throw new ArgumentException();
this.Min = min;
this.Max = max;
}
- public FractionRange (GLib.Value val) : this ()
- {
+ public FractionRange(GLib.Value val) : this() {
IntPtr min_ptr, max_ptr;
GLib.Value min, max;
- min_ptr = gst_value_get_fraction_range_min (ref val);
- max_ptr = gst_value_get_fraction_range_max (ref val);
+ min_ptr = gst_value_get_fraction_range_min(ref val);
+ max_ptr = gst_value_get_fraction_range_max(ref val);
- min = (GLib.Value)Marshal.PtrToStructure (min_ptr, typeof(GLib.Value));
- max = (GLib.Value)Marshal.PtrToStructure (max_ptr, typeof(GLib.Value));
+ min = (GLib.Value)Marshal.PtrToStructure(min_ptr, typeof(GLib.Value));
+ max = (GLib.Value)Marshal.PtrToStructure(max_ptr, typeof(GLib.Value));
this.Min = (Fraction)min.Val;
this.Max = (Fraction)max.Val;
}
- public void SetGValue (ref GLib.Value val)
- {
- GLib.Value min = new GLib.Value (Min);
- GLib.Value max = new GLib.Value (Max);
- gst_value_set_fraction_range (ref val, ref min, ref max);
- min.Dispose ();
- max.Dispose ();
+ public void SetGValue(ref GLib.Value val) {
+ GLib.Value min = new GLib.Value(Min);
+ GLib.Value max = new GLib.Value(Max);
+ gst_value_set_fraction_range(ref val, ref min, ref max);
+ min.Dispose();
+ max.Dispose();
}
- public override string ToString ()
- {
- return String.Format ("[{0}, {1}]", Min, Max);
+ public override string ToString() {
+ return String.Format("[{0}, {1}]", Min, Max);
}
- public static explicit operator GLib.Value (FractionRange range)
- {
- GLib.Value val = new GLib.Value (FractionRange.GType);
+ public static explicit operator GLib.Value(FractionRange range) {
+ GLib.Value val = new GLib.Value(FractionRange.GType);
- GLib.Value min = new GLib.Value (range.Min);
- GLib.Value max = new GLib.Value (range.Max);
- gst_value_set_fraction_range (ref val, ref min, ref max);
- min.Dispose ();
- max.Dispose ();
+ GLib.Value min = new GLib.Value(range.Min);
+ GLib.Value max = new GLib.Value(range.Max);
+ gst_value_set_fraction_range(ref val, ref min, ref max);
+ min.Dispose();
+ max.Dispose();
return val;
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr gst_fraction_range_get_type ();
+ private static extern IntPtr gst_fraction_range_get_type();
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern void gst_value_set_fraction_range (ref GLib.Value v, ref GLib.Value min, ref GLib.Value max);
+ private static extern void gst_value_set_fraction_range(ref GLib.Value v, ref GLib.Value min, ref GLib.Value max);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr gst_value_get_fraction_range_min (ref GLib.Value v);
+ private static extern IntPtr gst_value_get_fraction_range_min(ref GLib.Value v);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr gst_value_get_fraction_range_max (ref GLib.Value v);
+ private static extern IntPtr gst_value_get_fraction_range_max(ref GLib.Value v);
}
- public class Date : IWrapper
- {
+ public class Date : IWrapper {
public DateTime Val;
private IntPtr handle;
public static GLib.GType GType {
get {
- return new GType (gst_date_get_type ());
+ return new GType(gst_date_get_type());
}
}
- ~Date ()
- {
- g_date_free (handle);
+ ~Date() {
+ g_date_free(handle);
}
- public Date (DateTime date)
- {
+ public Date(DateTime date) {
this.Val = date;
- handle = g_date_new_dmy ((byte)Val.Day, (int)Val.Month, (ushort)Val.Year);
+ handle = g_date_new_dmy((byte)Val.Day, (int)Val.Month, (ushort)Val.Year);
}
- public Date (int day, int month, int year)
- {
- this.Val = new DateTime (year, month, day);
- handle = g_date_new_dmy ((byte)Val.Day, (int)Val.Month, (ushort)Val.Year);
+ public Date(int day, int month, int year) {
+ this.Val = new DateTime(year, month, day);
+ handle = g_date_new_dmy((byte)Val.Day, (int)Val.Month, (ushort)Val.Year);
}
- public Date (GLib.Value val)
- {
- IntPtr date = gst_value_get_date (ref val);
+ public Date(GLib.Value val) {
+ IntPtr date = gst_value_get_date(ref val);
- this.Val = new DateTime (g_date_get_year (date), g_date_get_month (date), g_date_get_day (date));
- handle = g_date_new_dmy ((byte)Val.Day, (int)Val.Month, (ushort)Val.Year);
+ this.Val = new DateTime(g_date_get_year(date), g_date_get_month(date), g_date_get_day(date));
+ handle = g_date_new_dmy((byte)Val.Day, (int)Val.Month, (ushort)Val.Year);
}
- public static Date New (IntPtr date)
- {
- return new Date (g_date_get_day (date), g_date_get_month (date), g_date_get_year (date));
+ public static Date New(IntPtr date) {
+ return new Date(g_date_get_day(date), g_date_get_month(date), g_date_get_year(date));
}
- public void SetGValue (ref GLib.Value val)
- {
- IntPtr date_ptr = g_date_new_dmy ((byte)Val.Day, (int)Val.Month, (ushort)Val.Year);
+ public void SetGValue(ref GLib.Value val) {
+ IntPtr date_ptr = g_date_new_dmy((byte)Val.Day, (int)Val.Month, (ushort)Val.Year);
- gst_value_set_date (ref val, date_ptr);
+ gst_value_set_date(ref val, date_ptr);
- GLib.Marshaller.Free (date_ptr);
+ GLib.Marshaller.Free(date_ptr);
}
- public override string ToString ()
- {
- return String.Format ("{0}-{1}-{2}", Val.Year, Val.Month, Val.Day);
+ public override string ToString() {
+ return String.Format("{0}-{1}-{2}", Val.Year, Val.Month, Val.Day);
}
- public static explicit operator GLib.Value (Date date)
- {
- GLib.Value val = new GLib.Value (Date.GType);
+ public static explicit operator GLib.Value(Date date) {
+ GLib.Value val = new GLib.Value(Date.GType);
- date.SetGValue (ref val);
+ date.SetGValue(ref val);
return val;
}
- [DllImport ("glib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern byte g_date_get_day (IntPtr date);
+ [DllImport("glib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ private static extern byte g_date_get_day(IntPtr date);
- [DllImport ("glib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern int g_date_get_month (IntPtr date);
+ [DllImport("glib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ private static extern int g_date_get_month(IntPtr date);
- [DllImport ("glib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern ushort g_date_get_year (IntPtr date);
+ [DllImport("glib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ private static extern ushort g_date_get_year(IntPtr date);
- [DllImport ("glib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr g_date_new_dmy (byte day, int month, ushort year);
+ [DllImport("glib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ private static extern IntPtr g_date_new_dmy(byte day, int month, ushort year);
- [DllImport ("glib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern void g_date_free (IntPtr date);
+ [DllImport("glib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ private static extern void g_date_free(IntPtr date);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr gst_date_get_type ();
+ private static extern IntPtr gst_date_get_type();
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr gst_value_get_date (ref GLib.Value val);
+ private static extern IntPtr gst_value_get_date(ref GLib.Value val);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern void gst_value_set_date (ref GLib.Value val, IntPtr date);
+ private static extern void gst_value_set_date(ref GLib.Value val, IntPtr date);
}
- public struct List : IEnumerable
- {
+ public struct List : IEnumerable {
private IList content;
public static GLib.GType GType {
get {
- return new GType (gst_value_list_get_type ());
+ return new GType(gst_value_list_get_type());
}
}
- public List (IList content)
- {
+ public List(IList content) {
this.content = content;
}
- public List (GLib.Value val)
- {
- this.content = new ArrayList ();
+ public List(GLib.Value val) {
+ this.content = new ArrayList();
- uint n = gst_value_list_get_size (ref val);
+ uint n = gst_value_list_get_size(ref val);
for (uint i = 0; i < n; i++) {
- IntPtr v_ptr = gst_value_list_get_value (ref val, i);
- GLib.Value v = (GLib.Value)Marshal.PtrToStructure (v_ptr, typeof(GLib.Value));
- this.content.Add (v.Val);
+ IntPtr v_ptr = gst_value_list_get_value(ref val, i);
+ GLib.Value v = (GLib.Value)Marshal.PtrToStructure(v_ptr, typeof(GLib.Value));
+ this.content.Add(v.Val);
}
}
- public void SetGValue (ref GLib.Value val)
- {
+ public void SetGValue(ref GLib.Value val) {
foreach (object o in content) {
- GLib.Value v = new GLib.Value (o);
- gst_value_list_append_value (ref val, ref v);
- v.Dispose ();
+ GLib.Value v = new GLib.Value(o);
+ gst_value_list_append_value(ref val, ref v);
+ v.Dispose();
}
}
- public override string ToString ()
- {
- StringBuilder sb = new StringBuilder ();
+ public override string ToString() {
+ StringBuilder sb = new StringBuilder();
- sb.Append ("< ");
+ sb.Append("< ");
for (int i = 0; i < content.Count; i++) {
- sb.Append (content [i]);
+ sb.Append(content[i]);
if (i < content.Count - 1)
- sb.Append (", ");
+ sb.Append(", ");
}
- sb.Append (" >");
+ sb.Append(" >");
- return sb.ToString ();
+ return sb.ToString();
}
- public static explicit operator GLib.Value (List l)
- {
- GLib.Value val = new GLib.Value (List.GType);
+ public static explicit operator GLib.Value(List l) {
+ GLib.Value val = new GLib.Value(List.GType);
foreach (object o in l.content) {
- GLib.Value v = new GLib.Value (o);
- gst_value_list_append_value (ref val, ref v);
- v.Dispose ();
+ GLib.Value v = new GLib.Value(o);
+ gst_value_list_append_value(ref val, ref v);
+ v.Dispose();
}
return val;
}
- public IEnumerator GetEnumerator ()
- {
- return content.GetEnumerator ();
+ public IEnumerator GetEnumerator() {
+ return content.GetEnumerator();
}
- public object this [int index] {
+ public object this[int index] {
set {
- content [index] = value;
+ content[index] = value;
}
get {
- return content [index];
+ return content[index];
}
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr gst_value_list_get_type ();
+ private static extern IntPtr gst_value_list_get_type();
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern uint gst_value_list_get_size (ref GLib.Value val);
+ private static extern uint gst_value_list_get_size(ref GLib.Value val);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr gst_value_list_get_value (ref GLib.Value val, uint index);
+ private static extern IntPtr gst_value_list_get_value(ref GLib.Value val, uint index);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern void gst_value_list_append_value (ref GLib.Value val, ref GLib.Value el);
+ private static extern void gst_value_list_append_value(ref GLib.Value val, ref GLib.Value el);
}
- public struct Array : IEnumerable
- {
+ public struct Array : IEnumerable {
private IList content;
public static GLib.GType GType {
get {
- return new GType (gst_value_array_get_type ());
+ return new GType(gst_value_array_get_type());
}
}
- public Array (IList content)
- {
+ public Array(IList content) {
this.content = content;
}
- public Array (GLib.Value val)
- {
- this.content = new ArrayList ();
+ public Array(GLib.Value val) {
+ this.content = new ArrayList();
- uint n = gst_value_array_get_size (ref val);
+ uint n = gst_value_array_get_size(ref val);
for (uint i = 0; i < n; i++) {
- IntPtr v_ptr = gst_value_array_get_value (ref val, i);
- GLib.Value v = (GLib.Value)Marshal.PtrToStructure (v_ptr, typeof(GLib.Value));
- this.content.Add (v.Val);
+ IntPtr v_ptr = gst_value_array_get_value(ref val, i);
+ GLib.Value v = (GLib.Value)Marshal.PtrToStructure(v_ptr, typeof(GLib.Value));
+ this.content.Add(v.Val);
}
}
- public void SetGValue (ref GLib.Value val)
- {
+ public void SetGValue(ref GLib.Value val) {
foreach (object o in content) {
- GLib.Value v = new GLib.Value (o);
- gst_value_array_append_value (ref val, ref v);
- v.Dispose ();
+ GLib.Value v = new GLib.Value(o);
+ gst_value_array_append_value(ref val, ref v);
+ v.Dispose();
}
}
- public static explicit operator GLib.Value (Array a)
- {
- GLib.Value val = new GLib.Value (Gst.Array.GType);
+ public static explicit operator GLib.Value(Array a) {
+ GLib.Value val = new GLib.Value(Gst.Array.GType);
foreach (object o in a.content) {
- GLib.Value v = new GLib.Value (o);
- gst_value_array_append_value (ref val, ref v);
- v.Dispose ();
+ GLib.Value v = new GLib.Value(o);
+ gst_value_array_append_value(ref val, ref v);
+ v.Dispose();
}
return val;
}
- public override string ToString ()
- {
- StringBuilder sb = new StringBuilder ();
+ public override string ToString() {
+ StringBuilder sb = new StringBuilder();
- sb.Append ("{ ");
+ sb.Append("{ ");
for (int i = 0; i < content.Count; i++) {
- sb.Append (content [i]);
+ sb.Append(content[i]);
if (i < content.Count - 1)
- sb.Append (", ");
+ sb.Append(", ");
}
- sb.Append (" }");
+ sb.Append(" }");
- return sb.ToString ();
+ return sb.ToString();
}
- public IEnumerator GetEnumerator ()
- {
- return content.GetEnumerator ();
+ public IEnumerator GetEnumerator() {
+ return content.GetEnumerator();
}
- public object this [int index] {
+ public object this[int index] {
set {
- content [index] = value;
+ content[index] = value;
}
get {
- return content [index];
+ return content[index];
}
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr gst_value_array_get_type ();
+ private static extern IntPtr gst_value_array_get_type();
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern uint gst_value_array_get_size (ref GLib.Value val);
+ private static extern uint gst_value_array_get_size(ref GLib.Value val);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr gst_value_array_get_value (ref GLib.Value val, uint index);
+ private static extern IntPtr gst_value_array_get_value(ref GLib.Value val, uint index);
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern void gst_value_array_append_value (ref GLib.Value val, ref GLib.Value el);
+ private static extern void gst_value_array_append_value(ref GLib.Value val, ref GLib.Value el);
}
-}
+}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
-namespace Gst
-{
- public static class Version
- {
+namespace Gst {
+ public static class Version {
private static uint major;
private static uint minor;
private static uint micro;
private static uint nano;
private static string version_string;
- static Version ()
- {
- gst_version (out major, out minor, out micro, out nano);
+ static Version() {
+ gst_version(out major, out minor, out micro, out nano);
}
public static string Description {
get {
if (version_string == null) {
- IntPtr version_string_ptr = gst_version_string ();
- version_string = GLib.Marshaller.Utf8PtrToString (version_string_ptr);
+ IntPtr version_string_ptr = gst_version_string();
+ version_string = GLib.Marshaller.Utf8PtrToString(version_string_ptr);
}
return version_string;
}
}
- [DllImport ("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern void gst_version (out uint major, out uint minor, out uint micro, out uint nano);
+ [DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ private static extern void gst_version(out uint major, out uint minor, out uint micro, out uint nano);
- [DllImport ("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr gst_version_string ();
+ [DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ private static extern IntPtr gst_version_string();
}
-}
+}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
- partial struct VideoGLTextureUploadMeta
- {
- public bool Equals (VideoGLTextureUploadMeta other)
- {
- return Meta.Equals (other.Meta) && TextureOrientation.Equals (other.TextureOrientation) && NTextures.Equals (other.NTextures) && TextureType.Equals (other.TextureType);
+ partial struct VideoGLTextureUploadMeta {
+ public bool Equals(VideoGLTextureUploadMeta other) {
+ return Meta.Equals(other.Meta) && TextureOrientation.Equals(other.TextureOrientation) && NTextures.Equals(other.NTextures) && TextureType.Equals(other.TextureType);
}
}
-}
+}
\ No newline at end of file