From b3b018c916fbdc5009839ba1c04f85b55ab62973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 12 Jun 2009 15:21:28 +0200 Subject: [PATCH] AppSrc.PushBuffer() takes ownership of the buffer Part of bug #585551. --- gstreamer-sharp/AppSrc.custom | 33 +++++++++++++++++++----------- gstreamer-sharp/Gstreamer.metadata | 1 + 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/gstreamer-sharp/AppSrc.custom b/gstreamer-sharp/AppSrc.custom index 427252a43d..36fa1e8218 100644 --- a/gstreamer-sharp/AppSrc.custom +++ b/gstreamer-sharp/AppSrc.custom @@ -1,14 +1,23 @@ - [DllImport("libgstreamer-0.10.dll") ] - static extern IntPtr gst_element_factory_make (IntPtr element, IntPtr name); +[DllImport ("libgstreamer-0.10.dll") ] +static extern IntPtr gst_element_factory_make (IntPtr element, IntPtr name); - public AppSrc (string name) : base (IntPtr.Zero) { - IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name); - IntPtr native_element = GLib.Marshaller.StringToPtrGStrdup ("appsrc"); - Raw = gst_element_factory_make (native_element, native_name); - GLib.Marshaller.Free (native_name); - GLib.Marshaller.Free (native_element); - if (Raw == IntPtr.Zero) - throw new Exception ("Failed to instantiate element \"appsrc\""); - } +public AppSrc (string name) : base (IntPtr.Zero) { + IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name); + IntPtr native_element = GLib.Marshaller.StringToPtrGStrdup ("appsrc"); + Raw = gst_element_factory_make (native_element, native_name); + GLib.Marshaller.Free (native_name); + GLib.Marshaller.Free (native_element); + if (Raw == IntPtr.Zero) + throw new Exception ("Failed to instantiate element \"appsrc\""); +} - public AppSrc () : this ((string) null) { } +public AppSrc () : this ( (string) null) { } + +[DllImport ("libgstapp-0.10.dll") ] +static extern int gst_app_src_push_buffer (IntPtr raw, IntPtr buffer); + +public Gst.FlowReturn PushBuffer (Gst.Buffer buffer) { + int raw_ret = gst_app_src_push_buffer (Handle, buffer == null ? IntPtr.Zero : buffer.OwnedHandle); + Gst.FlowReturn ret = (Gst.FlowReturn) raw_ret; + return ret; +} diff --git a/gstreamer-sharp/Gstreamer.metadata b/gstreamer-sharp/Gstreamer.metadata index 8cc103c338..8603ebe23d 100644 --- a/gstreamer-sharp/Gstreamer.metadata +++ b/gstreamer-sharp/Gstreamer.metadata @@ -1134,6 +1134,7 @@ 1 1 1 + 1 NavigationCommand