Commit ae812685 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

gl: Add support for iOS EAGL platform

https://bugzilla.gnome.org/show_bug.cgi?id=703341
parent 6b2c24d0
......@@ -775,6 +775,7 @@ USE_GLX=no
USE_COCOA=no
USE_WGL=no
USE_X11=no
USE_EAGL=no
GL_LIBS=
GL_CFLAGS=
GL_OBJCFLAGS=
......@@ -960,8 +961,34 @@ case $host in
;;
*-darwin*)
if test "x$HAVE_IOS" = "xyes"; then
dnl iOS requires EAGL, which we don't support yet
AC_MSG_WARN([OpenGL support not ported to iOS yet])
if test "x$NEED_WGL" = "xyes"; then
AC_MSG_ERROR([WGL is not available on iOS])
fi
if test "x$NEED_GLX" = "xyes"; then
AC_MSG_ERROR([GLX is not available on iOS])
fi
if test "x$NEED_GL" = "xyes"; then
AC_MSG_ERROR([GL is not available on iOS])
fi
if test "x$NEED_X11" = "xyes"; then
AC_MSG_ERROR([X11 is not available on iOS])
fi
if test "x$NEED_COCOA" = "xyes"; then
AC_MSG_ERROR([Cocoa is not available on iOS])
fi
if test "x$NEED_EGL" = "xyes"; then
AC_MSG_ERROR([EGL is not available on iOS])
fi
GL_LIBS="$LIBS -framework OpenGLES -framework QuartzCore -framework UIKit -framework CoreGraphics -framework CoreFoundation -framework Foundation"
GL_CFLAGS="$GL_CFLAGS"
USE_GLES2=yes
USE_EAGL=yes
HAVE_WINDOW_EAGL=yes
ac_cv_type_GLsizeiptr=yes
ac_cv_type_GLintptr=yes
ac_cv_type_GLchar=yes
else
dnl Only osx supports cocoa.
if test "x$NEED_WGL" = "xyes"; then
......@@ -1074,6 +1101,7 @@ GST_GL_HAVE_WINDOW_WIN32=0
GST_GL_HAVE_WINDOW_WAYLAND=0
GST_GL_HAVE_WINDOW_ANDROID=0
GST_GL_HAVE_WINDOW_DISPMANX=0
GST_GL_HAVE_WINDOW_EAGL=0
if test "x$HAVE_WINDOW_X11" = "xyes"; then
GL_WINDOWS="x11 $GL_WINDOWS"
......@@ -1099,6 +1127,10 @@ if test "x$HAVE_WINDOW_DISPMANX" = "xyes"; then
GL_WINDOWS="dispmanx $GL_WINDOWS"
GST_GL_HAVE_WINDOW_DISPMANX=1
fi
if test "x$HAVE_WINDOW_EAGL" = "xyes"; then
GL_WINDOWS="eagl $GL_WINDOWS"
GST_GL_HAVE_WINDOW_EAGL=1
fi
GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
#define GST_GL_HAVE_WINDOW_X11 $GST_GL_HAVE_WINDOW_X11
......@@ -1107,6 +1139,7 @@ GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
#define GST_GL_HAVE_WINDOW_WAYLAND $GST_GL_HAVE_WINDOW_WAYLAND
#define GST_GL_HAVE_WINDOW_ANDROID $GST_GL_HAVE_WINDOW_ANDROID
#define GST_GL_HAVE_WINDOW_DISPMANX $GST_GL_HAVE_WINDOW_DISPMANX
#define GST_GL_HAVE_WINDOW_EAGL $GST_GL_HAVE_WINDOW_EAGL
"
dnl PLATFORM's
......@@ -1115,6 +1148,7 @@ GST_GL_HAVE_PLATFORM_EGL=0
GST_GL_HAVE_PLATFORM_GLX=0
GST_GL_HAVE_PLATFORM_WGL=0
GST_GL_HAVE_PLATFORM_COCOA=0
GST_GL_HAVE_PLATFORM_EAGL=0
if test "x$USE_EGL" = "xyes"; then
GL_PLATFORMS="egl $GL_PLATFORMS"
......@@ -1132,12 +1166,17 @@ if test "x$USE_COCOA" = "xyes"; then
GL_PLATFORMS="cocoa $GL_PLATFORMS"
GST_GL_HAVE_PLATFORM_COCOA=1
fi
if test "x$USE_EAGL" = "xyes"; then
GL_PLATFORMS="eagl $GL_PLATFORMS"
GST_GL_HAVE_PLATFORM_EAGL=1
fi
GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
#define GST_GL_HAVE_PLATFORM_EGL $GST_GL_HAVE_PLATFORM_EGL
#define GST_GL_HAVE_PLATFORM_GLX $GST_GL_HAVE_PLATFORM_GLX
#define GST_GL_HAVE_PLATFORM_WGL $GST_GL_HAVE_PLATFORM_WGL
#define GST_GL_HAVE_PLATFORM_COCOA $GST_GL_HAVE_PLATFORM_COCOA
#define GST_GL_HAVE_PLATFORM_EAGL $GST_GL_HAVE_PLATFORM_EAGL
"
dnl Check for no platforms/window systems
......@@ -1162,12 +1201,15 @@ if test "x$GL_APIS" = "x" -o "x$GL_PLATFORMS" = "x" -o "x$GL_WINDOWS" = "x"; the
USE_WGL=no
USE_COCOA=no
USE_EGL_RPI=no
USE_EAGL=no
HAVE_WINDOW_X11=no
HAVE_WINDOW_WIN32=no
HAVE_WINDOW_DISPMANX=no
HAVE_WINDOW_WAYLAND=no
HAVE_WINDOW_ANDROID=no
HAVE_WINDOW_COCOA=no
HAVE_WINDOW_EAGL=no
fi
AC_SUBST(GL_LIBS)
......@@ -1182,6 +1224,7 @@ AM_CONDITIONAL(HAVE_WINDOW_WIN32, test "x$HAVE_WINDOW_WIN32" = "xyes")
AM_CONDITIONAL(HAVE_WINDOW_DISPMANX, test "x$HAVE_WINDOW_DISPMANX" = "xyes")
AM_CONDITIONAL(HAVE_WINDOW_WAYLAND, test "x$HAVE_WINDOW_WAYLAND" = "xyes")
AM_CONDITIONAL(HAVE_WINDOW_ANDROID, test "x$HAVE_WINDOW_ANDROID" = "xyes")
AM_CONDITIONAL(HAVE_WINDOW_EAGL, test "x$HAVE_WINDOW_EAGL" = "xyes")
AM_CONDITIONAL(USE_OPENGL, test "x$USE_OPENGL" = "xyes")
AM_CONDITIONAL(USE_GLES2, test "x$USE_GLES2" = "xyes")
......@@ -1190,6 +1233,7 @@ AM_CONDITIONAL(USE_EGL, test "x$USE_EGL" = "xyes")
AM_CONDITIONAL(USE_WGL, test "x$USE_WGL" = "xyes")
AM_CONDITIONAL(USE_COCOA, test "x$USE_COCOA" = "xyes")
AM_CONDITIONAL(USE_EGL_RPI, test "x$USE_EGL_RPI" = "xyes")
AM_CONDITIONAL(USE_EAGL, test "x$USE_EAGL" = "xyes")
AM_CONDITIONAL(HAVE_GST_GL, test "x$USE_OPENGL" = "xyes" -o "x$USE_GLES2" = "xyes")
......@@ -3199,6 +3243,7 @@ gst-libs/gst/gl/android/Makefile
gst-libs/gst/gl/cocoa/Makefile
gst-libs/gst/gl/dispmanx/Makefile
gst-libs/gst/gl/glprototypes/Makefile
gst-libs/gst/gl/eagl/Makefile
gst-libs/gst/gl/egl/Makefile
gst-libs/gst/gl/wayland/Makefile
gst-libs/gst/gl/win32/Makefile
......
......@@ -2,7 +2,7 @@
lib_LTLIBRARIES = libgstgl-@GST_API_VERSION@.la
SUBDIRS = glprototypes
DIST_SUBDIRS = glprototypes android x11 win32 cocoa wayland dispmanx egl
DIST_SUBDIRS = glprototypes android x11 win32 cocoa wayland dispmanx egl eagl
noinst_HEADERS =
......@@ -87,6 +87,11 @@ SUBDIRS += android
libgstgl_@GST_API_VERSION@_la_LIBADD += android/libgstgl-android.la
endif
if HAVE_WINDOW_EAGL
SUBDIRS += eagl
libgstgl_@GST_API_VERSION@_la_LIBADD += eagl/libgstgl-eagl.la
endif
if USE_EGL
SUBDIRS += egl
libgstgl_@GST_API_VERSION@_la_LIBADD += egl/libgstgl-egl.la
......
## Process this file with automake to produce Makefile.in
noinst_LTLIBRARIES = libgstgl-eagl.la
libgstgl_eagl_la_SOURCES = \
gstglwindow_eagl.m \
gstglcontext_eagl.m
noinst_HEADERS = \
gstglwindow_eagl.h \
gstglcontext_eagl.h
libgstgl_eagl_la_CFLAGS = \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
$(GL_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(GST_CFLAGS)
libgstgl_eagl_la_OBJCFLAGS = \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
$(GL_CFLAGS) \
$(GL_OBJCFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(GST_CFLAGS)
libgstgl_eagl_la_LDFLAGS = \
$(GST_LIB_LDFLAGS) \
$(GST_ALL_LDFLAGS)
libgstgl_eagl_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) --tag=CC
/*
* GStreamer
* Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.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_CONTEXT_EAGL_H__
#define __GST_GL_CONTEXT_EAGL_H__
#include <gst/gst.h>
#include <gst/gl/gl.h>
G_BEGIN_DECLS
#define GST_GL_TYPE_CONTEXT_EAGL (gst_gl_context_eagl_get_type())
#define GST_GL_CONTEXT_EAGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_GL_TYPE_CONTEXT_EAGL, GstGLContextEagl))
#define GST_GL_CONTEXT_EAGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_GL_TYPE_CONTEXT_EAGL, GstGLContextEaglClass))
#define GST_GL_IS_CONTEXT_EAGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_GL_TYPE_CONTEXT_EAGL))
#define GST_GL_IS_CONTEXT_EAGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_GL_TYPE_CONTEXT_EAGL))
#define GST_GL_CONTEXT_EAGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_GL_TYPE_CONTEXT_EAGL, GstGLContextEaglClass))
typedef struct _GstGLContextEagl GstGLContextEagl;
typedef struct _GstGLContextEaglPrivate GstGLContextEaglPrivate;
typedef struct _GstGLContextEaglClass GstGLContextEaglClass;
struct _GstGLContextEagl {
/*< private >*/
GstGLContext parent;
/*< private >*/
GstGLContextEaglPrivate *priv;
gpointer _reserved[GST_PADDING];
};
struct _GstGLContextEaglClass {
/*< private >*/
GstGLContextClass parent_class;
/*< private >*/
gpointer _reserved[GST_PADDING_LARGE];
GstGLContextEaglPrivate *priv;
};
GType gst_gl_context_eagl_get_type (void);
GstGLContextEagl * gst_gl_context_eagl_new (void);
void gst_gl_context_eagl_prepare_draw (GstGLContextEagl * context);
void gst_gl_context_eagl_finish_draw (GstGLContextEagl * context);
G_END_DECLS
#endif /* __GST_GL_CONTEXT_EAGL_H__ */
This diff is collapsed.
/*
* GStreamer
* Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.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_WINDOW_EAGL_H__
#define __GST_GL_WINDOW_EAGL_H__
#include <gst/gst.h>
#include <gst/gl/gl.h>
G_BEGIN_DECLS
#define GST_GL_TYPE_WINDOW_EAGL (gst_gl_window_eagl_get_type())
#define GST_GL_WINDOW_EAGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_GL_TYPE_WINDOW_EAGL, GstGLWindowEagl))
#define GST_GL_WINDOW_EAGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_GL_TYPE_WINDOW_EAGL, GstGLWindowEaglClass))
#define GST_GL_IS_WINDOW_EAGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_GL_TYPE_WINDOW_EAGL))
#define GST_GL_IS_WINDOW_EAGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_GL_TYPE_WINDOW_EAGL))
#define GST_GL_WINDOW_EAGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_GL_TYPE_WINDOW_EAGL, GstGLWindowEaglClass))
typedef struct _GstGLWindowEagl GstGLWindowEagl;
typedef struct _GstGLWindowEaglPrivate GstGLWindowEaglPrivate;
typedef struct _GstGLWindowEaglClass GstGLWindowEaglClass;
struct _GstGLWindowEagl {
/*< private >*/
GstGLWindow parent;
/*< private >*/
GstGLWindowEaglPrivate *priv;
gpointer _reserved[GST_PADDING];
};
struct _GstGLWindowEaglClass {
/*< private >*/
GstGLWindowClass parent_class;
/*< private >*/
gpointer _reserved[GST_PADDING_LARGE];
};
GType gst_gl_window_eagl_get_type (void);
GstGLWindowEagl * gst_gl_window_eagl_new (void);
G_END_DECLS
#endif /* __GST_GL_WINDOW_EAGL_H__ */
/*
* GStreamer
* Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com>
*
* This library is free software; you can redistribute it and/or
* modify it un der 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#import <OpenGLES/EAGL.h>
#import <UIKit/UIKit.h>
#include "gstglwindow_eagl.h"
#include "gstglcontext_eagl.h"
#define GST_GL_WINDOW_EAGL_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), GST_GL_TYPE_WINDOW_EAGL, GstGLWindowEaglPrivate))
#define GST_CAT_DEFAULT gst_gl_window_eagl_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
#define DEBUG_INIT \
GST_DEBUG_CATEGORY_GET (GST_CAT_DEFAULT, "glwindow");
#define gst_gl_window_eagl_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstGLWindowEagl, gst_gl_window_eagl,
GST_GL_TYPE_WINDOW, DEBUG_INIT);
static guintptr gst_gl_window_eagl_get_display (GstGLWindow * window);
static guintptr gst_gl_window_eagl_get_window_handle (GstGLWindow * window);
static void gst_gl_window_eagl_set_window_handle (GstGLWindow * window,
guintptr handle);
static void gst_gl_window_eagl_draw (GstGLWindow * window, guint width,
guint height);
static void gst_gl_window_eagl_run (GstGLWindow * window);
static void gst_gl_window_eagl_quit (GstGLWindow * window);
static void gst_gl_window_eagl_send_message_async (GstGLWindow * window,
GstGLWindowCB callback, gpointer data, GDestroyNotify destroy);
static gboolean gst_gl_window_eagl_open (GstGLWindow * window, GError ** error);
static void gst_gl_window_eagl_close (GstGLWindow * window);
struct _GstGLWindowEaglPrivate
{
UIView *view;
GMainContext *main_context;
GMainLoop *loop;
};
static void
gst_gl_window_eagl_class_init (GstGLWindowEaglClass * klass)
{
GstGLWindowClass *window_class;
window_class = (GstGLWindowClass *) klass;
g_type_class_add_private (klass, sizeof (GstGLWindowEaglPrivate));
window_class->get_display =
GST_DEBUG_FUNCPTR (gst_gl_window_eagl_get_display);
window_class->get_window_handle =
GST_DEBUG_FUNCPTR (gst_gl_window_eagl_get_window_handle);
window_class->set_window_handle =
GST_DEBUG_FUNCPTR (gst_gl_window_eagl_set_window_handle);
window_class->draw_unlocked = GST_DEBUG_FUNCPTR (gst_gl_window_eagl_draw);
window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_eagl_draw);
window_class->run = GST_DEBUG_FUNCPTR (gst_gl_window_eagl_run);
window_class->quit = GST_DEBUG_FUNCPTR (gst_gl_window_eagl_quit);
window_class->send_message_async =
GST_DEBUG_FUNCPTR (gst_gl_window_eagl_send_message_async);
window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_eagl_open);
window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_eagl_close);
}
static void
gst_gl_window_eagl_init (GstGLWindowEagl * window)
{
window->priv = GST_GL_WINDOW_EAGL_GET_PRIVATE (window);
}
/* Must be called in the gl thread */
GstGLWindowEagl *
gst_gl_window_eagl_new (void)
{
GstGLWindowEagl *window = g_object_new (GST_GL_TYPE_WINDOW_EAGL, NULL);
return window;
}
static guintptr
gst_gl_window_eagl_get_display (GstGLWindow * window)
{
return 0;
}
static guintptr
gst_gl_window_eagl_get_window_handle (GstGLWindow * window)
{
return (guintptr) GST_GL_WINDOW_EAGL (window)->priv->view;
}
static void
gst_gl_window_eagl_set_window_handle (GstGLWindow * window, guintptr handle)
{
GstGLWindowEagl *window_eagl;
window_eagl = GST_GL_WINDOW_EAGL (window);
window_eagl->priv->view = (UIView *) handle;
}
static gboolean
gst_gl_window_eagl_open (GstGLWindow * window, GError ** error)
{
GstGLWindowEagl *window_eagl;
window_eagl = GST_GL_WINDOW_EAGL (window);
window_eagl->priv->main_context = g_main_context_new ();
window_eagl->priv->loop =
g_main_loop_new (window_eagl->priv->main_context, FALSE);
return TRUE;
}
static void
gst_gl_window_eagl_close (GstGLWindow * window)
{
GstGLWindowEagl *window_eagl;
window_eagl = GST_GL_WINDOW_EAGL (window);
g_main_loop_unref (window_eagl->priv->loop);
g_main_context_unref (window_eagl->priv->main_context);
}
static void
gst_gl_window_eagl_run (GstGLWindow * window)
{
GstGLWindowEagl *window_eagl;
window_eagl = GST_GL_WINDOW_EAGL (window);
GST_LOG ("starting main loop");
g_main_loop_run (window_eagl->priv->loop);
GST_LOG ("exiting main loop");
}
static void
gst_gl_window_eagl_quit (GstGLWindow * window)
{
GstGLWindowEagl *window_eagl;
window_eagl = GST_GL_WINDOW_EAGL (window);
GST_LOG ("sending quit");
g_main_loop_quit (window_eagl->priv->loop);
GST_LOG ("quit sent");
}
typedef struct _GstGLMessage
{
GstGLWindowCB callback;
gpointer data;
GDestroyNotify destroy;
} GstGLMessage;
static gboolean
_run_message (GstGLMessage * message)
{
if (message->callback)
message->callback (message->data);
if (message->destroy)
message->destroy (message->data);
g_slice_free (GstGLMessage, message);
return FALSE;
}
static void
gst_gl_window_eagl_send_message_async (GstGLWindow * window,
GstGLWindowCB callback, gpointer data, GDestroyNotify destroy)
{
GstGLWindowEagl *window_eagl;
GstGLMessage *message;
window_eagl = GST_GL_WINDOW_EAGL (window);
message = g_slice_new (GstGLMessage);
message->callback = callback;
message->data = data;
message->destroy = destroy;
g_main_context_invoke (window_eagl->priv->main_context,
(GSourceFunc) _run_message, message);
}
struct draw
{
GstGLWindowEagl *window;
guint width, height;
};
static void
draw_cb (gpointer data)
{
struct draw *draw_data = data;
GstGLWindowEagl *window_eagl = draw_data->window;
GstGLWindow *window = GST_GL_WINDOW (window_eagl);
GstGLContext *context = gst_gl_window_get_context (window);
GstGLContextEagl *eagl_context = GST_GL_CONTEXT_EAGL (context);
GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
gst_gl_context_eagl_prepare_draw (eagl_context);
if (window->draw)
window->draw (window->draw_data);
context_class->swap_buffers (context);
gst_gl_context_eagl_finish_draw (eagl_context);
gst_object_unref (context);
}
static void
gst_gl_window_eagl_draw (GstGLWindow * window, guint width, guint height)
{
struct draw draw_data;
draw_data.window = GST_GL_WINDOW_EAGL (window);
draw_data.width = width;
draw_data.height = height;
gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, &draw_data);
}
......@@ -54,8 +54,13 @@
#ifndef GL_GLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES 1
#endif
# include <GLES2/gl2.h>
# include <GLES2/gl2ext.h>
# if __APPLE__
# include <OpenGLES/ES2/gl.h>
# include <OpenGLES/ES2/glext.h>
# else
# include <GLES2/gl2.h>
# include <GLES2/gl2ext.h>
# endif
# if !GST_GL_HAVE_OPENGL
# include <gst/gl/gstgles2.h>
# endif
......@@ -110,6 +115,7 @@ typedef enum
GST_GL_PLATFORM_GLX = (1 << 1),
GST_GL_PLATFORM_WGL = (1 << 2),
GST_GL_PLATFORM_CGL = (1 << 3),
GST_GL_PLATFORM_EAGL = (1 << 4),
GST_GL_PLATFORM_ANY = G_MAXUINT32
} GstGLPlatform;
......
......@@ -61,6 +61,9 @@
#if GST_GL_HAVE_PLATFORM_WGL
#include "win32/gstglcontext_wgl.h"
#endif
#if GST_GL_HAVE_PLATFORM_EAGL
#include "eagl/gstglcontext_eagl.h"
#endif
#define USING_OPENGL(display) (display->gl_api & GST_GL_API_OPENGL)
#define USING_OPENGL3(display) (display->gl_api & GST_GL_API_OPENGL3)
......@@ -218,6 +221,10 @@ gst_gl_context_new (GstGLDisplay * display)
context = GST_GL_CONTEXT (gst_gl_context_wgl_new ());
}
#endif
#if GST_GL_HAVE_PLATFORM_EAGL
if (!context && (!user_choice || g_strstr_len (user_choice, 5, "eagl")))
context = GST_GL_CONTEXT (gst_gl_context_eagl_new ());
#endif
if (!context) {
/* subclass returned a NULL context */
......
......@@ -28,6 +28,12 @@
G_BEGIN_DECLS
/* SUPPORTED */
/* FIXME: On iOS this exists but maps to an actual BGRA extension */
#ifdef __APPLE__
#ifdef GL_BGRA
#undef GL_BGRA
#endif
#endif
//FIXME:
#define GL_RGB16 GL_RGB565
......
......@@ -55,6 +55,9 @@
#if GST_GL_HAVE_WINDOW_ANDROID
#include "android/gstglwindow_android_egl.h"
#endif
#if GST_GL_HAVE_WINDOW_EAGL
#include "eagl/gstglwindow_eagl.h"
#endif
#if GST_GL_HAVE_WINDOW_DISPMANX
#include "dispmanx/gstglwindow_dispmanx_egl.h"
#endif
......@@ -177,6 +180,10 @@ gst_gl_window_new (GstGLDisplay * display)
#if GST_GL_HAVE_WINDOW_ANDROID
if (!window && (!user_choice || g_strstr_len (user_choice, 7, "android")))
window = GST_GL_WINDOW (gst_gl_window_android_egl_new ());
#endif
#if GST_GL_HAVE_WINDOW_EAGL
if (!window && (!user_choice || g_strstr_len (user_choice, 7, "eagl")))
window = GST_GL_WINDOW (gst_gl_window_eagl_new ());
#endif
if (!window) {
/* subclass returned a NULL window */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment