mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-13 21:01:14 +00:00
Bind gst_buffer_new_wrapped() manually
The memory must be allocated with g_malloc() as we will free it again later with g_free(), as such allocate and copy the array that is passed in.
This commit is contained in:
parent
a518db8224
commit
a088475b9d
4 changed files with 14 additions and 13 deletions
|
@ -46,5 +46,15 @@ namespace Gst {
|
|||
|
||||
return (ulong) native_dest_size;
|
||||
}
|
||||
|
||||
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr gst_buffer_new_wrapped(IntPtr data, UIntPtr n_length);
|
||||
|
||||
public Buffer (byte[] data)
|
||||
{
|
||||
IntPtr ptr = GLib.Marshaller.Malloc((ulong) data.Length);
|
||||
Marshal.Copy(data, 0, ptr, data.Length);
|
||||
Raw = gst_buffer_new_wrapped(ptr, new UIntPtr((ulong) data.Length));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -580,14 +580,6 @@ namespace Gst {
|
|||
Marshal.FreeHGlobal (native_parms);
|
||||
}
|
||||
|
||||
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr gst_buffer_new_wrapped(byte[] data, UIntPtr n_length);
|
||||
|
||||
public Buffer (byte[] data)
|
||||
{
|
||||
Raw = gst_buffer_new_wrapped(data, new UIntPtr ((ulong) (data == null ? 0 : data.Length)));
|
||||
}
|
||||
|
||||
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr gst_buffer_new_wrapped_bytes(IntPtr bytes);
|
||||
|
||||
|
|
|
@ -6150,10 +6150,10 @@
|
|||
</parameter>
|
||||
</parameters>
|
||||
</constructor>
|
||||
<constructor cname="gst_buffer_new_wrapped">
|
||||
<constructor cname="gst_buffer_new_wrapped" hidden="true">
|
||||
<parameters>
|
||||
<parameter name="data" type="guint8*" owned="true" array="true" array_length_param_index="1" />
|
||||
<parameter name="n_length" type="gsize" />
|
||||
<parameter name="data" type="gpointer*" owned="true" array="true" array_length_param_index="1" />
|
||||
<parameter name="size" type="gsize" />
|
||||
</parameters>
|
||||
</constructor>
|
||||
<constructor cname="gst_buffer_new_wrapped_bytes" version="1.16">
|
||||
|
|
|
@ -321,8 +321,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|||
<attr path="//method[@cname='gst_tag_list_copy_value']/parameters/parameter[@name='dest']" name="pass_as">ref</attr>
|
||||
<attr path="//object/field[@cname='parent']" name="hidden">true</attr>
|
||||
<!-- buffer fixes -->
|
||||
<attr path="//constructor[@cname='gst_buffer_new_wrapped']/parameters/parameter[@name='data']" name="type">guint8*</attr>
|
||||
<attr path="//constructor[@cname='gst_buffer_new_wrapped']/parameters/parameter[@name='size']" name="name">n_length</attr>
|
||||
<attr path="//constructor[@cname='gst_buffer_new_wrapped']" name="hidden">true</attr>
|
||||
<attr path="//constructor[@cname='gst_buffer_new_wrapped_full']/parameters/parameter[@name='data']" name="type">guint8*</attr>
|
||||
<attr path="//constructor[@cname='gst_memory_new_wrapped']/parameters/parameter[@name='data']" name="type">guint8*</attr>
|
||||
<attr path="//method[@cname='gst_buffer_fill']/parameters/parameter[@name='src']" name="type">guint8*</attr>
|
||||
|
|
Loading…
Reference in a new issue