image: add gst_vaapi_image_copy() helper.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Fri, 26 Jul 2013 09:43:49 +0000 (11:43 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Fri, 26 Jul 2013 11:16:52 +0000 (13:16 +0200)
Add gst_vaapi_image_copy() helper function to copy images of same format
and size.

docs/reference/libs/libs-sections.txt
gst-libs/gst/vaapi/gstvaapiimage.c
gst-libs/gst/vaapi/gstvaapiimage.h

index e619f19..9b005e6 100644 (file)
@@ -228,6 +228,7 @@ gst_vaapi_image_get_data_size
 gst_vaapi_image_get_buffer
 gst_vaapi_image_get_raw
 gst_vaapi_image_update_from_buffer
+gst_vaapi_image_copy
 <SUBSECTION Standard>
 GST_VAAPI_IMAGE
 </SECTION>
index 30df81d..3ddf124 100644 (file)
@@ -1116,3 +1116,35 @@ gst_vaapi_image_update_from_raw(
 
     return success;
 }
+
+/**
+ * gst_vaapi_image_copy:
+ * @dst_image: the target #GstVaapiImage
+ * @src_image: the source #GstVaapiImage
+ *
+ * Copies pixels data from @src_image to @dst_image. Both images shall
+ * have the same format and size.
+ *
+ * Return value: %TRUE on success
+ */
+gboolean
+gst_vaapi_image_copy(GstVaapiImage *dst_image, GstVaapiImage *src_image)
+{
+    GstVaapiImageRaw dst_image_raw, src_image_raw;
+    gboolean success = FALSE;
+
+    g_return_val_if_fail(dst_image != NULL, FALSE);
+    g_return_val_if_fail(src_image != NULL, FALSE);
+
+    if (!_gst_vaapi_image_map(dst_image, &dst_image_raw))
+        goto end;
+    if (!_gst_vaapi_image_map(src_image, &src_image_raw))
+        goto end;
+
+    success = copy_image(&dst_image_raw, &src_image_raw, NULL);
+
+end:
+    _gst_vaapi_image_unmap(src_image);
+    _gst_vaapi_image_unmap(dst_image);
+    return success;
+}
index 94eff61..124bdad 100644 (file)
@@ -156,6 +156,9 @@ gst_vaapi_image_update_from_raw(
     GstVaapiRectangle *rect
 );
 
+gboolean
+gst_vaapi_image_copy(GstVaapiImage *dst_image, GstVaapiImage *src_image);
+
 G_END_DECLS
 
 #endif /* GST_VAAPI_IMAGE_H */