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.
This commit is contained in:
Wim Taymans 2012-03-02 12:45:23 +01:00
parent 36b6204811
commit 5cd35d6386
2 changed files with 10 additions and 2 deletions

View file

@ -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;

View file

@ -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;