From 334dd704b668a59be93892fcc0733a9f588a388c Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Mon, 15 Sep 2014 14:57:57 +0200 Subject: [PATCH] surface: re-indent all GstVaapiSurface related source code. --- gst-libs/gst/vaapi/gstvaapisurface.c | 866 ++++++++++------------ gst-libs/gst/vaapi/gstvaapisurface.h | 128 ++-- gst-libs/gst/vaapi/gstvaapisurface_priv.h | 46 +- 3 files changed, 479 insertions(+), 561 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapisurface.c b/gst-libs/gst/vaapi/gstvaapisurface.c index ba848cb774..ce211fe9f0 100644 --- a/gst-libs/gst/vaapi/gstvaapisurface.c +++ b/gst-libs/gst/vaapi/gstvaapisurface.c @@ -41,162 +41,148 @@ #include "gstvaapidebug.h" static gboolean -_gst_vaapi_surface_associate_subpicture( - GstVaapiSurface *surface, - GstVaapiSubpicture *subpicture, - const GstVaapiRectangle *src_rect, - const GstVaapiRectangle *dst_rect -); +_gst_vaapi_surface_associate_subpicture (GstVaapiSurface * surface, + GstVaapiSubpicture * subpicture, const GstVaapiRectangle * src_rect, + const GstVaapiRectangle * dst_rect); static gboolean -_gst_vaapi_surface_deassociate_subpicture( - GstVaapiSurface *surface, - GstVaapiSubpicture *subpicture -); +_gst_vaapi_surface_deassociate_subpicture (GstVaapiSurface * surface, + GstVaapiSubpicture * subpicture); static void -destroy_subpicture_cb(gpointer subpicture, gpointer surface) +destroy_subpicture_cb (gpointer subpicture, gpointer surface) { - _gst_vaapi_surface_deassociate_subpicture(surface, subpicture); - gst_vaapi_object_unref(subpicture); + _gst_vaapi_surface_deassociate_subpicture (surface, subpicture); + gst_vaapi_object_unref (subpicture); } static void -gst_vaapi_surface_destroy_subpictures(GstVaapiSurface *surface) +gst_vaapi_surface_destroy_subpictures (GstVaapiSurface * surface) { - if (surface->subpictures) { - g_ptr_array_foreach(surface->subpictures, destroy_subpicture_cb, - surface); - g_ptr_array_free(surface->subpictures, TRUE); - surface->subpictures = NULL; - } + if (surface->subpictures) { + g_ptr_array_foreach (surface->subpictures, destroy_subpicture_cb, surface); + g_ptr_array_free (surface->subpictures, TRUE); + surface->subpictures = NULL; + } } static void -gst_vaapi_surface_destroy(GstVaapiSurface *surface) +gst_vaapi_surface_destroy (GstVaapiSurface * surface) { - GstVaapiDisplay * const display = GST_VAAPI_OBJECT_DISPLAY(surface); - VASurfaceID surface_id; - VAStatus status; + GstVaapiDisplay *const display = GST_VAAPI_OBJECT_DISPLAY (surface); + VASurfaceID surface_id; + VAStatus status; - surface_id = GST_VAAPI_OBJECT_ID(surface); - GST_DEBUG("surface %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS(surface_id)); + surface_id = GST_VAAPI_OBJECT_ID (surface); + GST_DEBUG ("surface %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS (surface_id)); - gst_vaapi_surface_destroy_subpictures(surface); - gst_vaapi_surface_set_parent_context(surface, NULL); - - if (surface_id != VA_INVALID_SURFACE) { - GST_VAAPI_DISPLAY_LOCK(display); - status = vaDestroySurfaces( - GST_VAAPI_DISPLAY_VADISPLAY(display), - &surface_id, 1 - ); - GST_VAAPI_DISPLAY_UNLOCK(display); - if (!vaapi_check_status(status, "vaDestroySurfaces()")) - g_warning("failed to destroy surface %" GST_VAAPI_ID_FORMAT, - GST_VAAPI_ID_ARGS(surface_id)); - GST_VAAPI_OBJECT_ID(surface) = VA_INVALID_SURFACE; - } + gst_vaapi_surface_destroy_subpictures (surface); + gst_vaapi_surface_set_parent_context (surface, NULL); + + if (surface_id != VA_INVALID_SURFACE) { + GST_VAAPI_DISPLAY_LOCK (display); + status = vaDestroySurfaces (GST_VAAPI_DISPLAY_VADISPLAY (display), + &surface_id, 1); + GST_VAAPI_DISPLAY_UNLOCK (display); + if (!vaapi_check_status (status, "vaDestroySurfaces()")) + g_warning ("failed to destroy surface %" GST_VAAPI_ID_FORMAT, + GST_VAAPI_ID_ARGS (surface_id)); + GST_VAAPI_OBJECT_ID (surface) = VA_INVALID_SURFACE; + } } static gboolean -gst_vaapi_surface_create(GstVaapiSurface *surface, +gst_vaapi_surface_create (GstVaapiSurface * surface, GstVaapiChromaType chroma_type, guint width, guint height) { - GstVaapiDisplay * const display = GST_VAAPI_OBJECT_DISPLAY(surface); - VASurfaceID surface_id; - VAStatus status; - guint va_chroma_format; + GstVaapiDisplay *const display = GST_VAAPI_OBJECT_DISPLAY (surface); + VASurfaceID surface_id; + VAStatus status; + guint va_chroma_format; - va_chroma_format = from_GstVaapiChromaType(chroma_type); - if (!va_chroma_format) - goto error_unsupported_chroma_type; + va_chroma_format = from_GstVaapiChromaType (chroma_type); + if (!va_chroma_format) + goto error_unsupported_chroma_type; - GST_VAAPI_DISPLAY_LOCK(display); - status = vaCreateSurfaces( - GST_VAAPI_DISPLAY_VADISPLAY(display), - width, height, va_chroma_format, - 1, &surface_id - ); - GST_VAAPI_DISPLAY_UNLOCK(display); - if (!vaapi_check_status(status, "vaCreateSurfaces()")) - return FALSE; - - surface->format = GST_VIDEO_FORMAT_UNKNOWN; - surface->chroma_type = chroma_type; - surface->width = width; - surface->height = height; - - GST_DEBUG("surface %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS(surface_id)); - GST_VAAPI_OBJECT_ID(surface) = surface_id; - return TRUE; - - /* ERRORS */ -error_unsupported_chroma_type: - GST_ERROR("unsupported chroma-type %u", chroma_type); + GST_VAAPI_DISPLAY_LOCK (display); + status = vaCreateSurfaces (GST_VAAPI_DISPLAY_VADISPLAY (display), + width, height, va_chroma_format, 1, &surface_id); + GST_VAAPI_DISPLAY_UNLOCK (display); + if (!vaapi_check_status (status, "vaCreateSurfaces()")) return FALSE; + + surface->format = GST_VIDEO_FORMAT_UNKNOWN; + surface->chroma_type = chroma_type; + surface->width = width; + surface->height = height; + + GST_DEBUG ("surface %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS (surface_id)); + GST_VAAPI_OBJECT_ID (surface) = surface_id; + return TRUE; + + /* ERRORS */ +error_unsupported_chroma_type: + GST_ERROR ("unsupported chroma-type %u", chroma_type); + return FALSE; } static gboolean -gst_vaapi_surface_create_with_format(GstVaapiSurface *surface, +gst_vaapi_surface_create_with_format (GstVaapiSurface * surface, GstVideoFormat format, guint width, guint height) { #if VA_CHECK_VERSION(0,34,0) - GstVaapiDisplay * const display = GST_VAAPI_OBJECT_DISPLAY(surface); - VASurfaceID surface_id; - VAStatus status; - guint chroma_type, va_chroma_format; - const VAImageFormat *va_format; - VASurfaceAttrib attrib; + GstVaapiDisplay *const display = GST_VAAPI_OBJECT_DISPLAY (surface); + VASurfaceID surface_id; + VAStatus status; + guint chroma_type, va_chroma_format; + const VAImageFormat *va_format; + VASurfaceAttrib attrib; - va_format = gst_vaapi_video_format_to_va_format(format); - if (!va_format) - goto error_unsupported_format; + va_format = gst_vaapi_video_format_to_va_format (format); + if (!va_format) + goto error_unsupported_format; - chroma_type = gst_vaapi_video_format_get_chroma_type(format); - if (!chroma_type) - goto error_unsupported_format; + chroma_type = gst_vaapi_video_format_get_chroma_type (format); + if (!chroma_type) + goto error_unsupported_format; - va_chroma_format = from_GstVaapiChromaType(chroma_type); - if (!va_chroma_format) - goto error_unsupported_format; + va_chroma_format = from_GstVaapiChromaType (chroma_type); + if (!va_chroma_format) + goto error_unsupported_format; - attrib.flags = VA_SURFACE_ATTRIB_SETTABLE; - attrib.type = VASurfaceAttribPixelFormat; - attrib.value.type = VAGenericValueTypeInteger; - attrib.value.value.i = va_format->fourcc; + attrib.flags = VA_SURFACE_ATTRIB_SETTABLE; + attrib.type = VASurfaceAttribPixelFormat; + attrib.value.type = VAGenericValueTypeInteger; + attrib.value.value.i = va_format->fourcc; - GST_VAAPI_DISPLAY_LOCK(display); - status = vaCreateSurfaces( - GST_VAAPI_DISPLAY_VADISPLAY(display), - va_chroma_format, width, height, - &surface_id, 1, - &attrib, 1 - ); - GST_VAAPI_DISPLAY_UNLOCK(display); - if (!vaapi_check_status(status, "vaCreateSurfaces()")) - return FALSE; + GST_VAAPI_DISPLAY_LOCK (display); + status = vaCreateSurfaces (GST_VAAPI_DISPLAY_VADISPLAY (display), + va_chroma_format, width, height, &surface_id, 1, &attrib, 1); + GST_VAAPI_DISPLAY_UNLOCK (display); + if (!vaapi_check_status (status, "vaCreateSurfaces()")) + return FALSE; - surface->format = format; - surface->chroma_type = chroma_type; - surface->width = width; - surface->height = height; + surface->format = format; + surface->chroma_type = chroma_type; + surface->width = width; + surface->height = height; - GST_DEBUG("surface %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS(surface_id)); - GST_VAAPI_OBJECT_ID(surface) = surface_id; - return TRUE; + GST_DEBUG ("surface %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS (surface_id)); + GST_VAAPI_OBJECT_ID (surface) = surface_id; + return TRUE; - /* ERRORS */ + /* ERRORS */ error_unsupported_format: - GST_ERROR("unsupported format %s", gst_vaapi_video_format_to_string(format)); - return FALSE; + GST_ERROR ("unsupported format %s", + gst_vaapi_video_format_to_string (format)); + return FALSE; #else - return FALSE; + return FALSE; #endif } #define gst_vaapi_surface_finalize gst_vaapi_surface_destroy -GST_VAAPI_OBJECT_DEFINE_CLASS(GstVaapiSurface, gst_vaapi_surface) +GST_VAAPI_OBJECT_DEFINE_CLASS (GstVaapiSurface, gst_vaapi_surface); /** * gst_vaapi_surface_new: @@ -211,28 +197,24 @@ GST_VAAPI_OBJECT_DEFINE_CLASS(GstVaapiSurface, gst_vaapi_surface) * Return value: the newly allocated #GstVaapiSurface object */ GstVaapiSurface * -gst_vaapi_surface_new( - GstVaapiDisplay *display, - GstVaapiChromaType chroma_type, - guint width, - guint height -) +gst_vaapi_surface_new (GstVaapiDisplay * display, + GstVaapiChromaType chroma_type, guint width, guint height) { - GstVaapiSurface *surface; + GstVaapiSurface *surface; - GST_DEBUG("size %ux%u, chroma type 0x%x", width, height, chroma_type); + GST_DEBUG ("size %ux%u, chroma type 0x%x", width, height, chroma_type); - surface = gst_vaapi_object_new(gst_vaapi_surface_class(), display); - if (!surface) - return NULL; + surface = gst_vaapi_object_new (gst_vaapi_surface_class (), display); + if (!surface) + return NULL; - if (!gst_vaapi_surface_create(surface, chroma_type, width, height)) - goto error; - return surface; + if (!gst_vaapi_surface_create (surface, chroma_type, width, height)) + goto error; + return surface; error: - gst_vaapi_object_unref(surface); - return NULL; + gst_vaapi_object_unref (surface); + return NULL; } /** @@ -250,29 +232,25 @@ error: * supported or failed. */ GstVaapiSurface * -gst_vaapi_surface_new_with_format( - GstVaapiDisplay *display, - GstVideoFormat format, - guint width, - guint height -) +gst_vaapi_surface_new_with_format (GstVaapiDisplay * display, + GstVideoFormat format, guint width, guint height) { - GstVaapiSurface *surface; + GstVaapiSurface *surface; - GST_DEBUG("size %ux%u, format %s", width, height, - gst_vaapi_video_format_to_string(format)); + GST_DEBUG ("size %ux%u, format %s", width, height, + gst_vaapi_video_format_to_string (format)); - surface = gst_vaapi_object_new(gst_vaapi_surface_class(), display); - if (!surface) - return NULL; + surface = gst_vaapi_object_new (gst_vaapi_surface_class (), display); + if (!surface) + return NULL; - if (!gst_vaapi_surface_create_with_format(surface, format, width, height)) - goto error; - return surface; + if (!gst_vaapi_surface_create_with_format (surface, format, width, height)) + goto error; + return surface; error: - gst_vaapi_object_unref(surface); - return NULL; + gst_vaapi_object_unref (surface); + return NULL; } /** @@ -284,11 +262,11 @@ error: * Return value: the underlying VA surface id */ GstVaapiID -gst_vaapi_surface_get_id(GstVaapiSurface *surface) +gst_vaapi_surface_get_id (GstVaapiSurface * surface) { - g_return_val_if_fail(surface != NULL, VA_INVALID_SURFACE); + g_return_val_if_fail (surface != NULL, VA_INVALID_SURFACE); - return GST_VAAPI_OBJECT_ID(surface); + return GST_VAAPI_OBJECT_ID (surface); } /** @@ -300,11 +278,11 @@ gst_vaapi_surface_get_id(GstVaapiSurface *surface) * Return value: the #GstVaapiChromaType */ GstVaapiChromaType -gst_vaapi_surface_get_chroma_type(GstVaapiSurface *surface) +gst_vaapi_surface_get_chroma_type (GstVaapiSurface * surface) { - g_return_val_if_fail(surface != NULL, 0); + g_return_val_if_fail (surface != NULL, 0); - return GST_VAAPI_SURFACE_CHROMA_TYPE(surface); + return GST_VAAPI_SURFACE_CHROMA_TYPE (surface); } /** @@ -318,21 +296,21 @@ gst_vaapi_surface_get_chroma_type(GstVaapiSurface *surface) * the underlying video format could not be determined */ GstVideoFormat -gst_vaapi_surface_get_format(GstVaapiSurface *surface) +gst_vaapi_surface_get_format (GstVaapiSurface * surface) { - g_return_val_if_fail(surface != NULL, 0); + g_return_val_if_fail (surface != NULL, 0); - /* Try to determine the underlying VA surface format */ - if (surface->format == GST_VIDEO_FORMAT_UNKNOWN) { - GstVaapiImage * const image = gst_vaapi_surface_derive_image(surface); - if (image) { - surface->format = GST_VAAPI_IMAGE_FORMAT(image); - gst_vaapi_object_unref(image); - } - if (surface->format == GST_VIDEO_FORMAT_UNKNOWN) - surface->format = GST_VIDEO_FORMAT_ENCODED; + /* Try to determine the underlying VA surface format */ + if (surface->format == GST_VIDEO_FORMAT_UNKNOWN) { + GstVaapiImage *const image = gst_vaapi_surface_derive_image (surface); + if (image) { + surface->format = GST_VAAPI_IMAGE_FORMAT (image); + gst_vaapi_object_unref (image); } - return GST_VAAPI_SURFACE_FORMAT(surface); + if (surface->format == GST_VIDEO_FORMAT_UNKNOWN) + surface->format = GST_VIDEO_FORMAT_ENCODED; + } + return GST_VAAPI_SURFACE_FORMAT (surface); } /** @@ -344,11 +322,11 @@ gst_vaapi_surface_get_format(GstVaapiSurface *surface) * Return value: the surface width, in pixels */ guint -gst_vaapi_surface_get_width(GstVaapiSurface *surface) +gst_vaapi_surface_get_width (GstVaapiSurface * surface) { - g_return_val_if_fail(surface != NULL, 0); + g_return_val_if_fail (surface != NULL, 0); - return GST_VAAPI_SURFACE_WIDTH(surface); + return GST_VAAPI_SURFACE_WIDTH (surface); } /** @@ -360,35 +338,32 @@ gst_vaapi_surface_get_width(GstVaapiSurface *surface) * Return value: the surface height, in pixels. */ guint -gst_vaapi_surface_get_height(GstVaapiSurface *surface) +gst_vaapi_surface_get_height (GstVaapiSurface * surface) { - g_return_val_if_fail(surface != NULL, 0); + g_return_val_if_fail (surface != NULL, 0); - return GST_VAAPI_SURFACE_HEIGHT(surface); + return GST_VAAPI_SURFACE_HEIGHT (surface); } /** * gst_vaapi_surface_get_size: * @surface: a #GstVaapiSurface - * @pwidth: return location for the width, or %NULL - * @pheight: return location for the height, or %NULL + * @width_ptr: return location for the width, or %NULL + * @height_ptr: return location for the height, or %NULL * * Retrieves the dimensions of a #GstVaapiSurface. */ void -gst_vaapi_surface_get_size( - GstVaapiSurface *surface, - guint *pwidth, - guint *pheight -) +gst_vaapi_surface_get_size (GstVaapiSurface * surface, + guint * width_ptr, guint * height_ptr) { - g_return_if_fail(surface != NULL); + g_return_if_fail (surface != NULL); - if (pwidth) - *pwidth = GST_VAAPI_SURFACE_WIDTH(surface); + if (width_ptr) + *width_ptr = GST_VAAPI_SURFACE_WIDTH (surface); - if (pheight) - *pheight = GST_VAAPI_SURFACE_HEIGHT(surface); + if (height_ptr) + *height_ptr = GST_VAAPI_SURFACE_HEIGHT (surface); } /** @@ -401,14 +376,12 @@ gst_vaapi_surface_get_size( * which will be released when the surface is destroyed. */ void -gst_vaapi_surface_set_parent_context( - GstVaapiSurface *surface, - GstVaapiContext *context -) +gst_vaapi_surface_set_parent_context (GstVaapiSurface * surface, + GstVaapiContext * context) { - g_return_if_fail(surface != NULL); + g_return_if_fail (surface != NULL); - surface->parent_context = NULL; + surface->parent_context = NULL; } /** @@ -422,11 +395,11 @@ gst_vaapi_surface_set_parent_context( * Return value: the parent context, if any. */ GstVaapiContext * -gst_vaapi_surface_get_parent_context(GstVaapiSurface *surface) +gst_vaapi_surface_get_parent_context (GstVaapiSurface * surface) { - g_return_val_if_fail(surface != NULL, NULL); + g_return_val_if_fail (surface != NULL, NULL); - return surface->parent_context; + return surface->parent_context; } /** @@ -454,31 +427,28 @@ gst_vaapi_surface_get_parent_context(GstVaapiSurface *surface) * on failure */ GstVaapiImage * -gst_vaapi_surface_derive_image(GstVaapiSurface *surface) +gst_vaapi_surface_derive_image (GstVaapiSurface * surface) { - GstVaapiDisplay *display; - VAImage va_image; - VAStatus status; + GstVaapiDisplay *display; + VAImage va_image; + VAStatus status; - g_return_val_if_fail(surface != NULL, NULL); + g_return_val_if_fail (surface != NULL, NULL); - display = GST_VAAPI_OBJECT_DISPLAY(surface); - va_image.image_id = VA_INVALID_ID; - va_image.buf = VA_INVALID_ID; + display = GST_VAAPI_OBJECT_DISPLAY (surface); + va_image.image_id = VA_INVALID_ID; + va_image.buf = VA_INVALID_ID; - GST_VAAPI_DISPLAY_LOCK(display); - status = vaDeriveImage( - GST_VAAPI_DISPLAY_VADISPLAY(display), - GST_VAAPI_OBJECT_ID(surface), - &va_image - ); - GST_VAAPI_DISPLAY_UNLOCK(display); - if (!vaapi_check_status(status, "vaDeriveImage()")) - return NULL; - if (va_image.image_id == VA_INVALID_ID || va_image.buf == VA_INVALID_ID) - return NULL; + GST_VAAPI_DISPLAY_LOCK (display); + status = vaDeriveImage (GST_VAAPI_DISPLAY_VADISPLAY (display), + GST_VAAPI_OBJECT_ID (surface), &va_image); + GST_VAAPI_DISPLAY_UNLOCK (display); + if (!vaapi_check_status (status, "vaDeriveImage()")) + return NULL; + if (va_image.image_id == VA_INVALID_ID || va_image.buf == VA_INVALID_ID) + return NULL; - return gst_vaapi_image_new_with_image(display, &va_image); + return gst_vaapi_image_new_with_image (display, &va_image); } /** @@ -492,41 +462,37 @@ gst_vaapi_surface_derive_image(GstVaapiSurface *surface) * Return value: %TRUE on success */ gboolean -gst_vaapi_surface_get_image(GstVaapiSurface *surface, GstVaapiImage *image) +gst_vaapi_surface_get_image (GstVaapiSurface * surface, GstVaapiImage * image) { - GstVaapiDisplay *display; - VAImageID image_id; - VAStatus status; - guint width, height; + GstVaapiDisplay *display; + VAImageID image_id; + VAStatus status; + guint width, height; - g_return_val_if_fail(surface != NULL, FALSE); - g_return_val_if_fail(image != NULL, FALSE); + g_return_val_if_fail (surface != NULL, FALSE); + g_return_val_if_fail (image != NULL, FALSE); - display = GST_VAAPI_OBJECT_DISPLAY(surface); - if (!display) - return FALSE; + display = GST_VAAPI_OBJECT_DISPLAY (surface); + if (!display) + return FALSE; - width = GST_VAAPI_IMAGE_WIDTH(image); - height = GST_VAAPI_IMAGE_HEIGHT(image); - if (width != surface->width || height != surface->height) - return FALSE; + width = GST_VAAPI_IMAGE_WIDTH (image); + height = GST_VAAPI_IMAGE_HEIGHT (image); + if (width != surface->width || height != surface->height) + return FALSE; - image_id = GST_VAAPI_OBJECT_ID(image); - if (image_id == VA_INVALID_ID) - return FALSE; + image_id = GST_VAAPI_OBJECT_ID (image); + if (image_id == VA_INVALID_ID) + return FALSE; - GST_VAAPI_DISPLAY_LOCK(display); - status = vaGetImage( - GST_VAAPI_DISPLAY_VADISPLAY(display), - GST_VAAPI_OBJECT_ID(surface), - 0, 0, width, height, - image_id - ); - GST_VAAPI_DISPLAY_UNLOCK(display); - if (!vaapi_check_status(status, "vaGetImage()")) - return FALSE; + GST_VAAPI_DISPLAY_LOCK (display); + status = vaGetImage (GST_VAAPI_DISPLAY_VADISPLAY (display), + GST_VAAPI_OBJECT_ID (surface), 0, 0, width, height, image_id); + GST_VAAPI_DISPLAY_UNLOCK (display); + if (!vaapi_check_status (status, "vaGetImage()")) + return FALSE; - return TRUE; + return TRUE; } /** @@ -540,42 +506,38 @@ gst_vaapi_surface_get_image(GstVaapiSurface *surface, GstVaapiImage *image) * Return value: %TRUE on success */ gboolean -gst_vaapi_surface_put_image(GstVaapiSurface *surface, GstVaapiImage *image) +gst_vaapi_surface_put_image (GstVaapiSurface * surface, GstVaapiImage * image) { - GstVaapiDisplay *display; - VAImageID image_id; - VAStatus status; - guint width, height; + GstVaapiDisplay *display; + VAImageID image_id; + VAStatus status; + guint width, height; - g_return_val_if_fail(surface != NULL, FALSE); - g_return_val_if_fail(image != NULL, FALSE); + g_return_val_if_fail (surface != NULL, FALSE); + g_return_val_if_fail (image != NULL, FALSE); - display = GST_VAAPI_OBJECT_DISPLAY(surface); - if (!display) - return FALSE; + display = GST_VAAPI_OBJECT_DISPLAY (surface); + if (!display) + return FALSE; - width = GST_VAAPI_IMAGE_WIDTH(image); - height = GST_VAAPI_IMAGE_HEIGHT(image); - if (width != surface->width || height != surface->height) - return FALSE; + width = GST_VAAPI_IMAGE_WIDTH (image); + height = GST_VAAPI_IMAGE_HEIGHT (image); + if (width != surface->width || height != surface->height) + return FALSE; - image_id = GST_VAAPI_OBJECT_ID(image); - if (image_id == VA_INVALID_ID) - return FALSE; + image_id = GST_VAAPI_OBJECT_ID (image); + if (image_id == VA_INVALID_ID) + return FALSE; - GST_VAAPI_DISPLAY_LOCK(display); - status = vaPutImage( - GST_VAAPI_DISPLAY_VADISPLAY(display), - GST_VAAPI_OBJECT_ID(surface), - image_id, - 0, 0, width, height, - 0, 0, width, height - ); - GST_VAAPI_DISPLAY_UNLOCK(display); - if (!vaapi_check_status(status, "vaPutImage()")) - return FALSE; + GST_VAAPI_DISPLAY_LOCK (display); + status = vaPutImage (GST_VAAPI_DISPLAY_VADISPLAY (display), + GST_VAAPI_OBJECT_ID (surface), image_id, 0, 0, width, height, + 0, 0, width, height); + GST_VAAPI_DISPLAY_UNLOCK (display); + if (!vaapi_check_status (status, "vaPutImage()")) + return FALSE; - return TRUE; + return TRUE; } /** @@ -597,100 +559,87 @@ gst_vaapi_surface_put_image(GstVaapiSurface *surface, GstVaapiImage *image) * Return value: %TRUE on success */ gboolean -gst_vaapi_surface_associate_subpicture( - GstVaapiSurface *surface, - GstVaapiSubpicture *subpicture, - const GstVaapiRectangle *src_rect, - const GstVaapiRectangle *dst_rect -) +gst_vaapi_surface_associate_subpicture (GstVaapiSurface * surface, + GstVaapiSubpicture * subpicture, + const GstVaapiRectangle * src_rect, const GstVaapiRectangle * dst_rect) { - gboolean success; + gboolean success; - g_return_val_if_fail(surface != NULL, FALSE); - g_return_val_if_fail(subpicture != NULL, FALSE); + g_return_val_if_fail (surface != NULL, FALSE); + g_return_val_if_fail (subpicture != NULL, FALSE); - if (!surface->subpictures) { - surface->subpictures = g_ptr_array_new(); - if (!surface->subpictures) - return FALSE; - } + if (!surface->subpictures) { + surface->subpictures = g_ptr_array_new (); + if (!surface->subpictures) + return FALSE; + } - if (g_ptr_array_remove_fast(surface->subpictures, subpicture)) { - success = _gst_vaapi_surface_deassociate_subpicture(surface, - subpicture); - gst_vaapi_object_unref(subpicture); - if (!success) - return FALSE; - } - - success = _gst_vaapi_surface_associate_subpicture( - surface, - subpicture, - src_rect, - dst_rect - ); + if (g_ptr_array_remove_fast (surface->subpictures, subpicture)) { + success = _gst_vaapi_surface_deassociate_subpicture (surface, subpicture); + gst_vaapi_object_unref (subpicture); if (!success) - return FALSE; + return FALSE; + } - g_ptr_array_add(surface->subpictures, gst_vaapi_object_ref(subpicture)); - return TRUE; + success = _gst_vaapi_surface_associate_subpicture (surface, + subpicture, src_rect, dst_rect); + if (!success) + return FALSE; + + g_ptr_array_add (surface->subpictures, gst_vaapi_object_ref (subpicture)); + return TRUE; } gboolean -_gst_vaapi_surface_associate_subpicture( - GstVaapiSurface *surface, - GstVaapiSubpicture *subpicture, - const GstVaapiRectangle *src_rect, - const GstVaapiRectangle *dst_rect -) +_gst_vaapi_surface_associate_subpicture (GstVaapiSurface * surface, + GstVaapiSubpicture * subpicture, + const GstVaapiRectangle * src_rect, const GstVaapiRectangle * dst_rect) { - GstVaapiDisplay *display; - GstVaapiRectangle src_rect_default, dst_rect_default; - GstVaapiImage *image; - VASurfaceID surface_id; - VAStatus status; + GstVaapiDisplay *display; + GstVaapiRectangle src_rect_default, dst_rect_default; + GstVaapiImage *image; + VASurfaceID surface_id; + VAStatus status; - display = GST_VAAPI_OBJECT_DISPLAY(surface); - if (!display) - return FALSE; + display = GST_VAAPI_OBJECT_DISPLAY (surface); + if (!display) + return FALSE; - surface_id = GST_VAAPI_OBJECT_ID(surface); - if (surface_id == VA_INVALID_SURFACE) - return FALSE; + surface_id = GST_VAAPI_OBJECT_ID (surface); + if (surface_id == VA_INVALID_SURFACE) + return FALSE; - if (!src_rect) { - image = gst_vaapi_subpicture_get_image(subpicture); - if (!image) - return FALSE; - src_rect = &src_rect_default; - src_rect_default.x = 0; - src_rect_default.y = 0; - src_rect_default.width = GST_VAAPI_IMAGE_WIDTH(image); - src_rect_default.height = GST_VAAPI_IMAGE_HEIGHT(image); - } + if (!src_rect) { + image = gst_vaapi_subpicture_get_image (subpicture); + if (!image) + return FALSE; + src_rect = &src_rect_default; + src_rect_default.x = 0; + src_rect_default.y = 0; + src_rect_default.width = GST_VAAPI_IMAGE_WIDTH (image); + src_rect_default.height = GST_VAAPI_IMAGE_HEIGHT (image); + } - if (!dst_rect) { - dst_rect = &dst_rect_default; - dst_rect_default.x = 0; - dst_rect_default.y = 0; - dst_rect_default.width = surface->width; - dst_rect_default.height = surface->height; - } + if (!dst_rect) { + dst_rect = &dst_rect_default; + dst_rect_default.x = 0; + dst_rect_default.y = 0; + dst_rect_default.width = surface->width; + dst_rect_default.height = surface->height; + } - GST_VAAPI_DISPLAY_LOCK(display); - status = vaAssociateSubpicture( - GST_VAAPI_DISPLAY_VADISPLAY(display), - GST_VAAPI_OBJECT_ID(subpicture), - &surface_id, 1, - src_rect->x, src_rect->y, src_rect->width, src_rect->height, - dst_rect->x, dst_rect->y, dst_rect->width, dst_rect->height, - from_GstVaapiSubpictureFlags(gst_vaapi_subpicture_get_flags(subpicture)) - ); - GST_VAAPI_DISPLAY_UNLOCK(display); - if (!vaapi_check_status(status, "vaAssociateSubpicture()")) - return FALSE; + GST_VAAPI_DISPLAY_LOCK (display); + status = vaAssociateSubpicture (GST_VAAPI_DISPLAY_VADISPLAY (display), + GST_VAAPI_OBJECT_ID (subpicture), &surface_id, 1, + src_rect->x, src_rect->y, src_rect->width, src_rect->height, + dst_rect->x, dst_rect->y, dst_rect->width, dst_rect->height, + from_GstVaapiSubpictureFlags (gst_vaapi_subpicture_get_flags + (subpicture))); + GST_VAAPI_DISPLAY_UNLOCK (display); + if (!vaapi_check_status (status, "vaAssociateSubpicture()")) + return FALSE; - return TRUE; + return TRUE; } /** @@ -703,62 +652,55 @@ _gst_vaapi_surface_associate_subpicture( * Return value: %TRUE on success */ gboolean -gst_vaapi_surface_deassociate_subpicture( - GstVaapiSurface *surface, - GstVaapiSubpicture *subpicture -) +gst_vaapi_surface_deassociate_subpicture (GstVaapiSurface * surface, + GstVaapiSubpicture * subpicture) { - gboolean success; + gboolean success; - g_return_val_if_fail(surface != NULL, FALSE); - g_return_val_if_fail(subpicture != NULL, FALSE); + g_return_val_if_fail (surface != NULL, FALSE); + g_return_val_if_fail (subpicture != NULL, FALSE); - if (!surface->subpictures) - return TRUE; + if (!surface->subpictures) + return TRUE; - /* First, check subpicture was really associated with this surface */ - if (!g_ptr_array_remove_fast(surface->subpictures, subpicture)) { - GST_DEBUG("subpicture %" GST_VAAPI_ID_FORMAT " was not bound to " - "surface %" GST_VAAPI_ID_FORMAT, - GST_VAAPI_ID_ARGS(GST_VAAPI_OBJECT_ID(subpicture)), - GST_VAAPI_ID_ARGS(GST_VAAPI_OBJECT_ID(surface))); - return TRUE; - } + /* First, check subpicture was really associated with this surface */ + if (!g_ptr_array_remove_fast (surface->subpictures, subpicture)) { + GST_DEBUG ("subpicture %" GST_VAAPI_ID_FORMAT " was not bound to " + "surface %" GST_VAAPI_ID_FORMAT, + GST_VAAPI_ID_ARGS (GST_VAAPI_OBJECT_ID (subpicture)), + GST_VAAPI_ID_ARGS (GST_VAAPI_OBJECT_ID (surface))); + return TRUE; + } - success = _gst_vaapi_surface_deassociate_subpicture(surface, subpicture); - gst_vaapi_object_unref(subpicture); - return success; + success = _gst_vaapi_surface_deassociate_subpicture (surface, subpicture); + gst_vaapi_object_unref (subpicture); + return success; } gboolean -_gst_vaapi_surface_deassociate_subpicture( - GstVaapiSurface *surface, - GstVaapiSubpicture *subpicture -) +_gst_vaapi_surface_deassociate_subpicture (GstVaapiSurface * surface, + GstVaapiSubpicture * subpicture) { - GstVaapiDisplay *display; - VASurfaceID surface_id; - VAStatus status; + GstVaapiDisplay *display; + VASurfaceID surface_id; + VAStatus status; - display = GST_VAAPI_OBJECT_DISPLAY(surface); - if (!display) - return FALSE; + display = GST_VAAPI_OBJECT_DISPLAY (surface); + if (!display) + return FALSE; - surface_id = GST_VAAPI_OBJECT_ID(surface); - if (surface_id == VA_INVALID_SURFACE) - return FALSE; + surface_id = GST_VAAPI_OBJECT_ID (surface); + if (surface_id == VA_INVALID_SURFACE) + return FALSE; - GST_VAAPI_DISPLAY_LOCK(display); - status = vaDeassociateSubpicture( - GST_VAAPI_DISPLAY_VADISPLAY(display), - GST_VAAPI_OBJECT_ID(subpicture), - &surface_id, 1 - ); - GST_VAAPI_DISPLAY_UNLOCK(display); - if (!vaapi_check_status(status, "vaDeassociateSubpicture()")) - return FALSE; + GST_VAAPI_DISPLAY_LOCK (display); + status = vaDeassociateSubpicture (GST_VAAPI_DISPLAY_VADISPLAY (display), + GST_VAAPI_OBJECT_ID (subpicture), &surface_id, 1); + GST_VAAPI_DISPLAY_UNLOCK (display); + if (!vaapi_check_status (status, "vaDeassociateSubpicture()")) + return FALSE; - return TRUE; + return TRUE; } /** @@ -771,27 +713,25 @@ _gst_vaapi_surface_deassociate_subpicture( * Return value: %TRUE on success */ gboolean -gst_vaapi_surface_sync(GstVaapiSurface *surface) +gst_vaapi_surface_sync (GstVaapiSurface * surface) { - GstVaapiDisplay *display; - VAStatus status; + GstVaapiDisplay *display; + VAStatus status; - g_return_val_if_fail(surface != NULL, FALSE); + g_return_val_if_fail (surface != NULL, FALSE); - display = GST_VAAPI_OBJECT_DISPLAY(surface); - if (!display) - return FALSE; + display = GST_VAAPI_OBJECT_DISPLAY (surface); + if (!display) + return FALSE; - GST_VAAPI_DISPLAY_LOCK(display); - status = vaSyncSurface( - GST_VAAPI_DISPLAY_VADISPLAY(display), - GST_VAAPI_OBJECT_ID(surface) - ); - GST_VAAPI_DISPLAY_UNLOCK(display); - if (!vaapi_check_status(status, "vaSyncSurface()")) - return FALSE; + GST_VAAPI_DISPLAY_LOCK (display); + status = vaSyncSurface (GST_VAAPI_DISPLAY_VADISPLAY (display), + GST_VAAPI_OBJECT_ID (surface)); + GST_VAAPI_DISPLAY_UNLOCK (display); + if (!vaapi_check_status (status, "vaSyncSurface()")) + return FALSE; - return TRUE; + return TRUE; } /** @@ -805,29 +745,24 @@ gst_vaapi_surface_sync(GstVaapiSurface *surface) * Return value: %TRUE on success */ gboolean -gst_vaapi_surface_query_status( - GstVaapiSurface *surface, - GstVaapiSurfaceStatus *pstatus -) +gst_vaapi_surface_query_status (GstVaapiSurface * surface, + GstVaapiSurfaceStatus * pstatus) { - VASurfaceStatus surface_status; - VAStatus status; + VASurfaceStatus surface_status; + VAStatus status; - g_return_val_if_fail(surface != NULL, FALSE); + g_return_val_if_fail (surface != NULL, FALSE); - GST_VAAPI_OBJECT_LOCK_DISPLAY(surface); - status = vaQuerySurfaceStatus( - GST_VAAPI_OBJECT_VADISPLAY(surface), - GST_VAAPI_OBJECT_ID(surface), - &surface_status - ); - GST_VAAPI_OBJECT_UNLOCK_DISPLAY(surface); - if (!vaapi_check_status(status, "vaQuerySurfaceStatus()")) - return FALSE; + GST_VAAPI_OBJECT_LOCK_DISPLAY (surface); + status = vaQuerySurfaceStatus (GST_VAAPI_OBJECT_VADISPLAY (surface), + GST_VAAPI_OBJECT_ID (surface), &surface_status); + GST_VAAPI_OBJECT_UNLOCK_DISPLAY (surface); + if (!vaapi_check_status (status, "vaQuerySurfaceStatus()")) + return FALSE; - if (pstatus) - *pstatus = to_GstVaapiSurfaceStatus(surface_status); - return TRUE; + if (pstatus) + *pstatus = to_GstVaapiSurfaceStatus (surface_status); + return TRUE; } /** @@ -844,54 +779,51 @@ gst_vaapi_surface_query_status( * Return value: %TRUE on success */ gboolean -gst_vaapi_surface_set_subpictures_from_composition( - GstVaapiSurface *surface, - GstVideoOverlayComposition *composition, - gboolean propagate_context -) +gst_vaapi_surface_set_subpictures_from_composition (GstVaapiSurface * surface, + GstVideoOverlayComposition * composition, gboolean propagate_context) { - GstVaapiDisplay *display; - guint n, nb_rectangles; + GstVaapiDisplay *display; + guint n, nb_rectangles; - g_return_val_if_fail(surface != NULL, FALSE); + g_return_val_if_fail (surface != NULL, FALSE); - if (propagate_context && surface->parent_context) - return gst_vaapi_context_apply_composition(surface->parent_context, - composition); + if (propagate_context && surface->parent_context) + return gst_vaapi_context_apply_composition (surface->parent_context, + composition); - display = GST_VAAPI_OBJECT_DISPLAY(surface); - if (!display) - return FALSE; + display = GST_VAAPI_OBJECT_DISPLAY (surface); + if (!display) + return FALSE; - /* Clear current subpictures */ - gst_vaapi_surface_destroy_subpictures(surface); + /* Clear current subpictures */ + gst_vaapi_surface_destroy_subpictures (surface); - if (!composition) - return TRUE; - - nb_rectangles = gst_video_overlay_composition_n_rectangles (composition); - - /* Overlay all the rectangles cantained in the overlay composition */ - for (n = 0; n < nb_rectangles; ++n) { - GstVideoOverlayRectangle *rect; - GstVaapiRectangle sub_rect; - GstVaapiSubpicture *subpicture; - - rect = gst_video_overlay_composition_get_rectangle (composition, n); - subpicture = gst_vaapi_subpicture_new_from_overlay_rectangle (display, - rect); - - gst_video_overlay_rectangle_get_render_rectangle (rect, - (gint *)&sub_rect.x, (gint *)&sub_rect.y, - &sub_rect.width, &sub_rect.height); - - if (!gst_vaapi_surface_associate_subpicture (surface, subpicture, - NULL, &sub_rect)) { - GST_WARNING ("could not render overlay rectangle %p", rect); - gst_vaapi_object_unref (subpicture); - return FALSE; - } - gst_vaapi_object_unref (subpicture); - } + if (!composition) return TRUE; + + nb_rectangles = gst_video_overlay_composition_n_rectangles (composition); + + /* Overlay all the rectangles cantained in the overlay composition */ + for (n = 0; n < nb_rectangles; ++n) { + GstVideoOverlayRectangle *rect; + GstVaapiRectangle sub_rect; + GstVaapiSubpicture *subpicture; + + rect = gst_video_overlay_composition_get_rectangle (composition, n); + subpicture = gst_vaapi_subpicture_new_from_overlay_rectangle (display, + rect); + + gst_video_overlay_rectangle_get_render_rectangle (rect, + (gint *) & sub_rect.x, (gint *) & sub_rect.y, + &sub_rect.width, &sub_rect.height); + + if (!gst_vaapi_surface_associate_subpicture (surface, subpicture, + NULL, &sub_rect)) { + GST_WARNING ("could not render overlay rectangle %p", rect); + gst_vaapi_object_unref (subpicture); + return FALSE; + } + gst_vaapi_object_unref (subpicture); + } + return TRUE; } diff --git a/gst-libs/gst/vaapi/gstvaapisurface.h b/gst-libs/gst/vaapi/gstvaapisurface.h index 48f86622e3..e14861aac1 100644 --- a/gst-libs/gst/vaapi/gstvaapisurface.h +++ b/gst-libs/gst/vaapi/gstvaapisurface.h @@ -67,15 +67,16 @@ G_BEGIN_DECLS * * The set of all chroma types for #GstVaapiSurface. */ -typedef enum { - GST_VAAPI_CHROMA_TYPE_YUV420 = 1, - GST_VAAPI_CHROMA_TYPE_YUV422, - GST_VAAPI_CHROMA_TYPE_YUV444, - GST_VAAPI_CHROMA_TYPE_YUV411, - GST_VAAPI_CHROMA_TYPE_YUV410, - GST_VAAPI_CHROMA_TYPE_YUV400, - GST_VAAPI_CHROMA_TYPE_RGB32, - GST_VAAPI_CHROMA_TYPE_RGB16 +typedef enum +{ + GST_VAAPI_CHROMA_TYPE_YUV420 = 1, + GST_VAAPI_CHROMA_TYPE_YUV422, + GST_VAAPI_CHROMA_TYPE_YUV444, + GST_VAAPI_CHROMA_TYPE_YUV411, + GST_VAAPI_CHROMA_TYPE_YUV410, + GST_VAAPI_CHROMA_TYPE_YUV400, + GST_VAAPI_CHROMA_TYPE_RGB32, + GST_VAAPI_CHROMA_TYPE_RGB16 } GstVaapiChromaType; /** @@ -91,11 +92,12 @@ typedef enum { * * The set of all surface status for #GstVaapiSurface. */ -typedef enum { - GST_VAAPI_SURFACE_STATUS_IDLE = 1 << 0, - GST_VAAPI_SURFACE_STATUS_RENDERING = 1 << 1, - GST_VAAPI_SURFACE_STATUS_DISPLAYING = 1 << 2, - GST_VAAPI_SURFACE_STATUS_SKIPPED = 1 << 3 +typedef enum +{ + GST_VAAPI_SURFACE_STATUS_IDLE = 1 << 0, + GST_VAAPI_SURFACE_STATUS_RENDERING = 1 << 1, + GST_VAAPI_SURFACE_STATUS_DISPLAYING = 1 << 2, + GST_VAAPI_SURFACE_STATUS_SKIPPED = 1 << 3 } GstVaapiSurfaceStatus; /** @@ -121,21 +123,22 @@ typedef enum { * * The set of all render flags for gst_vaapi_window_put_surface(). */ -typedef enum { - /* Picture structure */ - GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD = 0x01 << 0, - GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD = 0x02 << 0, - GST_VAAPI_PICTURE_STRUCTURE_FRAME = 0x03 << 0, - GST_VAAPI_PICTURE_STRUCTURE_MASK = 0x00000003, /* 2 bits */ +typedef enum +{ + /* Picture structure */ + GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD = 0x01 << 0, + GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD = 0x02 << 0, + GST_VAAPI_PICTURE_STRUCTURE_FRAME = 0x03 << 0, + GST_VAAPI_PICTURE_STRUCTURE_MASK = 0x00000003, /* 2 bits */ - /* Color standard */ - GST_VAAPI_COLOR_STANDARD_ITUR_BT_601 = 0x01 << 2, - GST_VAAPI_COLOR_STANDARD_ITUR_BT_709 = 0x02 << 2, - GST_VAAPI_COLOR_STANDARD_ITUR_BT_470M = 0x03 << 2, - GST_VAAPI_COLOR_STANDARD_ITUR_BT_470BG = 0x04 << 2, - GST_VAAPI_COLOR_STANDARD_SMPTE_170M = 0x05 << 2, - GST_VAAPI_COLOR_STANDARD_SMPTE_240M = 0x06 << 2, - GST_VAAPI_COLOR_STANDARD_MASK = 0x0000003c, /* 4 bits */ + /* Color standard */ + GST_VAAPI_COLOR_STANDARD_ITUR_BT_601 = 0x01 << 2, + GST_VAAPI_COLOR_STANDARD_ITUR_BT_709 = 0x02 << 2, + GST_VAAPI_COLOR_STANDARD_ITUR_BT_470M = 0x03 << 2, + GST_VAAPI_COLOR_STANDARD_ITUR_BT_470BG = 0x04 << 2, + GST_VAAPI_COLOR_STANDARD_SMPTE_170M = 0x05 << 2, + GST_VAAPI_COLOR_STANDARD_SMPTE_240M = 0x06 << 2, + GST_VAAPI_COLOR_STANDARD_MASK = 0x0000003c, /* 4 bits */ } GstVaapiSurfaceRenderFlags; #define GST_VAAPI_SURFACE(obj) \ @@ -145,81 +148,60 @@ typedef struct _GstVaapiSurface GstVaapiSurface; typedef struct _GstVaapiSurfaceProxy GstVaapiSurfaceProxy; GstVaapiSurface * -gst_vaapi_surface_new( - GstVaapiDisplay *display, - GstVaapiChromaType chroma_type, - guint width, - guint height -); +gst_vaapi_surface_new (GstVaapiDisplay * display, + GstVaapiChromaType chroma_type, guint width, guint height); GstVaapiSurface * -gst_vaapi_surface_new_with_format( - GstVaapiDisplay *display, - GstVideoFormat format, - guint width, - guint height -); +gst_vaapi_surface_new_with_format (GstVaapiDisplay * display, + GstVideoFormat format, guint width, guint height); GstVaapiID -gst_vaapi_surface_get_id(GstVaapiSurface *surface); +gst_vaapi_surface_get_id (GstVaapiSurface * surface); GstVaapiChromaType -gst_vaapi_surface_get_chroma_type(GstVaapiSurface *surface); +gst_vaapi_surface_get_chroma_type (GstVaapiSurface * surface); GstVideoFormat -gst_vaapi_surface_get_format(GstVaapiSurface *surface); +gst_vaapi_surface_get_format (GstVaapiSurface * surface); guint -gst_vaapi_surface_get_width(GstVaapiSurface *surface); +gst_vaapi_surface_get_width (GstVaapiSurface * surface); guint -gst_vaapi_surface_get_height(GstVaapiSurface *surface); +gst_vaapi_surface_get_height (GstVaapiSurface * surface); void -gst_vaapi_surface_get_size( - GstVaapiSurface *surface, - guint *pwidth, - guint *pheight -); +gst_vaapi_surface_get_size (GstVaapiSurface * surface, guint * width_ptr, + guint * height_ptr); GstVaapiImage * -gst_vaapi_surface_derive_image(GstVaapiSurface *surface); +gst_vaapi_surface_derive_image (GstVaapiSurface * surface); gboolean -gst_vaapi_surface_get_image(GstVaapiSurface *surface, GstVaapiImage *image); +gst_vaapi_surface_get_image (GstVaapiSurface * surface, GstVaapiImage * image); gboolean -gst_vaapi_surface_put_image(GstVaapiSurface *surface, GstVaapiImage *image); +gst_vaapi_surface_put_image (GstVaapiSurface * surface, GstVaapiImage * image); gboolean -gst_vaapi_surface_associate_subpicture( - GstVaapiSurface *surface, - GstVaapiSubpicture *subpicture, - const GstVaapiRectangle *src_rect, - const GstVaapiRectangle *dst_rect -); +gst_vaapi_surface_associate_subpicture (GstVaapiSurface * surface, + GstVaapiSubpicture * subpicture, const GstVaapiRectangle * src_rect, + const GstVaapiRectangle * dst_rect); gboolean -gst_vaapi_surface_deassociate_subpicture( - GstVaapiSurface *surface, - GstVaapiSubpicture *subpicture -); +gst_vaapi_surface_deassociate_subpicture (GstVaapiSurface * surface, + GstVaapiSubpicture * subpicture); gboolean -gst_vaapi_surface_sync(GstVaapiSurface *surface); +gst_vaapi_surface_sync (GstVaapiSurface * surface); gboolean -gst_vaapi_surface_query_status( - GstVaapiSurface *surface, - GstVaapiSurfaceStatus *pstatus -); +gst_vaapi_surface_query_status (GstVaapiSurface * surface, + GstVaapiSurfaceStatus * pstatus); gboolean -gst_vaapi_surface_set_subpictures_from_composition( - GstVaapiSurface *surface, - GstVideoOverlayComposition *composition, - gboolean propagate_context -); +gst_vaapi_surface_set_subpictures_from_composition (GstVaapiSurface * surface, + GstVideoOverlayComposition * composition, gboolean propagate_context); G_END_DECLS diff --git a/gst-libs/gst/vaapi/gstvaapisurface_priv.h b/gst-libs/gst/vaapi/gstvaapisurface_priv.h index 468226d981..dc5663cce8 100644 --- a/gst-libs/gst/vaapi/gstvaapisurface_priv.h +++ b/gst-libs/gst/vaapi/gstvaapisurface_priv.h @@ -27,6 +27,8 @@ #include #include "gstvaapiobject_priv.h" +G_BEGIN_DECLS + typedef struct _GstVaapiSurfaceClass GstVaapiSurfaceClass; /** @@ -34,16 +36,17 @@ typedef struct _GstVaapiSurfaceClass GstVaapiSurfaceClass; * * A VA surface wrapper. */ -struct _GstVaapiSurface { - /*< private >*/ - GstVaapiObject parent_instance; +struct _GstVaapiSurface +{ + /*< private >*/ + GstVaapiObject parent_instance; - GstVideoFormat format; - guint width; - guint height; - GstVaapiChromaType chroma_type; - GPtrArray *subpictures; - GstVaapiContext *parent_context; + GstVideoFormat format; + guint width; + guint height; + GstVaapiChromaType chroma_type; + GPtrArray *subpictures; + GstVaapiContext *parent_context; }; /** @@ -51,9 +54,10 @@ struct _GstVaapiSurface { * * A VA surface wrapper class. */ -struct _GstVaapiSurfaceClass { - /*< private >*/ - GstVaapiObjectClass parent_class; +struct _GstVaapiSurfaceClass +{ + /*< private >*/ + GstVaapiObjectClass parent_class; }; /** @@ -66,7 +70,7 @@ struct _GstVaapiSurfaceClass { */ #undef GST_VAAPI_SURFACE_CHROMA_TYPE #define GST_VAAPI_SURFACE_CHROMA_TYPE(surface) \ - GST_VAAPI_SURFACE(surface)->chroma_type + (GST_VAAPI_SURFACE (surface)->chroma_type) /** * GST_VAAPI_SURFACE_SURFACE_FORMAT: @@ -78,7 +82,7 @@ struct _GstVaapiSurfaceClass { */ #undef GST_VAAPI_SURFACE_FORMAT #define GST_VAAPI_SURFACE_FORMAT(surface) \ - GST_VAAPI_SURFACE(surface)->format + (GST_VAAPI_SURFACE (surface)->format) /** * GST_VAAPI_SURFACE_SURFACE_WIDTH: @@ -90,7 +94,7 @@ struct _GstVaapiSurfaceClass { */ #undef GST_VAAPI_SURFACE_WIDTH #define GST_VAAPI_SURFACE_WIDTH(surface) \ - GST_VAAPI_SURFACE(surface)->width + (GST_VAAPI_SURFACE (surface)->width) /** * GST_VAAPI_SURFACE_SURFACE_HEIGHT: @@ -102,17 +106,17 @@ struct _GstVaapiSurfaceClass { */ #undef GST_VAAPI_SURFACE_HEIGHT #define GST_VAAPI_SURFACE_HEIGHT(surface) \ - GST_VAAPI_SURFACE(surface)->height + (GST_VAAPI_SURFACE (surface)->height) G_GNUC_INTERNAL void -gst_vaapi_surface_set_parent_context( - GstVaapiSurface *surface, - GstVaapiContext *context -); +gst_vaapi_surface_set_parent_context (GstVaapiSurface * surface, + GstVaapiContext * context); G_GNUC_INTERNAL GstVaapiContext * -gst_vaapi_surface_get_parent_context(GstVaapiSurface *surface); +gst_vaapi_surface_get_parent_context (GstVaapiSurface * surface); + +G_END_DECLS #endif /* GST_VAAPI_SURFACE_PRIV_H */