From f8bfb404f5d787cff13bbf197233b51dca0019bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 13 Feb 2010 09:38:10 +0100 Subject: [PATCH] Extend Gst.Controller bindings Add methods to set the object of a controller, to get a controller instance from an object, to get/set control sources on an object and to sync the properties of an object to a timestamp. --- gstreamer-sharp/Controller.custom | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/gstreamer-sharp/Controller.custom b/gstreamer-sharp/Controller.custom index 806df06a28..2a82a5b5b3 100644 --- a/gstreamer-sharp/Controller.custom +++ b/gstreamer-sharp/Controller.custom @@ -52,6 +52,9 @@ public string[] Properties { [DllImport ("gstreamersharpglue-0.10.dll") ] extern static uint gst__controllersharp_gst__controller_controller_get_object_offset (); +[DllImport ("libgstcontroller-0.10.dll") ] +static extern bool gst_object_set_controller (IntPtr raw, IntPtr contr); + static uint object_offset = gst__controllersharp_gst__controller_controller_get_object_offset (); public Gst.GLib.Object Object { get { @@ -60,6 +63,12 @@ public Gst.GLib.Object Object { return Gst.GLib.Object.GetObject ( (*raw_ptr)); } } + + set { + bool ret = gst_object_set_controller (value.Handle, this.Handle); + if (!ret) + throw new ApplicationException (); + } } [StructLayout (LayoutKind.Sequential) ] @@ -185,3 +194,40 @@ public System.Array GetValueArray (string property, ulong timestamp, int nsample return values; } +[DllImport ("libgstcontroller-0.10.dll") ] +static extern IntPtr gst_object_get_controller (IntPtr raw); + +static Controller GetController (Gst.Object obj) { + IntPtr raw_ret = gst_object_get_controller (obj.Handle); + return Gst.GLib.Object.GetObject (raw_ret, true) as Controller; +} + +[DllImport ("libgstcontroller-0.10.dll") ] +static extern IntPtr gst_object_get_control_source (IntPtr raw, IntPtr property); + +public static ControlSource GetControlSource (Gst.Object obj, string property) { + IntPtr raw_property = Gst.GLib.Marshaller.StringToPtrGStrdup (property); + IntPtr raw_ret = gst_object_get_control_source (obj.Handle, raw_property); + + Gst.GLib.Marshaller.Free (raw_property); + return Gst.GLib.Object.GetObject (raw_ret, true) as ControlSource; +} + +[DllImport ("libgstcontroller-0.10.dll") ] +static extern bool gst_object_set_control_source (IntPtr raw, IntPtr property, IntPtr csrc); + +public static bool SetControlSource (Gst.Object obj, string property, ControlSource csrc) { + IntPtr raw_property = Gst.GLib.Marshaller.StringToPtrGStrdup (property); + bool ret = gst_object_set_control_source (obj.Handle, raw_property, csrc.Handle); + Gst.GLib.Marshaller.Free (raw_property); + + return ret; +} + +[DllImport ("libgstcontroller-0.10.dll") ] +static extern bool gst_object_sync_values (IntPtr raw, ulong timestamp); + +public static bool SyncValue (Gst.Object obj, ulong timestamp) { + return gst_object_sync_values (obj.Handle, timestamp); +} +