gl: Generate enum GTypes via glib-mkenums

https://bugzilla.gnome.org/show_bug.cgi?id=797240
https://bugzilla.gnome.org/show_bug.cgi?id=797144
This commit is contained in:
Sebastian Dröge 2018-10-03 13:06:42 +03:00
parent 48e1c8e12d
commit 2b4dfb9941
6 changed files with 39 additions and 37 deletions

View file

@ -1,4 +1,3 @@
lib_LTLIBRARIES = libgstgl-@GST_API_VERSION@.la
SUBDIRS = glprototypes
@ -169,11 +168,28 @@ libgstgl_@GST_API_VERSION@_la_LDFLAGS = \
# DISTCLEANFILES is for files generated by configure
DISTCLEANFILES = $(built_sys_header_configure)
glib_enum_headers = $(gstgl_headers)
glib_enum_define = GST_GL
glib_gen_prefix = gst_gl
glib_gen_basename = gl
glib_gen_decl_banner=GST_GL_API
glib_gen_decl_include=\#include <gst/gl/gl-prelude.h>
built_sources = gl-enumtypes.c
built_headers = gl-enumtypes.h
BUILT_SOURCES = $(built_sources) $(built_headers)
nodist_libgstgl_@GST_API_VERSION@_la_SOURCES = $(BUILT_SOURCES)
include $(top_srcdir)/common/gst-glib-gen.mak
if HAVE_INTROSPECTION
BUILT_GIRSOURCES = GstGL-@GST_API_VERSION@.gir
gir_headers=$(patsubst %,$(srcdir)/%, $(gstgl_gir_headers))
gir_headers+=$(patsubst %,$(builddir)/%, $(built_headers))
gir_sources=$(patsubst %,$(srcdir)/%, $(gstgl_gir_sources))
gir_sources+=$(patsubst %,$(builddir)/%, $(built_sources))
GstGL-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstgl-@GST_API_VERSION@.la
$(AM_V_GEN)PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" GI_SCANNER_DISABLE_CACHE=yes\

View file

@ -22,6 +22,7 @@
#define __GST_GL_H__
#include <gst/gl/gstgl_fwd.h>
#include <gst/gl/gl-enumtypes.h>
#include <gst/gl/gstglapi.h>
#include <gst/gl/gstglconfig.h>
#include <gst/gl/gstglcontext.h>

View file

@ -111,30 +111,6 @@ static void gst_gl_view_convert_finalize (GObject * object);
static void _do_view_convert (GstGLContext * context,
GstGLViewConvert * viewconvert);
GType
gst_gl_stereo_downmix_mode_get_type (void)
{
static volatile gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) {
static const GEnumValue values[] = {
{GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS,
"GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS",
"green-magenta-dubois"},
{GST_GL_STEREO_DOWNMIX_ANAGLYPH_RED_CYAN_DUBOIS,
"GST_GL_STEREO_DOWNMIX_ANAGLYPH_RED_CYAN_DUBOIS",
"red-cyan-dubois"},
{GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS,
"GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS",
"amber-blue-dubois"},
{0, NULL, NULL}
};
GType g_define_type_id =
g_enum_register_static ("GstGLStereoDownmix", values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* *INDENT-OFF* */
/* These match the order and number of DOWNMIX_ANAGLYPH_* modes */
static GLfloat downmix_matrices[][2][9] = {
@ -286,7 +262,7 @@ gst_gl_view_convert_class_init (GstGLViewConvertClass * klass)
g_object_class_install_property (gobject_class, PROP_OUTPUT_DOWNMIX_MODE,
g_param_spec_enum ("downmix-mode", "Mode for mono downmixed output",
"Output anaglyph type to generate when downmixing to mono",
GST_TYPE_GL_STEREO_DOWNMIX_MODE_TYPE, DEFAULT_DOWNMIX,
GST_TYPE_GL_STEREO_DOWNMIX, DEFAULT_DOWNMIX,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}

View file

@ -35,10 +35,6 @@ G_BEGIN_DECLS
#define GST_IS_GL_VIEW_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_VIEW_CONVERT))
#define GST_GL_VIEW_CONVERT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_VIEW_CONVERT,GstGLViewConvertClass))
#define GST_TYPE_GL_STEREO_DOWNMIX_MODE_TYPE gst_gl_stereo_downmix_mode_get_type()
GST_GL_API
GType gst_gl_stereo_downmix_mode_get_type (void);
/**
* GstGLStereoDownmix:
* @GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS: Dubois optimised Green-Magenta anaglyph
@ -47,12 +43,15 @@ GType gst_gl_stereo_downmix_mode_get_type (void);
*
* Output anaglyph type to generate when downmixing to mono
*/
enum _GstGLStereoDownmix {
typedef enum _GstGLStereoDownmix {
GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS,
GST_GL_STEREO_DOWNMIX_ANAGLYPH_RED_CYAN_DUBOIS,
GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS,
};
typedef enum _GstGLStereoDownmix GstGLStereoDownmix;
} GstGLStereoDownmix;
#ifndef GST_DISABLE_DEPRECATED
#define GST_TYPE_GL_STEREO_DOWNMIX_MODE_TYPE GST_TYPE_GL_STEREO_DOWNMIX
#endif
/**
* GstGLViewConvert:

View file

@ -875,8 +875,19 @@ if build_gstgl
install_dir : get_option('libdir') + '/gstreamer-1.0/include/gst/gl',
configuration : glconf)
gl_enums = gnome.mkenums_simple('gl-enumtypes',
sources : gir_gl_headers,
body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif',
header_prefix : '#include <gst/gl/gl-prelude.h>',
decorator : 'GST_GL_API',
install_header: true,
install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst/gl'))
gl_enumtypes_c = gl_enums[0]
gl_enumtypes_h = gl_enums[1]
gen_sources = [gl_enumtypes_h]
gstgl = library('gstgl-' + api_version,
gl_sources,
gl_sources, gl_enumtypes_c, gl_enumtypes_h,
c_args : gst_plugins_base_args + gl_cpp_args + ['-DBUILDING_GST_GL'],
objc_args : gst_plugins_base_args + gl_cpp_args + gl_objc_args + ['-DBUILDING_GST_GL'],
include_directories : [configinc, libsinc, gl_includes],
@ -886,10 +897,9 @@ if build_gstgl
install : true,
dependencies : [gst_base_dep, video_dep, allocators_dep, gmodule_dep,
gl_lib_deps, gl_platform_deps, gl_winsys_deps, gl_misc_deps])
gen_sources = []
if build_gir
gl_gir = gnome.generate_gir(gstgl,
sources : gl_sources + gir_gl_headers + gl_x11_headers + gl_wayland_headers + gl_win32_headers + gl_cocoa_headers + gl_egl_headers,
sources : gl_sources + [gl_enumtypes_h] + [gl_enumtypes_c] + gir_gl_headers + gl_x11_headers + gl_wayland_headers + gl_win32_headers + gl_cocoa_headers + gl_egl_headers,
namespace : 'GstGL',
nsversion : api_version,
identifier_prefix : 'Gst',

View file

@ -23,7 +23,7 @@
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gst/video/video-info.h>
#include <gst/gl/gstglviewconvert.h>
#include <gst/gl/gl.h>
G_BEGIN_DECLS