gstreamer/gstreamer-sharp/glue/buffer.c
Sebastian Dröge 1c1fe228b4 Don't forget to set the freefunc of buffers
Partially fixes bug #585551.
2009-06-17 13:36:53 +02:00

46 lines
993 B
C

#include <gst/gst.h>
void
gstsharp_gst_buffer_set_data (GstBuffer * buffer, guint8 * new_data, guint size)
{
g_return_if_fail (gst_buffer_is_writable (buffer));
if (buffer->malloc_data && buffer->free_func)
buffer->free_func (buffer->malloc_data);
else if (buffer->malloc_data)
g_free (buffer->malloc_data);
buffer->malloc_data = buffer->data = new_data;
buffer->size = size;
buffer->free_func = g_free;
}
guint
gstsharp_gst_buffer_get_data_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstBuffer, data);
}
guint
gstsharp_gst_buffer_get_timestamp_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstBuffer, timestamp);
}
guint
gstsharp_gst_buffer_get_duration_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstBuffer, duration);
}
guint
gstsharp_gst_buffer_get_offset_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstBuffer, offset);
}
guint
gstsharp_gst_buffer_get_offset_end_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstBuffer, offset_end);
}