[cogl/lionel/introspection-next: 44/44] cogl-gst: add gtype definition for CoglGstRectangle



commit d086fac04358566376d559115a0a295a7e464864
Author: Lionel Landwerlin <llandwerlin gmail com>
Date:   Sun Jan 12 03:49:18 2014 +0000

    cogl-gst: add gtype definition for CoglGstRectangle

 cogl-gst/cogl-gst-video-sink.c |   30 ++++++++++++++++++++++++++++++
 cogl-gst/cogl-gst-video-sink.h |    6 ++++++
 2 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
index 31891ea..f70a01e 100644
--- a/cogl-gst/cogl-gst-video-sink.c
+++ b/cogl-gst/cogl-gst-video-sink.c
@@ -39,6 +39,8 @@
 #include <gst/riff/riff-ids.h>
 #include <string.h>
 
+#include "cogl-gtype-private.h"
+
 /* We just need the public Cogl api for cogl-gst but we first need to
  * undef COGL_COMPILATION to avoid getting an error that normally
  * checks cogl.h isn't used internally. */
@@ -175,6 +177,34 @@ struct _CoglGstVideoSinkPrivate
   GstVideoInfo info;
 };
 
+/* GTypes */
+
+static gpointer
+cogl_gst_rectangle_copy (gpointer src)
+{
+  if (G_LIKELY (src))
+    {
+      CoglGstRectangle *new = g_slice_new (CoglGstRectangle);
+      memcpy (new, src, sizeof (CoglGstRectangle));
+      return new;
+    }
+  else
+    return NULL;
+}
+
+static void
+cogl_gst_rectangle_free (gpointer ptr)
+{
+  g_slice_free (CoglGstRectangle, ptr);
+}
+
+COGL_GTYPE_DEFINE_BOXED (GstRectangle,
+                         gst_rectangle,
+                         cogl_gst_rectangle_copy,
+                         cogl_gst_rectangle_free);
+
+/**/
+
 static void
 cogl_gst_source_finalize (GSource *source)
 {
diff --git a/cogl-gst/cogl-gst-video-sink.h b/cogl-gst/cogl-gst-video-sink.h
index fc73792..95fabb3 100644
--- a/cogl-gst/cogl-gst-video-sink.h
+++ b/cogl-gst/cogl-gst-video-sink.h
@@ -91,6 +91,10 @@
 
 G_BEGIN_DECLS
 
+#define COGL_GST_GTYPE_DECLARE_TYPE(name)       \
+  GType cogl_gst_ ## name ## _get_gtype (void)
+
+
 #define COGL_GST_TYPE_VIDEO_SINK cogl_gst_video_sink_get_type()
 
 #define COGL_GST_VIDEO_SINK(obj) \
@@ -433,6 +437,8 @@ typedef struct _CoglGstRectangle
   float height;
 } CoglGstRectangle;
 
+COGL_GST_GTYPE_DECLARE_TYPE (rectangle);
+
 /**
  * cogl_gst_video_sink_fit_size:
  * @sink: A #CoglGstVideoSink


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]