Implement Adapter.Peek() that returns a GstBuffer

This commit is contained in:
Sebastian Dröge 2009-05-28 15:31:01 +02:00
parent 1ed4fbcfbd
commit 5a9a2f27a7
3 changed files with 22 additions and 1 deletions

View file

@ -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);
}

View file

@ -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

View 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;
}