summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2017-11-23 22:58:40 +1100
committerJan Schmidt <jan@centricular.com>2017-11-24 01:48:27 +1100
commitb906601c7bed2aa50ba2d3bddf423b4af375de17 (patch)
tree099ac044249160584aac4617d7d74918265e13c3 /gst-libs
parent9a10dbe35025ca119dd44ba44509a9af727df370 (diff)
Revert "gl: Use GstGLDisplayEGL directly instead of creating a GstGLDisplayVIVFb subclass"
This reverts commit 47fd4d391e775c11f529705bb0f457a9d25ba5e7. This patch is incorrect. It doesn't actually compile, and causes a crash because the viv-fb window implementation needs a native EGL handle to pass to fbCreateWindow, but the GstGLDisplayEGL handleis actually an EGLDisplay now (and gets cast to the wrong type)
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.c63
-rw-r--r--gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.h36
-rw-r--r--gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c5
3 files changed, 95 insertions, 9 deletions
diff --git a/gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.c b/gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.c
index 90202c78f..48815e52f 100644
--- a/gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.c
+++ b/gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.c
@@ -29,26 +29,75 @@
GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
#define GST_CAT_DEFAULT gst_gl_display_debug
+G_DEFINE_TYPE (GstGLDisplayVivFB, gst_gl_display_viv_fb, GST_TYPE_GL_DISPLAY);
+
+static void gst_gl_display_viv_fb_finalize (GObject * object);
+static guintptr gst_gl_display_viv_fb_get_handle (GstGLDisplay * display);
+
+static void
+gst_gl_display_viv_fb_class_init (GstGLDisplayVivFBClass * klass)
+{
+ GST_GL_DISPLAY_CLASS (klass)->get_handle =
+ GST_DEBUG_FUNCPTR (gst_gl_display_viv_fb_get_handle);
+
+ G_OBJECT_CLASS (klass)->finalize = gst_gl_display_viv_fb_finalize;
+}
+
+static void
+gst_gl_display_viv_fb_init (GstGLDisplayVivFB * display_viv_fb)
+{
+ GstGLDisplay *display = (GstGLDisplay *) display_viv_fb;
+
+ display->type = GST_GL_DISPLAY_TYPE_VIV_FB;
+
+ display_viv_fb->disp_idx = 0;
+ display_viv_fb->display = NULL;
+}
+
+static void
+gst_gl_display_viv_fb_finalize (GObject * object)
+{
+ GstGLDisplayVivFB *display_viv_fb = GST_GL_DISPLAY_VIV_FB (object);
+
+ if (display_viv_fb->display)
+ fbDestroyDisplay (display_viv_fb->display);
+
+ G_OBJECT_CLASS (gst_gl_display_viv_fb_parent_class)->finalize (object);
+}
+
/**
* gst_gl_display_viv_fb_new:
* @disp_idx: a display index
*
- * Create a new #GstGLDisplay from the FB display index.
+ * Create a new #GstGLDisplayVivFB from the FB display index.
*
* Returns: (transfer full): a new #GstGLDisplayVivFB or %NULL
*/
-GstGLDisplayEGL *
+GstGLDisplayVivFB *
gst_gl_display_viv_fb_new (gint disp_idx)
{
- EGLDisplay display;
+ GstGLDisplayVivFB *display;
GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
GST_DEBUG ("creating Vivante FB EGL display %d", disp_idx);
- display = fbGetDisplayByIndex (disp_idx);
+ display = g_object_new (GST_TYPE_GL_DISPLAY_VIV_FB, NULL);
+ gst_object_ref_sink (display);
+ display->disp_idx = disp_idx;
+ display->display = fbGetDisplayByIndex (display->disp_idx);
+ if (!display->display) {
+ GST_ERROR ("Failed to open Vivante FB display %d", disp_idx);
+ return NULL;
+ }
+
GST_DEBUG ("Created Vivante FB EGL display %p", (gpointer) display->display);
- return
- gst_gl_display_egl_new_with_egl_display (eglGetDisplay (
- (EGLNativeDisplayType) display));
+
+ return display;
+}
+
+static guintptr
+gst_gl_display_viv_fb_get_handle (GstGLDisplay * display)
+{
+ return (guintptr) GST_GL_DISPLAY_VIV_FB (display)->display;
}
diff --git a/gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.h b/gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.h
index 6d19c3778..9ce1dce84 100644
--- a/gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.h
+++ b/gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.h
@@ -23,12 +23,44 @@
#define __GST_GL_DISPLAY_VIV_FB_H__
#include <gst/gst.h>
-#include <gst/gl/egl/gstgldisplay_egl.h>
+#include <gst/gl/gstgldisplay.h>
#include <gst/gl/egl/gstegl.h>
G_BEGIN_DECLS
-GstGLDisplayEGL *gst_gl_display_viv_fb_new (gint disp_idx);
+GType gst_gl_display_viv_fb_get_type (void);
+
+#define GST_TYPE_GL_DISPLAY_VIV_FB (gst_gl_display_viv_fb_get_type())
+#define GST_GL_DISPLAY_VIV_FB(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY_VIV_FB,GstGLDisplayVivFB))
+#define GST_GL_DISPLAY_VIV_FB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY_VIV_FB,GstGLDisplayVivFBClass))
+#define GST_IS_GL_DISPLAY_VIV_FB(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY_VIV_FB))
+#define GST_IS_GL_DISPLAY_VIV_FB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY_VIV_FB))
+#define GST_GL_DISPLAY_VIV_FB_CAST(obj) ((GstGLDisplayVivFB*)(obj))
+
+typedef struct _GstGLDisplayVivFB GstGLDisplayVivFB;
+typedef struct _GstGLDisplayVivFBClass GstGLDisplayVivFBClass;
+
+/**
+ * GstGLDisplayVivFB:
+ *
+ * the contents of a #GstGLDisplayVivFB are private and should only be accessed
+ * through the provided API
+ */
+struct _GstGLDisplayVivFB
+{
+ GstGLDisplay parent;
+
+ /* <private> */
+ gint disp_idx;
+ EGLNativeDisplayType display;
+};
+
+struct _GstGLDisplayVivFBClass
+{
+ GstGLDisplayClass object_class;
+};
+
+GstGLDisplayVivFB *gst_gl_display_viv_fb_new (gint disp_idx);
G_END_DECLS
diff --git a/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c b/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c
index e6a62508b..8515dc8ec 100644
--- a/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c
+++ b/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c
@@ -75,6 +75,11 @@ gst_gl_window_viv_fb_egl_new (GstGLDisplay * display)
{
GstGLWindowVivFBEGL *window;
+ if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_VIV_FB) ==
+ 0)
+ /* we require a Vivante FB display to create windows */
+ return NULL;
+
window = g_object_new (GST_TYPE_GL_WINDOW_VIV_FB_EGL, NULL);
gst_object_ref_sink (window);