Commit 4952fdd9 authored by Julien Isorce's avatar Julien Isorce Committed by Tim-Philipp Müller

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
parent 632015a9
......@@ -22,6 +22,8 @@
#include "config.h"
#endif
#include <gst/gl/gstglfuncs.h>
#include "gltestsrc.h"
#define MAX_ATTRIBUTES 4
......
......@@ -38,12 +38,12 @@
#include "config.h"
#endif
#include <string.h>
#include <gst/gl/gstglfuncs.h>
#include <gst/math-compat.h>
#include <gst/video/colorbalance.h>
#include "gstglcolorbalance.h"
#include <string.h>
#include <gst/video/colorbalance.h>
GST_DEBUG_CATEGORY_STATIC (glcolorbalance_debug);
#define GST_CAT_DEFAULT glcolorbalance_debug
......
......@@ -47,7 +47,6 @@
#include "gstglcolorscale.h"
#define GST_CAT_DEFAULT gst_gl_colorscale_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
......
......@@ -36,6 +36,8 @@
#include "config.h"
#endif
#include <gst/gl/gstglfuncs.h>
#include "gstgldeinterlace.h"
#define GST_CAT_DEFAULT gst_gl_deinterlace_debug
......
......@@ -39,6 +39,8 @@
#include <stdlib.h>
#include <png.h>
#include <gst/gl/gstglfuncs.h>
#include "gstgldifferencematte.h"
#include "effects/gstgleffectssources.h"
......
......@@ -36,7 +36,6 @@
#include "config.h"
#endif
#include <gst/gl/gstglconfig.h>
#include "gstgleffects.h"
#define GST_CAT_DEFAULT gst_gl_effects_debug
......
......@@ -22,6 +22,8 @@
#define __GST_GL_EFFECTS_H__
#include <gst/gl/gstglfilter.h>
#include <gst/gl/gstglfuncs.h>
#include "effects/gstgleffectssources.h"
G_BEGIN_DECLS
......
......@@ -22,6 +22,7 @@
#define _GST_GL_FILTERCUBE_H_
#include <gst/gl/gstglfilter.h>
#include <gst/gl/gstglfuncs.h>
G_BEGIN_DECLS
......
......@@ -41,7 +41,10 @@
#endif
#include <math.h>
#include <gst/gl/gstglfuncs.h>
#include "gstglfilterglass.h"
#include "gstglutils.h"
#define GST_CAT_DEFAULT gst_gl_filter_glass_debug
......
......@@ -56,7 +56,7 @@
#include "config.h"
#endif
#include <gst/gst.h>
#include <gst/gl/gstglfuncs.h>
#include "gstglfiltershader.h"
#if HAVE_GRAPHENE
......
......@@ -28,6 +28,7 @@
#include <gst/video/video.h>
#include <gst/gl/gl.h>
#include <gst/gl/gstglfuncs.h>
G_BEGIN_DECLS
......
......@@ -24,6 +24,7 @@
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/gl/gl.h>
#include <gst/gl/gstglfuncs.h>
#include "gstglbasemixer.h"
G_BEGIN_DECLS
......
......@@ -22,6 +22,7 @@
#define _GST_GL_OVERLAY_H_
#include <gst/gl/gstglfilter.h>
#include <gst/gl/gstglfuncs.h>
G_BEGIN_DECLS
......
......@@ -42,9 +42,11 @@
#include "config.h"
#endif
#include <gst/gl/gstglfuncs.h>
#include <gst/gst-i18n-plugin.h>
#include "gstgltestsrc.h"
#include "gltestsrc.h"
#include <gst/gst-i18n-plugin.h>
#define USE_PEER_BUFFERALLOC
#define SUPPORTED_GL_APIS (GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2)
......
......@@ -22,7 +22,8 @@
#include "config.h"
#endif
#include <gst/gst.h>
#include <gst/gl/gstglfuncs.h>
#include "gstglutils.h"
struct _compile_shader
......
......@@ -43,10 +43,12 @@
#include "config.h"
#endif
#include <gst/video/gstvideoaffinetransformationmeta.h>
#include <gst/controller/gstproxycontrolbinding.h>
#include <gst/gl/gstglfuncs.h>
#include <gst/video/gstvideoaffinetransformationmeta.h>
#include "gstglvideomixer.h"
#include "gstglmixerbin.h"
#include "gstglutils.h"
......
......@@ -47,6 +47,7 @@
#endif
#include <gst/base/gstbasetransform.h>
#include "gstglviewconvert.h"
#define GST_CAT_DEFAULT gst_gl_view_convert_element_debug
......
......@@ -22,7 +22,7 @@
#ifndef _GST_GL_VIEW_CONVERT_ELEMENT_H_
#define _GST_GL_VIEW_CONVERT_ELEMENT_H_
#include <gst/gl/gstglviewconvert.h>
#include <gst/gl/gstglfilter.h>
G_BEGIN_DECLS
#define GST_TYPE_GL_VIEW_CONVERT_ELEMENT (gst_gl_view_convert_element_get_type())
......
......@@ -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)
{
......
......@@ -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,
......
......@@ -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) {
......
......@@ -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;
};
/**
......
......@@ -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;
......
......@@ -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"
......
......@@ -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);
......
......@@ -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
......
......@@ -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>
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -24,7 +24,10 @@
#include <string.h>
#include <gst/gl/gstglbasememory.h>
#include "gstglbasememory.h"
#include "gstglcontext.h"
#include "gstglquery.h"
/**
* SECTION:gstglbasememory
......
......@@ -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:
......
......@@ -25,6 +25,9 @@
#include <string.h>
#include "gstglbuffer.h"
#include "gstglcontext.h"
#include "gstglfuncs.h"
#include "gstglutils.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
......
......@@ -22,8 +22,10 @@
#include "config.h"
#endif
#include "gl.h"
#include "gstglbufferpool.h"
#include "gstglmemory.h"
#include "gstglsyncmeta.h"
#include "gstglutils.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
......
......@@ -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"
/**
......
......@@ -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"