gst_buffer_list_iterator_merge_group (const GstBufferListIterator * it)
{
GList *tmp;
- guint size;
+ gsize size, bsize;
GstBuffer *buf;
- guint8 *ptr;
+ guint8 *dest, *ptr, *bdata;
g_return_val_if_fail (it != NULL, NULL);
tmp = it->next;
while (tmp && tmp->data != GROUP_START) {
if (tmp->data != STOLEN) {
- size += GST_BUFFER_SIZE (tmp->data);
+ size += gst_buffer_get_size (tmp->data);
}
tmp = g_list_next (tmp);
}
buf = gst_buffer_new_and_alloc (size);
/* copy metadata from the next buffer after the implicit cursor */
- gst_buffer_copy_metadata (buf, GST_BUFFER_CAST (it->next->data),
- GST_BUFFER_COPY_ALL);
+ gst_buffer_copy_into (buf, GST_BUFFER_CAST (it->next->data),
+ GST_BUFFER_COPY_METADATA, 0, 0);
/* copy data of all buffers before the next group start into the new buffer */
- ptr = GST_BUFFER_DATA (buf);
+ dest = ptr = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
tmp = it->next;
do {
if (tmp->data != STOLEN) {
- memcpy (ptr, GST_BUFFER_DATA (tmp->data), GST_BUFFER_SIZE (tmp->data));
- ptr += GST_BUFFER_SIZE (tmp->data);
+
+ bdata =
+ gst_buffer_map (GST_BUFFER_CAST (tmp->data), &bsize, NULL,
+ GST_MAP_READ);
+ memcpy (ptr, bdata, bsize);
+ gst_buffer_unmap (GST_BUFFER_CAST (tmp->data), bdata, bsize);
+ ptr += bsize;
}
tmp = g_list_next (tmp);
} while (tmp && tmp->data != GROUP_START);
+ gst_buffer_unmap (buf, dest, size);
+
return buf;
}