AC_SUBST(GLIB_PREFIX)
AC_SUBST(GST_PREFIX)
+dnl *** EGL ***
+PKG_CHECK_MODULES([EGL], [egl], [
+ AC_DEFINE(HAVE_EGL, 1, [Have egl])
+ HAVE_EGL=yes
+], [HAVE_EGL=no])
+AM_CONDITIONAL(HAVE_EGL, test "x$HAVE_EGL" = "xyes")
+
+dnl *** GLESv2 ***
+PKG_CHECK_MODULES([GLES2], [glesv2], [
+ AC_DEFINE(HAVE_EGL, 1, [Have glesv2])
+ HAVE_GLES2=yes
+], [HAVE_GLES2=no])
+AM_CONDITIONAL(HAVE_GLES2, test "x$HAVE_GLES2" = "xyes")
+
+dnl *** X11 ***
+PKG_CHECK_MODULES([X11], [x11], [
+ AC_DEFINE(HAVE_X11, 1, [Have x11])
+ HAVE_X11=yes
+], [HAVE_X11=no])
+AM_CONDITIONAL(HAVE_X11, test "x$HAVE_X11" = "xyes")
+
dnl Check for -Bsymbolic-functions linker flag used to avoid
dnl intra-library PLT jumps, if available.
AC_ARG_ENABLE(Bsymbolic,
#include "config.h"
#endif
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined (USE_OMX_TARGET_RPI)
#include <bcm_host.h>
+#elif defined(HAVE_X11)
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
#endif
#if defined (USE_OMX_TARGET_RPI) && defined (__GNUC__)
/* number of rendered and dropped frames */
guint64 rendered;
guint64 dropped;
+
+#if !defined (USE_OMX_TARGET_RPI) && defined(HAVE_X11)
+ Display *xdisplay;
+ Window xwindow;
+#endif
} APP_STATE_T;
static void init_ogl (APP_STATE_T * state);
static void
init_ogl (APP_STATE_T * state)
{
+#if defined (USE_OMX_TARGET_RPI)
int32_t success = 0;
+#else
+ gint screen_num = 0;
+ gulong black_pixel = 0;
+#endif
EGLBoolean result;
EGLint num_config;
EGLNativeWindowType window_handle = (EGLNativeWindowType) 0;
vc_dispmanx_update_submit_sync (dispman_update);
window_handle = &nativewindow;
+#elif defined(HAVE_X11)
+ state->screen_width = 1280;
+ state->screen_height = 720;
+ state->xdisplay = XOpenDisplay (NULL);
+ screen_num = DefaultScreen (state->xdisplay);
+ black_pixel = XBlackPixel (state->xdisplay, screen_num);
+ state->xwindow = XCreateSimpleWindow (state->xdisplay,
+ DefaultRootWindow (state->xdisplay), 0, 0, state->screen_width,
+ state->screen_height, 0, 0, black_pixel);
+ XSetWindowBackgroundPixmap (state->xdisplay, state->xwindow, None);
+ XMapRaised (state->xdisplay, state->xwindow);
+ XSync (state->xdisplay, FALSE);
+ window_handle = state->xwindow;
#endif
state->surface =
glDrawArrays (GL_TRIANGLE_STRIP, 16, 4);
glDrawArrays (GL_TRIANGLE_STRIP, 20, 4);
- eglSwapBuffers (state->display, state->surface);
+ if (!eglSwapBuffers (state->display, state->surface)) {
+ g_main_loop_quit (state->main_loop);
+ return;
+ }
glDisable (GL_DEPTH_TEST);
glDisable (GL_CULL_FACE);
GstElement *vsink = gst_element_factory_make ("fakesink", "vsink");
g_object_set (capsfilter, "caps",
- gst_caps_from_string ("video/x-raw(memory:GLMemory)"), NULL);
+ gst_caps_from_string ("video/x-raw(memory:GLMemory), format=RGBA"), NULL);
g_object_set (vsink, "sync", TRUE, "silent", TRUE, "qos", TRUE,
"enable-last-sample", FALSE, "max-lateness", 20 * GST_MSECOND,
"signal-handoffs", TRUE, NULL);
vc_dispmanx_element_remove (dispman_update, state->dispman_element);
vc_dispmanx_update_submit_sync (dispman_update);
vc_dispmanx_display_close (state->dispman_display);
+#elif defined(HAVE_X11)
+ XSync (state->xdisplay, FALSE);
+ XUnmapWindow (state->xdisplay, state->xwindow);
+ XDestroyWindow (state->xdisplay, state->xwindow);
+ XSync (state->xdisplay, FALSE);
+ XCloseDisplay (state->xdisplay);
#endif
}
if (!res)
goto done;
- /* Create a GLib Main Loop and set it to run */
+ /* Create a GLib Main Loop */
state->main_loop = g_main_loop_new (NULL, FALSE);
/* Add a keyboard watch so we get notified of keystrokes */
gst_element_set_state (state->pipeline, GST_STATE_PLAYING);
/* Start the mainloop */
- state->main_loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (state->main_loop);
done:
gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req,
fallback : ['gst-plugins-bad', 'gstgl_dep'], required : false)
+x11_dep = dependency('x11', required : false)
+
if host_machine.system() != 'windows'
gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
fallback : ['gstreamer', 'gst_check_dep'])
cdata.set ('HAVE_GST_GL', 1)
endif
+if x11_dep.found()
+ cdata.set ('HAVE_X11', 1)
+endif
+
omx_struct_packing = get_option ('with_omx_struct_packing').to_int()
if omx_struct_packing == 0
omx_struct_packing = default_omx_struct_packing