Commit 5cd35d63 authored by Wim Taymans's avatar Wim Taymans

meta: add boolean to signal a region copy

Add a boolean to the metadata copy transform that signals if a only a
region is copied.
parent 36b62048
......@@ -271,6 +271,7 @@ gst_buffer_copy_into (GstBuffer * dest, GstBuffer * src,
{
GstMetaItem *walk;
gsize bufsize;
gboolean region = FALSE;
g_return_if_fail (dest != NULL);
g_return_if_fail (src != NULL);
......@@ -283,8 +284,12 @@ gst_buffer_copy_into (GstBuffer * dest, GstBuffer * src,
bufsize = gst_buffer_get_size (src);
g_return_if_fail (bufsize >= offset);
if (offset > 0)
region = TRUE;
if (size == -1)
size = bufsize - offset;
if (size < bufsize)
region = TRUE;
g_return_if_fail (bufsize >= offset + size);
GST_CAT_LOG (GST_CAT_BUFFER, "copy %p to %p, offset %" G_GSIZE_FORMAT
......@@ -362,6 +367,7 @@ gst_buffer_copy_into (GstBuffer * dest, GstBuffer * src,
if (info->transform_func) {
GstMetaTransformCopy copy_data;
copy_data.region = region;
copy_data.offset = offset;
copy_data.size = size;
......
......@@ -123,12 +123,14 @@ GST_EXPORT GQuark _gst_meta_transform_copy;
/**
* GstMetaTransformCopy:
* @offset: the offset to copy
* @size: the size to copy
* @region: %TRUE if only region is copied
* @offset: the offset to copy, 0 if @region is %FALSE, otherwise > 0
* @size: the size to copy, -1 or the buffer size when @region is %FALSE
*
* Extra data passed to a "gst-copy" transform #GstMetaTransformFunction.
*/
typedef struct {
gboolean region;
gsize offset;
gsize size;
} GstMetaTransformCopy;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment