[vlc-commits] gl: rearrange includes

Thomas Guillem git at videolan.org
Thu Feb 15 08:42:29 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb 14 15:33:10 2018 +0100| [0e6793148a573389860facb3b62dc808cdd3a18a] | committer: Thomas Guillem

gl: rearrange includes

Mainly to remove libplacebo include dependencies from gl converters. For now,
only the generic converter need libplacebo. Future converters will still be
able to use if they add CFLAGS/LIBADD dependencies.

This fixes the build when libplacebo includes are not in common places
(contrib,/usr/include,/usr/local/include...).

(cherry picked from commit 1fe5c1e3b1be29c111e24848854d30759e278978)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=0e6793148a573389860facb3b62dc808cdd3a18a
---

 modules/video_output/opengl/converter.h        | 54 +++++++++++++++++++++-----
 modules/video_output/opengl/fragment_shaders.c |  1 +
 modules/video_output/opengl/vout_helper.c      |  1 +
 modules/video_output/opengl/vout_helper.h      | 42 +-------------------
 4 files changed, 48 insertions(+), 50 deletions(-)

diff --git a/modules/video_output/opengl/converter.h b/modules/video_output/opengl/converter.h
index 89e9fce66c..02b2f11bd4 100644
--- a/modules/video_output/opengl/converter.h
+++ b/modules/video_output/opengl/converter.h
@@ -21,12 +21,35 @@
 #ifndef VLC_OPENGL_CONVERTER_H
 #define VLC_OPENGL_CONVERTER_H
 
-#ifdef HAVE_LIBPLACEBO
-#include <libplacebo/shaders.h>
-#endif
-
-#include "vout_helper.h"
 #include <vlc_plugin.h>
+#include <vlc_common.h>
+#include <vlc_picture_pool.h>
+#include <vlc_opengl.h>
+
+/* if USE_OPENGL_ES2 is defined, OpenGL ES version 2 will be used, otherwise
+ * normal OpenGL will be used */
+#ifdef __APPLE__
+# include <TargetConditionals.h>
+# if !TARGET_OS_IPHONE
+#  undef USE_OPENGL_ES2
+#  define MACOS_OPENGL
+#  include <OpenGL/gl.h>
+# else /* Force ESv2 on iOS */
+#  define USE_OPENGL_ES2
+#  include <OpenGLES/ES1/gl.h>
+#  include <OpenGLES/ES2/gl.h>
+#  include <OpenGLES/ES2/glext.h>
+# endif
+#else /* !defined (__APPLE__) */
+# if defined (USE_OPENGL_ES2)
+#  include <GLES2/gl2.h>
+# else
+#  ifdef _WIN32
+#   include <GL/glew.h>
+#  endif
+#  include <GL/gl.h>
+# endif
+#endif
 
 #define VLCGL_PICTURE_MAX 128
 
@@ -215,6 +238,23 @@ typedef struct {
     PFNGLCLIENTWAITSYNCPROC         ClientWaitSync; /* can be NULL */
 } opengl_vtable_t;
 
+static inline bool HasExtension(const char *apis, const char *api)
+{
+    size_t apilen = strlen(api);
+    while (apis) {
+        while (*apis == ' ')
+            apis++;
+        if (!strncmp(apis, api, apilen) && memchr(" ", apis[apilen], 2))
+            return true;
+        apis = strchr(apis, ' ');
+    }
+    return false;
+}
+
+struct pl_context;
+struct pl_shader;
+struct pl_shader_res;
+
 /*
  * Structure that is filled by "glhw converter" module probe function
  * The implementation should initialize every members of the struct that are
@@ -230,10 +270,8 @@ struct opengl_tex_converter_t
     /* Pointer to object gl, set by the caller */
     vlc_gl_t *gl;
 
-#ifdef HAVE_LIBPLACEBO
     /* libplacebo context, created by the caller (optional) */
     struct pl_context *pl_ctx;
-#endif
 
     /* Function pointers to OpenGL functions, set by the caller */
     const opengl_vtable_t *vt;
@@ -297,10 +335,8 @@ struct opengl_tex_converter_t
     bool yuv_color;
     GLfloat yuv_coefficients[16];
 
-#ifdef HAVE_LIBPLACEBO
     struct pl_shader *pl_sh;
     const struct pl_shader_res *pl_sh_res;
-#endif
 
     /* Private context */
     void *priv;
diff --git a/modules/video_output/opengl/fragment_shaders.c b/modules/video_output/opengl/fragment_shaders.c
index 0c91a4db76..3fc6886bec 100644
--- a/modules/video_output/opengl/fragment_shaders.c
+++ b/modules/video_output/opengl/fragment_shaders.c
@@ -33,6 +33,7 @@
 #include <vlc_common.h>
 #include <vlc_memstream.h>
 #include "internal.h"
+#include "vout_helper.h"
 
 #ifndef GL_RED
 # define GL_RED 0x1903
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index fe98279f5d..0032010403 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -41,6 +41,7 @@
 #include <vlc_vout.h>
 #include <vlc_viewpoint.h>
 
+#include "vout_helper.h"
 #include "internal.h"
 
 #ifndef GL_CLAMP_TO_EDGE
diff --git a/modules/video_output/opengl/vout_helper.h b/modules/video_output/opengl/vout_helper.h
index 97d961e0de..978669f89c 100644
--- a/modules/video_output/opengl/vout_helper.h
+++ b/modules/video_output/opengl/vout_helper.h
@@ -29,34 +29,7 @@
 #ifndef VLC_OPENGL_VOUT_HELPER_H
 #define VLC_OPENGL_VOUT_HELPER_H
 
-#include <vlc_common.h>
-#include <vlc_picture_pool.h>
-#include <vlc_opengl.h>
-
-/* if USE_OPENGL_ES2 is defined, OpenGL ES version 2 will be used, otherwise
- * normal OpenGL will be used */
-#ifdef __APPLE__
-# include <TargetConditionals.h>
-# if !TARGET_OS_IPHONE
-#  undef USE_OPENGL_ES2
-#  define MACOS_OPENGL
-#  include <OpenGL/gl.h>
-# else /* Force ESv2 on iOS */
-#  define USE_OPENGL_ES2
-#  include <OpenGLES/ES1/gl.h>
-#  include <OpenGLES/ES2/gl.h>
-#  include <OpenGLES/ES2/glext.h>
-# endif
-#else /* !defined (__APPLE__) */
-# if defined (USE_OPENGL_ES2)
-#  include <GLES2/gl2.h>
-# else
-#  ifdef _WIN32
-#   include <GL/glew.h>
-#  endif
-#  include <GL/gl.h>
-# endif
-#endif
+#include "converter.h"
 
 #ifdef HAVE_LIBPLACEBO
 #include <libplacebo/shaders/colorspace.h>
@@ -236,19 +209,6 @@ static const vlc_fourcc_t gl_subpicture_chromas[] = {
     0
 };
 
-static inline bool HasExtension(const char *apis, const char *api)
-{
-    size_t apilen = strlen(api);
-    while (apis) {
-        while (*apis == ' ')
-            apis++;
-        if (!strncmp(apis, api, apilen) && memchr(" ", apis[apilen], 2))
-            return true;
-        apis = strchr(apis, ' ');
-    }
-    return false;
-}
-
 typedef struct vout_display_opengl_t vout_display_opengl_t;
 
 vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,



More information about the vlc-commits mailing list