libs: add type definitions for GstVaapiPoint and GstVaapiRectangle.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 24 Jul 2013 09:41:05 +0000 (11:41 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Fri, 23 Aug 2013 17:00:38 +0000 (19:00 +0200)
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
gst-libs/gst/vaapi/gstvaapivalue.h

index e66e225..2912cc9 100644 (file)
 #include <gobject/gvaluecollector.h>
 #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
index 9762f58..5ca8f5f 100644 (file)
 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:
  *
  * A #GstVaapiRenderMode type that represents the VA display backend
@@ -48,6 +67,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;
 
 GType