diff options
author | Lionel Landwerlin <llandwerlin@gmail.com> | 2013-09-02 16:02:42 +0100 |
---|---|---|
committer | Neil Roberts <neil@linux.intel.com> | 2014-03-20 18:27:12 +0000 |
commit | 1b2dd815b4a81048f445890b91d12237a8a06a8b (patch) | |
tree | 2d8e74039cf945ed4b628863e47532dc75e1b13a /cogl-gst | |
parent | bb10532f4b11cba169ace6d9e26543fe6f70ad8f (diff) | |
download | cogl-1b2dd815b4a81048f445890b91d12237a8a06a8b.tar.gz |
Registers gtypes for all public objects and structs
This adds much more comprehensive support for gobject-introspection
based bindings by registering all objects as fundamental types that
inherit from CoglObject, and all structs as boxed types.
Co-Author: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Diffstat (limited to 'cogl-gst')
-rw-r--r-- | cogl-gst/Makefile.am | 37 | ||||
-rw-r--r-- | cogl-gst/cogl-gst-video-sink.c | 30 | ||||
-rw-r--r-- | cogl-gst/cogl-gst-video-sink.h | 6 |
3 files changed, 73 insertions, 0 deletions
diff --git a/cogl-gst/Makefile.am b/cogl-gst/Makefile.am index 49c68ad9..ba0c3d82 100644 --- a/cogl-gst/Makefile.am +++ b/cogl-gst/Makefile.am @@ -68,3 +68,40 @@ pkgconfig_DATA = $(pc_files) EXTRA_DIST += cogl-gst.pc.in DISTCLEANFILES += $(pc_files) + +-include $(INTROSPECTION_MAKEFILE) + +INTROSPECTION_GIRS = + +if HAVE_INTROSPECTION +INTROSPECTION_COMPILER_ARGS=--includedir=$(top_builddir)/cogl + +CoglGst-2.0.gir: libcogl-gst.la Makefile + +CoglGst_2_0_gir_NAMESPACE = CoglGst +CoglGst_2_0_gir_VERSION = 2.0 +CoglGst_2_0_gir_LIBS = $(top_builddir)/cogl/libcogl.la libcogl-gst.la +CoglGst_2_0_gir_FILES = $(source_h) $(source_c) +CoglGst_2_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_GST_DEP_CFLAGS) +CoglGst_2_0_gir_INCLUDES = GObject-2.0 Gst-1.0 GstBase-1.0 +CoglGst_2_0_gir_EXPORT_PACKAGES = cogl-gst-2.0-experimental +CoglGst_2_0_gir_SCANNERFLAGS = \ + --warn-all \ + --identifier-prefix=CoglGst \ + --symbol-prefix=cogl_gst \ + --c-include='cogl-gst/cogl-gst.h' \ + --c-include="gst/gst.h" \ + --include-uninstalled=$(top_builddir)/cogl/Cogl-2.0.gir \ + --pkg gstreamer-1.0 \ + --add-init-section="gst_init(NULL, NULL);" + +INTROSPECTION_GIRS += CoglGst-2.0.gir + +girdir = $(datadir)/gir-1.0 +gir_DATA = $(INTROSPECTION_GIRS) + +typelibdir = $(libdir)/girepository-1.0 +typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) + +CLEANFILES += $(gir_DATA) $(typelib_DATA) +endif diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c index 42b50a9a..14610834 100644 --- a/cogl-gst/cogl-gst-video-sink.c +++ b/cogl-gst/cogl-gst-video-sink.c @@ -35,6 +35,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. */ @@ -171,6 +173,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 71718c2b..12a6480d 100644 --- a/cogl-gst/cogl-gst-video-sink.h +++ b/cogl-gst/cogl-gst-video-sink.h @@ -87,6 +87,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) \ @@ -500,6 +504,8 @@ typedef struct _CoglGstRectangle float height; } CoglGstRectangle; +COGL_GST_GTYPE_DECLARE_TYPE (rectangle); + /** * cogl_gst_video_sink_fit_size: * @sink: A #CoglGstVideoSink |