summaryrefslogtreecommitdiff
path: root/gst-libs/gst
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-11-20 14:36:29 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-12-17 14:56:11 +0100
commit9dc70a0ce6a4a36ab6fb9bd0b5f189efc679b767 (patch)
tree3477694c09ce2c7604ffdb4762523155ffdcae49 /gst-libs/gst
parentf81450ad39b3f73c8f22ff4e62e8d3e58d57ffe9 (diff)
image: fix GstVaapiImage map and unmap.
Fix gst_vaapi_image_map() to return TRUE and the GstVaapiImageRaw structure correctly filled in if the image was already mapped. Likewise, make gst_vaapi_image_unmap() return TRUE if the image was already unmapped.
Diffstat (limited to 'gst-libs/gst')
-rw-r--r--gst-libs/gst/vaapi/gstvaapiimage.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiimage.c b/gst-libs/gst/vaapi/gstvaapiimage.c
index 0961234b..65d79a5e 100644
--- a/gst-libs/gst/vaapi/gstvaapiimage.c
+++ b/gst-libs/gst/vaapi/gstvaapiimage.c
@@ -753,12 +753,11 @@ _gst_vaapi_image_map(GstVaapiImage *image, GstVaapiImageRaw *raw_image)
{
GstVaapiImagePrivate * const priv = image->priv;
GstVaapiDisplay *display;
- void *image_data;
VAStatus status;
guint i;
if (_gst_vaapi_image_is_mapped(image))
- return TRUE;
+ goto map_success;
display = GST_VAAPI_OBJECT_DISPLAY(image);
if (!display)
@@ -767,15 +766,14 @@ _gst_vaapi_image_map(GstVaapiImage *image, GstVaapiImageRaw *raw_image)
GST_VAAPI_DISPLAY_LOCK(display);
status = vaMapBuffer(
GST_VAAPI_DISPLAY_VADISPLAY(display),
- image->priv->image.buf,
- &image_data
+ priv->image.buf,
+ (void **)&priv->image_data
);
GST_VAAPI_DISPLAY_UNLOCK(display);
if (!vaapi_check_status(status, "vaMapBuffer()"))
return FALSE;
- image->priv->image_data = image_data;
-
+map_success:
if (raw_image) {
const VAImage * const va_image = &priv->image;
raw_image->format = priv->format;
@@ -783,7 +781,8 @@ _gst_vaapi_image_map(GstVaapiImage *image, GstVaapiImageRaw *raw_image)
raw_image->height = va_image->height;
raw_image->num_planes = va_image->num_planes;
for (i = 0; i < raw_image->num_planes; i++) {
- raw_image->pixels[i] = (guchar *)image_data + va_image->offsets[i];
+ raw_image->pixels[i] = (guchar *)priv->image_data +
+ va_image->offsets[i];
raw_image->stride[i] = va_image->pitches[i];
}
}
@@ -815,7 +814,7 @@ _gst_vaapi_image_unmap(GstVaapiImage *image)
VAStatus status;
if (!_gst_vaapi_image_is_mapped(image))
- return FALSE;
+ return TRUE;
display = GST_VAAPI_OBJECT_DISPLAY(image);
if (!display)