From: Sebastian Dröge Date: Mon, 27 Apr 2009 10:34:20 +0000 (+0200) Subject: Fix the Gst.Task bindings X-Git-Tag: 1.19.3~483^2~672 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=48a5bce6892d9db0be12f0c95f6ad2df4ffd1688;p=platform%2Fupstream%2Fgstreamer.git Fix the Gst.Task bindings 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. --- diff --git a/gstreamer-sharp/Gstreamer.metadata b/gstreamer-sharp/Gstreamer.metadata index c80d68cea8..d298406f5e 100644 --- a/gstreamer-sharp/Gstreamer.metadata +++ b/gstreamer-sharp/Gstreamer.metadata @@ -700,6 +700,19 @@ 1 + + 1 + 1 + > + + + + + + + + + 1 diff --git a/gstreamer-sharp/Makefile.am b/gstreamer-sharp/Makefile.am index 299978328e..73b298c088 100644 --- a/gstreamer-sharp/Makefile.am +++ b/gstreamer-sharp/Makefile.am @@ -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 index 0000000000..fd842badf1 --- /dev/null +++ b/gstreamer-sharp/Task.custom @@ -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); + } + } +} + diff --git a/gstreamer-sharp/glue/Makefile.am b/gstreamer-sharp/glue/Makefile.am index 06676d1537..5fe9674dcc 100644 --- a/gstreamer-sharp/glue/Makefile.am +++ b/gstreamer-sharp/glue/Makefile.am @@ -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 index 0000000000..18b8ba5189 --- /dev/null +++ b/gstreamer-sharp/glue/task.c @@ -0,0 +1,13 @@ +#include + +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); +}