From 53fc8bb4c79be5cebde22a5b238699df93ec8165 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Wed, 24 Jul 2013 11:41:05 +0200 Subject: [PATCH] libs: add type definitions for GstVaapiPoint and GstVaapiRectangle. Add helper functions to describe GstVaapiPoint and GstVaapiRectangle structures as a standard GType. This could be useful to have them described as a GValue later on. --- gst-libs/gst/vaapi/gstvaapivalue.c | 43 ++++++++++++++++++++++++++++++ gst-libs/gst/vaapi/gstvaapivalue.h | 25 +++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/gst-libs/gst/vaapi/gstvaapivalue.c b/gst-libs/gst/vaapi/gstvaapivalue.c index e66e225a21..2912cc9c5d 100644 --- a/gst-libs/gst/vaapi/gstvaapivalue.c +++ b/gst-libs/gst/vaapi/gstvaapivalue.c @@ -29,6 +29,49 @@ #include #include "gstvaapivalue.h" +static gpointer +default_copy_func(gpointer data) +{ + return data; +} + +static void +default_free_func(gpointer data) +{ +} + +/* --- GstVaapiPoint --- */ + +GType +gst_vaapi_point_get_type(void) +{ + static volatile gsize g_type = 0; + + if (g_once_init_enter(&g_type)) { + GType type = g_boxed_type_register_static( + g_intern_static_string("GstVaapiPoint"), + default_copy_func, default_free_func); + g_once_init_leave(&g_type, type); + } + return g_type; +} + +/* --- GstVaapiRectangle --- */ + +GType +gst_vaapi_rectangle_get_type(void) +{ + static volatile gsize g_type = 0; + + if (g_once_init_enter(&g_type)) { + GType type = g_boxed_type_register_static( + g_intern_static_string("GstVaapiRectangle"), + default_copy_func, default_free_func); + g_once_init_leave(&g_type, type); + } + return g_type; +} + /* --- GstVaapiRenderMode --- */ GType diff --git a/gst-libs/gst/vaapi/gstvaapivalue.h b/gst-libs/gst/vaapi/gstvaapivalue.h index 9762f582b6..5ca8f5f916 100644 --- a/gst-libs/gst/vaapi/gstvaapivalue.h +++ b/gst-libs/gst/vaapi/gstvaapivalue.h @@ -28,6 +28,25 @@ G_BEGIN_DECLS +/** + * GST_VAAPI_TYPE_POINT: + * + * A #GstVaapiPoint type that represents a 2D point coordinates. + * + * Return value: the GType of #GstVaapiPoint + */ +#define GST_VAAPI_TYPE_POINT gst_vaapi_point_get_type() + +/** + * GST_VAAPI_TYPE_RECTANGLE: + * + * A #GstVaapiRectangle type that represents a 2D rectangle position + * and size. + * + * Return value: the GType of #GstVaapiRectangle + */ +#define GST_VAAPI_TYPE_RECTANGLE gst_vaapi_rectangle_get_type() + /** * GST_VAAPI_TYPE_RENDER_MODE: * @@ -47,6 +66,12 @@ G_BEGIN_DECLS */ #define GST_VAAPI_TYPE_ROTATION gst_vaapi_rotation_get_type() +GType +gst_vaapi_point_get_type(void) G_GNUC_CONST; + +GType +gst_vaapi_rectangle_get_type(void) G_GNUC_CONST; + GType gst_vaapi_render_mode_get_type(void) G_GNUC_CONST;