summaryrefslogtreecommitdiff
path: root/gst-libs/gst/vaapi/gstvaapiimage.c
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2011-12-12 16:34:07 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2011-12-12 18:32:29 +0100
commitefcdec08fb26dd772b5c53a6c4370508c55425ff (patch)
tree2af091110fee576d9416970899929f2d03252510 /gst-libs/gst/vaapi/gstvaapiimage.c
parent9337fb9a74a700026a139f622156ea676bacc138 (diff)
image: allow updates from GstVaapiImageRaw.
Diffstat (limited to 'gst-libs/gst/vaapi/gstvaapiimage.c')
-rw-r--r--gst-libs/gst/vaapi/gstvaapiimage.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiimage.c b/gst-libs/gst/vaapi/gstvaapiimage.c
index 584d4157..4b503cf9 100644
--- a/gst-libs/gst/vaapi/gstvaapiimage.c
+++ b/gst-libs/gst/vaapi/gstvaapiimage.c
@@ -1175,3 +1175,40 @@ gst_vaapi_image_update_from_buffer(
return success;
}
+
+/**
+ * gst_vaapi_image_update_from_raw:
+ * @image: a #GstVaapiImage
+ * @src_image: a #GstVaapiImageRaw
+ * @buffer: a #GstBuffer
+ * @rect: a #GstVaapiRectangle expressing a region, or %NULL for the
+ * whole image
+ *
+ * Transfers pixels data contained in the #GstVaapiImageRaw into the
+ * @image. Both image structures shall have the same format.
+ *
+ * Return value: %TRUE on success
+ */
+gboolean
+gst_vaapi_image_update_from_raw(
+ GstVaapiImage *image,
+ GstVaapiImageRaw *src_image,
+ GstVaapiRectangle *rect
+)
+{
+ GstVaapiImageRaw dst_image;
+ gboolean success;
+
+ g_return_val_if_fail(GST_VAAPI_IS_IMAGE(image), FALSE);
+ g_return_val_if_fail(image->priv->is_constructed, FALSE);
+
+ if (!_gst_vaapi_image_map(image, &dst_image))
+ return FALSE;
+
+ success = copy_image(&dst_image, src_image, rect);
+
+ if (!_gst_vaapi_image_unmap(image))
+ return FALSE;
+
+ return success;
+}