mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-04 23:46:43 +00:00
292 lines
9 KiB
C#
292 lines
9 KiB
C#
|
// This file was generated by the Gtk# code generator.
|
||
|
// Changed to use strings instead of GParamSpecs
|
||
|
|
||
|
namespace Gst.Interfaces {
|
||
|
|
||
|
using System;
|
||
|
using System.Runtime.InteropServices;
|
||
|
using System.Collections;
|
||
|
|
||
|
public class PropertyProbeAdapter : GLib.GInterfaceAdapter, Gst.Interfaces.PropertyProbe {
|
||
|
|
||
|
[StructLayout (LayoutKind.Sequential)]
|
||
|
struct GstPropertyProbeInterface {
|
||
|
IntPtr ProbeNeeded;
|
||
|
public GetPropertiesNativeDelegate GetProperties;
|
||
|
public NeedsProbeNativeDelegate NeedsProbe;
|
||
|
public ProbePropertyNativeDelegate ProbeProperty;
|
||
|
public GetValuesNativeDelegate GetValues;
|
||
|
[MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
|
||
|
public IntPtr[] GstReserved;
|
||
|
}
|
||
|
|
||
|
static GstPropertyProbeInterface iface;
|
||
|
|
||
|
static PropertyProbeAdapter ()
|
||
|
{
|
||
|
GLib.GType.Register (_gtype, typeof(PropertyProbeAdapter));
|
||
|
iface.GetProperties = new GetPropertiesNativeDelegate (GetProperties_cb);
|
||
|
iface.NeedsProbe = new NeedsProbeNativeDelegate (NeedsProbe_cb);
|
||
|
iface.ProbeProperty = new ProbePropertyNativeDelegate (ProbeProperty_cb);
|
||
|
iface.GetValues = new GetValuesNativeDelegate (GetValues_cb);
|
||
|
}
|
||
|
|
||
|
[GLib.CDeclCallback]
|
||
|
delegate IntPtr GetPropertiesNativeDelegate (IntPtr inst);
|
||
|
|
||
|
[DllImport("libglib-2.0-0.dll")]
|
||
|
static extern IntPtr g_object_class_find_property (IntPtr gclass, IntPtr name);
|
||
|
|
||
|
static IntPtr GetProperties_cb (IntPtr inst)
|
||
|
{
|
||
|
try {
|
||
|
PropertyProbeImplementor __obj = GLib.Object.GetObject (inst, false) as PropertyProbeImplementor;
|
||
|
|
||
|
string[] properties = __obj.Properties;
|
||
|
GLib.List properties_list = new GLib.List (typeof (IntPtr));
|
||
|
IntPtr gclass = Marshal.ReadIntPtr (inst);
|
||
|
foreach (string prop in properties) {
|
||
|
IntPtr name = GLib.Marshaller.StringToPtrGStrdup (prop);
|
||
|
IntPtr pspec = g_object_class_find_property (gclass, name);
|
||
|
GLib.Marshaller.Free (name);
|
||
|
if (pspec != IntPtr.Zero)
|
||
|
properties_list.Prepend (pspec);
|
||
|
}
|
||
|
|
||
|
/* FIXME: We leak the list! */
|
||
|
return properties_list.Handle;
|
||
|
} catch (Exception e) {
|
||
|
GLib.ExceptionManager.RaiseUnhandledException (e, true);
|
||
|
// NOTREACHED: above call does not return.
|
||
|
throw e;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
[GLib.CDeclCallback]
|
||
|
delegate bool NeedsProbeNativeDelegate (IntPtr inst, uint prop_id, IntPtr pspec);
|
||
|
|
||
|
static bool NeedsProbe_cb (IntPtr inst, uint prop_id, IntPtr pspec)
|
||
|
{
|
||
|
try {
|
||
|
PropertyProbeImplementor __obj = GLib.Object.GetObject (inst, false) as PropertyProbeImplementor;
|
||
|
Gst.PropertyInfo pi = new Gst.PropertyInfo (pspec);
|
||
|
bool __result = __obj.NeedsProbe (pi.Name);
|
||
|
return __result;
|
||
|
} catch (Exception e) {
|
||
|
GLib.ExceptionManager.RaiseUnhandledException (e, true);
|
||
|
// NOTREACHED: above call does not return.
|
||
|
throw e;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
[GLib.CDeclCallback]
|
||
|
delegate void ProbePropertyNativeDelegate (IntPtr inst, uint prop_id, IntPtr pspec);
|
||
|
|
||
|
static void ProbeProperty_cb (IntPtr inst, uint prop_id, IntPtr pspec)
|
||
|
{
|
||
|
try {
|
||
|
PropertyProbeImplementor __obj = GLib.Object.GetObject (inst, false) as PropertyProbeImplementor;
|
||
|
Gst.PropertyInfo pi = new Gst.PropertyInfo (pspec);
|
||
|
__obj.ProbeProperty (pi.Name);
|
||
|
} catch (Exception e) {
|
||
|
GLib.ExceptionManager.RaiseUnhandledException (e, false);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
[GLib.CDeclCallback]
|
||
|
delegate IntPtr GetValuesNativeDelegate (IntPtr inst, uint prop_id, IntPtr pspec);
|
||
|
|
||
|
static IntPtr GetValues_cb (IntPtr inst, uint prop_id, IntPtr pspec)
|
||
|
{
|
||
|
try {
|
||
|
PropertyProbeImplementor __obj = GLib.Object.GetObject (inst, false) as PropertyProbeImplementor;
|
||
|
Gst.PropertyInfo pi = new Gst.PropertyInfo (pspec);
|
||
|
object[] values = __obj.GetValues (pi.Name);
|
||
|
GLib.ValueArray va = new GLib.ValueArray ((uint) values.Length);
|
||
|
|
||
|
foreach (object v in values)
|
||
|
va.Append (new GLib.Value (v));
|
||
|
return va.Handle;
|
||
|
} catch (Exception e) {
|
||
|
GLib.ExceptionManager.RaiseUnhandledException (e, false);
|
||
|
// 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);
|
||
|
GstPropertyProbeInterface native_iface = (GstPropertyProbeInterface) Marshal.PtrToStructure (ifaceptr, typeof (GstPropertyProbeInterface));
|
||
|
native_iface.GetProperties = iface.GetProperties;
|
||
|
native_iface.NeedsProbe = iface.NeedsProbe;
|
||
|
native_iface.ProbeProperty = iface.ProbeProperty;
|
||
|
native_iface.GetValues = iface.GetValues;
|
||
|
Marshal.StructureToPtr (native_iface, ifaceptr, false);
|
||
|
GCHandle gch = (GCHandle) data;
|
||
|
gch.Free ();
|
||
|
}
|
||
|
|
||
|
public PropertyProbeAdapter ()
|
||
|
{
|
||
|
InitHandler = new GLib.GInterfaceInitHandler (Initialize);
|
||
|
}
|
||
|
|
||
|
PropertyProbeImplementor implementor;
|
||
|
|
||
|
public PropertyProbeAdapter (PropertyProbeImplementor implementor)
|
||
|
{
|
||
|
if (implementor == null)
|
||
|
throw new ArgumentNullException ("implementor");
|
||
|
this.implementor = implementor;
|
||
|
}
|
||
|
|
||
|
public PropertyProbeAdapter (IntPtr handle)
|
||
|
{
|
||
|
if (!_gtype.IsInstance (handle))
|
||
|
throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle");
|
||
|
this.handle = handle;
|
||
|
}
|
||
|
|
||
|
[DllImport("gstinterfaces-0.10.dll")]
|
||
|
static extern IntPtr gst_property_probe_get_type();
|
||
|
|
||
|
private static GLib.GType _gtype = new GLib.GType (gst_property_probe_get_type ());
|
||
|
|
||
|
public override GLib.GType GType {
|
||
|
get {
|
||
|
return _gtype;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
IntPtr handle;
|
||
|
public override IntPtr Handle {
|
||
|
get {
|
||
|
if (handle != IntPtr.Zero)
|
||
|
return handle;
|
||
|
return implementor == null ? IntPtr.Zero : implementor.Handle;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static PropertyProbe GetObject (IntPtr handle, bool owned)
|
||
|
{
|
||
|
GLib.Object obj = GLib.Object.GetObject (handle, owned);
|
||
|
return GetObject (obj);
|
||
|
}
|
||
|
|
||
|
public static PropertyProbe GetObject (GLib.Object obj)
|
||
|
{
|
||
|
if (obj == null)
|
||
|
return null;
|
||
|
else if (obj is PropertyProbeImplementor)
|
||
|
return new PropertyProbeAdapter (obj as PropertyProbeImplementor);
|
||
|
else if (obj as PropertyProbe == null)
|
||
|
return new PropertyProbeAdapter (obj.Handle);
|
||
|
else
|
||
|
return obj as PropertyProbe;
|
||
|
}
|
||
|
|
||
|
public PropertyProbeImplementor Implementor {
|
||
|
get {
|
||
|
return implementor;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
[GLib.Signal("probe-needed")]
|
||
|
public event Gst.Interfaces.ProbeNeededHandler ProbeNeeded {
|
||
|
add {
|
||
|
GLib.Signal sig = GLib.Signal.Lookup (GLib.Object.GetObject (Handle), "probe-needed", typeof (Gst.Interfaces.ProbeNeededArgs));
|
||
|
sig.AddDelegate (value);
|
||
|
}
|
||
|
remove {
|
||
|
GLib.Signal sig = GLib.Signal.Lookup (GLib.Object.GetObject (Handle), "probe-needed", typeof (Gst.Interfaces.ProbeNeededArgs));
|
||
|
sig.RemoveDelegate (value);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
[DllImport("gstinterfaces-0.10.dll")]
|
||
|
static extern bool gst_property_probe_needs_probe_name(IntPtr raw, IntPtr name);
|
||
|
|
||
|
public bool NeedsProbe(string name) {
|
||
|
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
|
||
|
bool raw_ret = gst_property_probe_needs_probe_name(Handle, native_name);
|
||
|
bool ret = raw_ret;
|
||
|
GLib.Marshaller.Free (native_name);
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
[DllImport("gstinterfaces-0.10.dll")]
|
||
|
static extern void gst_property_probe_probe_property_name(IntPtr raw, IntPtr name);
|
||
|
|
||
|
public void Probe(string name) {
|
||
|
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
|
||
|
gst_property_probe_probe_property_name(Handle, native_name);
|
||
|
GLib.Marshaller.Free (native_name);
|
||
|
}
|
||
|
|
||
|
[DllImport("gstinterfaces-0.10.dll")]
|
||
|
static extern IntPtr gst_property_probe_get_properties(IntPtr raw);
|
||
|
|
||
|
public string[] Properties {
|
||
|
get {
|
||
|
IntPtr raw_ret = gst_property_probe_get_properties(Handle);
|
||
|
if (raw_ret == IntPtr.Zero)
|
||
|
return new string[] {};
|
||
|
|
||
|
GLib.List raw_ret_list = new GLib.List(raw_ret, typeof (IntPtr));
|
||
|
ArrayList ret = new ArrayList ();
|
||
|
|
||
|
foreach (IntPtr pspec in raw_ret_list) {
|
||
|
Gst.PropertyInfo pi = new Gst.PropertyInfo (pspec);
|
||
|
ret.Add (pi.Name);
|
||
|
}
|
||
|
|
||
|
return (string[]) ret.ToArray (typeof (string));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
[DllImport("gstinterfaces-0.10.dll")]
|
||
|
static extern IntPtr gst_property_probe_get_values_name (IntPtr raw, IntPtr name);
|
||
|
|
||
|
public object[] GetValues (string name) {
|
||
|
IntPtr raw_name = GLib.Marshaller.StringToPtrGStrdup (name);
|
||
|
IntPtr raw_ret = gst_property_probe_get_values_name (Handle, raw_name);
|
||
|
GLib.Marshaller.Free (raw_name);
|
||
|
if (raw_ret == IntPtr.Zero)
|
||
|
return new object[] {};
|
||
|
|
||
|
GLib.ValueArray va = new GLib.ValueArray (raw_ret);
|
||
|
ArrayList ret = new ArrayList ();
|
||
|
foreach (GLib.Value v in va)
|
||
|
ret.Add ((object) v.Val);
|
||
|
|
||
|
va.Dispose ();
|
||
|
|
||
|
return (object[]) ret.ToArray (typeof (object));
|
||
|
}
|
||
|
|
||
|
[DllImport("gstinterfaces-0.10.dll")]
|
||
|
static extern IntPtr gst_property_probe_probe_and_get_values_name (IntPtr raw, IntPtr name);
|
||
|
|
||
|
public object[] ProbeAndGetValues (string name) {
|
||
|
IntPtr raw_name = GLib.Marshaller.StringToPtrGStrdup (name);
|
||
|
IntPtr raw_ret = gst_property_probe_probe_and_get_values_name (Handle, raw_name);
|
||
|
GLib.Marshaller.Free (raw_name);
|
||
|
if (raw_ret == IntPtr.Zero)
|
||
|
return new object[] {};
|
||
|
|
||
|
GLib.ValueArray va = new GLib.ValueArray (raw_ret);
|
||
|
ArrayList ret = new ArrayList ();
|
||
|
foreach (GLib.Value v in va)
|
||
|
ret.Add ((object) v.Val);
|
||
|
|
||
|
va.Dispose ();
|
||
|
|
||
|
return (object[]) ret.ToArray (typeof (object));
|
||
|
}
|
||
|
}
|
||
|
}
|