mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
Implement Adapter.Peek() that returns a GstBuffer
This commit is contained in:
parent
1ed4fbcfbd
commit
5a9a2f27a7
3 changed files with 22 additions and 1 deletions
|
@ -5,3 +5,10 @@
|
|||
gst_adapter_push(Handle, buf == null ? IntPtr.Zero : buf.OwnedHandle);
|
||||
}
|
||||
|
||||
|
||||
[DllImport ("gstreamersharpglue-0.10.dll") ]
|
||||
static extern IntPtr gstsharp_gst_adapter_peek_buffer (IntPtr adapter, uint size);
|
||||
|
||||
public Gst.Buffer Peek (uint size) {
|
||||
return (Gst.Buffer) Gst.MiniObject.GetObject (gstsharp_gst_adapter_peek_buffer (Handle, size), true);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,8 @@ libgstreamersharpglue_0_10_la_SOURCES = \
|
|||
indexentry.c \
|
||||
indexfactory.c \
|
||||
mixertrack.c \
|
||||
tunernorm.c
|
||||
tunernorm.c \
|
||||
adapter.c
|
||||
|
||||
nodist_libgstreamersharpglue_0_10_la_SOURCES = generated.c
|
||||
|
||||
|
|
13
gstreamer-sharp/glue/adapter.c
Normal file
13
gstreamer-sharp/glue/adapter.c
Normal file
|
@ -0,0 +1,13 @@
|
|||
#include <gst/gst.h>
|
||||
#include <gst/base/gstadapter.h>
|
||||
|
||||
GstBuffer *
|
||||
gstsharp_gst_adapter_peek_buffer (GstAdapter *adapter, guint size) {
|
||||
GstBuffer *ret = gst_buffer_new_and_try_alloc (size);
|
||||
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
|
||||
gst_adapter_copy (adapter, GST_BUFFER_DATA (ret), 0, size);
|
||||
return ret;
|
||||
}
|
Loading…
Reference in a new issue