diff options
author | Julien Isorce <jisorce@oblong.com> | 2017-07-07 16:15:12 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2017-12-09 19:32:29 +0000 |
commit | 4952fdd956959782902d1ad435142f758341545b (patch) | |
tree | ae5c4f2fda31170dd64b96c843730c043157e831 /gst-libs | |
parent | 632015a9e8ad978e276823cabd024c40965bd723 (diff) |
gl: do not include GL headers in public gstgl headers
Except for gst/gl/gstglfuncs.h
It is up to the client app to include these headers.
It is coherent with the fact that gstreamer-gl.pc does not
require any egl.pc/gles.pc. I.e. it is the responsability
of the app to search these headers within its build setup.
For example gstreamer-vaapi includes explicitly EGL/egl.h
and search for it in its configure.ac.
For example with this patch, if an app includes the headers
gst/gl/egl/gstglcontext_egl.h
gst/gl/egl/gstgldisplay_egl.h
gst/gl/egl/gstglmemoryegl.h
it will *no longer* automatically include EGL/egl.h and GLES2/gl2.h.
Which is good because the app might want to use the gstgl api only
without the need to bother about gl headers.
Also added a test: cd tests/check && make libs/gstglheaders.check
https://bugzilla.gnome.org/show_bug.cgi?id=784779
Diffstat (limited to 'gst-libs')
50 files changed, 275 insertions, 201 deletions
diff --git a/gst-libs/gst/gl/egl/gsteglimage.c b/gst-libs/gst/gl/egl/gsteglimage.c index f5707189a..92b3862b1 100644 --- a/gst-libs/gst/gl/egl/gsteglimage.c +++ b/gst-libs/gst/gl/egl/gsteglimage.c @@ -39,9 +39,16 @@ #endif #include "gsteglimage.h" -#include <gst/gl/egl/gstgldisplay_egl.h> + #include <string.h> +#include <gst/gl/gstglfeature.h> +#include <gst/gl/gstglmemory.h> + +#include "gst/gl/egl/gstegl.h" +#include "gst/gl/egl/gstglcontext_egl.h" +#include "gst/gl/egl/gstgldisplay_egl.h" + #if GST_GL_HAVE_DMABUF #include <gst/allocators/gstdmabuf.h> #include <libdrm/drm_fourcc.h> @@ -107,7 +114,7 @@ gst_egl_image_ensure_debug_category (void) * * Returns: the #EGLImageKHR of @image */ -EGLImageKHR +gpointer gst_egl_image_get_image (GstEGLImage * image) { g_return_val_if_fail (GST_IS_EGL_IMAGE (image), EGL_NO_IMAGE_KHR); @@ -151,7 +158,7 @@ _gst_egl_image_copy (GstMiniObject * obj) * Returns: a new #GstEGLImage wrapping @image */ GstEGLImage * -gst_egl_image_new_wrapped (GstGLContext * context, EGLImageKHR image, +gst_egl_image_new_wrapped (GstGLContext * context, gpointer image, GstGLFormat format, gpointer user_data, GstEGLImageDestroyNotify user_data_destroy) { diff --git a/gst-libs/gst/gl/egl/gsteglimage.h b/gst-libs/gst/gl/egl/gsteglimage.h index 9a0e84806..cfd8f008a 100644 --- a/gst-libs/gst/gl/egl/gsteglimage.h +++ b/gst-libs/gst/gl/egl/gsteglimage.h @@ -23,11 +23,8 @@ #ifndef _GST_EGL_IMAGE_H_ #define _GST_EGL_IMAGE_H_ -#include <gst/gst.h> -#include <gst/video/video.h> - -#include <gst/gl/gl.h> -#include <gst/gl/egl/gstegl.h> +#include <gst/gl/gstgl_fwd.h> +#include <gst/gl/gstglformat.h> G_BEGIN_DECLS @@ -61,7 +58,7 @@ struct _GstEGLImage GstMiniObject parent; GstGLContext *context; - EGLImageKHR image; + gpointer image; GstGLFormat format; /* <private> */ @@ -73,12 +70,12 @@ struct _GstEGLImage GST_EXPORT GstEGLImage * gst_egl_image_new_wrapped (GstGLContext * context, - EGLImageKHR image, + gpointer image, GstGLFormat format, gpointer user_data, GstEGLImageDestroyNotify user_data_destroy); GST_EXPORT -EGLImageKHR gst_egl_image_get_image (GstEGLImage * image); +gpointer gst_egl_image_get_image (GstEGLImage * image); GST_EXPORT GstEGLImage * gst_egl_image_from_texture (GstGLContext * context, diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.c b/gst-libs/gst/gl/egl/gstglcontext_egl.c index ddac4c483..926050c38 100644 --- a/gst-libs/gst/gl/egl/gstglcontext_egl.c +++ b/gst-libs/gst/gl/egl/gstglcontext_egl.c @@ -29,10 +29,13 @@ */ #include "gstglcontext_egl.h" -#include <gst/gl/egl/gstegl.h> + +#include <gst/gl/gstglcontext_private.h> +#include <gst/gl/gstglfeature.h> + +#include "gstegl.h" #include "../utils/opengl_versions.h" #include "../utils/gles_versions.h" -#include "../gstglcontext_private.h" #if GST_GL_HAVE_WINDOW_X11 #include "../x11/gstglwindow_x11.h" @@ -281,7 +284,7 @@ gst_gl_context_egl_create_context (GstGLContext * context, { GstGLContextEGL *egl; GstGLWindow *window = NULL; - EGLNativeWindowType window_handle = (EGLNativeWindowType) 0; + guintptr window_handle = 0; EGLint egl_major; EGLint egl_minor; gboolean need_surface = TRUE; @@ -520,15 +523,14 @@ gst_gl_context_egl_create_context (GstGLContext * context, } if (window) - window_handle = - (EGLNativeWindowType) gst_gl_window_get_window_handle (window); + window_handle = gst_gl_window_get_window_handle (window); if (window_handle) { GST_DEBUG ("Creating EGLSurface from window_handle %p", (void *) window_handle); egl->egl_surface = eglCreateWindowSurface (egl->egl_display, egl->egl_config, - window_handle, NULL); + (EGLNativeWindowType) window_handle, NULL); /* Store window handle for later comparision */ egl->window_handle = window_handle; } else if (!gst_gl_check_extension ("EGL_KHR_surfaceless_context", @@ -619,10 +621,10 @@ gst_gl_context_egl_activate (GstGLContext * context, gboolean activate) if (activate) { GstGLWindow *window = gst_gl_context_get_window (context); - EGLNativeWindowType handle = 0; + guintptr handle = 0; /* Check if the backing handle changed */ if (window) { - handle = (EGLNativeWindowType) gst_gl_window_get_window_handle (window); + handle = gst_gl_window_get_window_handle (window); gst_object_unref (window); } if (handle && handle != egl->window_handle) { @@ -639,8 +641,8 @@ gst_gl_context_egl_activate (GstGLContext * context, gboolean activate) } } egl->egl_surface = - eglCreateWindowSurface (egl->egl_display, egl->egl_config, handle, - NULL); + eglCreateWindowSurface (egl->egl_display, egl->egl_config, + (EGLNativeWindowType) handle, NULL); egl->window_handle = handle; if (egl->egl_surface == EGL_NO_SURFACE) { diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.h b/gst-libs/gst/gl/egl/gstglcontext_egl.h index 40adc9978..67947a885 100644 --- a/gst-libs/gst/gl/egl/gstglcontext_egl.h +++ b/gst-libs/gst/gl/egl/gstglcontext_egl.h @@ -21,10 +21,7 @@ #ifndef __GST_GL_EGL_H__ #define __GST_GL_EGL_H__ -#include <gst/gst.h> -#include <gst/gl/gl.h> -#include <gst/gl/egl/gstegl.h> - +#include <gst/gl/gstglcontext.h> #include <gst/gl/egl/gstgldisplay_egl.h> G_BEGIN_DECLS @@ -57,10 +54,10 @@ struct _GstGLContextEGL GstGLDisplayEGL *display_egl; - EGLContext egl_context; - EGLDisplay egl_display; - EGLSurface egl_surface; - EGLConfig egl_config; + gpointer egl_context; + gpointer egl_display; + gpointer egl_surface; + gpointer egl_config; gint egl_major; gint egl_minor; @@ -70,7 +67,7 @@ struct _GstGLContextEGL const gchar *egl_exts; /* Cached handle */ - EGLNativeWindowType window_handle; + guintptr window_handle; }; /** diff --git a/gst-libs/gst/gl/egl/gstgldisplay_egl.c b/gst-libs/gst/gl/egl/gstgldisplay_egl.c index a2dc98a8e..83b7b41bd 100644 --- a/gst-libs/gst/gl/egl/gstgldisplay_egl.c +++ b/gst-libs/gst/gl/egl/gstgldisplay_egl.c @@ -22,9 +22,13 @@ #include "config.h" #endif -#include <gst/gl/egl/gstgldisplay_egl.h> -#include <gst/gl/egl/gsteglimage.h> -#include <gst/gl/egl/gstglmemoryegl.h> +#include "gstgldisplay_egl.h" + +#include <gst/gl/gstglfeature.h> + +#include "gstegl.h" +#include "gsteglimage.h" +#include "gstglmemoryegl.h" GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug); #define GST_CAT_DEFAULT gst_gl_display_debug @@ -92,7 +96,7 @@ gst_gl_display_egl_finalize (GObject * object) * * Since: 1.12 */ -EGLDisplay +gpointer gst_gl_display_egl_get_from_native (GstGLDisplayType type, guintptr display) { const gchar *egl_exts; @@ -107,7 +111,7 @@ gst_gl_display_egl_get_from_native (GstGLDisplayType type, guintptr display) /* given an EGLDisplay already */ if (type == GST_GL_DISPLAY_TYPE_EGL) - return (EGLDisplay) display; + return (gpointer) display; if (type == GST_GL_DISPLAY_TYPE_NONE) type = GST_GL_DISPLAY_TYPE_ANY; @@ -158,7 +162,7 @@ gst_gl_display_egl_get_from_native (GstGLDisplayType type, guintptr display) /* otherwise rely on the implementation to choose the correct display * based on the pointer */ default_display: - return eglGetDisplay ((EGLNativeDisplayType) display); + return (gpointer) eglGetDisplay ((EGLNativeDisplayType) display); } /** @@ -198,7 +202,7 @@ gst_gl_display_egl_new (void) * Since: 1.12 */ GstGLDisplayEGL * -gst_gl_display_egl_new_with_egl_display (EGLDisplay display) +gst_gl_display_egl_new_with_egl_display (gpointer display) { GstGLDisplayEGL *ret; diff --git a/gst-libs/gst/gl/egl/gstgldisplay_egl.h b/gst-libs/gst/gl/egl/gstgldisplay_egl.h index 1ee1c4939..319a04724 100644 --- a/gst-libs/gst/gl/egl/gstgldisplay_egl.h +++ b/gst-libs/gst/gl/egl/gstgldisplay_egl.h @@ -21,9 +21,7 @@ #ifndef __GST_GL_DISPLAY_EGL_H__ #define __GST_GL_DISPLAY_EGL_H__ -#include <gst/gst.h> #include <gst/gl/gstgldisplay.h> -#include <gst/gl/egl/gstegl.h> G_BEGIN_DECLS @@ -51,7 +49,7 @@ struct _GstGLDisplayEGL GstGLDisplay parent; /* <private> */ - EGLDisplay display; + gpointer display; gboolean foreign_display; @@ -69,13 +67,13 @@ GST_EXPORT GstGLDisplayEGL *gst_gl_display_egl_new (void); GST_EXPORT -GstGLDisplayEGL *gst_gl_display_egl_new_with_egl_display (EGLDisplay display); +GstGLDisplayEGL *gst_gl_display_egl_new_with_egl_display (gpointer display); GST_EXPORT GstGLDisplayEGL *gst_gl_display_egl_from_gl_display (GstGLDisplay * display); GST_EXPORT -EGLDisplay gst_gl_display_egl_get_from_native (GstGLDisplayType type, guintptr display); +gpointer gst_gl_display_egl_get_from_native (GstGLDisplayType type, guintptr display); #define GST_GL_DISPLAY_EGL_NAME "gst.gl.display.egl" diff --git a/gst-libs/gst/gl/egl/gstglmemoryegl.c b/gst-libs/gst/gl/egl/gstglmemoryegl.c index 32c4223c2..1f461149d 100644 --- a/gst-libs/gst/gl/egl/gstglmemoryegl.c +++ b/gst-libs/gst/gl/egl/gstglmemoryegl.c @@ -37,8 +37,13 @@ #include <string.h> -#include <gst/gl/egl/gstglmemoryegl.h> -#include <gst/gl/egl/gstglcontext_egl.h> +#include "gstglmemoryegl.h" + +#include <gst/gl/gstglfuncs.h> + +#include "gstegl.h" +#include "gsteglimage.h" +#include "gstglcontext_egl.h" static GstAllocator *_gl_memory_egl_allocator; @@ -80,7 +85,7 @@ _gl_mem_get_parent (GstGLMemoryEGL * gl_mem) * * Since: 1.10 */ -EGLImageKHR +gpointer gst_gl_memory_egl_get_image (GstGLMemoryEGL * mem) { g_return_val_if_fail (gst_is_gl_memory_egl (GST_MEMORY_CAST (mem)), @@ -96,7 +101,7 @@ gst_gl_memory_egl_get_image (GstGLMemoryEGL * mem) * * Since: 1.10 */ -EGLDisplay +gpointer gst_gl_memory_egl_get_display (GstGLMemoryEGL * mem) { g_return_val_if_fail (gst_is_gl_memory_egl (GST_MEMORY_CAST (mem)), NULL); diff --git a/gst-libs/gst/gl/egl/gstglmemoryegl.h b/gst-libs/gst/gl/egl/gstglmemoryegl.h index ac7ca7841..098e7cf0d 100644 --- a/gst-libs/gst/gl/egl/gstglmemoryegl.h +++ b/gst-libs/gst/gl/egl/gstglmemoryegl.h @@ -23,15 +23,9 @@ #ifndef _GST_GL_MEMORY_EGL_H_ #define _GST_GL_MEMORY_EGL_H_ -#include <gst/gst.h> -#include <gst/gstallocator.h> -#include <gst/gstmemory.h> -#include <gst/video/video.h> - -#include <gst/gl/gl.h> -#include <gst/gl/egl/gsteglimage.h> - #include <gst/gl/gstglmemory.h> +#include <gst/gl/egl/gsteglimage.h> +#include <gst/gl/egl/gstgldisplay_egl.h> G_BEGIN_DECLS @@ -74,10 +68,10 @@ GST_EXPORT gboolean gst_is_gl_memory_egl (GstMemory * mem); GST_EXPORT -EGLImageKHR gst_gl_memory_egl_get_image (GstGLMemoryEGL * mem); +gpointer gst_gl_memory_egl_get_image (GstGLMemoryEGL * mem); GST_EXPORT -EGLDisplay gst_gl_memory_egl_get_display (GstGLMemoryEGL * mem); +gpointer gst_gl_memory_egl_get_display (GstGLMemoryEGL * mem); /** * GstGLMemoryEGLAllocator diff --git a/gst-libs/gst/gl/gl.h b/gst-libs/gst/gl/gl.h index 036c8d8d6..33d1f3578 100644 --- a/gst-libs/gst/gl/gl.h +++ b/gst-libs/gst/gl/gl.h @@ -27,11 +27,11 @@ #endif #include <gst/gl/gstgl_fwd.h> -#include <gst/gl/gstglconfig.h> #include <gst/gl/gstglapi.h> -#include <gst/gl/gstgldisplay.h> +#include <gst/gl/gstglconfig.h> #include <gst/gl/gstglcontext.h> #include <gst/gl/gstgldebug.h> +#include <gst/gl/gstgldisplay.h> #include <gst/gl/gstglfeature.h> #include <gst/gl/gstglformat.h> #include <gst/gl/gstglutils.h> diff --git a/gst-libs/gst/gl/gstgl_fwd.h b/gst-libs/gst/gl/gstgl_fwd.h index 8f42e8de8..19ca6f358 100644 --- a/gst-libs/gst/gl/gstgl_fwd.h +++ b/gst-libs/gst/gl/gstgl_fwd.h @@ -102,6 +102,10 @@ typedef struct _GstGLOverlayCompositorClass GstGLOverlayCompositorClass; typedef struct _GstGLQuery GstGLQuery; +typedef struct _GstGLFuncs GstGLFuncs; + +typedef struct _GstGLAsyncDebug GstGLAsyncDebug; + #include <gst/gl/gstgl_enums.h> #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC diff --git a/gst-libs/gst/gl/gstglapi.h b/gst-libs/gst/gl/gstglapi.h index 4196e839e..1622d9095 100644 --- a/gst-libs/gst/gl/gstglapi.h +++ b/gst-libs/gst/gl/gstglapi.h @@ -23,66 +23,6 @@ #include <gst/gl/gstglconfig.h> -/* This mimic GCC behaviour with system headers files even if GL headers may - * not be in the system header path. */ -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wredundant-decls" -#endif - -/* OpenGL 2.0 for Embedded Systems */ -#if GST_GL_HAVE_GLES2 -# if GST_GL_HAVE_PLATFORM_EAGL -# include <OpenGLES/ES2/gl.h> -# include <OpenGLES/ES2/glext.h> -# else -# if GST_GL_HAVE_GLES3 -# include <GLES3/gl3.h> -# if GST_GL_HAVE_GLES3EXT3_H -# include <GLES3/gl3ext.h> -# endif -# include <GLES2/gl2ext.h> -# else -# include <GLES2/gl2.h> -# include <GLES2/gl2ext.h> -# endif -# endif -# if !GST_GL_HAVE_OPENGL -# include <gst/gl/glprototypes/gstgl_gles2compat.h> -# endif -#endif - -/* OpenGL for desktop systems */ -#if GST_GL_HAVE_OPENGL -# ifdef __APPLE__ -# include <OpenGL/OpenGL.h> -# include <OpenGL/gl.h> -# if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 -# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED -# include <OpenGL/gl3.h> -# endif -# else -# if defined(_MSC_VER) -# include <windows.h> -# endif -# include <GL/gl.h> -# if defined(__WIN32__) || defined(_WIN32) -# include <GL/glext.h> -# endif -# endif -#endif - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif - -#if defined(WINAPI) -#define GSTGLAPI WINAPI -#else -#define GSTGLAPI -#endif -#include <gst/gl/glprototypes/gstgl_compat.h> - #include <gst/gst.h> G_BEGIN_DECLS @@ -158,22 +98,6 @@ typedef enum GST_GL_PLATFORM_ANY = G_MAXUINT32 } GstGLPlatform; -#define GST_GL_EXT_BEGIN(name, gl_availability, min_gl, maj_gl, gles_maj, \ - gles_min, ext_suf, ext_name) -#define GST_GL_EXT_FUNCTION(ret, name, args) \ - ret (GSTGLAPI *name) args; -#define GST_GL_EXT_END() - -typedef struct _GstGLFuncs -{ -#include <gst/gl/glprototypes/all_functions.h> - gpointer padding[GST_PADDING_LARGE*6]; -} GstGLFuncs; - -#undef GST_GL_EXT_BEGIN -#undef GST_GL_EXT_FUNCTION -#undef GST_GL_EXT_END - GST_EXPORT gchar * gst_gl_api_to_string (GstGLAPI api); GST_EXPORT diff --git a/gst-libs/gst/gl/gstglbasefilter.h b/gst-libs/gst/gl/gstglbasefilter.h index aa5b94693..fa4958d89 100644 --- a/gst-libs/gst/gl/gstglbasefilter.h +++ b/gst-libs/gst/gl/gstglbasefilter.h @@ -23,11 +23,9 @@ #ifndef _GST_GL_BASE_FILTER_H_ #define _GST_GL_BASE_FILTER_H_ -#include <gst/gst.h> #include <gst/base/gstbasetransform.h> -#include <gst/video/video.h> -#include <gst/gl/gl.h> +#include <gst/gl/gstgl_fwd.h> G_BEGIN_DECLS diff --git a/gst-libs/gst/gl/gstglbasememory.c b/gst-libs/gst/gl/gstglbasememory.c index d7bd88cb1..4bebedc37 100644 --- a/gst-libs/gst/gl/gstglbasememory.c +++ b/gst-libs/gst/gl/gstglbasememory.c @@ -24,7 +24,10 @@ #include <string.h> -#include <gst/gl/gstglbasememory.h> +#include "gstglbasememory.h" + +#include "gstglcontext.h" +#include "gstglquery.h" /** * SECTION:gstglbasememory diff --git a/gst-libs/gst/gl/gstglbasememory.h b/gst-libs/gst/gl/gstglbasememory.h index 302334d2a..175fbf610 100644 --- a/gst-libs/gst/gl/gstglbasememory.h +++ b/gst-libs/gst/gl/gstglbasememory.h @@ -375,7 +375,8 @@ struct _GstGLBaseMemoryAllocatorClass gpointer _padding[GST_PADDING]; }; -#include <gst/gl/gl.h> +#include <gst/gl/gstglconfig.h> +#include <gst/gl/gstglformat.h> /** * GST_GL_BASE_MEMORY_ALLOCATOR_NAME: diff --git a/gst-libs/gst/gl/gstglbuffer.c b/gst-libs/gst/gl/gstglbuffer.c index 140f83cac..5a4500757 100644 --- a/gst-libs/gst/gl/gstglbuffer.c +++ b/gst-libs/gst/gl/gstglbuffer.c @@ -25,6 +25,9 @@ #include <string.h> #include "gstglbuffer.h" + +#include "gstglcontext.h" +#include "gstglfuncs.h" #include "gstglutils.h" /** diff --git a/gst-libs/gst/gl/gstglbuffer.h b/gst-libs/gst/gl/gstglbuffer.h index 90f8eb260..52a6576fd 100644 --- a/gst-libs/gst/gl/gstglbuffer.h +++ b/gst-libs/gst/gl/gstglbuffer.h @@ -21,10 +21,6 @@ #ifndef _GST_GL_BUFFER_H_ #define _GST_GL_BUFFER_H_ -#include <gst/gst.h> -#include <gst/gstallocator.h> -#include <gst/gstmemory.h> - #include <gst/gl/gstglbasememory.h> G_BEGIN_DECLS diff --git a/gst-libs/gst/gl/gstglbufferpool.c b/gst-libs/gst/gl/gstglbufferpool.c index fc9522b82..309bc367b 100644 --- a/gst-libs/gst/gl/gstglbufferpool.c +++ b/gst-libs/gst/gl/gstglbufferpool.c @@ -22,8 +22,10 @@ #include "config.h" #endif -#include "gl.h" #include "gstglbufferpool.h" + +#include "gstglmemory.h" +#include "gstglsyncmeta.h" #include "gstglutils.h" /** diff --git a/gst-libs/gst/gl/gstglbufferpool.h b/gst-libs/gst/gl/gstglbufferpool.h index bfe5371c7..0921464d5 100644 --- a/gst-libs/gst/gl/gstglbufferpool.h +++ b/gst-libs/gst/gl/gstglbufferpool.h @@ -21,11 +21,10 @@ #ifndef _GST_GL_BUFFER_POOL_H_ #define _GST_GL_BUFFER_POOL_H_ -#include <gst/video/video.h> #include <gst/video/gstvideometa.h> #include <gst/video/gstvideopool.h> -#include <gst/gl/gl.h> +#include <gst/gl/gstglbasememory.h> G_BEGIN_DECLS diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c index 6644759ec..6bd919754 100644 --- a/gst-libs/gst/gl/gstglcolorconvert.c +++ b/gst-libs/gst/gl/gstglcolorconvert.c @@ -25,8 +25,10 @@ #include <string.h> #include <stdio.h> -#include "gl.h" #include "gstglcolorconvert.h" + +#include "gl.h" +#include "gstglfuncs.h" #include "gstglsl_private.h" /** diff --git a/gst-libs/gst/gl/gstglcontext.c b/gst-libs/gst/gl/gstglcontext.c index 01c03c11a..0d7a5326c 100644 --- a/gst-libs/gst/gl/gstglcontext.c +++ b/gst-libs/gst/gl/gstglcontext.c @@ -40,14 +40,16 @@ #define _GNU_SOURCE #endif +#include "gstglcontext.h" + #include <gmodule.h> #include <string.h> #include <stdio.h> -#include "gl.h" -#include "gstglcontext.h" #include "gstglcontext_private.h" +#include "gstglfeature.h" #include "gstglfeature_private.h" +#include "gstglfuncs.h" #ifndef GL_NUM_EXTENSIONS #define GL_NUM_EXTENSIONS 0x0000821d diff --git a/gst-libs/gst/gl/gstglcontext.h b/gst-libs/gst/gl/gstglcontext.h index 7cdc95764..54383c56e 100644 --- a/gst-libs/gst/gl/gstglcontext.h +++ b/gst-libs/gst/gl/gstglcontext.h @@ -23,7 +23,7 @@ #include <gst/gst.h> -#include <gst/gl/gl.h> +#include <gst/gl/gstgl_fwd.h> G_BEGIN_DECLS diff --git a/gst-libs/gst/gl/gstgldebug.c b/gst-libs/gst/gl/gstgldebug.c index 2b738cc3e..6f8eb4aa8 100644 --- a/gst-libs/gst/gl/gstgldebug.c +++ b/gst-libs/gst/gl/gstgldebug.c @@ -22,12 +22,15 @@ #include "config.h" #endif -#include "gl.h" #include "gstgldebug.h" -#include "gstglcontext_private.h" + #include <glib/gprintf.h> #include <string.h> +#include "gstglcontext.h" +#include "gstglcontext_private.h" +#include "gstglfuncs.h" + /** * SECTION:gstgldebug * @short_description: helper routines for dealing with OpenGL debugging diff --git a/gst-libs/gst/gl/gstgldebug.h b/gst-libs/gst/gl/gstgldebug.h index 36ba3a68d..503115544 100644 --- a/gst-libs/gst/gl/gstgldebug.h +++ b/gst-libs/gst/gl/gstgldebug.h @@ -21,7 +21,7 @@ #ifndef __GST_GL_DEBUG_H__ #define __GST_GL_DEBUG_H__ -#include <gst/gl/gl.h> +#include <gst/gl/gstgl_fwd.h> G_BEGIN_DECLS diff --git a/gst-libs/gst/gl/gstgldisplay.h b/gst-libs/gst/gl/gstgldisplay.h index 95ae8d648..7e8fe68a7 100644 --- a/gst-libs/gst/gl/gstgldisplay.h +++ b/gst-libs/gst/gl/gstgldisplay.h @@ -24,8 +24,6 @@ #ifndef __GST_GL_DISPLAY_H__ #define __GST_GL_DISPLAY_H__ -#include <gst/gst.h> - #include <gst/gl/gstgl_fwd.h> G_BEGIN_DECLS diff --git a/gst-libs/gst/gl/gstglfeature.c b/gst-libs/gst/gl/gstglfeature.c index 56fd0fecc..a1cadc277 100644 --- a/gst-libs/gst/gl/gstglfeature.c +++ b/gst-libs/gst/gl/gstglfeature.c @@ -24,9 +24,11 @@ #include <string.h> -#include "gl.h" #include "gstglfeature.h" + +#include "gstglcontext.h" #include "gstglfeature_private.h" +#include "gstglfuncs.h" #define GST_CAT_DEFAULT gl_feature GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c index 77b3e999d..9f03b5044 100644 --- a/gst-libs/gst/gl/gstglfilter.c +++ b/gst-libs/gst/gl/gstglfilter.c @@ -38,6 +38,8 @@ #include "gstglfilter.h" +#include "gstglfuncs.h" + #define GST_CAT_DEFAULT gst_gl_filter_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); diff --git a/gst-libs/gst/gl/gstglfilter.h b/gst-libs/gst/gl/gstglfilter.h index 9dbb5378f..fc1928b9d 100644 --- a/gst-libs/gst/gl/gstglfilter.h +++ b/gst-libs/gst/gl/gstglfilter.h @@ -79,11 +79,11 @@ struct _GstGLFilter GstGLShader *default_shader; gboolean valid_attributes; - GLuint vao; - GLuint vbo_indices; - GLuint vertex_buffer; - GLint draw_attr_position_loc; - GLint draw_attr_texture_loc; + guint vao; + guint vbo_indices; + guint vertex_buffer; + gint draw_attr_position_loc; + gint draw_attr_texture_loc; gpointer _padding[GST_PADDING]; }; diff --git a/gst-libs/gst/gl/gstglformat.c b/gst-libs/gst/gl/gstglformat.c index fd1d6b89c..8427be43f 100644 --- a/gst-libs/gst/gl/gstglformat.c +++ b/gst-libs/gst/gl/gstglformat.c @@ -32,8 +32,10 @@ #include "config.h" #endif -#include <gst/gl/gstglformat.h> -#include <gst/gl/gstglcontext.h> +#include "gstglformat.h" + +#include "gstglcontext.h" +#include "gstglfuncs.h" #define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0)) #define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1)) diff --git a/gst-libs/gst/gl/gstglframebuffer.c b/gst-libs/gst/gl/gstglframebuffer.c index 2e1c3bc85..b1d64b288 100644 --- a/gst-libs/gst/gl/gstglframebuffer.c +++ b/gst-libs/gst/gl/gstglframebuffer.c @@ -42,9 +42,13 @@ #include "config.h" #endif -#include "gl.h" #include "gstglframebuffer.h" +#include "gstglcontext.h" +#include "gstglfuncs.h" +#include "gstglmemory.h" +#include "gstglrenderbuffer.h" + #ifndef GL_FRAMEBUFFER_UNDEFINED #define GL_FRAMEBUFFER_UNDEFINED 0x8219 #endif @@ -518,7 +522,7 @@ gst_gl_framebuffer_get_effective_dimensions (GstGLFramebuffer * fb, */ gboolean gst_gl_context_check_framebuffer_status (GstGLContext * context, - GLenum fbo_target) + guint fbo_target) { g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE); diff --git a/gst-libs/gst/gl/gstglframebuffer.h b/gst-libs/gst/gl/gstglframebuffer.h index 172f999fa..aaf60ec8a 100644 --- a/gst-libs/gst/gl/gstglframebuffer.h +++ b/gst-libs/gst/gl/gstglframebuffer.h @@ -104,7 +104,7 @@ void gst_gl_framebuffer_get_effective_dimensions (GstGLFrameb GST_EXPORT gboolean gst_gl_context_check_framebuffer_status (GstGLContext * context, - GLenum fbo_target); + guint fbo_target); GST_EXPORT gboolean gst_gl_framebuffer_draw_to_texture (GstGLFramebuffer * fb, diff --git a/gst-libs/gst/gl/gstglfuncs.h b/gst-libs/gst/gl/gstglfuncs.h new file mode 100644 index 000000000..805abcf3d --- /dev/null +++ b/gst-libs/gst/gl/gstglfuncs.h @@ -0,0 +1,108 @@ +/* + * GStreamer + * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __GST_GL_FUNCS_H__ +#define __GST_GL_FUNCS_H__ + +#include <gst/gl/gstglconfig.h> + +/* This mimic GCC behaviour with system headers files even if GL headers may + * not be in the system header path. */ +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wredundant-decls" +#endif + +/* OpenGL 2.0 for Embedded Systems */ +#if GST_GL_HAVE_GLES2 +# if GST_GL_HAVE_PLATFORM_EAGL +# include <OpenGLES/ES2/gl.h> +# include <OpenGLES/ES2/glext.h> +# else +# if GST_GL_HAVE_GLES3 +# include <GLES3/gl3.h> +# if GST_GL_HAVE_GLES3EXT3_H +# include <GLES3/gl3ext.h> +# endif +# include <GLES2/gl2ext.h> +# else +# include <GLES2/gl2.h> +# include <GLES2/gl2ext.h> +# endif +# endif +# if !GST_GL_HAVE_OPENGL +# include <gst/gl/glprototypes/gstgl_gles2compat.h> +# endif +#endif + +/* OpenGL for desktop systems */ +#if GST_GL_HAVE_OPENGL +# ifdef __APPLE__ +# include <OpenGL/OpenGL.h> +# include <OpenGL/gl.h> +# if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 +# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED +# include <OpenGL/gl3.h> +# endif +# else +# if defined(_MSC_VER) +# include <windows.h> +# endif +# include <GL/gl.h> +# if defined(__WIN32__) || defined(_WIN32) +# include <GL/glext.h> +# endif +# endif +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif + +#if defined(WINAPI) +#define GSTGLAPI WINAPI +#else +#define GSTGLAPI +#endif +#include <gst/gl/glprototypes/gstgl_compat.h> + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_GL_EXT_BEGIN(name, gl_availability, min_gl, maj_gl, gles_maj, \ + gles_min, ext_suf, ext_name) +#define GST_GL_EXT_FUNCTION(ret, name, args) \ + ret (GSTGLAPI *name) args; +#define GST_GL_EXT_END() + +typedef struct _GstGLFuncs +{ +#include <gst/gl/glprototypes/all_functions.h> + gpointer padding[GST_PADDING_LARGE*6]; +} GstGLFuncs; + +#undef GST_GL_EXT_BEGIN +#undef GST_GL_EXT_FUNCTION +#undef GST_GL_EXT_END + +G_END_DECLS + +#endif /* __GST_GL_API_H__ */ diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c index aba40ef1e..a4a137233 100644 --- a/gst-libs/gst/gl/gstglmemory.c +++ b/gst-libs/gst/gl/gstglmemory.c @@ -24,10 +24,10 @@ #include <string.h> -#include <gst/video/video.h> +#include "gstglmemory.h" -#include <gst/gl/gstglbasememory.h> -#include <gst/gl/gstglmemory.h> +#include "gl.h" +#include "gstglfuncs.h" /** * SECTION:gstglmemory diff --git a/gst-libs/gst/gl/gstglmemory.h b/gst-libs/gst/gl/gstglmemory.h index 3a4bf9f9c..e7721a79f 100644 --- a/gst-libs/gst/gl/gstglmemory.h +++ b/gst-libs/gst/gl/gstglmemory.h @@ -21,12 +21,8 @@ #ifndef _GST_GL_MEMORY_H_ #define _GST_GL_MEMORY_H_ -#include <gst/gst.h> -#include <gst/gstallocator.h> -#include <gst/gstmemory.h> -#include <gst/video/video.h> - #include <gst/gl/gstglbasememory.h> +#include <gst/gl/gstglformat.h> G_BEGIN_DECLS diff --git a/gst-libs/gst/gl/gstglmemorypbo.c b/gst-libs/gst/gl/gstglmemorypbo.c index 89091c80b..4a62a383c 100644 --- a/gst-libs/gst/gl/gstglmemorypbo.c +++ b/gst-libs/gst/gl/gstglmemorypbo.c @@ -25,9 +25,12 @@ #include <string.h> -#include <gst/video/video.h> +#include "gstglmemorypbo.h" -#include <gst/gl/gstglmemorypbo.h> +#include "gstglbuffer.h" +#include "gstglcontext.h" +#include "gstglfuncs.h" +#include "gstglutils.h" /** * SECTION:gstglmemorypbo diff --git a/gst-libs/gst/gl/gstglmemorypbo.h b/gst-libs/gst/gl/gstglmemorypbo.h index 77eff7b95..c57bf1734 100644 --- a/gst-libs/gst/gl/gstglmemorypbo.h +++ b/gst-libs/gst/gl/gstglmemorypbo.h @@ -22,11 +22,6 @@ #ifndef _GST_GL_MEMORY_PBO_H_ #define _GST_GL_MEMORY_PBO_H_ -#include <gst/gst.h> -#include <gst/gstallocator.h> -#include <gst/gstmemory.h> -#include <gst/video/video.h> - #include <gst/gl/gstglmemory.h> G_BEGIN_DECLS diff --git a/gst-libs/gst/gl/gstgloverlaycompositor.c b/gst-libs/gst/gl/gstgloverlaycompositor.c index 257211097..05575aa8b 100644 --- a/gst-libs/gst/gl/gstgloverlaycompositor.c +++ b/gst-libs/gst/gl/gstgloverlaycompositor.c @@ -31,9 +31,14 @@ #include <stdio.h> -#include "gl.h" #include "gstgloverlaycompositor.h" +#include "gstglcontext.h" +#include "gstglfuncs.h" +#include "gstglmemory.h" +#include "gstglshader.h" +#include "gstglslstage.h" + GST_DEBUG_CATEGORY_STATIC (gst_gl_overlay_compositor_debug); #define GST_CAT_DEFAULT gst_gl_overlay_compositor_debug diff --git a/gst-libs/gst/gl/gstgloverlaycompositor.h b/gst-libs/gst/gl/gstgloverlaycompositor.h index 0f4f1b282..3bc24620d 100644 --- a/gst-libs/gst/gl/gstgloverlaycompositor.h +++ b/gst-libs/gst/gl/gstgloverlaycompositor.h @@ -54,8 +54,8 @@ struct _GstGLOverlayCompositor GList * overlays; GstGLShader *shader; - GLint position_attrib; - GLint texcoord_attrib; + gint position_attrib; + gint texcoord_attrib; gpointer _padding[GST_PADDING]; }; diff --git a/gst-libs/gst/gl/gstglquery.c b/gst-libs/gst/gl/gstglquery.c index 0cf0f75ad..faceebf5f 100644 --- a/gst-libs/gst/gl/gstglquery.c +++ b/gst-libs/gst/gl/gstglquery.c @@ -34,12 +34,13 @@ #include "config.h" #endif -#include <gst/gl/gl.h> - #include <string.h> #include "gstglquery.h" +#include "gstglcontext.h" +#include "gstglfuncs.h" + #ifndef GL_TIME_ELAPSED #define GL_TIME_ELAPSED 0x88BF #endif diff --git a/gst-libs/gst/gl/gstglquery.h b/gst-libs/gst/gl/gstglquery.h index 0b057421f..48634b809 100644 --- a/gst-libs/gst/gl/gstglquery.h +++ b/gst-libs/gst/gl/gstglquery.h @@ -22,6 +22,7 @@ #define __GST_GL_QUERY_H__ #include <gst/gl/gstgl_fwd.h> +#include <gst/gl/gstgldebug.h> G_BEGIN_DECLS diff --git a/gst-libs/gst/gl/gstglrenderbuffer.c b/gst-libs/gst/gl/gstglrenderbuffer.c index 9a3c0c69e..4399c7ef8 100644 --- a/gst-libs/gst/gl/gstglrenderbuffer.c +++ b/gst-libs/gst/gl/gstglrenderbuffer.c @@ -24,10 +24,11 @@ #include <string.h> -#include <gst/video/video.h> +#include "gstglrenderbuffer.h" -#include <gst/gl/gstglbasememory.h> -#include <gst/gl/gstglrenderbuffer.h> +#include "gstglcontext.h" +#include "gstglfuncs.h" +#include "gstglmemory.h" /** * SECTION:gstglrenderbuffer diff --git a/gst-libs/gst/gl/gstglrenderbuffer.h b/gst-libs/gst/gl/gstglrenderbuffer.h index 9b47e6796..598f0ab9c 100644 --- a/gst-libs/gst/gl/gstglrenderbuffer.h +++ b/gst-libs/gst/gl/gstglrenderbuffer.h @@ -21,10 +21,6 @@ #ifndef _GST_GL_RENDERBUFFER_H_ #define _GST_GL_RENDERBUFFER_H_ -#include <gst/gst.h> -#include <gst/gstallocator.h> -#include <gst/gstmemory.h> - #include <gst/gl/gstglbasememory.h> G_BEGIN_DECLS diff --git a/gst-libs/gst/gl/gstglshaderstrings.h b/gst-libs/gst/gl/gstglshaderstrings.h index 0e56471c3..48ea20085 100644 --- a/gst-libs/gst/gl/gstglshaderstrings.h +++ b/gst-libs/gst/gl/gstglshaderstrings.h @@ -21,7 +21,7 @@ #ifndef __GST_GL_SHADER_STRINGS_H__ #define __GST_GL_SHADER_STRINGS_H__ -#include <gst/gl/gl.h> +#include <gst/gst.h> G_BEGIN_DECLS diff --git a/gst-libs/gst/gl/gstglsl_private.h b/gst-libs/gst/gl/gstglsl_private.h index 08addeb8c..992c41752 100644 --- a/gst-libs/gst/gl/gstglsl_private.h +++ b/gst-libs/gst/gl/gstglsl_private.h @@ -22,6 +22,7 @@ #define __GST_GLSL_PRIVATE_H__ #include <gst/gl/gstgl_fwd.h> +#include <gst/gl/gstglfuncs.h> G_BEGIN_DECLS diff --git a/gst-libs/gst/gl/gstglslstage.c b/gst-libs/gst/gl/gstglslstage.c index d40a88b7e..0205f384f 100644 --- a/gst-libs/gst/gl/gstglslstage.c +++ b/gst-libs/gst/gl/gstglslstage.c @@ -22,9 +22,10 @@ #include "config.h" #endif -#include <gst/gl/gl.h> - #include "gstglslstage.h" + +#include "gl.h" +#include "gstglfuncs.h" #include "gstglsl_private.h" #ifndef GL_GEOMETRY_SHADER diff --git a/gst-libs/gst/gl/gstglsyncmeta.c b/gst-libs/gst/gl/gstglsyncmeta.c index bd9131d93..d74b3cd46 100644 --- a/gst-libs/gst/gl/gstglsyncmeta.c +++ b/gst-libs/gst/gl/gstglsyncmeta.c @@ -32,9 +32,11 @@ #include "config.h" #endif -#include "gl.h" #include "gstglsyncmeta.h" +#include "gstglcontext.h" +#include "gstglfuncs.h" + GST_DEBUG_CATEGORY_STATIC (gst_gl_sync_meta_debug); #define GST_CAT_DEFAULT gst_gl_sync_meta_debug diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c index 1bdbfb117..feaf2f68e 100644 --- a/gst-libs/gst/gl/gstglupload.c +++ b/gst-libs/gst/gl/gstglupload.c @@ -29,6 +29,7 @@ #include "gstglupload.h" #if GST_GL_HAVE_PLATFORM_EGL +#include "egl/gsteglimage.h" #include "egl/gstglmemoryegl.h" #include "egl/gstglcontext_egl.h" #endif diff --git a/gst-libs/gst/gl/gstglviewconvert.c b/gst-libs/gst/gl/gstglviewconvert.c index 53475a744..755f1b997 100644 --- a/gst-libs/gst/gl/gstglviewconvert.c +++ b/gst-libs/gst/gl/gstglviewconvert.c @@ -34,9 +34,18 @@ #endif #include "gstglviewconvert.h" + +#include <gst/video/gstvideoaffinetransformationmeta.h> + +#include "gstglcontext.h" +#include "gstglframebuffer.h" +#include "gstglmemory.h" +#include "gstglshader.h" +#include "gstglshaderstrings.h" +#include "gstglsl.h" #include "gstglsl_private.h" +#include "gstglslstage.h" #include "gstglutils_private.h" -#include <gst/video/gstvideoaffinetransformationmeta.h> #define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0)) #define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1)) diff --git a/gst-libs/gst/gl/gstglviewconvert.h b/gst-libs/gst/gl/gstglviewconvert.h index d418ca90e..3cad3adeb 100644 --- a/gst-libs/gst/gl/gstglviewconvert.h +++ b/gst-libs/gst/gl/gstglviewconvert.h @@ -22,7 +22,10 @@ #ifndef _GST_GL_VIEW_CONVERT_H_ #define _GST_GL_VIEW_CONVERT_H_ -#include <gst/gl/gl.h> +#include <gst/gstmemory.h> +#include <gst/video/video.h> + +#include <gst/gl/gstgl_fwd.h> G_BEGIN_DECLS #define GST_TYPE_GL_VIEW_CONVERT (gst_gl_view_convert_get_type()) diff --git a/gst-libs/gst/gl/x11/gstgldisplay_x11.h b/gst-libs/gst/gl/x11/gstgldisplay_x11.h index d96a6697f..3ffe251bb 100644 --- a/gst-libs/gst/gl/x11/gstgldisplay_x11.h +++ b/gst-libs/gst/gl/x11/gstgldisplay_x11.h @@ -25,7 +25,6 @@ #include <X11/Xlib-xcb.h> -#include <gst/gl/gstgl_fwd.h> #include <gst/gl/gstgldisplay.h> G_BEGIN_DECLS diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.h b/gst-libs/gst/gl/x11/gstglwindow_x11.h index e612ff190..ba6fd16bd 100644 --- a/gst-libs/gst/gl/x11/gstglwindow_x11.h +++ b/gst-libs/gst/gl/x11/gstglwindow_x11.h @@ -24,7 +24,10 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> -#include <gst/gl/gl.h> +#include <gst/video/video.h> + +#include <gst/gl/gstgl_fwd.h> +#include <gst/gl/gstglwindow.h> G_BEGIN_DECLS |