mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
buffer: fix remaining unit tests
This commit is contained in:
parent
f35847a094
commit
beac9c4a95
12 changed files with 98 additions and 134 deletions
|
@ -175,7 +175,7 @@ _gst_buffer_initialize (void)
|
||||||
* @src: a source #GstBuffer
|
* @src: a source #GstBuffer
|
||||||
* @flags: flags indicating what metadata fields should be copied.
|
* @flags: flags indicating what metadata fields should be copied.
|
||||||
* @offset: offset to copy from
|
* @offset: offset to copy from
|
||||||
* @trim: bytes to trim from end
|
* @size: total size to copy
|
||||||
*
|
*
|
||||||
* Copies the information from @src into @dest.
|
* Copies the information from @src into @dest.
|
||||||
*
|
*
|
||||||
|
@ -183,9 +183,10 @@ _gst_buffer_initialize (void)
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gst_buffer_copy_into (GstBuffer * dest, GstBuffer * src,
|
gst_buffer_copy_into (GstBuffer * dest, GstBuffer * src,
|
||||||
GstBufferCopyFlags flags, gsize offset, gsize trim)
|
GstBufferCopyFlags flags, gsize offset, gsize size)
|
||||||
{
|
{
|
||||||
GstMetaItem *walk;
|
GstMetaItem *walk;
|
||||||
|
gsize bufsize;
|
||||||
|
|
||||||
g_return_if_fail (dest != NULL);
|
g_return_if_fail (dest != NULL);
|
||||||
g_return_if_fail (src != NULL);
|
g_return_if_fail (src != NULL);
|
||||||
|
@ -194,6 +195,11 @@ gst_buffer_copy_into (GstBuffer * dest, GstBuffer * src,
|
||||||
if (G_UNLIKELY (dest == src))
|
if (G_UNLIKELY (dest == src))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
bufsize = gst_buffer_get_size (src);
|
||||||
|
if (size == -1)
|
||||||
|
size = bufsize - offset;
|
||||||
|
g_return_if_fail (bufsize >= offset + size);
|
||||||
|
|
||||||
#if GST_VERSION_NANO == 1
|
#if GST_VERSION_NANO == 1
|
||||||
/* we enable this extra debugging in git versions only for now */
|
/* we enable this extra debugging in git versions only for now */
|
||||||
g_warn_if_fail (gst_buffer_is_writable (dest));
|
g_warn_if_fail (gst_buffer_is_writable (dest));
|
||||||
|
@ -216,7 +222,7 @@ gst_buffer_copy_into (GstBuffer * dest, GstBuffer * src,
|
||||||
if (offset == 0) {
|
if (offset == 0) {
|
||||||
GST_BUFFER_TIMESTAMP (dest) = GST_BUFFER_TIMESTAMP (src);
|
GST_BUFFER_TIMESTAMP (dest) = GST_BUFFER_TIMESTAMP (src);
|
||||||
GST_BUFFER_OFFSET (dest) = GST_BUFFER_OFFSET (src);
|
GST_BUFFER_OFFSET (dest) = GST_BUFFER_OFFSET (src);
|
||||||
if (trim == 0) {
|
if (size == gst_buffer_get_size (src)) {
|
||||||
GST_BUFFER_DURATION (dest) = GST_BUFFER_DURATION (src);
|
GST_BUFFER_DURATION (dest) = GST_BUFFER_DURATION (src);
|
||||||
GST_BUFFER_OFFSET_END (dest) = GST_BUFFER_OFFSET_END (src);
|
GST_BUFFER_OFFSET_END (dest) = GST_BUFFER_OFFSET_END (src);
|
||||||
}
|
}
|
||||||
|
@ -241,31 +247,36 @@ gst_buffer_copy_into (GstBuffer * dest, GstBuffer * src,
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
GstMemory *mem, *dmem;
|
GstMemory *mem, *dmem;
|
||||||
gsize size;
|
gsize msize;
|
||||||
|
|
||||||
mem = g_ptr_array_index (sarr, i);
|
mem = g_ptr_array_index (sarr, i);
|
||||||
|
msize = gst_memory_get_sizes (mem, NULL);
|
||||||
|
|
||||||
if (i + 1 == len) {
|
if (i + 1 == len) {
|
||||||
/* last chunk */
|
/* last chunk */
|
||||||
size = gst_memory_get_sizes (mem, NULL);
|
dmem = gst_memory_sub (mem, offset, size);
|
||||||
dmem = gst_memory_sub (mem, offset, size - offset - trim);
|
|
||||||
} else if (offset) {
|
} else if (offset) {
|
||||||
size = gst_memory_get_sizes (mem, NULL);
|
if (msize > offset) {
|
||||||
dmem = gst_memory_sub (mem, offset, size - offset);
|
dmem = gst_memory_sub (mem, offset, msize - offset);
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
} else {
|
||||||
|
offset -= msize;
|
||||||
|
dmem = NULL;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
dmem = gst_memory_ref (mem);
|
dmem = gst_memory_ref (mem);
|
||||||
|
|
||||||
g_ptr_array_add (darr, dmem);
|
if (dmem)
|
||||||
|
g_ptr_array_add (darr, dmem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (walk = src->priv; walk; walk = walk->next) {
|
for (walk = src->priv; walk; walk = walk->next) {
|
||||||
GstMeta *meta = &walk->meta;
|
GstMeta *meta = &walk->meta;
|
||||||
const GstMetaInfo *info = meta->info;
|
const GstMetaInfo *info = meta->info;
|
||||||
GstMetaTransformData data = { GST_META_TRANSFORM_COPY };
|
|
||||||
|
|
||||||
if (info->transform_func)
|
if (info->copy_func)
|
||||||
info->transform_func (dest, meta, (GstBuffer *) src, &data);
|
info->copy_func (dest, meta, (GstBuffer *) src, offset, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +291,7 @@ _gst_buffer_copy (GstBuffer * buffer)
|
||||||
copy = gst_buffer_new ();
|
copy = gst_buffer_new ();
|
||||||
|
|
||||||
/* we simply copy everything from our parent */
|
/* we simply copy everything from our parent */
|
||||||
gst_buffer_copy_into (copy, buffer, GST_BUFFER_COPY_ALL, 0, 0);
|
gst_buffer_copy_into (copy, buffer, GST_BUFFER_COPY_ALL, 0, -1);
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
@ -696,14 +707,16 @@ gst_buffer_extract (GstBuffer * buffer, gsize offset, gpointer dest, gsize size)
|
||||||
mem = g_ptr_array_index (arr, i);
|
mem = g_ptr_array_index (arr, i);
|
||||||
|
|
||||||
data = gst_memory_map (mem, &ssize, NULL, GST_MAP_READ);
|
data = gst_memory_map (mem, &ssize, NULL, GST_MAP_READ);
|
||||||
tocopy = MIN (ssize, size);
|
if (ssize > offset) {
|
||||||
if (tocopy > offset) {
|
/* we have enough */
|
||||||
memcpy (ptr, data + offset, tocopy - offset);
|
tocopy = MIN (ssize - offset, size);
|
||||||
|
memcpy (ptr, data + offset, tocopy);
|
||||||
size -= tocopy;
|
size -= tocopy;
|
||||||
ptr += tocopy;
|
ptr += tocopy;
|
||||||
offset = 0;
|
offset = 0;
|
||||||
} else {
|
} else {
|
||||||
offset -= tocopy;
|
/* offset past buffer, skip */
|
||||||
|
offset -= ssize;
|
||||||
}
|
}
|
||||||
gst_memory_unmap (mem, data, ssize);
|
gst_memory_unmap (mem, data, ssize);
|
||||||
}
|
}
|
||||||
|
@ -802,8 +815,7 @@ gst_buffer_create_sub (GstBuffer * buffer, gsize offset, gsize size)
|
||||||
|
|
||||||
GST_CAT_LOG (GST_CAT_BUFFER, "new subbuffer %p of %p", subbuffer, buffer);
|
GST_CAT_LOG (GST_CAT_BUFFER, "new subbuffer %p of %p", subbuffer, buffer);
|
||||||
|
|
||||||
gst_buffer_copy_into (subbuffer, buffer, GST_BUFFER_COPY_ALL, offset,
|
gst_buffer_copy_into (subbuffer, buffer, GST_BUFFER_COPY_ALL, offset, size);
|
||||||
bufsize - (size + offset));
|
|
||||||
|
|
||||||
return subbuffer;
|
return subbuffer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -429,7 +429,7 @@ typedef enum {
|
||||||
/* copies memory or metadata into newly allocated buffer */
|
/* copies memory or metadata into newly allocated buffer */
|
||||||
void gst_buffer_copy_into (GstBuffer *dest, GstBuffer *src,
|
void gst_buffer_copy_into (GstBuffer *dest, GstBuffer *src,
|
||||||
GstBufferCopyFlags flags,
|
GstBufferCopyFlags flags,
|
||||||
gsize offset, gsize trim);
|
gsize offset, gsize size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_buffer_is_writable:
|
* gst_buffer_is_writable:
|
||||||
|
|
|
@ -836,9 +836,9 @@ GstBuffer *
|
||||||
gst_buffer_list_iterator_merge_group (const GstBufferListIterator * it)
|
gst_buffer_list_iterator_merge_group (const GstBufferListIterator * it)
|
||||||
{
|
{
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
gsize size, bsize;
|
gsize size;
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
guint8 *dest, *ptr, *bdata;
|
guint8 *dest, *ptr;
|
||||||
|
|
||||||
g_return_val_if_fail (it != NULL, NULL);
|
g_return_val_if_fail (it != NULL, NULL);
|
||||||
|
|
||||||
|
@ -861,19 +861,18 @@ gst_buffer_list_iterator_merge_group (const GstBufferListIterator * it)
|
||||||
|
|
||||||
/* copy metadata from the next buffer after the implicit cursor */
|
/* copy metadata from the next buffer after the implicit cursor */
|
||||||
gst_buffer_copy_into (buf, GST_BUFFER_CAST (it->next->data),
|
gst_buffer_copy_into (buf, GST_BUFFER_CAST (it->next->data),
|
||||||
GST_BUFFER_COPY_METADATA, 0, 0);
|
GST_BUFFER_COPY_METADATA, 0, -1);
|
||||||
|
|
||||||
/* copy data of all buffers before the next group start into the new buffer */
|
/* copy data of all buffers before the next group start into the new buffer */
|
||||||
dest = ptr = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
dest = ptr = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||||
tmp = it->next;
|
tmp = it->next;
|
||||||
do {
|
do {
|
||||||
if (tmp->data != STOLEN) {
|
if (tmp->data != STOLEN) {
|
||||||
|
GstBuffer *tbuf = GST_BUFFER_CAST (tmp->data);
|
||||||
|
gsize bsize;
|
||||||
|
|
||||||
bdata =
|
bsize = gst_buffer_get_size (tbuf);
|
||||||
gst_buffer_map (GST_BUFFER_CAST (tmp->data), &bsize, NULL,
|
gst_buffer_extract (tbuf, 0, ptr, bsize);
|
||||||
GST_MAP_READ);
|
|
||||||
memcpy (ptr, bdata, bsize);
|
|
||||||
gst_buffer_unmap (GST_BUFFER_CAST (tmp->data), bdata, bsize);
|
|
||||||
ptr += bsize;
|
ptr += bsize;
|
||||||
}
|
}
|
||||||
tmp = g_list_next (tmp);
|
tmp = g_list_next (tmp);
|
||||||
|
|
|
@ -54,6 +54,7 @@ _gst_meta_init (void)
|
||||||
const GstMetaInfo *
|
const GstMetaInfo *
|
||||||
gst_meta_register (const gchar * api, const gchar * impl, gsize size,
|
gst_meta_register (const gchar * api, const gchar * impl, gsize size,
|
||||||
GstMetaInitFunction init_func, GstMetaFreeFunction free_func,
|
GstMetaInitFunction init_func, GstMetaFreeFunction free_func,
|
||||||
|
GstMetaCopyFunction copy_func,
|
||||||
GstMetaTransformFunction transform_func,
|
GstMetaTransformFunction transform_func,
|
||||||
GstMetaSerializeFunction serialize_func,
|
GstMetaSerializeFunction serialize_func,
|
||||||
GstMetaDeserializeFunction deserialize_func)
|
GstMetaDeserializeFunction deserialize_func)
|
||||||
|
@ -70,6 +71,7 @@ gst_meta_register (const gchar * api, const gchar * impl, gsize size,
|
||||||
info->size = size;
|
info->size = size;
|
||||||
info->init_func = init_func;
|
info->init_func = init_func;
|
||||||
info->free_func = free_func;
|
info->free_func = free_func;
|
||||||
|
info->copy_func = copy_func;
|
||||||
info->transform_func = transform_func;
|
info->transform_func = transform_func;
|
||||||
info->serialize_func = serialize_func;
|
info->serialize_func = serialize_func;
|
||||||
info->deserialize_func = deserialize_func;
|
info->deserialize_func = deserialize_func;
|
||||||
|
@ -109,26 +111,15 @@ gst_meta_get_info (const gchar * impl)
|
||||||
|
|
||||||
/* Timing metadata */
|
/* Timing metadata */
|
||||||
static void
|
static void
|
||||||
meta_timing_transform (GstBuffer * transbuf, GstMetaTiming * meta,
|
meta_timing_copy (GstBuffer * copybuf, GstMetaTiming * meta,
|
||||||
GstBuffer * buffer, GstMetaTransformData * data)
|
GstBuffer * buffer, gsize offset, gsize size)
|
||||||
{
|
{
|
||||||
GstMetaTiming *timing;
|
GstMetaTiming *timing;
|
||||||
guint offset;
|
|
||||||
guint size;
|
|
||||||
|
|
||||||
if (data->type == GST_META_TRANSFORM_TRIM) {
|
|
||||||
GstMetaTransformSubbuffer *subdata = (GstMetaTransformSubbuffer *) data;
|
|
||||||
offset = subdata->offset;
|
|
||||||
size = subdata->size;
|
|
||||||
} else {
|
|
||||||
offset = 0;
|
|
||||||
size = gst_buffer_get_size (buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_DEBUG ("trans called from buffer %p to %p, meta %p, %u-%u", buffer,
|
GST_DEBUG ("trans called from buffer %p to %p, meta %p, %u-%u", buffer,
|
||||||
transbuf, meta, offset, size);
|
copybuf, meta, offset, size);
|
||||||
|
|
||||||
timing = gst_buffer_add_meta_timing (transbuf);
|
timing = gst_buffer_add_meta_timing (copybuf);
|
||||||
if (offset == 0) {
|
if (offset == 0) {
|
||||||
/* same offset, copy timestamps */
|
/* same offset, copy timestamps */
|
||||||
timing->pts = meta->pts;
|
timing->pts = meta->pts;
|
||||||
|
@ -158,7 +149,8 @@ gst_meta_timing_get_info (void)
|
||||||
sizeof (GstMetaTiming),
|
sizeof (GstMetaTiming),
|
||||||
(GstMetaInitFunction) NULL,
|
(GstMetaInitFunction) NULL,
|
||||||
(GstMetaFreeFunction) NULL,
|
(GstMetaFreeFunction) NULL,
|
||||||
(GstMetaTransformFunction) meta_timing_transform,
|
(GstMetaCopyFunction) meta_timing_copy,
|
||||||
|
(GstMetaTransformFunction) NULL,
|
||||||
(GstMetaSerializeFunction) NULL, (GstMetaDeserializeFunction) NULL);
|
(GstMetaSerializeFunction) NULL, (GstMetaDeserializeFunction) NULL);
|
||||||
}
|
}
|
||||||
return meta_info;
|
return meta_info;
|
||||||
|
|
|
@ -64,51 +64,8 @@ typedef gboolean (*GstMetaInitFunction) (GstMeta *meta, gpointer params, GstBuff
|
||||||
*/
|
*/
|
||||||
typedef void (*GstMetaFreeFunction) (GstMeta *meta, GstBuffer *buffer);
|
typedef void (*GstMetaFreeFunction) (GstMeta *meta, GstBuffer *buffer);
|
||||||
|
|
||||||
/**
|
typedef void (*GstMetaCopyFunction) (GstBuffer *dest, GstMeta *meta,
|
||||||
* GstMetaTransformType:
|
GstBuffer *buffer, gsize offset, gsize size);
|
||||||
* @GST_META_TRANSFORM_NONE: invalid transform type
|
|
||||||
* @GST_META_TRANSFORM_COPY: copy transform
|
|
||||||
* @GST_META_TRANSFORM_MAKE_WRITABLE: make writable type
|
|
||||||
* @GST_META_TRANSFORM_TRIM: trim buffer
|
|
||||||
* @GST_META_TRANSFORM_CUSTOM: start of custom transform types
|
|
||||||
*
|
|
||||||
* Different default transform types.
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
GST_META_TRANSFORM_NONE = 0,
|
|
||||||
GST_META_TRANSFORM_COPY,
|
|
||||||
GST_META_TRANSFORM_MAKE_WRITABLE,
|
|
||||||
GST_META_TRANSFORM_TRIM,
|
|
||||||
|
|
||||||
GST_META_TRANSFORM_CUSTOM = 256
|
|
||||||
} GstMetaTransformType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GstMetaTransformData:
|
|
||||||
* @type: a #GstMetaTransformType
|
|
||||||
*
|
|
||||||
* Common structure that should be put as the first field in the type specific
|
|
||||||
* structure for the #GstMetaTransformFunction. It contains the type of the
|
|
||||||
* transform that should be performed.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
GstMetaTransformType type;
|
|
||||||
} GstMetaTransformData;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GstMetaTransformSubbuffer:
|
|
||||||
* @data: parent #GstMetaTransformData
|
|
||||||
* @offset: the offset of the subbuffer
|
|
||||||
* @size: the new size of the subbuffer
|
|
||||||
*
|
|
||||||
* The subbuffer specific extra info.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
GstMetaTransformData data;
|
|
||||||
gsize offset;
|
|
||||||
gsize size;
|
|
||||||
} GstMetaTransformSubbuffer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstMetaTransformFunction:
|
* GstMetaTransformFunction:
|
||||||
* @transbuf: a #GstBuffer
|
* @transbuf: a #GstBuffer
|
||||||
|
@ -122,12 +79,9 @@ typedef struct {
|
||||||
*
|
*
|
||||||
* Implementations should check the type of the transform @data and parse
|
* Implementations should check the type of the transform @data and parse
|
||||||
* additional type specific field that should be used to perform the transform.
|
* additional type specific field that should be used to perform the transform.
|
||||||
*
|
|
||||||
* If @data is NULL, the metadata should be shallow copied. This is done when
|
|
||||||
* gst_buffer_make_metadata_writable() is called.
|
|
||||||
*/
|
*/
|
||||||
typedef void (*GstMetaTransformFunction) (GstBuffer *transbuf, GstMeta *meta,
|
typedef void (*GstMetaTransformFunction) (GstBuffer *transbuf, GstMeta *meta,
|
||||||
GstBuffer *buffer, GstMetaTransformData *data);
|
GstBuffer *buffer, gpointer data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstMetaSerializeFunction:
|
* GstMetaSerializeFunction:
|
||||||
|
@ -149,6 +103,7 @@ typedef gboolean (*GstMetaDeserializeFunction) (GstMeta *meta,
|
||||||
* @size: size of the metadata
|
* @size: size of the metadata
|
||||||
* @init_func: function for initializing the metadata
|
* @init_func: function for initializing the metadata
|
||||||
* @free_func: function for freeing the metadata
|
* @free_func: function for freeing the metadata
|
||||||
|
* @copy_func: function for copying the metadata
|
||||||
* @transform_func: function for transforming the metadata
|
* @transform_func: function for transforming the metadata
|
||||||
* @serialize_func: function for serializing
|
* @serialize_func: function for serializing
|
||||||
* @deserialize_func: function for deserializing
|
* @deserialize_func: function for deserializing
|
||||||
|
@ -163,6 +118,7 @@ struct _GstMetaInfo {
|
||||||
|
|
||||||
GstMetaInitFunction init_func;
|
GstMetaInitFunction init_func;
|
||||||
GstMetaFreeFunction free_func;
|
GstMetaFreeFunction free_func;
|
||||||
|
GstMetaCopyFunction copy_func;
|
||||||
GstMetaTransformFunction transform_func;
|
GstMetaTransformFunction transform_func;
|
||||||
GstMetaSerializeFunction serialize_func;
|
GstMetaSerializeFunction serialize_func;
|
||||||
GstMetaDeserializeFunction deserialize_func;
|
GstMetaDeserializeFunction deserialize_func;
|
||||||
|
@ -174,6 +130,7 @@ const GstMetaInfo * gst_meta_register (const gchar *api, const gchar *im
|
||||||
gsize size,
|
gsize size,
|
||||||
GstMetaInitFunction init_func,
|
GstMetaInitFunction init_func,
|
||||||
GstMetaFreeFunction free_func,
|
GstMetaFreeFunction free_func,
|
||||||
|
GstMetaCopyFunction copy_func,
|
||||||
GstMetaTransformFunction transform_func,
|
GstMetaTransformFunction transform_func,
|
||||||
GstMetaSerializeFunction serialize_func,
|
GstMetaSerializeFunction serialize_func,
|
||||||
GstMetaDeserializeFunction deserialize_func);
|
GstMetaDeserializeFunction deserialize_func);
|
||||||
|
|
|
@ -269,6 +269,7 @@ copy_into_unchecked (GstAdapter * adapter, guint8 * dest, gsize skip,
|
||||||
}
|
}
|
||||||
/* copy partial buffer */
|
/* copy partial buffer */
|
||||||
csize = MIN (bsize - skip, size);
|
csize = MIN (bsize - skip, size);
|
||||||
|
GST_DEBUG ("%u %u %u", bsize, skip, csize);
|
||||||
gst_buffer_extract (buf, skip, dest, csize);
|
gst_buffer_extract (buf, skip, dest, csize);
|
||||||
size -= csize;
|
size -= csize;
|
||||||
dest += csize;
|
dest += csize;
|
||||||
|
@ -623,7 +624,6 @@ gst_adapter_take_internal (GstAdapter * adapter, gsize nbytes)
|
||||||
}
|
}
|
||||||
if (tocopy) {
|
if (tocopy) {
|
||||||
/* copy the remaining data */
|
/* copy the remaining data */
|
||||||
GST_LOG_OBJECT (adapter, "copying %u bytes", tocopy);
|
|
||||||
copy_into_unchecked (adapter, toreuse + data, toreuse + adapter->skip,
|
copy_into_unchecked (adapter, toreuse + data, toreuse + adapter->skip,
|
||||||
tocopy);
|
tocopy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,7 +233,7 @@ GST_START_TEST (test_pull)
|
||||||
|
|
||||||
/* compare with previously read data */
|
/* compare with previously read data */
|
||||||
data2 = gst_buffer_map (buffer2, &size2, NULL, GST_MAP_READ);
|
data2 = gst_buffer_map (buffer2, &size2, NULL, GST_MAP_READ);
|
||||||
fail_unless (memcmp (data1, data2, 50) == 0);
|
fail_unless (memcmp (data1 + 50, data2, 50) == 0);
|
||||||
gst_buffer_unmap (buffer2, data2, size2);
|
gst_buffer_unmap (buffer2, data2, size2);
|
||||||
|
|
||||||
gst_buffer_unmap (buffer1, data1, size1);
|
gst_buffer_unmap (buffer1, data1, size1);
|
||||||
|
|
|
@ -80,26 +80,15 @@ test_free_func (GstMetaTest * meta, GstBuffer * buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_transform_func (GstBuffer * transbuf, GstMetaTest * meta,
|
test_copy_func (GstBuffer * copybuf, GstMetaTest * meta,
|
||||||
GstBuffer * buffer, GstMetaTransformData * data)
|
GstBuffer * buffer, gsize offset, gsize size)
|
||||||
{
|
{
|
||||||
GstMetaTest *test;
|
GstMetaTest *test;
|
||||||
guint offset;
|
|
||||||
guint size;
|
|
||||||
|
|
||||||
if (data->type == GST_META_TRANSFORM_TRIM) {
|
GST_DEBUG ("copy called from buffer %p to %p, meta %p, %u-%u", buffer,
|
||||||
GstMetaTransformSubbuffer *subdata = (GstMetaTransformSubbuffer *) data;
|
copybuf, meta, offset, size);
|
||||||
offset = subdata->offset;
|
|
||||||
size = subdata->size;
|
|
||||||
} else {
|
|
||||||
offset = 0;
|
|
||||||
size = gst_buffer_get_size (buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_DEBUG ("trans called from buffer %p to %p, meta %p, %u-%u", buffer,
|
test = GST_META_TEST_ADD (copybuf);
|
||||||
transbuf, meta, offset, size);
|
|
||||||
|
|
||||||
test = GST_META_TEST_ADD (transbuf);
|
|
||||||
if (offset == 0) {
|
if (offset == 0) {
|
||||||
/* same offset, copy timestamps */
|
/* same offset, copy timestamps */
|
||||||
test->pts = meta->pts;
|
test->pts = meta->pts;
|
||||||
|
@ -129,7 +118,8 @@ gst_meta_test_get_info (void)
|
||||||
sizeof (GstMetaTest),
|
sizeof (GstMetaTest),
|
||||||
(GstMetaInitFunction) test_init_func,
|
(GstMetaInitFunction) test_init_func,
|
||||||
(GstMetaFreeFunction) test_free_func,
|
(GstMetaFreeFunction) test_free_func,
|
||||||
(GstMetaTransformFunction) test_transform_func, NULL, NULL);
|
(GstMetaCopyFunction) test_copy_func,
|
||||||
|
(GstMetaTransformFunction) NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
return meta_test_info;
|
return meta_test_info;
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,6 +424,7 @@ buffer_compare (GstBuffer * buf, const gchar * str, gsize size)
|
||||||
|
|
||||||
data = gst_buffer_map (buf, NULL, NULL, GST_MAP_READ);
|
data = gst_buffer_map (buf, NULL, NULL, GST_MAP_READ);
|
||||||
res = memcmp (data, str, size) == 0;
|
res = memcmp (data, str, size) == 0;
|
||||||
|
GST_DEBUG ("%s <-> %s: %d", (gchar *) data, str, res);
|
||||||
gst_buffer_unmap (buf, data, size);
|
gst_buffer_unmap (buf, data, size);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@ -476,12 +477,12 @@ GST_START_TEST (test_push_buffer_list_compat)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 2);
|
fail_unless_equals_int (g_list_length (buffers), 2);
|
||||||
buffer = GST_BUFFER (buffers->data);
|
buffer = GST_BUFFER (buffers->data);
|
||||||
ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1);
|
ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1);
|
||||||
fail_unless (buffer_compare (buffer, "ListGroup", 9) == 0);
|
fail_unless (buffer_compare (buffer, "ListGroup", 9));
|
||||||
gst_buffer_unref (buffer);
|
gst_buffer_unref (buffer);
|
||||||
buffers = g_list_delete_link (buffers, buffers);
|
buffers = g_list_delete_link (buffers, buffers);
|
||||||
buffer = GST_BUFFER (buffers->data);
|
buffer = GST_BUFFER (buffers->data);
|
||||||
ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1);
|
ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1);
|
||||||
fail_unless (buffer_compare (buffer, "AnotherListGroup", 16) == 0);
|
fail_unless (buffer_compare (buffer, "AnotherListGroup", 16));
|
||||||
gst_buffer_unref (buffer);
|
gst_buffer_unref (buffer);
|
||||||
buffers = g_list_delete_link (buffers, buffers);
|
buffers = g_list_delete_link (buffers, buffers);
|
||||||
fail_unless (buffers == NULL);
|
fail_unless (buffers == NULL);
|
||||||
|
|
|
@ -125,8 +125,6 @@ GST_START_TEST (test_peek1)
|
||||||
avail = gst_adapter_available_fast (adapter);
|
avail = gst_adapter_available_fast (adapter);
|
||||||
fail_if (avail != 0);
|
fail_if (avail != 0);
|
||||||
|
|
||||||
gst_buffer_unmap (buffer, (gpointer) bufdata, 0);
|
|
||||||
|
|
||||||
/* silly clear just for fun */
|
/* silly clear just for fun */
|
||||||
gst_adapter_clear (adapter);
|
gst_adapter_clear (adapter);
|
||||||
|
|
||||||
|
@ -260,8 +258,6 @@ GST_START_TEST (test_take3)
|
||||||
/* the data should be the same */
|
/* the data should be the same */
|
||||||
fail_unless (data == data2);
|
fail_unless (data == data2);
|
||||||
|
|
||||||
gst_buffer_unmap (buffer, data, size);
|
|
||||||
gst_buffer_unmap (buffer2, data2, size2);
|
|
||||||
gst_buffer_unref (buffer2);
|
gst_buffer_unref (buffer2);
|
||||||
|
|
||||||
g_object_unref (adapter);
|
g_object_unref (adapter);
|
||||||
|
@ -309,8 +305,10 @@ GST_START_TEST (test_take_order)
|
||||||
adapter = create_and_fill_adapter ();
|
adapter = create_and_fill_adapter ();
|
||||||
while (gst_adapter_available (adapter) >= sizeof (guint32)) {
|
while (gst_adapter_available (adapter) >= sizeof (guint32)) {
|
||||||
guint8 *data = gst_adapter_take (adapter, sizeof (guint32));
|
guint8 *data = gst_adapter_take (adapter, sizeof (guint32));
|
||||||
|
guint32 val = GST_READ_UINT32_LE (data);
|
||||||
|
|
||||||
fail_unless (GST_READ_UINT32_LE (data) == i);
|
GST_DEBUG ("val %8u", val);
|
||||||
|
fail_unless (val == i);
|
||||||
i++;
|
i++;
|
||||||
g_free (data);
|
g_free (data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,16 @@ EXPORTS
|
||||||
gst_adapter_copy
|
gst_adapter_copy
|
||||||
gst_adapter_flush
|
gst_adapter_flush
|
||||||
gst_adapter_get_type
|
gst_adapter_get_type
|
||||||
|
gst_adapter_map
|
||||||
gst_adapter_masked_scan_uint32
|
gst_adapter_masked_scan_uint32
|
||||||
gst_adapter_masked_scan_uint32_peek
|
gst_adapter_masked_scan_uint32_peek
|
||||||
gst_adapter_new
|
gst_adapter_new
|
||||||
gst_adapter_peek
|
|
||||||
gst_adapter_prev_timestamp
|
gst_adapter_prev_timestamp
|
||||||
gst_adapter_push
|
gst_adapter_push
|
||||||
gst_adapter_take
|
gst_adapter_take
|
||||||
gst_adapter_take_buffer
|
gst_adapter_take_buffer
|
||||||
gst_adapter_take_list
|
gst_adapter_take_list
|
||||||
|
gst_adapter_unmap
|
||||||
gst_base_sink_do_preroll
|
gst_base_sink_do_preroll
|
||||||
gst_base_sink_get_blocksize
|
gst_base_sink_get_blocksize
|
||||||
gst_base_sink_get_last_buffer
|
gst_base_sink_get_last_buffer
|
||||||
|
@ -71,9 +72,7 @@ EXPORTS
|
||||||
gst_bit_reader_get_remaining
|
gst_bit_reader_get_remaining
|
||||||
gst_bit_reader_get_size
|
gst_bit_reader_get_size
|
||||||
gst_bit_reader_init
|
gst_bit_reader_init
|
||||||
gst_bit_reader_init_from_buffer
|
|
||||||
gst_bit_reader_new
|
gst_bit_reader_new
|
||||||
gst_bit_reader_new_from_buffer
|
|
||||||
gst_bit_reader_peek_bits_uint16
|
gst_bit_reader_peek_bits_uint16
|
||||||
gst_bit_reader_peek_bits_uint32
|
gst_bit_reader_peek_bits_uint32
|
||||||
gst_bit_reader_peek_bits_uint64
|
gst_bit_reader_peek_bits_uint64
|
||||||
|
@ -114,10 +113,8 @@ EXPORTS
|
||||||
gst_byte_reader_get_uint64_le
|
gst_byte_reader_get_uint64_le
|
||||||
gst_byte_reader_get_uint8
|
gst_byte_reader_get_uint8
|
||||||
gst_byte_reader_init
|
gst_byte_reader_init
|
||||||
gst_byte_reader_init_from_buffer
|
|
||||||
gst_byte_reader_masked_scan_uint32
|
gst_byte_reader_masked_scan_uint32
|
||||||
gst_byte_reader_new
|
gst_byte_reader_new
|
||||||
gst_byte_reader_new_from_buffer
|
|
||||||
gst_byte_reader_peek_data
|
gst_byte_reader_peek_data
|
||||||
gst_byte_reader_peek_float32_be
|
gst_byte_reader_peek_float32_be
|
||||||
gst_byte_reader_peek_float32_le
|
gst_byte_reader_peek_float32_le
|
||||||
|
@ -154,11 +151,9 @@ EXPORTS
|
||||||
gst_byte_writer_free_and_get_data
|
gst_byte_writer_free_and_get_data
|
||||||
gst_byte_writer_get_remaining
|
gst_byte_writer_get_remaining
|
||||||
gst_byte_writer_init
|
gst_byte_writer_init
|
||||||
gst_byte_writer_init_with_buffer
|
|
||||||
gst_byte_writer_init_with_data
|
gst_byte_writer_init_with_data
|
||||||
gst_byte_writer_init_with_size
|
gst_byte_writer_init_with_size
|
||||||
gst_byte_writer_new
|
gst_byte_writer_new
|
||||||
gst_byte_writer_new_with_buffer
|
|
||||||
gst_byte_writer_new_with_data
|
gst_byte_writer_new_with_data
|
||||||
gst_byte_writer_new_with_size
|
gst_byte_writer_new_with_size
|
||||||
gst_byte_writer_put_data
|
gst_byte_writer_put_data
|
||||||
|
@ -201,7 +196,6 @@ EXPORTS
|
||||||
gst_collect_pads_new
|
gst_collect_pads_new
|
||||||
gst_collect_pads_peek
|
gst_collect_pads_peek
|
||||||
gst_collect_pads_pop
|
gst_collect_pads_pop
|
||||||
gst_collect_pads_read
|
|
||||||
gst_collect_pads_read_buffer
|
gst_collect_pads_read_buffer
|
||||||
gst_collect_pads_remove_pad
|
gst_collect_pads_remove_pad
|
||||||
gst_collect_pads_set_clip_function
|
gst_collect_pads_set_clip_function
|
||||||
|
@ -225,6 +219,7 @@ EXPORTS
|
||||||
gst_push_src_get_type
|
gst_push_src_get_type
|
||||||
gst_type_find_helper
|
gst_type_find_helper
|
||||||
gst_type_find_helper_for_buffer
|
gst_type_find_helper_for_buffer
|
||||||
|
gst_type_find_helper_for_data
|
||||||
gst_type_find_helper_for_extension
|
gst_type_find_helper_for_extension
|
||||||
gst_type_find_helper_get_range
|
gst_type_find_helper_get_range
|
||||||
gst_type_find_helper_get_range_ext
|
gst_type_find_helper_get_range_ext
|
||||||
|
|
|
@ -90,14 +90,14 @@ EXPORTS
|
||||||
gst_bin_remove
|
gst_bin_remove
|
||||||
gst_bin_remove_many
|
gst_bin_remove_many
|
||||||
gst_buffer_add_meta
|
gst_buffer_add_meta
|
||||||
gst_buffer_add_meta_memory
|
|
||||||
gst_buffer_copy_flags_get_type
|
gst_buffer_copy_flags_get_type
|
||||||
gst_buffer_copy_metadata
|
gst_buffer_copy_into
|
||||||
gst_buffer_create_sub
|
gst_buffer_create_sub
|
||||||
|
gst_buffer_extract
|
||||||
gst_buffer_flag_get_type
|
gst_buffer_flag_get_type
|
||||||
gst_buffer_get_caps
|
gst_buffer_get_caps
|
||||||
gst_buffer_get_meta
|
gst_buffer_get_meta
|
||||||
gst_buffer_is_metadata_writable
|
gst_buffer_get_size
|
||||||
gst_buffer_is_span_fast
|
gst_buffer_is_span_fast
|
||||||
gst_buffer_iterate_meta
|
gst_buffer_iterate_meta
|
||||||
gst_buffer_join
|
gst_buffer_join
|
||||||
|
@ -119,10 +119,12 @@ EXPORTS
|
||||||
gst_buffer_list_iterator_take
|
gst_buffer_list_iterator_take
|
||||||
gst_buffer_list_n_groups
|
gst_buffer_list_n_groups
|
||||||
gst_buffer_list_new
|
gst_buffer_list_new
|
||||||
gst_buffer_make_metadata_writable
|
gst_buffer_map
|
||||||
gst_buffer_merge
|
gst_buffer_merge
|
||||||
|
gst_buffer_n_memory
|
||||||
gst_buffer_new
|
gst_buffer_new
|
||||||
gst_buffer_new_and_alloc
|
gst_buffer_new_and_alloc
|
||||||
|
gst_buffer_peek_memory
|
||||||
gst_buffer_pool_acquire_buffer
|
gst_buffer_pool_acquire_buffer
|
||||||
gst_buffer_pool_config_get
|
gst_buffer_pool_config_get
|
||||||
gst_buffer_pool_config_set
|
gst_buffer_pool_config_set
|
||||||
|
@ -133,10 +135,13 @@ EXPORTS
|
||||||
gst_buffer_pool_release_buffer
|
gst_buffer_pool_release_buffer
|
||||||
gst_buffer_pool_set_active
|
gst_buffer_pool_set_active
|
||||||
gst_buffer_pool_set_config
|
gst_buffer_pool_set_config
|
||||||
|
gst_buffer_remove_memory
|
||||||
gst_buffer_remove_meta
|
gst_buffer_remove_meta
|
||||||
gst_buffer_set_caps
|
gst_buffer_set_caps
|
||||||
gst_buffer_span
|
gst_buffer_span
|
||||||
|
gst_buffer_take_memory
|
||||||
gst_buffer_try_new_and_alloc
|
gst_buffer_try_new_and_alloc
|
||||||
|
gst_buffer_unmap
|
||||||
gst_buffering_mode_get_type
|
gst_buffering_mode_get_type
|
||||||
gst_bus_add_signal_watch
|
gst_bus_add_signal_watch
|
||||||
gst_bus_add_signal_watch_full
|
gst_bus_add_signal_watch_full
|
||||||
|
@ -504,6 +509,7 @@ EXPORTS
|
||||||
gst_iterator_resync
|
gst_iterator_resync
|
||||||
gst_library_error_get_type
|
gst_library_error_get_type
|
||||||
gst_library_error_quark
|
gst_library_error_quark
|
||||||
|
gst_map_flags_get_type
|
||||||
gst_marshal_BOOLEAN__BOXED
|
gst_marshal_BOOLEAN__BOXED
|
||||||
gst_marshal_BOOLEAN__POINTER
|
gst_marshal_BOOLEAN__POINTER
|
||||||
gst_marshal_BOOLEAN__VOID
|
gst_marshal_BOOLEAN__VOID
|
||||||
|
@ -521,6 +527,22 @@ EXPORTS
|
||||||
gst_marshal_VOID__OBJECT_STRING
|
gst_marshal_VOID__OBJECT_STRING
|
||||||
gst_marshal_VOID__POINTER_OBJECT
|
gst_marshal_VOID__POINTER_OBJECT
|
||||||
gst_marshal_VOID__UINT_BOXED
|
gst_marshal_VOID__UINT_BOXED
|
||||||
|
gst_memory_copy
|
||||||
|
gst_memory_extract
|
||||||
|
gst_memory_flags_get_type
|
||||||
|
gst_memory_get_sizes
|
||||||
|
gst_memory_is_span
|
||||||
|
gst_memory_map
|
||||||
|
gst_memory_new_alloc
|
||||||
|
gst_memory_new_copy
|
||||||
|
gst_memory_new_wrapped
|
||||||
|
gst_memory_ref
|
||||||
|
gst_memory_register
|
||||||
|
gst_memory_span
|
||||||
|
gst_memory_sub
|
||||||
|
gst_memory_trim
|
||||||
|
gst_memory_unmap
|
||||||
|
gst_memory_unref
|
||||||
gst_message_get_seqnum
|
gst_message_get_seqnum
|
||||||
gst_message_get_stream_status_object
|
gst_message_get_stream_status_object
|
||||||
gst_message_get_structure
|
gst_message_get_structure
|
||||||
|
@ -586,8 +608,6 @@ EXPORTS
|
||||||
gst_message_type_get_type
|
gst_message_type_get_type
|
||||||
gst_message_type_to_quark
|
gst_message_type_to_quark
|
||||||
gst_meta_get_info
|
gst_meta_get_info
|
||||||
gst_meta_map_flags_get_type
|
|
||||||
gst_meta_memory_get_info
|
|
||||||
gst_meta_register
|
gst_meta_register
|
||||||
gst_meta_timing_get_info
|
gst_meta_timing_get_info
|
||||||
gst_mini_object_copy
|
gst_mini_object_copy
|
||||||
|
|
Loading…
Reference in a new issue