summaryrefslogtreecommitdiffstats
path: root/recipes-multimedia
diff options
context:
space:
mode:
authorYuqing Zhu <carol.zhu@nxp.com>2016-12-22 18:26:37 +0800
committerOtavio Salvador <otavio@ossystems.com.br>2017-01-11 10:56:36 -0200
commitf2fbc0edb25f6d275888113e601c6913c252ef56 (patch)
tree935123065bb07bd8bf167e992a1d0e2388ad4194 /recipes-multimedia
parent2612cc0cccf892e48f170a9f6678beb4cc6f785e (diff)
downloadmeta-freescale-f2fbc0edb25f6d275888113e601c6913c252ef56.tar.gz
gstreamer1.0-plugins-bad: Support fb backend for gl plugins
1. Add fb support in glimagesink 2. Override set_render_rectangle() to support resize Signed-off-by: Yuqing Zhu <carol.zhu@nxp.com> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'recipes-multimedia')
-rwxr-xr-xrecipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-Support-fb-backend-for-gl-plugins.patch781
-rw-r--r--recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend1
2 files changed, 782 insertions, 0 deletions
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-Support-fb-backend-for-gl-plugins.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-Support-fb-backend-for-gl-plugins.patch
new file mode 100755
index 00000000..2dcce8d5
--- /dev/null
+++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-Support-fb-backend-for-gl-plugins.patch
@@ -0,0 +1,781 @@
1From d0179e89c294f775a7ebb6ccb0ad539433f3c22e Mon Sep 17 00:00:00 2001
2From: Haihua Hu <b55597@freescale.com>
3Date: Mon, 16 Nov 2015 17:41:57 +0800
4Subject: [PATCH 08/26] Support fb backend for gl plugins
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
91.Add fb support in glimagesink
102.override set_render_rectangle() to support resize
11
12Upstream-Status: Inappropriate [i.MX specific]
13
14Signed-off-by: Haihua Hu <b55597@freescale.com>
15
16Conflicts:
17 configure.ac
18---
19 configure.ac | 25 ++-
20 gst-libs/gst/gl/Makefile.am | 5 +
21 gst-libs/gst/gl/fb/Makefile.am | 25 +++
22 gst-libs/gst/gl/fb/gstgldisplay_fb.c | 109 +++++++++++++
23 gst-libs/gst/gl/fb/gstgldisplay_fb.h | 67 ++++++++
24 gst-libs/gst/gl/fb/gstglwindow_fb_egl.c | 265 ++++++++++++++++++++++++++++++++
25 gst-libs/gst/gl/fb/gstglwindow_fb_egl.h | 65 ++++++++
26 gst-libs/gst/gl/gstgldisplay.c | 11 ++
27 gst-libs/gst/gl/gstgldisplay.h | 1 +
28 gst-libs/gst/gl/gstglwindow.c | 8 +
29 11 files changed, 580 insertions(+), 1 deletions(-)
30 create mode 100644 gst-libs/gst/gl/fb/Makefile.am
31 create mode 100644 gst-libs/gst/gl/fb/gstgldisplay_fb.c
32 create mode 100644 gst-libs/gst/gl/fb/gstgldisplay_fb.h
33 create mode 100644 gst-libs/gst/gl/fb/gstglwindow_fb_egl.c
34 create mode 100644 gst-libs/gst/gl/fb/gstglwindow_fb_egl.h
35
36diff --git a/configure.ac b/configure.ac
37index f135648..991e7d0 100644
38--- a/configure.ac
39+++ b/configure.ac
40@@ -700,6 +700,7 @@ HAVE_GL=no
41 HAVE_GLES2=no
42 HAVE_GLES3_H=no
43 HAVE_WAYLAND_EGL=no
44+HAVE_FB_EGL=no
45
46 HAVE_EGL_RPI=no
47
48@@ -737,6 +738,9 @@ case $host in
49 old_LIBS=$LIBS
50 old_CFLAGS=$CFLAGS
51
52+ dnl check fb backend for imx soc
53+ AC_CHECK_LIB(EGL, fbGetDisplay, HAVE_FB_EGL=yes, HAVE_FB_EGL=no)
54+
55 dnl FIXME: Mali EGL depends on GLESv1 or GLESv2
56 AC_CHECK_HEADER([EGL/fbdev_window.h],
57 [
58@@ -1043,6 +1047,16 @@ case $host in
59 fi
60 fi
61
62+ if test "x$HAVE_FB_EGL" = "xyes"; then
63+ if test "x$NEED_EGL" = "xno" -o "x$HAVE_EGL" = "xno"; then
64+ AC_MSG_WARN([EGL is required by the fb backend for OpenGL support])
65+ else
66+ HAVE_WINDOW_FB=yes
67+ GL_LIBS="$GL_LIBS"
68+ GL_CFLAGS="$GL_CFLAGS"
69+ fi
70+ fi
71+
72 if test "x$HAVE_EGL_RPI" = "xyes"; then
73 if test "x$NEED_DISPMANX" != "xno"; then
74 HAVE_WINDOW_DISPMANX=yes
75@@ -1057,7 +1071,7 @@ case $host in
76 fi
77 else
78 if test "x$NEED_EGL" != "xno"; then
79- if test "x$HAVE_WINDOW_WAYLAND" = "xyes" -o "x$HAVE_WINDOW_X11" = "xyes" -o "x$HAVE_WINDOW_DISPMANX" = "xyes"; then
80+ if test "x$HAVE_WINDOW_WAYLAND" = "xyes" -o "x$HAVE_WINDOW_X11" = "xyes" -o "x$HAVE_WINDOW_DISPMANX" = "xyes" -o "x$HAVE_WINDOW_FB" = "xyes"; then
81 GL_LIBS="$GL_LIBS -lEGL $EGL_LIBS"
82 GL_CFLAGS="$GL_CFLAGS $EGL_CFLAGS"
83 USE_EGL=yes
84@@ -1209,6 +1223,7 @@ GST_GL_HAVE_WINDOW_WAYLAND=0
85 GST_GL_HAVE_WINDOW_ANDROID=0
86 GST_GL_HAVE_WINDOW_DISPMANX=0
87 GST_GL_HAVE_WINDOW_EAGL=0
88+GST_GL_HAVE_WINDOW_FB=0
89
90 if test "x$HAVE_WINDOW_X11" = "xyes"; then
91 GL_WINDOWS="x11 $GL_WINDOWS"
92@@ -1238,6 +1253,10 @@ if test "x$HAVE_WINDOW_EAGL" = "xyes"; then
93 GL_WINDOWS="eagl $GL_WINDOWS"
94 GST_GL_HAVE_WINDOW_EAGL=1
95 fi
96+if test "x$HAVE_WINDOW_FB" = "xyes"; then
97+ GL_WINDOWS="fb $GL_WINDOWS"
98+ GST_GL_HAVE_WINDOW_FB=1
99+fi
100
101 GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
102 #define GST_GL_HAVE_WINDOW_X11 $GST_GL_HAVE_WINDOW_X11
103@@ -1247,6 +1266,7 @@ GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
104 #define GST_GL_HAVE_WINDOW_ANDROID $GST_GL_HAVE_WINDOW_ANDROID
105 #define GST_GL_HAVE_WINDOW_DISPMANX $GST_GL_HAVE_WINDOW_DISPMANX
106 #define GST_GL_HAVE_WINDOW_EAGL $GST_GL_HAVE_WINDOW_EAGL
107+#define GST_GL_HAVE_WINDOW_FB $GST_GL_HAVE_WINDOW_FB
108 "
109
110 dnl PLATFORM's
111@@ -1322,6 +1342,7 @@ if test "x$GL_APIS" = "x" -o "x$GL_PLATFORMS" = "x" -o "x$GL_WINDOWS" = "x"; the
112 HAVE_WINDOW_ANDROID=no
113 HAVE_WINDOW_COCOA=no
114 HAVE_WINDOW_EAGL=no
115+ HAVE_WINDOW_FB=no
116 fi
117
118 AC_SUBST(GL_LIBS)
119@@ -1337,6 +1358,7 @@ AM_CONDITIONAL(HAVE_WINDOW_DISPMANX, test "x$HAVE_WINDOW_DISPMANX" = "xyes")
120 AM_CONDITIONAL(HAVE_WINDOW_WAYLAND, test "x$HAVE_WINDOW_WAYLAND" = "xyes")
121 AM_CONDITIONAL(HAVE_WINDOW_ANDROID, test "x$HAVE_WINDOW_ANDROID" = "xyes")
122 AM_CONDITIONAL(HAVE_WINDOW_EAGL, test "x$HAVE_WINDOW_EAGL" = "xyes")
123+AM_CONDITIONAL(HAVE_WINDOW_FB, test "x$HAVE_WINDOW_FB" = "xyes")
124
125 AM_CONDITIONAL(USE_OPENGL, test "x$USE_OPENGL" = "xyes")
126 AM_CONDITIONAL(USE_GLES2, test "x$USE_GLES2" = "xyes")
127@@ -3700,6 +3722,7 @@ gst-libs/gst/gl/egl/Makefile
128 gst-libs/gst/gl/wayland/Makefile
129 gst-libs/gst/gl/win32/Makefile
130 gst-libs/gst/gl/x11/Makefile
131+gst-libs/gst/gl/fb/Makefile
132 gst-libs/gst/insertbin/Makefile
133 gst-libs/gst/interfaces/Makefile
134 gst-libs/gst/codecparsers/Makefile
135diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
136index 5ceb622..01498e0 100644
137--- a/gst-libs/gst/gl/Makefile.am
138+++ b/gst-libs/gst/gl/Makefile.am
139@@ -119,6 +119,11 @@ SUBDIRS += eagl
140 libgstgl_@GST_API_VERSION@_la_LIBADD += eagl/libgstgl-eagl.la
141 endif
142
143+if HAVE_WINDOW_FB
144+SUBDIRS += fb
145+libgstgl_@GST_API_VERSION@_la_LIBADD += fb/libgstgl-fb.la
146+endif
147+
148 if USE_EGL
149 SUBDIRS += egl
150 libgstgl_@GST_API_VERSION@_la_LIBADD += egl/libgstgl-egl.la
151diff --git a/gst-libs/gst/gl/fb/Makefile.am b/gst-libs/gst/gl/fb/Makefile.am
152new file mode 100644
153index 0000000..8e4656c
154--- /dev/null
155+++ b/gst-libs/gst/gl/fb/Makefile.am
156@@ -0,0 +1,25 @@
157+## Process this file with automake to produce Makefile.in
158+
159+noinst_LTLIBRARIES = libgstgl-fb.la
160+
161+libgstgl_fb_la_SOURCES = \
162+ gstgldisplay_fb.c \
163+ gstglwindow_fb_egl.c
164+
165+noinst_HEADERS = \
166+ gstgldisplay_fb.h \
167+ gstglwindow_fb_egl.h
168+
169+libgstgl_fbincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/fb
170+
171+libgstgl_fb_la_CFLAGS = \
172+ -I$(top_srcdir)/gst-libs \
173+ -I$(top_builddir)/gst-libs \
174+ $(GL_CFLAGS) \
175+ $(GST_PLUGINS_BASE_CFLAGS) \
176+ $(GST_BASE_CFLAGS) \
177+ $(GST_CFLAGS)
178+
179+libgstgl_fb_la_LDFLAGS = \
180+ $(GST_LIB_LDFLAGS) \
181+ $(GST_ALL_LDFLAGS)
182diff --git a/gst-libs/gst/gl/fb/gstgldisplay_fb.c b/gst-libs/gst/gl/fb/gstgldisplay_fb.c
183new file mode 100644
184index 0000000..3be9756
185--- /dev/null
186+++ b/gst-libs/gst/gl/fb/gstgldisplay_fb.c
187@@ -0,0 +1,109 @@
188+/*
189+ * GStreamer
190+ * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.com>
191+ *
192+ * This library is free software; you can redistribute it and/or
193+ * modify it under the terms of the GNU Library General Public
194+ * License as published by the Free Software Foundation; either
195+ * version 2 of the License, or (at your option) any later version.
196+ *
197+ * This library is distributed in the hope that it will be useful,
198+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
199+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
200+ * Library General Public License for more details.
201+ *
202+ * You should have received a copy of the GNU Library General Public
203+ * License along with this library; if not, write to the
204+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
205+ * Boston, MA 02110-1301, USA.
206+ */
207+
208+#ifdef HAVE_CONFIG_H
209+#include "config.h"
210+#endif
211+
212+#include <gst/gl/fb/gstgldisplay_fb.h>
213+
214+GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
215+#define GST_CAT_DEFAULT gst_gl_display_debug
216+
217+G_DEFINE_TYPE (GstGLDisplayFB, gst_gl_display_fb, GST_TYPE_GL_DISPLAY);
218+
219+static void gst_gl_display_fb_finalize (GObject * object);
220+static guintptr gst_gl_display_fb_get_handle (GstGLDisplay * display);
221+
222+static void
223+gst_gl_display_fb_class_init (GstGLDisplayFBClass * klass)
224+{
225+ GST_GL_DISPLAY_CLASS (klass)->get_handle =
226+ GST_DEBUG_FUNCPTR (gst_gl_display_fb_get_handle);
227+
228+ G_OBJECT_CLASS (klass)->finalize = gst_gl_display_fb_finalize;
229+}
230+
231+static void
232+gst_gl_display_fb_init (GstGLDisplayFB * display_fb)
233+{
234+ GstGLDisplay *display = (GstGLDisplay *) display_fb;
235+
236+ display->type = GST_GL_DISPLAY_TYPE_FB;
237+ display_fb->name = NULL;
238+ display_fb->disp_idx = 0;
239+ display_fb->display = NULL;
240+}
241+
242+static void
243+gst_gl_display_fb_finalize (GObject * object)
244+{
245+ GstGLDisplayFB *display_fb = GST_GL_DISPLAY_FB (object);
246+
247+ if (display_fb->name)
248+ g_free (display_fb->name);
249+
250+ if (display_fb->display)
251+ fbDestroyDisplay (display_fb->display);
252+
253+ G_OBJECT_CLASS (gst_gl_display_fb_parent_class)->finalize (object);
254+}
255+
256+/**
257+ * gst_gl_display_fb_new:
258+ * @name: (allow-none): a display name
259+ *
260+ * Create a new #GstGLDisplayFB from the x11 display name. See XOpenDisplay()
261+ * for details on what is a valid name.
262+ *
263+ * Returns: (transfer full): a new #GstGLDisplayFB or %NULL
264+ */
265+GstGLDisplayFB *
266+gst_gl_display_fb_new (gchar *name)
267+{
268+ GstGLDisplayFB *display;
269+ const gchar *fb_name = NULL;
270+
271+ GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
272+ GST_DEBUG ("creating Fb EGL display");
273+
274+ fb_name = name;
275+ if (!fb_name) fb_name = "fb0";
276+
277+ display = g_object_new (GST_TYPE_GL_DISPLAY_FB, NULL);
278+ display->name = g_strdup (fb_name);
279+ sscanf (display->name, "fb%d", &display->disp_idx);
280+ display->display = fbGetDisplayByIndex (display->disp_idx);
281+ if (!display->display) {
282+ GST_ERROR ("Failed to open FB display, \'%s\'", fb_name);
283+ return NULL;
284+ }
285+
286+ GST_DEBUG ("Created fb EGL display %d", display->display);
287+
288+ return display;
289+}
290+
291+static guintptr
292+gst_gl_display_fb_get_handle (GstGLDisplay * display)
293+{
294+ GST_DEBUG ("Get fb EGL display %d", GST_GL_DISPLAY_FB (display)->display);
295+ return (guintptr) GST_GL_DISPLAY_FB (display)->display;
296+}
297diff --git a/gst-libs/gst/gl/fb/gstgldisplay_fb.h b/gst-libs/gst/gl/fb/gstgldisplay_fb.h
298new file mode 100644
299index 0000000..62987c1
300--- /dev/null
301+++ b/gst-libs/gst/gl/fb/gstgldisplay_fb.h
302@@ -0,0 +1,67 @@
303+/*
304+ * GStreamer
305+ * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.com>
306+ *
307+ * This library is free software; you can redistribute it and/or
308+ * modify it under the terms of the GNU Library General Public
309+ * License as published by the Free Software Foundation; either
310+ * version 2 of the License, or (at your option) any later version.
311+ *
312+ * This library is distributed in the hope that it will be useful,
313+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
314+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
315+ * Library General Public License for more details.
316+ *
317+ * You should have received a copy of the GNU Library General Public
318+ * License along with this library; if not, write to the
319+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
320+ * Boston, MA 02110-1301, USA.
321+ */
322+
323+#ifndef __GST_GL_DISPLAY_FB_H__
324+#define __GST_GL_DISPLAY_FB_H__
325+
326+#include <EGL/egl.h>
327+#include <gst/gst.h>
328+#include <gst/gl/gstgldisplay.h>
329+
330+G_BEGIN_DECLS
331+
332+GType gst_gl_display_fb_get_type (void);
333+
334+#define GST_TYPE_GL_DISPLAY_FB (gst_gl_display_fb_get_type())
335+#define GST_GL_DISPLAY_FB(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY_FB,GstGLDisplayFB))
336+#define GST_GL_DISPLAY_FB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY_FB,GstGLDisplayFBClass))
337+#define GST_IS_GL_DISPLAY_FB(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY_FB))
338+#define GST_IS_GL_DISPLAY_FB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY_FB))
339+#define GST_GL_DISPLAY_FB_CAST(obj) ((GstGLDisplayFB*)(obj))
340+
341+typedef struct _GstGLDisplayFB GstGLDisplayFB;
342+typedef struct _GstGLDisplayFBClass GstGLDisplayFBClass;
343+
344+/**
345+ * GstGLDisplayFB:
346+ *
347+ * the contents of a #GstGLDisplayFB are private and should only be accessed
348+ * through the provided API
349+ */
350+struct _GstGLDisplayFB
351+{
352+ GstGLDisplay parent;
353+
354+ /* <private> */
355+ gchar *name;
356+ gint disp_idx;
357+ EGLNativeDisplayType display;
358+};
359+
360+struct _GstGLDisplayFBClass
361+{
362+ GstGLDisplayClass object_class;
363+};
364+
365+GstGLDisplayFB *gst_gl_display_fb_new (gchar *name);
366+
367+G_END_DECLS
368+
369+#endif /* __GST_GL_DISPLAY_FB_H__ */
370diff --git a/gst-libs/gst/gl/fb/gstglwindow_fb_egl.c b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.c
371new file mode 100644
372index 0000000..a068e30
373--- /dev/null
374+++ b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.c
375@@ -0,0 +1,265 @@
376+/*
377+ * GStreamer
378+ * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
379+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
380+ *
381+ * This library is free software; you can redistribute it and/or
382+ * modify it under the terms of the GNU Library General Public
383+ * License as published by the Free Software Foundation; either
384+ * version 2 of the License, or (at your option) any later version.
385+ *
386+ * This library is distributed in the hope that it will be useful,
387+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
388+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
389+ * Library General Public License for more details.
390+ *
391+ * You should have received a copy of the GNU Library General Public
392+ * License along with this library; if not, write to the
393+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
394+ * Boston, MA 02110-1301, USA.
395+ */
396+
397+#include "../gstgl_fwd.h"
398+#include <gst/gl/gstglcontext.h>
399+
400+#include "gstglwindow_fb_egl.h"
401+
402+#define GST_CAT_DEFAULT gst_gl_window_debug
403+
404+#define gst_gl_window_fb_egl_parent_class parent_class
405+G_DEFINE_TYPE (GstGLWindowFbEGL, gst_gl_window_fb_egl,
406+ GST_GL_TYPE_WINDOW);
407+
408+static guintptr gst_gl_window_fb_egl_get_window_handle (GstGLWindow *
409+ window);
410+static void gst_gl_window_fb_egl_set_window_handle (GstGLWindow * window,
411+ guintptr handle);
412+static void gst_gl_window_fb_egl_draw (GstGLWindow * window);
413+static void gst_gl_window_fb_egl_close (GstGLWindow * window);
414+static gboolean gst_gl_window_fb_egl_open (GstGLWindow * window,
415+ GError ** error);
416+static gboolean
417+gst_gl_window_fb_egl_set_render_rectangle(GstGLWindow * window,
418+ guint x, guint y, guint width, guint height);
419+
420+static void
421+gst_gl_window_fb_egl_class_init (GstGLWindowFbEGLClass * klass)
422+{
423+ GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
424+
425+ window_class->get_window_handle =
426+ GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_get_window_handle);
427+ window_class->set_window_handle =
428+ GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_set_window_handle);
429+ window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_draw);
430+ window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_close);
431+ window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_open);
432+ window_class->set_render_rectangle =
433+ GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_set_render_rectangle);
434+}
435+
436+static void
437+gst_gl_window_fb_egl_init (GstGLWindowFbEGL * window)
438+{
439+ GstGLWindowFbEGL *window_egl;
440+
441+ window_egl = GST_GL_WINDOW_FB_EGL (window);
442+
443+ window_egl->width = 0;
444+ window_egl->height = 0;
445+ window_egl->default_fullscreen = TRUE;
446+ window_egl->display = 0;
447+}
448+
449+/* Must be called in the gl thread */
450+GstGLWindowFbEGL *
451+gst_gl_window_fb_egl_new (GstGLDisplay * display)
452+{
453+ GstGLWindowFbEGL *window;
454+ const gchar *fb_name = NULL;
455+
456+ if (!display)
457+ return NULL;
458+
459+ window = g_object_new (GST_GL_TYPE_WINDOW_FB_EGL, NULL);
460+ window->display = gst_gl_display_get_handle (display);
461+ if (!window->display) {
462+ GST_ERROR ("failed to get display for egl window");
463+ return NULL;
464+ }
465+
466+ return window;
467+}
468+
469+static void
470+gst_gl_window_fb_egl_close (GstGLWindow * window)
471+{
472+ GstGLWindowFbEGL *window_egl;
473+
474+ window_egl = GST_GL_WINDOW_FB_EGL (window);
475+
476+ if (window_egl->win_id) {
477+ fbDestroyWindow (window_egl->win_id);
478+ }
479+
480+ GST_GL_WINDOW_CLASS (parent_class)->close (window);
481+}
482+
483+static gboolean
484+gst_gl_window_fb_egl_open (GstGLWindow * window, GError ** error)
485+{
486+ GstGLWindowFbEGL *window_egl;
487+
488+ window_egl = GST_GL_WINDOW_FB_EGL (window);
489+
490+ if (!window_egl->display) {
491+ GST_ERROR ("No display for window_egl.");
492+ return FALSE;
493+ }
494+
495+ window_egl->win_id = fbCreateWindow (window_egl->display, -1, -1, 0, 0);
496+ if (!window_egl->win_id) {
497+ GST_ERROR ("Failed to create window_egl");
498+ return FALSE;
499+ }
500+
501+ fbGetDisplayGeometry (window_egl->display, &window_egl->width, &window_egl->height);
502+ window_egl->req_width = window_egl->width;
503+ window_egl->req_height = window_egl->height;
504+ GST_DEBUG ("Open FB display succesfully, resolution is (%dx%d),display %d, window %d.",
505+ window_egl->width, window_egl->height, window_egl->display, window_egl->win_id);
506+
507+ if (!GST_GL_WINDOW_CLASS (parent_class)->open (window, error))
508+ return FALSE;
509+
510+ return TRUE;
511+}
512+static guintptr
513+gst_gl_window_fb_egl_get_window_handle (GstGLWindow * window)
514+{
515+ GST_DEBUG ("fb egl get window: %d", GST_GL_WINDOW_FB_EGL (window)->win_id);
516+ return (guintptr) GST_GL_WINDOW_FB_EGL (window)->win_id;
517+}
518+
519+static void
520+gst_gl_window_fb_egl_set_window_handle (GstGLWindow * window,
521+ guintptr handle)
522+{
523+}
524+
525+static void
526+draw_cb (gpointer data)
527+{
528+ GstGLWindowFbEGL *window_egl = (GstGLWindowFbEGL *)data;
529+ GstGLWindow *window = GST_GL_WINDOW (window_egl);
530+ GstGLContext *context = gst_gl_window_get_context (window);
531+ GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
532+
533+ /* default full screen */
534+ if (window_egl->default_fullscreen && window->resize) {
535+ window->resize (window->resize_data, window_egl->width, window_egl->height);
536+ window_egl->default_fullscreen = FALSE;
537+ }
538+
539+ if (window->draw)
540+ window->draw (window->draw_data);
541+
542+ GST_DEBUG ("####### draw data");
543+ context_class->swap_buffers (context);
544+
545+ gst_object_unref (context);
546+}
547+
548+static void
549+gst_gl_window_fb_egl_draw (GstGLWindow * window)
550+{
551+ gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
552+}
553+
554+static gboolean
555+_calculate_viewport_coordinates(GstVideoRectangle *req, GstVideoRectangle *result,
556+ guint display_width, guint display_height)
557+{
558+ if(!req || !result || req->w < 1 || req->h < 1)
559+ return FALSE;
560+
561+ result->x = req->x;
562+ result->y = display_height - (req->y + req->h);
563+ result->w = req->w;
564+ result->h = req->h;
565+
566+ return TRUE;
567+}
568+
569+struct SetRenderRectangle
570+{
571+ GstGLWindowFbEGL *window_egl;
572+ GstVideoRectangle rect;
573+};
574+
575+static void
576+_free_set_render_rectangle (struct SetRenderRectangle *render)
577+{
578+ if (render) {
579+ if (render->window_egl)
580+ gst_object_unref (render->window_egl);
581+ g_free (render);
582+ }
583+}
584+
585+static void
586+_set_render_rectangle (gpointer data)
587+{
588+ const GstGLFuncs *gl;
589+ GstGLContext *context;
590+ GstVideoRectangle result, video_rect, tmp_res;
591+ struct SetRenderRectangle *render = data;
592+ GstGLWindow *window = GST_GL_WINDOW (render->window_egl);
593+
594+ context = gst_gl_window_get_context(window);
595+ gl = context->gl_vtable;
596+
597+ GST_LOG_OBJECT (render->window_egl, "setting render rectangle %i,%i+%ix%i",
598+ render->rect.x, render->rect.y, render->rect.w, render->rect.h);
599+
600+ video_rect.x = render->rect.x;
601+ video_rect.y = render->rect.y;
602+ video_rect.w = GST_VIDEO_SINK_WIDTH(window->resize_data);
603+ video_rect.h = GST_VIDEO_SINK_HEIGHT(window->resize_data);
604+
605+ gst_video_sink_center_rect(video_rect, render->rect, &tmp_res, TRUE);
606+
607+ GST_LOG_OBJECT (render->window_egl, "set center render rectangle %i,%i+%ix%i",
608+ tmp_res.x, tmp_res.y, tmp_res.w, tmp_res.h);
609+
610+ /* need to transform screen coordinate to viewport coordinate */
611+ if( _calculate_viewport_coordinates(&tmp_res, &result,
612+ render->window_egl->width, render->window_egl->height)){
613+ GST_LOG_OBJECT (render->window_egl, "viewport render rectangle %i,%i+%ix%i",
614+ result.x, result.y, result.w, result.h);
615+ gl->Viewport(result.x, result.y, result.w, result.h);
616+ }
617+
618+ if(context)
619+ gst_object_unref(context);
620+}
621+
622+static gboolean
623+gst_gl_window_fb_egl_set_render_rectangle(GstGLWindow * window,
624+ guint x, guint y, guint width, guint height)
625+{
626+ GstGLWindowFbEGL *window_egl = GST_GL_WINDOW_FB_EGL (window);
627+ struct SetRenderRectangle *render;
628+
629+ render = g_new0 (struct SetRenderRectangle, 1);
630+ render->window_egl = gst_object_ref (window_egl);
631+ render->rect.x = x;
632+ render->rect.y = y;
633+ render->rect.w = width;
634+ render->rect.h = height;
635+
636+ gst_gl_window_send_message_async (window,
637+ (GstGLWindowCB) _set_render_rectangle, render,
638+ (GDestroyNotify) _free_set_render_rectangle);
639+ return TRUE;
640+}
641diff --git a/gst-libs/gst/gl/fb/gstglwindow_fb_egl.h b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.h
642new file mode 100644
643index 0000000..216e421
644--- /dev/null
645+++ b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.h
646@@ -0,0 +1,65 @@
647+/*
648+ * GStreamer
649+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
650+ *
651+ * This library is free software; you can redistribute it and/or
652+ * modify it under the terms of the GNU Library General Public
653+ * License as published by the Free Software Foundation; either
654+ * version 2 of the License, or (at your option) any later version.
655+ *
656+ * This library is distributed in the hope that it will be useful,
657+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
658+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
659+ * Library General Public License for more details.
660+ *
661+ * You should have received a copy of the GNU Library General Public
662+ * License along with this library; if not, write to the
663+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
664+ * Boston, MA 02110-1301, USA.
665+ */
666+
667+#ifndef __GST_GL_WINDOW_FB_EGL_H__
668+#define __GST_GL_WINDOW_FB_EGL_H__
669+
670+#include <gst/gl/gl.h>
671+#include "EGL/eglplatform.h"
672+
673+G_BEGIN_DECLS
674+
675+#define GST_GL_TYPE_WINDOW_FB_EGL (gst_gl_window_fb_egl_get_type())
676+#define GST_GL_WINDOW_FB_EGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_GL_TYPE_WINDOW_FB_EGL, GstGLWindowFbEGL))
677+#define GST_GL_WINDOW_FB_EGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_GL_TYPE_WINDOW_FB_EGL, GstGLWindowFbEGLClass))
678+#define GST_GL_IS_WINDOW_FB_EGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_GL_TYPE_WINDOW_FB_EGL))
679+#define GST_GL_IS_WINDOW_FB_EGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_GL_TYPE_WINDOW_FB_EGL))
680+#define GST_GL_WINDOW_FB_EGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_GL_TYPE_WINDOW_FB_EGL, GstGLWindowFbEGL_Class))
681+
682+typedef struct _GstGLWindowFbEGL GstGLWindowFbEGL;
683+typedef struct _GstGLWindowFbEGLClass GstGLWindowFbEGLClass;
684+
685+struct _GstGLWindowFbEGL {
686+ /*< private >*/
687+ GstGLWindow parent;
688+
689+ /* <private> */
690+ gint width, req_width;
691+ gint height, req_height;
692+ gboolean default_fullscreen;
693+ EGLNativeDisplayType display;
694+ EGLNativeWindowType win_id;
695+};
696+
697+struct _GstGLWindowFbEGLClass {
698+ /*< private >*/
699+ GstGLWindowClass parent_class;
700+
701+ /*< private >*/
702+ gpointer _reserved[GST_PADDING];
703+};
704+
705+GType gst_gl_window_fb_egl_get_type (void);
706+
707+GstGLWindowFbEGL * gst_gl_window_fb_egl_new (GstGLDisplay * display);
708+
709+G_END_DECLS
710+
711+#endif /* __GST_GL_WINDOW_FB_EGL_H__ */
712diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c
713index 3ffc906..7b0b5bf 100644
714--- a/gst-libs/gst/gl/gstgldisplay.c
715+++ b/gst-libs/gst/gl/gstgldisplay.c
716@@ -70,6 +70,9 @@
717 #include <gst/gl/egl/gsteglimage.h>
718 #include <gst/gl/egl/gstglmemoryegl.h>
719 #endif
720+#if GST_GL_HAVE_WINDOW_FB
721+#include <gst/gl/fb/gstgldisplay_fb.h>
722+#endif
723
724 GST_DEBUG_CATEGORY_STATIC (gst_context);
725 GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
726@@ -207,6 +210,14 @@ gst_gl_display_new (void)
727 if (!display && (!user_choice || g_strstr_len (user_choice, 7, "wayland")))
728 display = GST_GL_DISPLAY (gst_gl_display_wayland_new (NULL));
729 #endif
730+#if GST_GL_HAVE_WINDOW_FB
731+ if (!display && (!user_choice || g_strstr_len (user_choice, 2, "fb"))) {
732+ const gchar *fb_name = NULL;
733+ fb_name = g_getenv ("GST_GL_FB");
734+ if (!fb_name) fb_name = "fb0";
735+ display = GST_GL_DISPLAY (gst_gl_display_fb_new (fb_name));
736+ }
737+#endif
738 #if GST_GL_HAVE_PLATFORM_EGL
739 if (!display && (!platform_choice
740 || g_strstr_len (platform_choice, 3, "egl")))
741diff --git a/gst-libs/gst/gl/gstgldisplay.h b/gst-libs/gst/gl/gstgldisplay.h
742index a02e904..2f896bb 100644
743--- a/gst-libs/gst/gl/gstgldisplay.h
744+++ b/gst-libs/gst/gl/gstgldisplay.h
745@@ -61,6 +61,7 @@ typedef enum
746 GST_GL_DISPLAY_TYPE_WIN32 = (1 << 3),
747 GST_GL_DISPLAY_TYPE_DISPMANX = (1 << 4),
748 GST_GL_DISPLAY_TYPE_EGL = (1 << 5),
749+ GST_GL_DISPLAY_TYPE_FB = (1 << 6),
750
751 GST_GL_DISPLAY_TYPE_ANY = G_MAXUINT32
752 } GstGLDisplayType;
753diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c
754index 0588f1d..834d927 100644
755--- a/gst-libs/gst/gl/gstglwindow.c
756+++ b/gst-libs/gst/gl/gstglwindow.c
757@@ -58,6 +58,9 @@
758 #if GST_GL_HAVE_WINDOW_EAGL
759 #include "eagl/gstglwindow_eagl.h"
760 #endif
761+#if GST_GL_HAVE_WINDOW_FB
762+#include "fb/gstglwindow_fb_egl.h"
763+#endif
764 #if GST_GL_HAVE_WINDOW_DISPMANX
765 #include "dispmanx/gstglwindow_dispmanx_egl.h"
766 #endif
767@@ -308,6 +311,11 @@ gst_gl_window_new (GstGLDisplay * display)
768 if (!window && (!user_choice || g_strstr_len (user_choice, 4, "eagl")))
769 window = GST_GL_WINDOW (gst_gl_window_eagl_new (display));
770 #endif
771+#if GST_GL_HAVE_WINDOW_FB
772+ if (!window && (!user_choice || g_strstr_len (user_choice, 2, "fb")))
773+ window = GST_GL_WINDOW (gst_gl_window_fb_egl_new (display));
774+#endif
775+
776 if (!window) {
777 /* subclass returned a NULL window */
778 GST_WARNING ("Could not create window. user specified %s, creating dummy"
779--
7801.9.1
781
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend
index e9f0cc3f..fddeb3fd 100644
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend
+++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend
@@ -9,6 +9,7 @@ PACKAGECONFIG_GL_imxgpu3d = "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', '
9 9
10SRC_URI_append_imxgpu2d = " \ 10SRC_URI_append_imxgpu2d = " \
11 file://0001-glplugin-Change-wayland-default-res-to-1024x768.patch \ 11 file://0001-glplugin-Change-wayland-default-res-to-1024x768.patch \
12 file://0002-Support-fb-backend-for-gl-plugins.patch \
12" 13"
13 14
14 15