Fix the Gst.Task bindings
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 27 Apr 2009 10:34:20 +0000 (12:34 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 27 Apr 2009 10:34:20 +0000 (12:34 +0200)
What still needs to be done is to add a way to set
a custom lock to the task, currently a newly created
task can only get a lock by making it a pad task.

gstreamer-sharp/Gstreamer.metadata
gstreamer-sharp/Makefile.am
gstreamer-sharp/Task.custom [new file with mode: 0644]
gstreamer-sharp/glue/Makefile.am
gstreamer-sharp/glue/task.c [new file with mode: 0644]

index c80d68cea81d7d6bfd4fd87ffa38084cbd0c7d3a..d298406f5ec40758ca361d032c636a5b1fca5ecb 100644 (file)
 
   <attr path="/api/namespace/struct[@name='TypeFind']/method[@name='Register']" name="hidden">1</attr>
 
+  <!-- FIXME: Bug https://bugzilla.novell.com/show_bug.cgi?id=323372 -->
+  <attr path="/api/namespace/object[@name='Task']/field" name="hidden">1</attr>
+  <attr path="/api/namespace/object[@name='Task']/method[@cname='gst_task_cleanup_all']" name="hidden">1</attr>
+  <remove-node path="/api/namespace/object[@name='Task']/method[@cname='gst_task_create']" />>
+  <add-node path="/api/namespace/object[@name='Task']">
+      <constructor cname="gst_task_create">
+        <parameters>
+          <parameter type="GstTaskFunction" name="func" />
+          <parameter type="gpointer" name="data" />
+        </parameters>
+      </constructor>
+  </add-node>
+
   <!-- FIXME: Bug https://bugzilla.novell.com/show_bug.cgi?id=323372 -->
   <attr path="/api/namespace/object[@name='TypeFindFactory']/field[@name='Caps']" name="hidden">1</attr>
   <!-- FIXME: Bug https://bugzilla.novell.com/show_bug.cgi?id=323372 -->
index 299978328ebac2492300e1450c977cfb066181cb..73b298c08818afc13376a302843a5ecda1c2e0ee 100644 (file)
@@ -66,6 +66,7 @@ customs =                     \
        Object.custom           \
        PadTemplate.custom      \
        Plugin.custom           \
+       Task.custom             \
        MiniObject.custom       \
        Registry.custom         \
        Query.custom            \
diff --git a/gstreamer-sharp/Task.custom b/gstreamer-sharp/Task.custom
new file mode 100644 (file)
index 0000000..fd842ba
--- /dev/null
@@ -0,0 +1,39 @@
+[DllImport ("gstreamersharpglue-0.10") ]
+extern static uint gstsharp_gst_task_get_cond_offset ();
+
+static uint cond_offset = gstsharp_gst_task_get_cond_offset ();
+private IntPtr CondPtr {
+  get {
+    unsafe {
+      IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + cond_offset);
+      return (*raw_ptr);
+    }
+  }
+}
+
+[DllImport ("libglib-2.0-0.dll") ]
+static extern void g_cond_wait (IntPtr cond, IntPtr mutex);
+[DllImport ("libglib-2.0-0.dll") ]
+static extern void g_cond_signal (IntPtr cond);
+
+public void Wait () {
+  g_cond_wait (CondPtr, LockPtr);
+}
+
+public void Signal () {
+  g_cond_signal (CondPtr);
+}
+
+[DllImport ("gstreamersharpglue-0.10") ]
+extern static uint gstsharp_gst_task_get_running_offset ();
+
+static uint running_offset = gstsharp_gst_task_get_running_offset ();
+public bool IsRunning {
+  get {
+    unsafe {
+      bool* raw_ptr = (bool*) ( ( (byte*) Handle) + running_offset);
+      return (*raw_ptr);
+    }
+  }
+}
+
index 06676d153728301f4cbdd153296a101dd65e46af..5fe9674dcc89908e7ca93fbf3ce562f2a5b8e086 100644 (file)
@@ -10,6 +10,7 @@ libgstreamersharpglue_0_10_la_SOURCES =       \
        bin.c \
        structure.c \
        taglist.c \
+       task.c \
        object.c \
        gobject.c
 
diff --git a/gstreamer-sharp/glue/task.c b/gstreamer-sharp/glue/task.c
new file mode 100644 (file)
index 0000000..18b8ba5
--- /dev/null
@@ -0,0 +1,13 @@
+#include <gst/gst.h>
+
+uint
+gstsharp_gst_task_get_cond_offset (void)
+{
+  return (uint) G_STRUCT_OFFSET (GstTask, cond);
+}
+
+uint
+gstsharp_gst_task_get_running_offset (void)
+{
+  return (uint) G_STRUCT_OFFSET (GstTask, running);
+}