From: gb Date: Thu, 18 Mar 2010 12:59:55 +0000 (+0000) Subject: Split map/unmap functions into internal functions that don't check preconditions. X-Git-Tag: accepted/trunk/20120822.173359~692 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=087b1dabda293dc3d1f2b9919c5714ce033b0f89;p=profile%2Fivi%2Fgstreamer-vaapi.git Split map/unmap functions into internal functions that don't check preconditions. --- diff --git a/gst-libs/gst/vaapi/gstvaapiimage.c b/gst-libs/gst/vaapi/gstvaapiimage.c index 039f55f..78f582f 100644 --- a/gst-libs/gst/vaapi/gstvaapiimage.c +++ b/gst-libs/gst/vaapi/gstvaapiimage.c @@ -63,13 +63,19 @@ enum { b = v; \ } while (0) +static gboolean +_gst_vaapi_image_map(GstVaapiImage *image); + +static gboolean +_gst_vaapi_image_unmap(GstVaapiImage *image); + static void gst_vaapi_image_destroy(GstVaapiImage *image) { GstVaapiImagePrivate * const priv = image->priv; VAStatus status; - gst_vaapi_image_unmap(image); + _gst_vaapi_image_unmap(image); if (priv->internal_image.image_id != VA_INVALID_ID) { GST_VAAPI_DISPLAY_LOCK(priv->display); @@ -497,12 +503,18 @@ gst_vaapi_image_is_mapped(GstVaapiImage *image) gboolean gst_vaapi_image_map(GstVaapiImage *image) { - void *image_data; - VAStatus status; - g_return_val_if_fail(GST_VAAPI_IS_IMAGE(image), FALSE); g_return_val_if_fail(image->priv->is_constructed, FALSE); + return _gst_vaapi_image_map(image); +} + +gboolean +_gst_vaapi_image_map(GstVaapiImage *image) +{ + void *image_data; + VAStatus status; + if (_gst_vaapi_image_is_mapped(image)) return TRUE; @@ -523,11 +535,17 @@ gst_vaapi_image_map(GstVaapiImage *image) gboolean gst_vaapi_image_unmap(GstVaapiImage *image) { - VAStatus status; - g_return_val_if_fail(GST_VAAPI_IS_IMAGE(image), FALSE); g_return_val_if_fail(image->priv->is_constructed, FALSE); + return _gst_vaapi_image_unmap(image); +} + +gboolean +_gst_vaapi_image_unmap(GstVaapiImage *image) +{ + VAStatus status; + if (!_gst_vaapi_image_is_mapped(image)) return FALSE;