[vlc-commits] gl: rearrange includes

2018-02-14 Thread Thomas Guillem
vlc/vlc-3.0 | branch: master | Thomas Guillem  | 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 

> 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 
-#endif
-
-#include "vout_helper.h"
 #include 
+#include 
+#include 
+#include 
+
+/* if USE_OPENGL_ES2 is defined, OpenGL ES version 2 will be used, otherwise
+ * normal OpenGL will be used */
+#ifdef __APPLE__
+# include 
+# if !TARGET_OS_IPHONE
+#  undef USE_OPENGL_ES2
+#  define MACOS_OPENGL
+#  include 
+# else /* Force ESv2 on iOS */
+#  define USE_OPENGL_ES2
+#  include 
+#  include 
+#  include 
+# endif
+#else /* !defined (__APPLE__) */
+# if defined (USE_OPENGL_ES2)
+#  include 
+# else
+#  ifdef _WIN32
+#   include 
+#  endif
+#  include 
+# 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 
 #include 
 #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 
 #include 
 
+#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 
-#include 
-#include 
-
-/* if USE_OPENGL_ES2 is defined, OpenGL ES version 2 will be used, otherwise
- * normal OpenGL will be used */
-#ifdef __APPLE__
-# include 
-# if !TARGET_OS_IPHONE
-#  undef USE_OPENGL_ES2
-#  define MACOS_OPENGL
-#  include 
-# else /* Force ESv2 on iOS */
-#  define USE_OPENGL_ES2
-#  include 
-#  include 
-#  include 
-# endif
-#else /* !defined (__APPLE__) */
-# if defined (USE_OPENGL_ES2)
-#  include 
-# else
-#  ifdef _WIN32
-#   include 
-#  endif
-#  include 
-# endif
-#endif
+#include "converter.h"
 
 #ifdef HAVE_LIBPLACEBO
 #include 
@@ -236,19 +209,6 @@ static const 

[vlc-commits] gl: rearrange includes

2018-02-14 Thread Thomas Guillem
vlc | branch: master | Thomas Guillem  | Wed Feb 14 15:33:10 
2018 +0100| [1fe5c1e3b1be29c111e24848854d30759e278978] | 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...).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1fe5c1e3b1be29c111e24848854d30759e278978
---

 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 4ea603f9f0..470758e876 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 
-#endif
-
-#include "vout_helper.h"
 #include 
+#include 
+#include 
+#include 
+
+/* if USE_OPENGL_ES2 is defined, OpenGL ES version 2 will be used, otherwise
+ * normal OpenGL will be used */
+#ifdef __APPLE__
+# include 
+# if !TARGET_OS_IPHONE
+#  undef USE_OPENGL_ES2
+#  define MACOS_OPENGL
+#  include 
+# else /* Force ESv2 on iOS */
+#  define USE_OPENGL_ES2
+#  include 
+#  include 
+#  include 
+# endif
+#else /* !defined (__APPLE__) */
+# if defined (USE_OPENGL_ES2)
+#  include 
+# else
+#  ifdef _WIN32
+#   include 
+#  endif
+#  include 
+# 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 
 #include 
 #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 f9b9426215..56f5be7bc3 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -40,6 +40,7 @@
 #include 
 #include 
 
+#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 03ba2eb05a..bd4126c632 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 
-#include 
-#include 
-
-/* if USE_OPENGL_ES2 is defined, OpenGL ES version 2 will be used, otherwise
- * normal OpenGL will be used */
-#ifdef __APPLE__
-# include 
-# if !TARGET_OS_IPHONE
-#  undef USE_OPENGL_ES2
-#  define MACOS_OPENGL
-#  include 
-# else /* Force ESv2 on iOS */
-#  define USE_OPENGL_ES2
-#  include 
-#  include 
-#  include 
-# endif
-#else /* !defined (__APPLE__) */
-# if defined (USE_OPENGL_ES2)
-#  include 
-# else
-#  ifdef _WIN32
-#   include 
-#  endif
-#  include 
-# endif
-#endif
+#include "converter.h"
 
 #ifdef HAVE_LIBPLACEBO
 #include 
@@ -237,19 +210,6 @@ static const vlc_fourcc_t gl_subpicture_chromas[] = {
 0
 };
 
-static inline bool HasExtension(const char *apis, const char *api)
-{
-