buffer: more fixes

This commit is contained in:
Wim Taymans 2011-03-28 15:52:17 +02:00
parent a12373b2ee
commit 826a7d83d4
6 changed files with 28 additions and 3 deletions

View file

@ -705,11 +705,12 @@ gst_buffer_unmap (GstBuffer * buffer, gpointer data, gsize size)
* Copy @size bytes fro @src to @buffer at @offset.
*/
void
gst_buffer_fill (GstBuffer * buffer, gsize offset, gpointer src, gsize size)
gst_buffer_fill (GstBuffer * buffer, gsize offset, gconstpointer src,
gsize size)
{
GPtrArray *arr = (GPtrArray *) buffer->memory;
gsize i, len;
guint8 *ptr = src;
const guint8 *ptr = src;
len = arr->len;

View file

@ -301,7 +301,7 @@ GstMemory * gst_buffer_peek_memory (GstBuffer *buffer, guint idx);
void gst_buffer_remove_memory (GstBuffer *buffer, guint idx);
void gst_buffer_fill (GstBuffer *buffer, gsize offset,
gpointer src, gsize size);
gconstpointer src, gsize size);
void gst_buffer_extract (GstBuffer *buffer, gsize offset,
gpointer dest, gsize size);

View file

@ -67,6 +67,7 @@ LIBGSTCHECK_EXPORTED_FUNCS = \
gst_buffer_straw_stop_pipeline \
gst_check_abi_list \
gst_check_caps_equal \
gst_check_buffer_data \
gst_check_chain_func \
gst_check_drop_buffers \
gst_check_element_push_buffer \

View file

@ -366,6 +366,26 @@ gst_check_caps_equal (GstCaps * caps1, GstCaps * caps2)
g_free (name2);
}
/**
* gst_check_buffer_data:
* @buffer: buffer to compare
* @data: data to compare to
* @size: size of data to compare
*
* Compare the buffer contents with @data and @size.
*/
void
gst_check_buffer_data (GstBuffer * buffer, gconstpointer data, gsize size)
{
guint8 *bdata;
gsize bsize;
bdata = gst_buffer_map (buffer, &bsize, NULL, GST_MAP_READ);
fail_unless (memcmp (bdata, data, size) == 0, "buffer contents not equal");
gst_buffer_unmap (buffer, bdata, bsize);
}
/**
* gst_check_element_push_buffer_list:
* @element_name: name of the element that needs to be created

View file

@ -81,6 +81,7 @@ void gst_check_teardown_pad_by_name (GstElement * element, const gchar *name);
void gst_check_teardown_src_pad (GstElement * element);
void gst_check_drop_buffers (void);
void gst_check_caps_equal (GstCaps * caps1, GstCaps * caps2);
void gst_check_buffer_data (GstBuffer * buffer, gconstpointer data, gsize size);
void gst_check_element_push_buffer_list (const gchar * element_name,
GList * buffer_in, GList * buffer_out, GstFlowReturn last_flow_return);
void gst_check_element_push_buffer (const gchar * element_name,

View file

@ -94,6 +94,7 @@ EXPORTS
gst_buffer_copy_into
gst_buffer_create_sub
gst_buffer_extract
gst_buffer_fill
gst_buffer_flag_get_type
gst_buffer_get_caps
gst_buffer_get_meta
@ -138,6 +139,7 @@ EXPORTS
gst_buffer_remove_memory
gst_buffer_remove_meta
gst_buffer_set_caps
gst_buffer_set_size
gst_buffer_span
gst_buffer_take_memory
gst_buffer_try_new_and_alloc