Skip to content

Commit 6e0a63d

Browse files
committed
GstPlayer update for Raspberry Pi; fixing bug with GLES
1 parent 88173e3 commit 6e0a63d

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

include/cinder/linux/GstPlayer.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@
4545
#if defined( CINDER_LINUX_EGL_ONLY )
4646
#include <gst/gl/egl/gstgldisplay_egl.h>
4747
#elif defined( CINDER_LINUX )
48-
#include <gst/gl/x11/gstgldisplay_x11.h>
48+
#if defined( CINDER_GL_ES )
49+
#include <gst/gl/egl/gstgldisplay_egl.h>
50+
#else
51+
#include <gst/gl/x11/gstgldisplay_x11.h>
52+
#endif
4953
#endif
5054

5155
#define CINDER_GST_HAS_GL

src/cinder/linux/GstPlayer.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
// These files will include a glfw_config.h that's custom to Cinder.
1212
#include "glad/glad.h"
1313
#define GLFW_EXPOSE_NATIVE_X11
14-
#define GLFW_EXPOSE_NATIVE_GLX
14+
#if ! defined( CINDER_GL_ES )
15+
#define GLFW_EXPOSE_NATIVE_GLX
16+
#endif
1517
#define GLFW_EXPOSE_NATIVE_EGL
1618
#include "glfw/glfw3.h"
1719
#include "glfw/glfw3native.h"
@@ -531,13 +533,18 @@ bool GstPlayer::initialize()
531533
ci::gl::context()->makeCurrent( true );
532534
}
533535
#else
534-
if( ! sGstGLDisplay )
536+
if( ! sGstGLDisplay ) {
537+
#if defined( CINDER_GL_ES )
538+
sGstGLDisplay = (GstGLDisplay*)gst_gl_display_egl_new_with_egl_display( (gpointer)::glfwGetEGLDisplay() );
539+
#else
535540
sGstGLDisplay = (GstGLDisplay*)gst_gl_display_x11_new_with_display( ::glfwGetX11Display() );
541+
#endif
542+
}
536543
if( ! sGstGLContext ) {
537544
ci::gl::env()->makeContextCurrent( nullptr );
538545
sGstGLContext = (GstGLContext*)gst_object_ref( gst_gl_context_new( sGstGLDisplay ) );
539546
#if defined( CINDER_GL_ES )
540-
sharedCtx = gst_gl_context_new_wrapped( sGstGLDisplay, (guintptr)::glfwGetEGLContext( platformData->mContext ), GST_GL_PLATFORM_GLX, GST_GL_API_GLES2 );
547+
sharedCtx = gst_gl_context_new_wrapped( sGstGLDisplay, (guintptr)::glfwGetEGLContext( platformData->mContext ), GST_GL_PLATFORM_EGL, GST_GL_API_GLES2 );
541548
#else
542549
sharedCtx = gst_gl_context_new_wrapped( sGstGLDisplay, (guintptr)::glfwGetGLXContext( platformData->mContext ), GST_GL_PLATFORM_GLX, GST_GL_API_OPENGL );
543550
#endif

0 commit comments

Comments
 (0)