[gst-cvs] gst-plugins-gl: build: support openGLES on linux via autofoo. Partialy fixes #593786

Stefan Kost ensonic at kemper.freedesktop.org
Mon Sep 14 08:30:10 PDT 2009


Module: gst-plugins-gl
Branch: master
Commit: 4b2ae4767e41a8db433e7e1717ab9a35e0d6627a
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-gl/commit/?id=4b2ae4767e41a8db433e7e1717ab9a35e0d6627a

Author: Stefan Kost <ensonic at users.sf.net>
Date:   Tue Sep  1 15:21:39 2009 +0300

build: support openGLES on linux via autofoo. Partialy fixes #593786

Add a pkg-config check for opengl and if not found assume opengl-es. If user has
none of both one still get build error later on (there is no pkg-config for
opengl-es).
Add more files to EXTRA dist and build the opengles variant if selected.
Simmilar changes could be done for the winCE backend.

---

 configure.ac                |   28 +++++++++++++++++++++++-----
 gst-libs/gst/gl/Makefile.am |    5 +++++
 gst/gl/Makefile.am          |   26 ++++++++++++++++----------
 3 files changed, 44 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6668825..6f47012 100644
--- a/configure.ac
+++ b/configure.ac
@@ -170,13 +170,23 @@ case $host in
     save_LIBS="$LIBS"
     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
     LIBS="$LIBS $X_LIBS"
-    AG_GST_CHECK_LIBHEADER(GL, GL, glTexImage2D,, GL/gl.h,, AC_MSG_ERROR([OpenGL is required]))
-    AG_GST_CHECK_LIBHEADER(GLU, GLU, gluSphere,, GL/glu.h,, AC_MSG_ERROR([GLU is required]))
-    AG_GST_CHECK_LIBHEADER(GLEW, GLEW, glewInit,, GL/glew.h,, AC_MSG_ERROR([GLEW is required]))
-    GL_LIBS="$LIBS $X_LIBS -lGL -lGLU -lGLEW"
+    PKG_CHECK_MODULES(GL, gl, HAVE_GL=yes, HAVE_GL=no)
+    if test "x$HAVE_GL" = "xyes"; then
+      AG_GST_CHECK_LIBHEADER(GL, GL, glTexImage2D,, GL/gl.h,, AC_MSG_ERROR([OpenGL is required]))
+      AG_GST_CHECK_LIBHEADER(GLU, GLU, gluSphere,, GL/glu.h,, AC_MSG_ERROR([GLU is required]))
+      AG_GST_CHECK_LIBHEADER(GLEW, GLEW, glewInit,, GL/glew.h,, AC_MSG_ERROR([GLEW is required]))
+      GL_LIBS="$LIBS $X_LIBS -lGL -lGLU -lGLEW"
+      GL_BACKEND=x11
+      GL_TYPE=gl
+    else
+      AG_GST_CHECK_LIBHEADER(EGL, EGL, eglGetError,, EGL/egl.h,, AC_MSG_ERROR([EGL is required]))
+      AG_GST_CHECK_LIBHEADER(GLES2, GLESv2, glTexImage2D,, GLES2/gl2.h,, AC_MSG_ERROR([OpenGLES2 is required]))
+      GL_LIBS="$LIBS $X_LIBS -lEGL -lGLESv2"
+      GL_BACKEND=x11ES2
+      GL_TYPE=gles
+    fi
     CPPFLAGS="$save_CPPFLAGS"
     LIBS="$save_LIBS"
-    GL_BACKEND=x11
     ;;
   *-darwin*)
     save_CPPFLAGS="$CPPFLAGS"
@@ -186,6 +196,7 @@ case $host in
     CPPFLAGS="$save_CPPFLAGS -framework OpenGL"
     LIBS="$save_LIBS"
     GL_BACKEND=cocoa
+    GL_TYPE=gl
     ;;
   *-mingw32*)
     save_CPPFLAGS="$CPPFLAGS"
@@ -198,16 +209,23 @@ case $host in
     CPPFLAGS="$save_CPPFLAGS"
     LIBS="$save_LIBS"
     GL_BACKEND=win32
+    GL_TYPE=gl
     ;;
   *)
     exit 1
     ;;
 esac
+if test "x$GL_TYPE" = "xgles"; then
+  AC_DEFINE(OPENGL_ES2, [1] , [Use OpenGLES2])
+fi
 AC_SUBST(GL_LIBS)
 AC_SUBST(GL_BACKEND)
+AC_SUBST(OPENGL_ES2)
 AM_CONDITIONAL(GL_BACKEND_X11, test "x$GL_BACKEND" = "xx11")
+AM_CONDITIONAL(GL_BACKEND_X11ES2, test "x$GL_BACKEND" = "xx11ES2")
 AM_CONDITIONAL(GL_BACKEND_COCOA, test "x$GL_BACKEND" = "xcocoa")
 AM_CONDITIONAL(GL_BACKEND_WIN32, test "x$GL_BACKEND" = "xwin32")
+AM_CONDITIONAL(GL_IS_OPENGL, test "x$GL_TYPE" = "xgl")
 
 dnl checks for gstreamer
 dnl uninstalled is selected preferentially -- see pkg-config(1)
diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
index 08ad810..8b10912 100644
--- a/gst-libs/gst/gl/Makefile.am
+++ b/gst-libs/gst/gl/Makefile.am
@@ -3,7 +3,9 @@ lib_LTLIBRARIES = libgstgl- at GST_MAJORMINOR@.la
 
 EXTRA_DIST = \
 	gstglwindow_x11.c \
+	gstglwindow_x11ES2.c \
 	gstglwindow_win32.c \
+	gstglwindow_winCE.c \
 	gstglwindow_cocoa.m
 
 libgstgl_ at GST_MAJORMINOR@_la_SOURCES = \
@@ -21,6 +23,9 @@ endif
 if GL_BACKEND_X11
 libgstgl_ at GST_MAJORMINOR@_la_SOURCES += gstglwindow_x11.c
 endif
+if GL_BACKEND_X11ES2
+libgstgl_ at GST_MAJORMINOR@_la_SOURCES += gstglwindow_x11ES2.c
+endif
 
 libgstgl_ at GST_MAJORMINOR@includedir = $(includedir)/gstreamer- at GST_MAJORMINOR@/gst/gl
 libgstgl_ at GST_MAJORMINOR@include_HEADERS = \
diff --git a/gst/gl/Makefile.am b/gst/gl/Makefile.am
index 159fdb8..6064474 100644
--- a/gst/gl/Makefile.am
+++ b/gst/gl/Makefile.am
@@ -4,22 +4,15 @@ plugin_LTLIBRARIES = libgstopengl.la
 AM_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
 AM_LIBS = $(GST_BASE_LIBS)
 
-libgstopengl_la_SOURCES = \
-	gstopengl.c \
-	gstglimagesink.c \
-	gstglimagesink.h \
-	gstglupload.c \
-	gstglupload.h \
+# full opengl required
+if GL_IS_OPENGL
+OPENGL_SOURCES =  \
 	gstglbumper.c \
 	gstglbumper.h \
-	gstgldownload.c \
-	gstgldownload.h \
 	gstglfilterblur.c \
 	gstglfilterblur.h \
 	gstglfiltersobel.c \
 	gstglfiltersobel.h \
-	gstglfiltercube.c \
-	gstglfiltercube.h \
 	gstglfilterlaplacian.c \
 	gstglfilterlaplacian.h \
 	gstglfilterglass.c \
@@ -58,6 +51,19 @@ libgstopengl_la_SOURCES = \
 	effects/gstgleffectsin.c \
 	effects/gstgleffectglow.c \
 	effects/gstgleffectxray.c
+endif
+
+libgstopengl_la_SOURCES = \
+	gstopengl.c \
+	gstglimagesink.c \
+	gstglimagesink.h \
+	gstglupload.c \
+	gstglupload.h \
+	gstgldownload.c \
+	gstgldownload.h \
+	gstglfiltercube.c \
+	gstglfiltercube.h \
+	$(OPENGL_SOURCES)
 
 # check order of CFLAGS and LIBS, shouldn't the order be the other way around
 # (like in AM_CFLAGS)?





More information about the Gstreamer-commits mailing list