morty migration: gstreamer1.0-plugins-bad: update package

Also apply patches from meta-fsl-bsp-release (krogoth_4.1.15-2.0.1)

https://jira.digi.com/browse/DEL-3459

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2017-02-24 13:50:13 +01:00
parent 2ab3c8792e
commit b094497c8d
38 changed files with 2280 additions and 3362 deletions

View File

@ -1,171 +0,0 @@
From e5b2bade360bcf12ac389463019162a6ce64d9ef Mon Sep 17 00:00:00 2001
From: Jian <Jian.Li@freescale.com>
Date: Thu, 26 Mar 2015 14:22:07 +0800
Subject: [PATCH] Support croping and alignment handling
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Upstream Status: Inappropriate [i.MX specific]
Signed-off-by: Jian <Jian.Li@freescale.com>
---
ext/gl/gstglimagesink.c | 57 ++++++++++++++++++++++++++++++-
ext/gl/gstglimagesink.h | 3 ++
gst-libs/gst/gl/gstglvivdirecttexture.c | 22 ++++++------
3 files changed, 71 insertions(+), 11 deletions(-)
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index cd3a9ff..1d60e1d 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -302,6 +302,8 @@ gst_glimage_sink_init (GstGLImageSink * glimage_sink)
glimage_sink->pool = NULL;
glimage_sink->stored_buffer = NULL;
glimage_sink->redisplay_texture = 0;
+ glimage_sink->cropmeta = NULL;
+ glimage_sink->videometa = NULL;
g_mutex_init (&glimage_sink->drawing_lock);
}
@@ -602,6 +604,10 @@ gst_glimage_sink_change_state (GstElement * element, GstStateChange transition)
gst_object_unref (glimage_sink->display);
glimage_sink->display = NULL;
}
+
+ glimage_sink->cropmeta = NULL;
+ glimage_sink->videometa = NULL;
+
break;
}
case GST_STATE_CHANGE_READY_TO_NULL:
@@ -804,6 +810,9 @@ gst_glimage_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
if (stored_buffer)
gst_buffer_unref (stored_buffer);
+ glimage_sink->cropmeta = gst_buffer_get_video_crop_meta (buf);
+ glimage_sink->videometa = gst_buffer_get_video_meta (buf);
+
/* Ask the underlying window to redraw its content */
if (!gst_glimage_sink_redisplay (glimage_sink))
goto redisplay_failed;
@@ -1155,7 +1164,7 @@ gst_glimage_sink_on_draw (GstGLImageSink * gl_sink)
#endif
#if GST_GL_HAVE_GLES2
if (USING_GLES2 (gl_sink->context)) {
- const GLfloat vVertices[] = { 1.0f, 1.0f, 0.0f,
+ GLfloat vVertices[] = { 1.0f, 1.0f, 0.0f,
1.0f, 0.0f,
-1.0f, 1.0f, 0.0f,
0.0f, 0.0f,
@@ -1165,6 +1174,52 @@ gst_glimage_sink_on_draw (GstGLImageSink * gl_sink)
1.0f, 1.0f
};
+ // recalculate the texcoords based on video crop and alignment
+ {
+ gint bufw, bufh;
+ gint x,y,width,height;
+
+ if (gl_sink->videometa
+ && (gl_sink->videometa->format == GST_VIDEO_FORMAT_I420
+ || gl_sink->videometa->format == GST_VIDEO_FORMAT_NV12)) {
+ bufw = gl_sink->videometa->stride[0];
+ bufh = gl_sink->videometa->offset[1] / bufw;
+ }
+ else {
+ bufw = GST_VIDEO_SINK_WIDTH (gl_sink);
+ bufh = GST_VIDEO_SINK_HEIGHT (gl_sink);
+ }
+
+ //g_print ("buffer res: %d, %d\n", bufw, bufh);
+
+ if (gl_sink->cropmeta) {
+ x = gl_sink->cropmeta->x;
+ y = gl_sink->cropmeta->y;
+ width = gl_sink->cropmeta->width;
+ height = gl_sink->cropmeta->height;
+ }
+ else {
+ x = y = 0;
+ width = GST_VIDEO_SINK_WIDTH (gl_sink);
+ height = GST_VIDEO_SINK_HEIGHT (gl_sink);
+ }
+
+ vVertices[8] = (float)(x) / bufw;
+ vVertices[9] = (float)(y) / bufh;
+
+ vVertices[3] = (float)(x + width) / bufw;
+ vVertices[4] = vVertices[9];
+
+ vVertices[13] = vVertices[8];
+ vVertices[14] = (float)(y + height) / bufh;
+
+ vVertices[18] = vVertices[3];
+ vVertices[19] = vVertices[14];
+
+ //g_print ("vVertices, (%f, %f), (%f, %f), (%f, %f), (%f, %f)\n", vVertices[8], vVertices[9], vVertices[3], vVertices[4],
+ // vVertices[13], vVertices[14], vVertices[18], vVertices[19]);
+ }
+
GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
gl->ClearColor (0.0, 0.0, 0.0, 0.0);
diff --git a/ext/gl/gstglimagesink.h b/ext/gl/gstglimagesink.h
index 25e6a13..1805e94 100644
--- a/ext/gl/gstglimagesink.h
+++ b/ext/gl/gstglimagesink.h
@@ -82,6 +82,9 @@ struct _GstGLImageSink
guint window_width;
guint window_height;
+ GstVideoCropMeta *cropmeta;
+ GstVideoMeta *videometa;
+
#if GST_GL_HAVE_GLES2
GstGLShader *redisplay_shader;
GLint redisplay_attr_position_loc;
diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.c b/gst-libs/gst/gl/gstglvivdirecttexture.c
index 4806335..9131101 100644
--- a/gst-libs/gst/gl/gstglvivdirecttexture.c
+++ b/gst-libs/gst/gl/gstglvivdirecttexture.c
@@ -89,8 +89,18 @@ gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideo
PhyMemBlock *memblk = &memphy->block;
GstVideoFormat fmt = GST_VIDEO_INFO_FORMAT (info);
- guint viv_fmt;
+ gint width, height;
+ GstVideoMeta *vmeta = gst_buffer_get_video_meta (buffer);
+ if (vmeta && (fmt == GST_VIDEO_FORMAT_I420 || fmt == GST_VIDEO_FORMAT_NV12)) {
+ width = vmeta->stride[0];
+ height = vmeta->offset[1] / width;
+ }
+ else {
+ width = GST_VIDEO_INFO_WIDTH (info);
+ height = GST_VIDEO_INFO_HEIGHT (info);
+ }
+ guint viv_fmt;
switch (fmt) {
case GST_VIDEO_FORMAT_I420:
viv_fmt = GL_VIV_I420;
@@ -107,15 +117,7 @@ gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideo
return FALSE;
}
- GstVivDirectTexture viv_tex = {
- tex_id,
- GST_VIDEO_INFO_WIDTH (info),
- GST_VIDEO_INFO_HEIGHT (info),
- viv_fmt,
- memblk->vaddr,
- memblk->paddr,
- FALSE};
-
+ GstVivDirectTexture viv_tex = {tex_id, width, height, viv_fmt, memblk->vaddr, memblk->paddr, FALSE};
gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _do_viv_direct_tex_bind_mem, &viv_tex);
return viv_tex.ret;
--
1.7.9.5

View File

@ -1,69 +0,0 @@
From 29da042a43dd49e1fb821afd8f6d5d63ad0f9f07 Mon Sep 17 00:00:00 2001
From: Jian <Jian.Li@freescale.com>
Date: Mon, 27 Apr 2015 17:42:36 +0800
Subject: [PATCH 1/3] [glimagesink] Add fps print in glimagesink
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Upstream Status: Inappropriate [i.MX specific]
Signed-off-by: Jian <Jian.Li@freescale.com>
---
ext/gl/gstglimagesink.c | 12 ++++++++++++
ext/gl/gstglimagesink.h | 2 ++
2 files changed, 14 insertions(+)
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index d3cacce..3c0c6b3 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -304,6 +304,7 @@ gst_glimage_sink_init (GstGLImageSink * glimage_sink)
glimage_sink->redisplay_texture = 0;
glimage_sink->cropmeta = NULL;
glimage_sink->videometa = NULL;
+ glimage_sink->frame_showed = 0;
g_mutex_init (&glimage_sink->drawing_lock);
}
@@ -611,6 +612,15 @@ gst_glimage_sink_change_state (GstElement * element, GstStateChange transition)
break;
}
case GST_STATE_CHANGE_READY_TO_NULL:
+ {
+ GstClockTime run_time = gst_element_get_start_time (GST_ELEMENT (glimage_sink));
+ if (run_time > 0) {
+ g_print ("Total showed frames (%lld), playing for (%"GST_TIME_FORMAT"), fps (%.3f).\n",
+ glimage_sink->frame_showed, GST_TIME_ARGS (run_time),
+ (gfloat)GST_SECOND * glimage_sink->frame_showed / run_time);
+ }
+ }
+
break;
default:
break;
@@ -827,6 +837,8 @@ gst_glimage_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
return GST_FLOW_ERROR;
}
+ glimage_sink->frame_showed ++;
+
return GST_FLOW_OK;
/* ERRORS */
diff --git a/ext/gl/gstglimagesink.h b/ext/gl/gstglimagesink.h
index 1805e94..5990457 100644
--- a/ext/gl/gstglimagesink.h
+++ b/ext/gl/gstglimagesink.h
@@ -85,6 +85,8 @@ struct _GstGLImageSink
GstVideoCropMeta *cropmeta;
GstVideoMeta *videometa;
+ guint64 frame_showed;
+
#if GST_GL_HAVE_GLES2
GstGLShader *redisplay_shader;
GLint redisplay_attr_position_loc;
--
1.7.9.5

View File

@ -1,779 +0,0 @@
From f70aa04abd040569038136a536d27ba928ad9339 Mon Sep 17 00:00:00 2001
From: Jian <Jian.Li@freescale.com>
Date: Mon, 27 Apr 2015 17:41:57 +0800
Subject: [PATCH 2/3] [gl fb] Support fb backend for gl plugins
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Upstream Status: Inappropriate [i.MX specific]
Signed-off-by: Jian <Jian.Li@freescale.com>
---
configure.ac | 23 ++-
gst-libs/gst/gl/Makefile.am | 6 +
gst-libs/gst/gl/fb/Makefile.am | 25 +++
gst-libs/gst/gl/fb/gstgldisplay_fb.c | 109 ++++++++++++
gst-libs/gst/gl/fb/gstgldisplay_fb.h | 66 +++++++
gst-libs/gst/gl/fb/gstglwindow_fb_egl.c | 283 +++++++++++++++++++++++++++++++
gst-libs/gst/gl/fb/gstglwindow_fb_egl.h | 68 ++++++++
gst-libs/gst/gl/gstgldisplay.c | 8 +
gst-libs/gst/gl/gstgldisplay.h | 1 +
gst-libs/gst/gl/gstglwindow.c | 5 +
10 files changed, 593 insertions(+), 1 deletion(-)
create mode 100644 gst-libs/gst/gl/fb/Makefile.am
create mode 100644 gst-libs/gst/gl/fb/gstgldisplay_fb.c
create mode 100644 gst-libs/gst/gl/fb/gstgldisplay_fb.h
create mode 100644 gst-libs/gst/gl/fb/gstglwindow_fb_egl.c
create mode 100644 gst-libs/gst/gl/fb/gstglwindow_fb_egl.h
diff --git a/configure.ac b/configure.ac
index b1cfbd8..1dc21f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -654,6 +654,7 @@ HAVE_GL=no
HAVE_GLES2=no
HAVE_GLU=no
HAVE_WAYLAND_EGL=no
+HAV_FB_EGL=no
HAVE_EGL_RPI=no
@@ -740,6 +741,7 @@ case $host in
CFLAGS=$old_CFLAGS
PKG_CHECK_MODULES(WAYLAND_EGL, wayland-client >= 1.0 wayland-cursor >= 1.0 wayland-egl >= 1.0, HAVE_WAYLAND_EGL=yes, HAVE_WAYLAND_EGL=no)
+ AC_CHECK_LIB(EGL, fbGetDisplay, HAVE_FB_EGL=yes, HAVE_FB_EGL=no)
;;
esac
@@ -958,6 +960,16 @@ case $host in
fi
fi
+ if test "x$HAVE_FB_EGL" = "xyes"; then
+ if test "x$NEED_EGL" = "xno" -o "x$HAVE_EGL" = "xno"; then
+ AC_MSG_WARN([EGL is required by the fb backend for OpenGL support])
+ else
+ HAVE_WINDOW_FB=yes
+ GL_LIBS="$GL_LIBS"
+ GL_CFLAGS="$GL_CFLAGS"
+ fi
+ fi
+
if test "x$HAVE_EGL_RPI" = "xyes"; then
if test "x$NEED_DISPMANX" != "xno"; then
HAVE_WINDOW_DISPMANX=yes
@@ -972,7 +984,7 @@ case $host in
fi
else
if test "x$NEED_EGL" != "xno"; then
- if test "x$HAVE_WINDOW_WAYLAND" = "xyes" -o "x$HAVE_WINDOW_X11" = "xyes" -o "x$HAVE_WINDOW_DISPMANX" = "xyes"; then
+ 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
GL_LIBS="$GL_LIBS -lEGL $EGL_LIBS"
GL_CFLAGS="$GL_CFLAGS $EGL_CFLAGS"
USE_EGL=yes
@@ -1112,6 +1124,7 @@ GST_GL_HAVE_WINDOW_WAYLAND=0
GST_GL_HAVE_WINDOW_ANDROID=0
GST_GL_HAVE_WINDOW_DISPMANX=0
GST_GL_HAVE_WINDOW_EAGL=0
+GST_GL_HAVE_WINDOW_FB=0
if test "x$HAVE_WINDOW_X11" = "xyes"; then
GL_WINDOWS="x11 $GL_WINDOWS"
@@ -1141,6 +1154,10 @@ if test "x$HAVE_WINDOW_EAGL" = "xyes"; then
GL_WINDOWS="eagl $GL_WINDOWS"
GST_GL_HAVE_WINDOW_EAGL=1
fi
+if test "x$HAVE_WINDOW_FB" = "xyes"; then
+ GL_WINDOWS="fb $GL_WINDOWS"
+ GST_GL_HAVE_WINDOW_FB=1
+fi
GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
#define GST_GL_HAVE_WINDOW_X11 $GST_GL_HAVE_WINDOW_X11
@@ -1150,6 +1167,7 @@ GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
#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
+#define GST_GL_HAVE_WINDOW_FB $GST_GL_HAVE_WINDOW_FB
"
dnl PLATFORM's
@@ -1221,6 +1239,7 @@ if test "x$GL_APIS" = "x" -o "x$GL_PLATFORMS" = "x" -o "x$GL_WINDOWS" = "x"; the
HAVE_WINDOW_ANDROID=no
HAVE_WINDOW_COCOA=no
HAVE_WINDOW_EAGL=no
+ HAVE_WINDOW_FB=no
fi
AC_SUBST(GL_LIBS)
@@ -1236,6 +1255,7 @@ 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(HAVE_WINDOW_FB, test "x$HAVE_WINDOW_FB" = "xyes")
AM_CONDITIONAL(USE_OPENGL, test "x$USE_OPENGL" = "xyes")
AM_CONDITIONAL(USE_GLES2, test "x$USE_GLES2" = "xyes")
@@ -3206,6 +3226,7 @@ gst-libs/gst/gl/egl/Makefile
gst-libs/gst/gl/wayland/Makefile
gst-libs/gst/gl/win32/Makefile
gst-libs/gst/gl/x11/Makefile
+gst-libs/gst/gl/fb/Makefile
gst-libs/gst/insertbin/Makefile
gst-libs/gst/interfaces/Makefile
gst-libs/gst/codecparsers/Makefile
diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
index 86bc439..d5e5baa 100644
--- a/gst-libs/gst/gl/Makefile.am
+++ b/gst-libs/gst/gl/Makefile.am
@@ -92,11 +92,17 @@ SUBDIRS += eagl
libgstgl_@GST_API_VERSION@_la_LIBADD += eagl/libgstgl-eagl.la
endif
+if HAVE_WINDOW_FB
+SUBDIRS += fb
+libgstgl_@GST_API_VERSION@_la_LIBADD += fb/libgstgl-fb.la
+endif
+
if USE_EGL
SUBDIRS += egl
libgstgl_@GST_API_VERSION@_la_LIBADD += egl/libgstgl-egl.la
endif
+
nodist_libgstgl_@GST_API_VERSION@include_HEADERS = \
$(built_header_configure)
diff --git a/gst-libs/gst/gl/fb/Makefile.am b/gst-libs/gst/gl/fb/Makefile.am
new file mode 100644
index 0000000..8e4656c
--- /dev/null
+++ b/gst-libs/gst/gl/fb/Makefile.am
@@ -0,0 +1,25 @@
+## Process this file with automake to produce Makefile.in
+
+noinst_LTLIBRARIES = libgstgl-fb.la
+
+libgstgl_fb_la_SOURCES = \
+ gstgldisplay_fb.c \
+ gstglwindow_fb_egl.c
+
+noinst_HEADERS = \
+ gstgldisplay_fb.h \
+ gstglwindow_fb_egl.h
+
+libgstgl_fbincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/fb
+
+libgstgl_fb_la_CFLAGS = \
+ -I$(top_srcdir)/gst-libs \
+ -I$(top_builddir)/gst-libs \
+ $(GL_CFLAGS) \
+ $(GST_PLUGINS_BASE_CFLAGS) \
+ $(GST_BASE_CFLAGS) \
+ $(GST_CFLAGS)
+
+libgstgl_fb_la_LDFLAGS = \
+ $(GST_LIB_LDFLAGS) \
+ $(GST_ALL_LDFLAGS)
diff --git a/gst-libs/gst/gl/fb/gstgldisplay_fb.c b/gst-libs/gst/gl/fb/gstgldisplay_fb.c
new file mode 100644
index 0000000..3be9756
--- /dev/null
+++ b/gst-libs/gst/gl/fb/gstgldisplay_fb.c
@@ -0,0 +1,109 @@
+/*
+ * GStreamer
+ * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gl/fb/gstgldisplay_fb.h>
+
+GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
+#define GST_CAT_DEFAULT gst_gl_display_debug
+
+G_DEFINE_TYPE (GstGLDisplayFB, gst_gl_display_fb, GST_TYPE_GL_DISPLAY);
+
+static void gst_gl_display_fb_finalize (GObject * object);
+static guintptr gst_gl_display_fb_get_handle (GstGLDisplay * display);
+
+static void
+gst_gl_display_fb_class_init (GstGLDisplayFBClass * klass)
+{
+ GST_GL_DISPLAY_CLASS (klass)->get_handle =
+ GST_DEBUG_FUNCPTR (gst_gl_display_fb_get_handle);
+
+ G_OBJECT_CLASS (klass)->finalize = gst_gl_display_fb_finalize;
+}
+
+static void
+gst_gl_display_fb_init (GstGLDisplayFB * display_fb)
+{
+ GstGLDisplay *display = (GstGLDisplay *) display_fb;
+
+ display->type = GST_GL_DISPLAY_TYPE_FB;
+ display_fb->name = NULL;
+ display_fb->disp_idx = 0;
+ display_fb->display = NULL;
+}
+
+static void
+gst_gl_display_fb_finalize (GObject * object)
+{
+ GstGLDisplayFB *display_fb = GST_GL_DISPLAY_FB (object);
+
+ if (display_fb->name)
+ g_free (display_fb->name);
+
+ if (display_fb->display)
+ fbDestroyDisplay (display_fb->display);
+
+ G_OBJECT_CLASS (gst_gl_display_fb_parent_class)->finalize (object);
+}
+
+/**
+ * gst_gl_display_fb_new:
+ * @name: (allow-none): a display name
+ *
+ * Create a new #GstGLDisplayFB from the x11 display name. See XOpenDisplay()
+ * for details on what is a valid name.
+ *
+ * Returns: (transfer full): a new #GstGLDisplayFB or %NULL
+ */
+GstGLDisplayFB *
+gst_gl_display_fb_new (gchar *name)
+{
+ GstGLDisplayFB *display;
+ const gchar *fb_name = NULL;
+
+ GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
+ GST_DEBUG ("creating Fb EGL display");
+
+ fb_name = name;
+ if (!fb_name) fb_name = "fb0";
+
+ display = g_object_new (GST_TYPE_GL_DISPLAY_FB, NULL);
+ display->name = g_strdup (fb_name);
+ sscanf (display->name, "fb%d", &display->disp_idx);
+ display->display = fbGetDisplayByIndex (display->disp_idx);
+ if (!display->display) {
+ GST_ERROR ("Failed to open FB display, \'%s\'", fb_name);
+ return NULL;
+ }
+
+ GST_DEBUG ("Created fb EGL display %d", display->display);
+
+ return display;
+}
+
+static guintptr
+gst_gl_display_fb_get_handle (GstGLDisplay * display)
+{
+ GST_DEBUG ("Get fb EGL display %d", GST_GL_DISPLAY_FB (display)->display);
+ return (guintptr) GST_GL_DISPLAY_FB (display)->display;
+}
diff --git a/gst-libs/gst/gl/fb/gstgldisplay_fb.h b/gst-libs/gst/gl/fb/gstgldisplay_fb.h
new file mode 100644
index 0000000..f0a5ce5
--- /dev/null
+++ b/gst-libs/gst/gl/fb/gstgldisplay_fb.h
@@ -0,0 +1,66 @@
+/*
+ * GStreamer
+ * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.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_DISPLAY_FB_H__
+#define __GST_GL_DISPLAY_FB_H__
+
+#include <gst/gst.h>
+#include <gst/gl/gstgldisplay.h>
+
+G_BEGIN_DECLS
+
+GType gst_gl_display_fb_get_type (void);
+
+#define GST_TYPE_GL_DISPLAY_FB (gst_gl_display_fb_get_type())
+#define GST_GL_DISPLAY_FB(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY_FB,GstGLDisplayFB))
+#define GST_GL_DISPLAY_FB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY_FB,GstGLDisplayFBClass))
+#define GST_IS_GL_DISPLAY_FB(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY_FB))
+#define GST_IS_GL_DISPLAY_FB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY_FB))
+#define GST_GL_DISPLAY_FB_CAST(obj) ((GstGLDisplayFB*)(obj))
+
+typedef struct _GstGLDisplayFB GstGLDisplayFB;
+typedef struct _GstGLDisplayFBClass GstGLDisplayFBClass;
+
+/**
+ * GstGLDisplayFB:
+ *
+ * the contents of a #GstGLDisplayFB are private and should only be accessed
+ * through the provided API
+ */
+struct _GstGLDisplayFB
+{
+ GstGLDisplay parent;
+
+ /* <private> */
+ gchar *name;
+ gint disp_idx;
+ EGLNativeDisplayType display;
+};
+
+struct _GstGLDisplayFBClass
+{
+ GstGLDisplayClass object_class;
+};
+
+GstGLDisplayFB *gst_gl_display_fb_new (gchar *name);
+
+G_END_DECLS
+
+#endif /* __GST_GL_DISPLAY_FB_H__ */
diff --git a/gst-libs/gst/gl/fb/gstglwindow_fb_egl.c b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.c
new file mode 100644
index 0000000..edb5fb9
--- /dev/null
+++ b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.c
@@ -0,0 +1,283 @@
+/*
+ * GStreamer
+ * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
+ */
+
+#include "../gstgl_fwd.h"
+#include <gst/gl/gstglcontext.h>
+
+#include "gstglwindow_fb_egl.h"
+
+#define GST_CAT_DEFAULT gst_gl_window_debug
+
+#define gst_gl_window_fb_egl_parent_class parent_class
+G_DEFINE_TYPE (GstGLWindowFbEGL, gst_gl_window_fb_egl,
+ GST_GL_TYPE_WINDOW);
+
+static guintptr gst_gl_window_fb_egl_get_window_handle (GstGLWindow *
+ window);
+static void gst_gl_window_fb_egl_set_window_handle (GstGLWindow * window,
+ guintptr handle);
+static void gst_gl_window_fb_egl_draw (GstGLWindow * window, guint width,
+ guint height);
+static void gst_gl_window_fb_egl_run (GstGLWindow * window);
+static void gst_gl_window_fb_egl_quit (GstGLWindow * window);
+static void gst_gl_window_fb_egl_send_message_async (GstGLWindow * window,
+ GstGLWindowCB callback, gpointer data, GDestroyNotify destroy);
+static void gst_gl_window_fb_egl_close (GstGLWindow * window);
+static gboolean gst_gl_window_fb_egl_open (GstGLWindow * window,
+ GError ** error);
+
+static void
+gst_gl_window_fb_egl_class_init (GstGLWindowFbEGLClass * klass)
+{
+ GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
+
+ window_class->get_window_handle =
+ GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_get_window_handle);
+ window_class->set_window_handle =
+ GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_set_window_handle);
+ window_class->draw_unlocked =
+ GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_draw);
+ window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_draw);
+ window_class->run = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_run);
+ window_class->quit = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_quit);
+ window_class->send_message_async =
+ GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_send_message_async);
+ window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_close);
+ window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_open);
+}
+
+static void
+gst_gl_window_fb_egl_init (GstGLWindowFbEGL * window)
+{
+ GstGLWindowFbEGL *window_egl;
+
+ window_egl = GST_GL_WINDOW_FB_EGL (window);
+
+ window_egl->width = 0;
+ window_egl->height = 0;
+ window_egl->fullscreen = FALSE;
+ window_egl->display = 0;
+ window_egl->main_context = NULL;
+ window_egl->loop = NULL;
+}
+
+/* Must be called in the gl thread */
+GstGLWindowFbEGL *
+gst_gl_window_fb_egl_new (GstGLDisplay * display)
+{
+ GstGLWindowFbEGL *window;
+ const gchar *fb_name = NULL;
+
+ if (!display)
+ return NULL;
+
+ window = g_object_new (GST_GL_TYPE_WINDOW_FB_EGL, NULL);
+ window->display = gst_gl_display_get_handle (display);
+ if (!window->display) {
+ GST_ERROR ("failed to get display for egl window");
+ return NULL;
+ }
+
+ return window;
+}
+
+static void
+gst_gl_window_fb_egl_close (GstGLWindow * window)
+{
+ GstGLWindowFbEGL *window_egl;
+
+ window_egl = GST_GL_WINDOW_FB_EGL (window);
+
+ g_main_loop_unref (window_egl->loop);
+ g_main_context_unref (window_egl->main_context);
+
+ if (window_egl->win_id) {
+ fbDestroyWindow (window_egl->win_id);
+ }
+}
+
+static gboolean
+gst_gl_window_fb_egl_open (GstGLWindow * window, GError ** error)
+{
+ GstGLWindowFbEGL *window_egl;
+
+ window_egl = GST_GL_WINDOW_FB_EGL (window);
+
+ if (!window_egl->display) {
+ GST_ERROR ("No display for window_egl.");
+ return FALSE;
+ }
+
+ window_egl->win_id = fbCreateWindow (window_egl->display, -1, -1, 0, 0);
+ if (!window_egl->win_id) {
+ GST_ERROR ("Failed to create window_egl");
+ return FALSE;
+ }
+
+ fbGetDisplayGeometry (window_egl->display, &window_egl->width, &window_egl->height);
+ window_egl->req_width = window_egl->width;
+ window_egl->req_height = window_egl->height;
+ GST_DEBUG ("Open FB display succesfully, resolution is (%dx%d),display %d, window %d.",
+ window_egl->width, window_egl->height, window_egl->display, window_egl->win_id);
+
+ window_egl->main_context = g_main_context_new ();
+ window_egl->loop = g_main_loop_new (window_egl->main_context, FALSE);
+
+ return TRUE;
+}
+
+static void
+gst_gl_window_fb_egl_run (GstGLWindow * window)
+{
+ GstGLWindowFbEGL *window_egl;
+
+ window_egl = GST_GL_WINDOW_FB_EGL (window);
+
+ GST_LOG ("starting main loop");
+ g_main_loop_run (window_egl->loop);
+ GST_LOG ("exiting main loop");
+}
+
+static void
+gst_gl_window_fb_egl_quit (GstGLWindow * window)
+{
+ GstGLWindowFbEGL *window_egl;
+
+ window_egl = GST_GL_WINDOW_FB_EGL (window);
+
+ GST_LOG ("sending quit");
+
+ g_main_loop_quit (window_egl->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_fb_egl_send_message_async (GstGLWindow * window,
+ GstGLWindowCB callback, gpointer data, GDestroyNotify destroy)
+{
+ GstGLWindowFbEGL *window_egl;
+ GstGLMessage *message;
+
+ window_egl = GST_GL_WINDOW_FB_EGL (window);
+ message = g_slice_new (GstGLMessage);
+
+ message->callback = callback;
+ message->data = data;
+ message->destroy = destroy;
+
+ g_main_context_invoke (window_egl->main_context, (GSourceFunc) _run_message,
+ message);
+}
+
+static guintptr
+gst_gl_window_fb_egl_get_window_handle (GstGLWindow * window)
+{
+ GST_DEBUG ("fb egl get window: %d", GST_GL_WINDOW_FB_EGL (window)->win_id);
+ return (guintptr) GST_GL_WINDOW_FB_EGL (window)->win_id;
+}
+
+static void
+gst_gl_window_fb_egl_set_window_handle (GstGLWindow * window,
+ guintptr handle)
+{
+}
+
+struct draw
+{
+ GstGLWindowFbEGL *window;
+ guint width, height;
+};
+
+static void
+draw_cb (gpointer data)
+{
+ struct draw *draw_data = data;
+ GstGLWindowFbEGL *window_egl = draw_data->window;
+ GstGLWindow *window = GST_GL_WINDOW (window_egl);
+ GstGLContext *context = gst_gl_window_get_context (window);
+ GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
+
+#if 0
+ if (draw_data->width != window_egl->req_width || draw_data->height != window_egl->req_height) {
+ if (draw_data->width == 0)
+ window_egl->req_width = window_egl->width;
+ else
+ window_egl->req_width = draw_data->width;
+
+ if (draw_data->height == 0)
+ window_egl->req_height = window_egl->height;
+ else
+ window_egl->req_height = draw_data->height;
+
+ if (window->resize)
+ window->resize (window->resize_data, window_egl->req_width, window_egl->req_height);
+ }
+#endif
+
+ //FIXME: default full screen currently
+ if (!window_egl->fullscreen && window->resize) {
+ window->resize (window->resize_data, window_egl->width, window_egl->height);
+ window_egl->fullscreen = TRUE;
+ }
+
+ if (window->draw)
+ window->draw (window->draw_data);
+
+ GST_DEBUG ("####### draw data");
+ context_class->swap_buffers (context);
+
+ gst_object_unref (context);
+}
+
+static void
+gst_gl_window_fb_egl_draw (GstGLWindow * window, guint width, guint height)
+{
+ struct draw draw_data;
+
+ draw_data.window = GST_GL_WINDOW_FB_EGL (window);
+ draw_data.width = width;
+ draw_data.height = height;
+
+ gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, &draw_data);
+}
+
diff --git a/gst-libs/gst/gl/fb/gstglwindow_fb_egl.h b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.h
new file mode 100644
index 0000000..bcd71ab
--- /dev/null
+++ b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.h
@@ -0,0 +1,68 @@
+/*
+ * GStreamer
+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_FB_EGL_H__
+#define __GST_GL_WINDOW_FB_EGL_H__
+
+#include <gst/gl/gl.h>
+#include "EGL/eglvivante.h"
+
+G_BEGIN_DECLS
+
+#define GST_GL_TYPE_WINDOW_FB_EGL (gst_gl_window_fb_egl_get_type())
+#define GST_GL_WINDOW_FB_EGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_GL_TYPE_WINDOW_FB_EGL, GstGLWindowFbEGL))
+#define GST_GL_WINDOW_FB_EGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_GL_TYPE_WINDOW_FB_EGL, GstGLWindowFbEGLClass))
+#define GST_GL_IS_WINDOW_FB_EGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_GL_TYPE_WINDOW_FB_EGL))
+#define GST_GL_IS_WINDOW_FB_EGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_GL_TYPE_WINDOW_FB_EGL))
+#define GST_GL_WINDOW_FB_EGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_GL_TYPE_WINDOW_FB_EGL, GstGLWindowFbEGL_Class))
+
+typedef struct _GstGLWindowFbEGL GstGLWindowFbEGL;
+typedef struct _GstGLWindowFbEGLClass GstGLWindowFbEGLClass;
+
+struct _GstGLWindowFbEGL {
+ /*< private >*/
+ GstGLWindow parent;
+
+ /* <private> */
+ gint width, req_width;
+ gint height, req_height;
+ gboolean fullscreen;
+ EGLNativeDisplayType display;
+ EGLNativeWindowType win_id;
+
+ GMainContext *main_context;
+ GMainLoop *loop;
+};
+
+struct _GstGLWindowFbEGLClass {
+ /*< private >*/
+ GstGLWindowClass parent_class;
+
+ /*< private >*/
+ gpointer _reserved[GST_PADDING];
+};
+
+GType gst_gl_window_fb_egl_get_type (void);
+
+GstGLWindowFbEGL * gst_gl_window_fb_egl_new (GstGLDisplay * display);
+
+G_END_DECLS
+
+#endif /* __GST_GL_WINDOW_FB_EGL_H__ */
diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c
index 6b7b835..9de8411 100644
--- a/gst-libs/gst/gl/gstgldisplay.c
+++ b/gst-libs/gst/gl/gstgldisplay.c
@@ -157,6 +157,14 @@ gst_gl_display_new (void)
if (!display && (!user_choice || g_strstr_len (user_choice, 7, "wayland")))
display = g_object_new (GST_TYPE_GL_DISPLAY, NULL);
#endif
+#if GST_GL_HAVE_WINDOW_FB
+ if (!display && (!user_choice || g_strstr_len (user_choice, 2, "fb"))) {
+ const gchar *fb_name = NULL;
+ fb_name = g_getenv ("GST_GL_FB");
+ if (!fb_name) fb_name = "fb0";
+ display = GST_GL_DISPLAY (gst_gl_display_fb_new (fb_name));
+ }
+#endif
#if GST_GL_HAVE_PLATFORM_EGL
if (!display && (!platform_choice
|| g_strstr_len (platform_choice, 3, "egl")))
diff --git a/gst-libs/gst/gl/gstgldisplay.h b/gst-libs/gst/gl/gstgldisplay.h
index 09489a6..d4d3db5 100644
--- a/gst-libs/gst/gl/gstgldisplay.h
+++ b/gst-libs/gst/gl/gstgldisplay.h
@@ -49,6 +49,7 @@ typedef enum
GST_GL_DISPLAY_TYPE_WIN32 = (1 << 3),
GST_GL_DISPLAY_TYPE_DISPMANX = (1 << 4),
GST_GL_DISPLAY_TYPE_EGL = (1 << 5),
+ GST_GL_DISPLAY_TYPE_FB = (1 << 6),
GST_GL_DISPLAY_TYPE_ANY = G_MAXUINT32
} GstGLDisplayType;
diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c
index a35ca05..86ebf78 100644
--- a/gst-libs/gst/gl/gstglwindow.c
+++ b/gst-libs/gst/gl/gstglwindow.c
@@ -187,6 +187,11 @@ gst_gl_window_new (GstGLDisplay * display)
if (!window && (!user_choice || g_strstr_len (user_choice, 4, "eagl")))
window = GST_GL_WINDOW (gst_gl_window_eagl_new ());
#endif
+#if GST_GL_HAVE_WINDOW_FB
+ if (!window && (!user_choice || g_strstr_len (user_choice, 2, "fb")))
+ window = GST_GL_WINDOW (gst_gl_window_fb_egl_new (display));
+#endif
+
if (!window) {
/* subclass returned a NULL window */
GST_WARNING ("Could not create window. user specified %s, creating dummy"
--
1.7.9.5

View File

@ -1,57 +0,0 @@
From 6bdbf69076950eb3024b1b271f3ff205df3937e4 Mon Sep 17 00:00:00 2001
From: Jian <Jian.Li@freescale.com>
Date: Mon, 27 Apr 2015 17:43:16 +0800
Subject: [PATCH 3/3] [gl wayland] Make it always fullscreen (1024x768)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
gl wayland backend has problem for window resolution,
currently make if always 1024x768.
Upstream Status: Inappropriate [i.MX specific]
Signed-off-by: Jian <Jian.Li@freescale.com>
---
gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
index d5853b0..5d9b457 100644
--- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
+++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
@@ -195,9 +195,9 @@ create_surface (GstGLWindowWaylandEGL * window_egl)
&shell_surface_listener, window_egl);
if (window_egl->window.window_width <= 0)
- window_egl->window.window_width = 320;
+ window_egl->window.window_width = 1024;
if (window_egl->window.window_height <= 0)
- window_egl->window.window_height = 240;
+ window_egl->window.window_height = 768;
window_egl->window.native =
wl_egl_window_create (window_egl->window.surface,
@@ -483,11 +483,19 @@ draw_cb (gpointer data)
GstGLContext *context = gst_gl_window_get_context (window);
GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
+#if 0
if (window_egl->window.window_width != draw_data->width
|| window_egl->window.window_height != draw_data->height) {
GST_DEBUG ("dimensions don't match, attempting resize");
window_resize (window_egl, draw_data->width, draw_data->height);
}
+#endif
+
+ // Fix to fullscreen here
+ if (!window_egl->window.fullscreen) {
+ window_resize (window_egl, window_egl->window.window_width, window_egl->window.window_height);
+ window_egl->window.fullscreen = 1;
+ }
if (window->draw)
window->draw (window->draw_data);
--
1.7.9.5

View File

@ -1,88 +0,0 @@
From: Lyon Wang <lyon.wang@freescale.com>
Date: Tue May 12 15:47:33 2015 +0800
h263parse: fix custom picture format (CPFMT) parsing
In the H263 spec, CPFMT is present only if the use of a custom
picture format is signalled in PLUSEPTYPE and UFEP is "001",
so we need to check params->format and only if the value is
6 (custom source format) the CPFMT should be read, otherwise
it's not present and wrong data will be parsed.
When reading the CPFMT, the width and height were not
calculated correctly (wrong bitmask).
https://bugzilla.gnome.org//show_bug.cgi?id=749253
Upstream Status: accepted and has been pushed to the master
diff --git a/gst/videoparsers/h263parse.c b/gst/videoparsers/h263parse.c
index d794f7a..98a30e7 100644
--- a/gst/videoparsers/h263parse.c
+++ b/gst/videoparsers/h263parse.c
@@ -271,29 +271,46 @@ gst_h263_parse_get_params (H263Params * params, GstBuffer * buffer,
}
if (ufep == 1) {
- guint32 cpfmt = 0;
+ if (params->format == 6) {
+ /* A fixed length codeword of 23 bits that is present only if the use of
+ * a custom picture format is signalled in PLUSPTYPE and UFEP is 001 */
+ guint32 cpfmt = 0;
- /* 5.1.5 CPFMT : Custom Picture Format (23 bits) */
- if (!gst_bit_reader_get_bits_uint32 (&br, &cpfmt, 23))
- goto more;
- if (!(cpfmt & 0x200)) {
- GST_WARNING ("Corrupted CPFMT (0x%x)", cpfmt);
- goto beach;
- }
- temp8 = cpfmt >> 19;
- params->width = (((cpfmt >> 10) & 0x1f) + 1) * 4;
- params->height = ((cpfmt & 0x1f) + 1) * 4;
-
- if (temp8 == 0xf) {
- guint32 epar = 0;
- /* 5.1.6 EPAR : Extended Pixel Aspect Ratio (16bits) */
- if (!gst_bit_reader_get_bits_uint32 (&br, &epar, 16))
+ /* 5.1.5 CPFMT : Custom Picture Format (23 bits) */
+ if (!gst_bit_reader_get_bits_uint32 (&br, &cpfmt, 23))
goto more;
- params->parnum = epar >> 8;
- params->pardenom = epar & 0xf;
+ if (!(cpfmt & 0x200)) {
+ GST_WARNING ("Corrupted CPFMT (0x%x)", cpfmt);
+ goto beach;
+ }
+ temp8 = cpfmt >> 19;
+ /* Bits 5-13: Picture Width Indication: Range [0, ... , 511];
+ * Number of pixels per line = (PWI + 1) * 4 */
+ params->width = (((cpfmt >> 10) & 0x1ff) + 1) * 4;
+ /* Bits 15-23 Picture Height Indication: Range [1, ... , 288];
+ * Number of lines = PHI * 4 */
+ params->height = (cpfmt & 0x1ff) * 4;
+
+ if (temp8 == 0xf) {
+ guint32 epar = 0;
+ /* 5.1.6 EPAR : Extended Pixel Aspect Ratio (16bits) */
+ if (!gst_bit_reader_get_bits_uint32 (&br, &epar, 16))
+ goto more;
+ params->parnum = epar >> 8;
+ params->pardenom = epar & 0xf;
+ } else {
+ params->parnum = partable[temp8][0];
+ params->pardenom = partable[temp8][1];
+ }
} else {
- params->parnum = partable[temp8][0];
- params->pardenom = partable[temp8][1];
+ /* Fill in width/height based on format */
+ params->width = sizetable[params->format][0];
+ params->height = sizetable[params->format][1];
+ GST_DEBUG (" Picture width x height: %d x %d",
+ params->width, params->height);
+ /* Fill in default Pixel aspect ratios */
+ params->parnum = 12;
+ params->pardenom = 11;
}
if (params->custompcfpresent) {

View File

@ -1,66 +0,0 @@
From b74f9d15cad37abddd9050a14fb12c1dac0a43eb Mon Sep 17 00:00:00 2001
From: Jian <Jian.Li@freescale.com>
Date: Thu, 21 May 2015 12:55:15 +0800
Subject: [PATCH] MMFMWK-6582 [glfilter] Fix video is tearing after enable
graphic effect
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Need to finish current gl draw before send the buffer
to downstream elements
Upstream Status: Inappropriate [i.MX specific]
Signed-off-by: Jian <Jian.Li@freescale.com>
---
gst-libs/gst/gl/gstglfilter.c | 7 +++++++
gst-libs/gst/gl/gstglfilter.h | 2 ++
2 files changed, 9 insertions(+)
diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c
index d038dcc..feff9de 100644
--- a/gst-libs/gst/gl/gstglfilter.c
+++ b/gst-libs/gst/gl/gstglfilter.c
@@ -300,6 +300,8 @@ gst_gl_filter_reset (GstGLFilter * filter)
if (filter->context)
gst_object_unref (filter->context);
filter->context = NULL;
+
+ filter->sync_draw = FALSE;
}
static gboolean
@@ -1197,6 +1199,7 @@ gst_gl_filter_filter_texture (GstGLFilter * filter, GstBuffer * inbuf,
GST_DEBUG ("Physical continious buffer, attempting viv direct texture binding");
gst_gl_viv_direct_bind_gstbuffer (filter->context, filter->out_tex_id, &filter->out_info, outbuf);
to_download = FALSE;
+ filter->sync_draw = TRUE;
out_tex = filter->out_tex_id;
}
else {
@@ -1434,4 +1437,8 @@ gst_gl_filter_draw_texture (GstGLFilter * filter, GLuint texture,
gl->DisableVertexAttribArray (filter->draw_attr_texture_loc);
}
#endif
+
+ if (filter->sync_draw) {
+ gl->Finish ();
+ }
}
diff --git a/gst-libs/gst/gl/gstglfilter.h b/gst-libs/gst/gl/gstglfilter.h
index c786493..1543d61 100644
--- a/gst-libs/gst/gl/gstglfilter.h
+++ b/gst-libs/gst/gl/gstglfilter.h
@@ -90,6 +90,8 @@ struct _GstGLFilter
GLint draw_attr_position_loc;
GLint draw_attr_texture_loc;
#endif
+
+ gboolean sync_draw;
};
/**
--
1.7.9.5

View File

@ -1,561 +0,0 @@
From 060f597eda27c8e4492c265f249e21d4ad5f3cc3 Mon Sep 17 00:00:00 2001
From: Jian <Jian.Li@freescale.com>
Date: Mon, 25 May 2015 16:30:53 +0800
Subject: [PATCH] [gl] Fix glimagesink loop playback failed in wayland
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
gl/wayland: add GstGLDisplayWayland
Simple implementation split from GstGLWindowWayland
Upstream Status: Back Port
https://bugzilla.gnome.org/show_bug.cgi?id=749411
Signed-off-by: Jian <Jian.Li@freescale.com>
---
gst-libs/gst/gl/gstgldisplay.c | 5 +-
gst-libs/gst/gl/wayland/Makefile.am | 2 +
gst-libs/gst/gl/wayland/gstgldisplay_wayland.c | 157 +++++++++++++++++++++
gst-libs/gst/gl/wayland/gstgldisplay_wayland.h | 74 ++++++++++
gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c | 129 ++++++-----------
5 files changed, 280 insertions(+), 87 deletions(-)
create mode 100644 gst-libs/gst/gl/wayland/gstgldisplay_wayland.c
create mode 100644 gst-libs/gst/gl/wayland/gstgldisplay_wayland.h
diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c
index 9de8411..a200c14 100644
--- a/gst-libs/gst/gl/gstgldisplay.c
+++ b/gst-libs/gst/gl/gstgldisplay.c
@@ -59,6 +59,9 @@
#if GST_GL_HAVE_WINDOW_X11
#include <gst/gl/x11/gstgldisplay_x11.h>
#endif
+#if GST_GL_HAVE_WINDOW_WAYLAND
+#include <gst/gl/wayland/gstgldisplay_wayland.h>
+#endif
#if GST_GL_HAVE_PLATFORM_EGL
#include <gst/gl/egl/gstgldisplay_egl.h>
#include <gst/gl/egl/gsteglimagememory.h>
@@ -155,7 +158,7 @@ gst_gl_display_new (void)
#endif
#if GST_GL_HAVE_WINDOW_WAYLAND
if (!display && (!user_choice || g_strstr_len (user_choice, 7, "wayland")))
- display = g_object_new (GST_TYPE_GL_DISPLAY, NULL);
+ display = GST_GL_DISPLAY (gst_gl_display_wayland_new (NULL));
#endif
#if GST_GL_HAVE_WINDOW_FB
if (!display && (!user_choice || g_strstr_len (user_choice, 2, "fb"))) {
diff --git a/gst-libs/gst/gl/wayland/Makefile.am b/gst-libs/gst/gl/wayland/Makefile.am
index 9006e67..1b284fb 100644
--- a/gst-libs/gst/gl/wayland/Makefile.am
+++ b/gst-libs/gst/gl/wayland/Makefile.am
@@ -3,10 +3,12 @@
noinst_LTLIBRARIES = libgstgl-wayland.la
libgstgl_wayland_la_SOURCES = \
+ gstgldisplay_wayland.c \
gstglwindow_wayland_egl.c \
wayland_event_source.c
noinst_HEADERS = \
+ gstgldisplay_wayland.h \
gstglwindow_wayland_egl.h \
wayland_event_source.h
diff --git a/gst-libs/gst/gl/wayland/gstgldisplay_wayland.c b/gst-libs/gst/gl/wayland/gstgldisplay_wayland.c
new file mode 100644
index 0000000..90cf1ea
--- /dev/null
+++ b/gst-libs/gst/gl/wayland/gstgldisplay_wayland.c
@@ -0,0 +1,157 @@
+/*
+ * GStreamer
+ * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gl/wayland/gstgldisplay_wayland.h>
+
+GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
+#define GST_CAT_DEFAULT gst_gl_display_debug
+
+G_DEFINE_TYPE (GstGLDisplayWayland, gst_gl_display_wayland,
+ GST_TYPE_GL_DISPLAY);
+
+static void gst_gl_display_wayland_finalize (GObject * object);
+static guintptr gst_gl_display_wayland_get_handle (GstGLDisplay * display);
+
+static void
+registry_handle_global (void *data, struct wl_registry *registry,
+ uint32_t name, const char *interface, uint32_t version)
+{
+ GstGLDisplayWayland *display = data;
+
+ GST_TRACE_OBJECT (display, "registry_handle_global with registry %p, "
+ "interface %s, version %u", registry, interface, version);
+
+ if (g_strcmp0 (interface, "wl_compositor") == 0) {
+ display->compositor =
+ wl_registry_bind (registry, name, &wl_compositor_interface, 1);
+ } else if (g_strcmp0 (interface, "wl_shell") == 0) {
+ display->shell = wl_registry_bind (registry, name, &wl_shell_interface, 1);
+ }
+}
+
+static const struct wl_registry_listener registry_listener = {
+ registry_handle_global
+};
+
+static void
+_connect_listeners (GstGLDisplayWayland * display)
+{
+ display->registry = wl_display_get_registry (display->display);
+ wl_registry_add_listener (display->registry, &registry_listener, display);
+
+ wl_display_roundtrip (display->display);
+}
+
+static void
+gst_gl_display_wayland_class_init (GstGLDisplayWaylandClass * klass)
+{
+ GST_GL_DISPLAY_CLASS (klass)->get_handle =
+ GST_DEBUG_FUNCPTR (gst_gl_display_wayland_get_handle);
+
+ G_OBJECT_CLASS (klass)->finalize = gst_gl_display_wayland_finalize;
+}
+
+static void
+gst_gl_display_wayland_init (GstGLDisplayWayland * display_wayland)
+{
+ GstGLDisplay *display = (GstGLDisplay *) display_wayland;
+
+ display->type = GST_GL_DISPLAY_TYPE_WAYLAND;
+ display_wayland->foreign_display = FALSE;
+}
+
+static void
+gst_gl_display_wayland_finalize (GObject * object)
+{
+ GstGLDisplayWayland *display_wayland = GST_GL_DISPLAY_WAYLAND (object);
+
+ if (!display_wayland->foreign_display && display_wayland->display) {
+ wl_display_flush (display_wayland->display);
+ wl_display_disconnect (display_wayland->display);
+ }
+
+ G_OBJECT_CLASS (gst_gl_display_wayland_parent_class)->finalize (object);
+}
+
+/**
+ * gst_gl_display_wayland_new:
+ * @name: (allow-none): a display name
+ *
+ * Create a new #GstGLDisplayWayland from the wayland display name. See wl_display_connect()
+ * for details on what is a valid name.
+ *
+ * Returns: (transfer full): a new #GstGLDisplayWayland or %NULL
+ */
+GstGLDisplayWayland *
+gst_gl_display_wayland_new (const gchar * name)
+{
+ GstGLDisplayWayland *ret;
+
+ GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
+
+ ret = g_object_new (GST_TYPE_GL_DISPLAY_WAYLAND, NULL);
+ ret->display = wl_display_connect (name);
+
+ if (!ret->display) {
+ GST_ERROR ("Failed to open X11 display connection with name, \'%s\'", name);
+ return NULL;
+ }
+
+ _connect_listeners (ret);
+
+ return ret;
+}
+
+/**
+ * gst_gl_display_wayland_new_with_display:
+ * @display: an existing, wayland display
+ *
+ * Creates a new display connection from a wl_display Display.
+ *
+ * Returns: (transfer full): a new #GstGLDisplayWayland
+ */
+GstGLDisplayWayland *
+gst_gl_display_wayland_new_with_display (struct wl_display * display)
+{
+ GstGLDisplayWayland *ret;
+
+ g_return_val_if_fail (display != NULL, NULL);
+
+ GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
+
+ ret = g_object_new (GST_TYPE_GL_DISPLAY_WAYLAND, NULL);
+
+ ret->display = display;
+ ret->foreign_display = TRUE;
+
+ _connect_listeners (ret);
+
+ return ret;
+}
+
+static guintptr
+gst_gl_display_wayland_get_handle (GstGLDisplay * display)
+{
+ return (guintptr) GST_GL_DISPLAY_WAYLAND (display)->display;
+}
diff --git a/gst-libs/gst/gl/wayland/gstgldisplay_wayland.h b/gst-libs/gst/gl/wayland/gstgldisplay_wayland.h
new file mode 100644
index 0000000..67b3883
--- /dev/null
+++ b/gst-libs/gst/gl/wayland/gstgldisplay_wayland.h
@@ -0,0 +1,74 @@
+/*
+ * GStreamer
+ * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.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_DISPLAY_WAYLAND_H__
+#define __GST_GL_DISPLAY_WAYLAND_H__
+
+#include <gst/gst.h>
+
+#include <wayland-client.h>
+
+#include <gst/gl/gstgl_fwd.h>
+#include <gst/gl/gstgldisplay.h>
+
+G_BEGIN_DECLS
+
+GType gst_gl_display_wayland_get_type (void);
+
+#define GST_TYPE_GL_DISPLAY_WAYLAND (gst_gl_display_wayland_get_type())
+#define GST_GL_DISPLAY_WAYLAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY_WAYLAND,GstGLDisplayWayland))
+#define GST_GL_DISPLAY_WAYLAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY_WAYLAND,GstGLDisplayWaylandClass))
+#define GST_IS_GL_DISPLAY_WAYLAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY_WAYLAND))
+#define GST_IS_GL_DISPLAY_WAYLAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY_WAYLAND))
+#define GST_GL_DISPLAY_WAYLAND_CAST(obj) ((GstGLDisplayWayland*)(obj))
+
+typedef struct _GstGLDisplayWayland GstGLDisplayWayland;
+typedef struct _GstGLDisplayWaylandClass GstGLDisplayWaylandClass;
+
+/**
+ * GstGLDisplayWayland:
+ *
+ * the contents of a #GstGLDisplayWayland are private and should only be accessed
+ * through the provided API
+ */
+struct _GstGLDisplayWayland
+{
+ GstGLDisplay parent;
+
+ struct wl_display *display;
+ struct wl_registry *registry;
+ struct wl_compositor *compositor;
+ struct wl_shell *shell;
+
+ /* <private> */
+ gboolean foreign_display;
+};
+
+struct _GstGLDisplayWaylandClass
+{
+ GstGLDisplayClass object_class;
+};
+
+GstGLDisplayWayland *gst_gl_display_wayland_new (const gchar * name);
+GstGLDisplayWayland *gst_gl_display_wayland_new_with_display (struct wl_display *display);
+
+G_END_DECLS
+
+#endif /* __GST_GL_DISPLAY_WAYLAND_H__ */
diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
index 5d9b457..f1dd0d0 100644
--- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
+++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
@@ -32,6 +32,7 @@
#include "../gstgl_fwd.h"
#include <gst/gl/gstglcontext.h>
+#include "gstgldisplay_wayland.h"
#include "gstglwindow_wayland_egl.h"
const gchar *WlEGLErrorString ();
@@ -41,13 +42,13 @@ const gchar *WlEGLErrorString ();
#define gst_gl_window_wayland_egl_parent_class parent_class
G_DEFINE_TYPE (GstGLWindowWaylandEGL, gst_gl_window_wayland_egl,
GST_GL_TYPE_WINDOW);
+static void gst_gl_window_wayland_egl_finalize (GObject * object);
static guintptr gst_gl_window_wayland_egl_get_window_handle (GstGLWindow *
window);
static void gst_gl_window_wayland_egl_set_window_handle (GstGLWindow * window,
guintptr handle);
-static void gst_gl_window_wayland_egl_draw (GstGLWindow * window, guint width,
- guint height);
+static void gst_gl_window_wayland_egl_draw (GstGLWindow * window, guint width, guint height);
static void gst_gl_window_wayland_egl_run (GstGLWindow * window);
static void gst_gl_window_wayland_egl_quit (GstGLWindow * window);
static void gst_gl_window_wayland_egl_send_message_async (GstGLWindow * window,
@@ -57,6 +58,7 @@ static gboolean gst_gl_window_wayland_egl_open (GstGLWindow * window,
GError ** error);
static guintptr gst_gl_window_wayland_egl_get_display (GstGLWindow * window);
+#if 0
static void
pointer_handle_enter (void *data, struct wl_pointer *pointer, uint32_t serial,
struct wl_surface *surface, wl_fixed_t sx_w, wl_fixed_t sy_w)
@@ -149,11 +151,15 @@ seat_handle_capabilities (void *data, struct wl_seat *seat,
static const struct wl_seat_listener seat_listener = {
seat_handle_capabilities,
};
-
+#endif
static void
handle_ping (void *data, struct wl_shell_surface *shell_surface,
uint32_t serial)
{
+ GstGLWindowWaylandEGL *window_egl = data;
+
+ GST_TRACE_OBJECT (window_egl, "ping received serial %u", serial);
+
wl_shell_surface_pong (shell_surface, serial);
}
@@ -166,7 +172,8 @@ handle_configure (void *data, struct wl_shell_surface *shell_surface,
{
GstGLWindowWaylandEGL *window_egl = data;
- GST_DEBUG ("configure event %ix%i", width, height);
+ GST_DEBUG ("configure event on surface %p, %ix%i", shell_surface, width,
+ height);
window_resize (window_egl, width, height);
}
@@ -185,11 +192,13 @@ static const struct wl_shell_surface_listener shell_surface_listener = {
static gboolean
create_surface (GstGLWindowWaylandEGL * window_egl)
{
+ GstGLDisplayWayland *display =
+ GST_GL_DISPLAY_WAYLAND (GST_GL_WINDOW (window_egl)->display);
+
window_egl->window.surface =
- wl_compositor_create_surface (window_egl->display.compositor);
+ wl_compositor_create_surface (display->compositor);
window_egl->window.shell_surface =
- wl_shell_get_shell_surface (window_egl->display.shell,
- window_egl->window.surface);
+ wl_shell_get_shell_surface (display->shell, window_egl->window.surface);
wl_shell_surface_add_listener (window_egl->window.shell_surface,
&shell_surface_listener, window_egl);
@@ -225,46 +234,13 @@ destroy_surface (GstGLWindowWaylandEGL * window_egl)
if (window_egl->window.callback)
wl_callback_destroy (window_egl->window.callback);
-
- g_source_destroy (window_egl->wl_source);
- g_source_unref (window_egl->wl_source);
- window_egl->wl_source = NULL;
- g_main_loop_unref (window_egl->loop);
- window_egl->loop = NULL, g_main_context_unref (window_egl->main_context);
- window_egl->main_context = NULL;
-}
-
-static void
-registry_handle_global (void *data, struct wl_registry *registry,
- uint32_t name, const char *interface, uint32_t version)
-{
- GstGLWindowWaylandEGL *window_egl = data;
- struct display *d = &window_egl->display;
-
- if (g_strcmp0 (interface, "wl_compositor") == 0) {
- d->compositor =
- wl_registry_bind (registry, name, &wl_compositor_interface, 1);
- } else if (g_strcmp0 (interface, "wl_shell") == 0) {
- d->shell = wl_registry_bind (registry, name, &wl_shell_interface, 1);
- } else if (g_strcmp0 (interface, "wl_seat") == 0) {
- d->seat = wl_registry_bind (registry, name, &wl_seat_interface, 1);
- wl_seat_add_listener (d->seat, &seat_listener, window_egl);
- } else if (g_strcmp0 (interface, "wl_shm") == 0) {
- d->shm = wl_registry_bind (registry, name, &wl_shm_interface, 1);
- d->cursor_theme = wl_cursor_theme_load (NULL, 32, d->shm);
- d->default_cursor =
- wl_cursor_theme_get_cursor (d->cursor_theme, "left_ptr");
- }
}
-static const struct wl_registry_listener registry_listener = {
- registry_handle_global
-};
-
static void
gst_gl_window_wayland_egl_class_init (GstGLWindowWaylandEGLClass * klass)
{
GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
+ GObjectClass *gobject_class = (GObjectClass *) klass;
window_class->get_window_handle =
GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_get_window_handle);
@@ -281,11 +257,26 @@ gst_gl_window_wayland_egl_class_init (GstGLWindowWaylandEGLClass * klass)
window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_open);
window_class->get_display =
GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_get_display);
+
+ gobject_class->finalize = gst_gl_window_wayland_egl_finalize;
}
static void
gst_gl_window_wayland_egl_init (GstGLWindowWaylandEGL * window)
{
+ window->main_context = g_main_context_new ();
+ window->loop = g_main_loop_new (window->main_context, FALSE);
+}
+
+static void
+gst_gl_window_wayland_egl_finalize (GObject * object)
+{
+ GstGLWindowWaylandEGL *window_egl = GST_GL_WINDOW_WAYLAND_EGL (object);
+
+ g_main_loop_unref (window_egl->loop);
+ g_main_context_unref (window_egl->main_context);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
/* Must be called in the gl thread */
@@ -310,60 +301,33 @@ gst_gl_window_wayland_egl_close (GstGLWindow * window)
destroy_surface (window_egl);
- if (window_egl->display.cursor_surface)
- wl_surface_destroy (window_egl->display.cursor_surface);
-
- if (window_egl->display.cursor_theme)
- wl_cursor_theme_destroy (window_egl->display.cursor_theme);
-
- if (window_egl->display.shell)
- wl_shell_destroy (window_egl->display.shell);
-
- if (window_egl->display.compositor)
- wl_compositor_destroy (window_egl->display.compositor);
-
- if (window_egl->display.display) {
- wl_display_flush (window_egl->display.display);
- wl_display_disconnect (window_egl->display.display);
- }
+ g_source_destroy (window_egl->wl_source);
+ g_source_unref (window_egl->wl_source);
+ window_egl->wl_source = NULL;
}
static gboolean
gst_gl_window_wayland_egl_open (GstGLWindow * window, GError ** error)
{
+ GstGLDisplayWayland *display = GST_GL_DISPLAY_WAYLAND (window->display);
GstGLWindowWaylandEGL *window_egl = GST_GL_WINDOW_WAYLAND_EGL (window);
- window_egl->display.display = wl_display_connect (NULL);
- if (!window_egl->display.display) {
+ if (!display->display) {
g_set_error (error, GST_GL_WINDOW_ERROR,
GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE,
- "Failed to connect to Wayland display server");
- goto error;
+ "Failed to retreive Wayland display");
+ return FALSE;
}
- window_egl->display.registry =
- wl_display_get_registry (window_egl->display.display);
- wl_registry_add_listener (window_egl->display.registry, &registry_listener,
- window_egl);
-
- wl_display_dispatch (window_egl->display.display);
+ wl_display_roundtrip (display->display);
create_surface (window_egl);
- window_egl->display.cursor_surface =
- wl_compositor_create_surface (window_egl->display.compositor);
-
- window_egl->wl_source =
- wayland_event_source_new (window_egl->display.display);
- window_egl->main_context = g_main_context_new ();
- window_egl->loop = g_main_loop_new (window_egl->main_context, FALSE);
+ window_egl->wl_source = wayland_event_source_new (display->display);
g_source_attach (window_egl->wl_source, window_egl->main_context);
return TRUE;
-
-error:
- return FALSE;
}
static void
@@ -461,11 +425,6 @@ window_resize (GstGLWindowWaylandEGL * window_egl, guint width, guint height)
window_egl->window.window_width = width;
window_egl->window.window_height = height;
-
-#if 0
- wl_shell_surface_resize (window_egl->window.shell_surface,
- window_egl->display.seat, window_egl->display.serial, 0);
-#endif
}
struct draw
@@ -520,9 +479,7 @@ gst_gl_window_wayland_egl_draw (GstGLWindow * window, guint width, guint height)
static guintptr
gst_gl_window_wayland_egl_get_display (GstGLWindow * window)
{
- GstGLWindowWaylandEGL *window_egl;
-
- window_egl = GST_GL_WINDOW_WAYLAND_EGL (window);
+ GstGLDisplayWayland *display = GST_GL_DISPLAY_WAYLAND (window->display);
- return (guintptr) window_egl->display.display;
+ return (guintptr) display->display;
}
--
1.7.9.5

View File

@ -1,351 +0,0 @@
From b3a9be129e25b9c84b2a056b6c9fad50d6b60c88 Mon Sep 17 00:00:00 2001
From: Song Bing <b06498@freescale.com>
Date: Mon, 1 Jun 2015 14:52:45 +0800
Subject: [PATCH 1/2] opencv: rename gstopencv.c to gstopencv.cpp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
As Open CV plugin will include many Open CV C++ head files.
Upstream Status: Waiting for review.
https://bugzilla.gnome.org/show_bug.cgi?id=751203
---
ext/opencv/Makefile.am | 2 +-
ext/opencv/gstopencv.c | 113 -----------------------------------------
ext/opencv/gstopencv.cpp | 113 +++++++++++++++++++++++++++++++++++++++++
ext/opencv/gsttemplatematch.c | 14 ++---
ext/opencv/gsttemplatematch.h | 2 +-
5 files changed, 122 insertions(+), 122 deletions(-)
delete mode 100644 ext/opencv/gstopencv.c
create mode 100644 ext/opencv/gstopencv.cpp
diff --git a/ext/opencv/Makefile.am b/ext/opencv/Makefile.am
index 3ba1c34..3c3418e 100644
--- a/ext/opencv/Makefile.am
+++ b/ext/opencv/Makefile.am
@@ -1,7 +1,7 @@
plugin_LTLIBRARIES = libgstopencv.la
# sources used to compile this plug-in
-libgstopencv_la_SOURCES = gstopencv.c \
+libgstopencv_la_SOURCES = gstopencv.cpp \
gstopencvvideofilter.c \
gstopencvutils.c \
gstcvdilate.c \
diff --git a/ext/opencv/gstopencv.c b/ext/opencv/gstopencv.c
deleted file mode 100644
index 3184518..0000000
--- a/ext/opencv/gstopencv.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* GStreamer
- * Copyright (C) <2009> Kapil Agrawal <kapil@mediamagictechnologies.com>
- *
- * gstopencv.c: plugin registering
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstcvdilate.h"
-#include "gstcvequalizehist.h"
-#include "gstcverode.h"
-#include "gstcvlaplace.h"
-#include "gstcvsmooth.h"
-#include "gstcvsobel.h"
-#include "gstedgedetect.h"
-#include "gstfaceblur.h"
-#include "gstfacedetect.h"
-#include "gstmotioncells.h"
-#include "gstpyramidsegment.h"
-#include "gsttemplatematch.h"
-#include "gsttextoverlay.h"
-#include "gsthanddetect.h"
-#include "gstskindetect.h"
-#include "gstretinex.h"
-#include "gstsegmentation.h"
-#include "gstgrabcut.h"
-#include "gstdisparity.h"
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_cv_dilate_plugin_init (plugin))
- return FALSE;
-
- if (!gst_cv_equalize_hist_plugin_init (plugin))
- return FALSE;
-
- if (!gst_cv_erode_plugin_init (plugin))
- return FALSE;
-
- if (!gst_cv_laplace_plugin_init (plugin))
- return FALSE;
-
- if (!gst_cv_smooth_plugin_init (plugin))
- return FALSE;
-
- if (!gst_cv_sobel_plugin_init (plugin))
- return FALSE;
-
- if (!gst_edge_detect_plugin_init (plugin))
- return FALSE;
-
- if (!gst_face_blur_plugin_init (plugin))
- return FALSE;
-
- if (!gst_face_detect_plugin_init (plugin))
- return FALSE;
-
- if (!gst_motion_cells_plugin_init (plugin))
- return FALSE;
-
- if (!gst_pyramid_segment_plugin_init (plugin))
- return FALSE;
-
- if (!gst_template_match_plugin_init (plugin))
- return FALSE;
-
- if (!gst_opencv_text_overlay_plugin_init (plugin))
- return FALSE;
-
- if (!gst_handdetect_plugin_init (plugin))
- return FALSE;
-
- if (!gst_skin_detect_plugin_init (plugin))
- return FALSE;
-
- if (!gst_retinex_plugin_init (plugin))
- return FALSE;
-
- if (!gst_segmentation_plugin_init (plugin))
- return FALSE;
-
- if (!gst_grabcut_plugin_init (plugin))
- return FALSE;
-
- if (!gst_disparity_plugin_init (plugin))
- return FALSE;
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- opencv,
- "GStreamer OpenCV Plugins",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/opencv/gstopencv.cpp b/ext/opencv/gstopencv.cpp
new file mode 100644
index 0000000..3184518
--- /dev/null
+++ b/ext/opencv/gstopencv.cpp
@@ -0,0 +1,113 @@
+/* GStreamer
+ * Copyright (C) <2009> Kapil Agrawal <kapil@mediamagictechnologies.com>
+ *
+ * gstopencv.c: plugin registering
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstcvdilate.h"
+#include "gstcvequalizehist.h"
+#include "gstcverode.h"
+#include "gstcvlaplace.h"
+#include "gstcvsmooth.h"
+#include "gstcvsobel.h"
+#include "gstedgedetect.h"
+#include "gstfaceblur.h"
+#include "gstfacedetect.h"
+#include "gstmotioncells.h"
+#include "gstpyramidsegment.h"
+#include "gsttemplatematch.h"
+#include "gsttextoverlay.h"
+#include "gsthanddetect.h"
+#include "gstskindetect.h"
+#include "gstretinex.h"
+#include "gstsegmentation.h"
+#include "gstgrabcut.h"
+#include "gstdisparity.h"
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+ if (!gst_cv_dilate_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_cv_equalize_hist_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_cv_erode_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_cv_laplace_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_cv_smooth_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_cv_sobel_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_edge_detect_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_face_blur_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_face_detect_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_motion_cells_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_pyramid_segment_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_template_match_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_opencv_text_overlay_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_handdetect_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_skin_detect_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_retinex_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_segmentation_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_grabcut_plugin_init (plugin))
+ return FALSE;
+
+ if (!gst_disparity_plugin_init (plugin))
+ return FALSE;
+
+ return TRUE;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ opencv,
+ "GStreamer OpenCV Plugins",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/opencv/gsttemplatematch.c b/ext/opencv/gsttemplatematch.c
index 507b218..12c92cd 100644
--- a/ext/opencv/gsttemplatematch.c
+++ b/ext/opencv/gsttemplatematch.c
@@ -176,7 +176,7 @@ gst_template_match_init (GstTemplateMatch * filter)
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
- filter->template = NULL;
+ filter->templatename = NULL;
filter->display = TRUE;
filter->cvTemplateImage = NULL;
filter->cvDistImage = NULL;
@@ -215,7 +215,7 @@ gst_template_match_set_property (GObject * object, guint prop_id,
}
break;
case PROP_TEMPLATE:
- filter->template = (char *) g_value_get_string (value);
+ filter->templatename = (char *) g_value_get_string (value);
gst_template_match_load_template (filter);
break;
case PROP_DISPLAY:
@@ -238,7 +238,7 @@ gst_template_match_get_property (GObject * object, guint prop_id,
g_value_set_int (value, filter->method);
break;
case PROP_TEMPLATE:
- g_value_set_string (value, filter->template);
+ g_value_set_string (value, filter->templatename);
break;
case PROP_DISPLAY:
g_value_set_boolean (value, filter->display);
@@ -321,7 +321,7 @@ gst_template_match_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
/* FIXME Why template == NULL returns OK?
* shouldn't it be a passthrough instead? */
- if ((!filter) || (!buf) || filter->template == NULL) {
+ if ((!filter) || (!buf) || filter->templatename == NULL) {
return GST_FLOW_OK;
}
GST_LOG_OBJECT (filter, "Buffer size %u", (guint) gst_buffer_get_size (buf));
@@ -410,17 +410,17 @@ gst_template_match_match (IplImage * input, IplImage * template,
static void
gst_template_match_load_template (GstTemplateMatch * filter)
{
- if (filter->template) {
+ if (filter->templatename) {
if (filter->cvTemplateImage) {
cvReleaseImage (&filter->cvTemplateImage);
}
filter->cvTemplateImage =
- cvLoadImage (filter->template, CV_LOAD_IMAGE_COLOR);
+ cvLoadImage (filter->templatename, CV_LOAD_IMAGE_COLOR);
if (!filter->cvTemplateImage) {
GST_WARNING ("Couldn't load template image: %s. error: %s",
- filter->template, g_strerror (errno));
+ filter->templatename, g_strerror (errno));
}
}
}
diff --git a/ext/opencv/gsttemplatematch.h b/ext/opencv/gsttemplatematch.h
index 6b67000..4a716d8 100644
--- a/ext/opencv/gsttemplatematch.h
+++ b/ext/opencv/gsttemplatematch.h
@@ -79,7 +79,7 @@ struct _GstTemplateMatch
gint method;
gboolean display;
- gchar *template;
+ gchar *templatename;
IplImage *cvImage, *cvGray, *cvTemplateImage, *cvDistImage;
};
--
1.7.9.5

View File

@ -1,323 +0,0 @@
From d7a28c5c7edcbceb13d35577d61a466ba750b3d9 Mon Sep 17 00:00:00 2001
From: Mingke Wang <mingke.wang@freescale.com>
Date: Wed, 8 Jul 2015 15:34:57 +0800
Subject: [PATCH] [PATCH] gstaggregator: memory leak increasing a lot after
overnight
this patch picks from community fix:
aggregator: Replace GMainContext with GAsyncQueue (v2)
The previous implementation kept accumulating GSources,
slowing down the iteration and leaking memory.
Instead of trying to fix the main context flushing, replace
it with a GAsyncQueue which is simple to flush and has
less overhead.
https://bugzilla.gnome.org/show_bug.cgi?id=736782
Upstream Status: Backport
Signed-off-by: Mingke Wang <mingke.wang@freescale.com>
diff --git a/gst-libs/gst/base/gstaggregator.c b/gst-libs/gst/base/gstaggregator.c
old mode 100644
new mode 100755
index e12ed93..47eb1e7
--- a/gst-libs/gst/base/gstaggregator.c
+++ b/gst-libs/gst/base/gstaggregator.c
@@ -106,6 +106,48 @@ GST_DEBUG_CATEGORY_STATIC (aggregator_debug);
g_cond_broadcast(&(((GstAggregatorPad* )pad)->priv->event_cond)); \
}
+#define GST_AGGREGATOR_SETCAPS_LOCK(self) G_STMT_START { \
+ GST_LOG_OBJECT (self, "Taking SETCAPS lock from thread %p", \
+ g_thread_self()); \
+ g_mutex_lock(&self->priv->setcaps_lock); \
+ GST_LOG_OBJECT (self, "Took SETCAPS lock from thread %p", \
+ g_thread_self()); \
+ } G_STMT_END
+
+#define GST_AGGREGATOR_SETCAPS_UNLOCK(self) G_STMT_START { \
+ GST_LOG_OBJECT (self, "Releasing SETCAPS lock from thread %p", \
+ g_thread_self()); \
+ g_mutex_unlock(&self->priv->setcaps_lock); \
+ GST_LOG_OBJECT (self, "Took SETCAPS lock from thread %p", \
+ g_thread_self()); \
+ } G_STMT_END
+
+#define AGGREGATOR_QUEUE(self) (((GstAggregator*)self)->priv->queue)
+
+#define QUEUE_PUSH(self) G_STMT_START { \
+ GST_LOG_OBJECT (self, "Pushing to QUEUE in thread %p", \
+ g_thread_self()); \
+ g_async_queue_push (AGGREGATOR_QUEUE (self), GINT_TO_POINTER (1)); \
+} G_STMT_END
+
+#define QUEUE_POP(self) G_STMT_START { \
+ GST_LOG_OBJECT (self, "Waiting on QUEUE in thread %p", \
+ g_thread_self()); \
+ g_async_queue_pop (AGGREGATOR_QUEUE (self)); \
+ GST_LOG_OBJECT (self, "Waited on QUEUE in thread %p", \
+ g_thread_self()); \
+ } G_STMT_END
+
+#define QUEUE_FLUSH(self) G_STMT_START { \
+ GST_LOG_OBJECT (self, "Flushing QUEUE in thread %p", \
+ g_thread_self()); \
+ g_async_queue_lock (AGGREGATOR_QUEUE (self)); \
+ while (g_async_queue_try_pop_unlocked (AGGREGATOR_QUEUE (self))); \
+ g_async_queue_unlock (AGGREGATOR_QUEUE (self)); \
+ GST_LOG_OBJECT (self, "Flushed QUEUE in thread %p", \
+ g_thread_self()); \
+ } G_STMT_END
+
struct _GstAggregatorPadPrivate
{
gboolean pending_flush_start;
@@ -136,35 +178,15 @@ _aggpad_flush (GstAggregatorPad * aggpad, GstAggregator * agg)
*************************************/
static GstElementClass *aggregator_parent_class = NULL;
-#define MAIN_CONTEXT_LOCK(self) G_STMT_START { \
- GST_LOG_OBJECT (self, "Getting MAIN_CONTEXT_LOCK in thread %p", \
- g_thread_self()); \
- g_mutex_lock(&((GstAggregator*)self)->priv->mcontext_lock); \
- GST_LOG_OBJECT (self, "Got MAIN_CONTEXT_LOCK in thread %p", \
- g_thread_self()); \
-} G_STMT_END
-
-#define MAIN_CONTEXT_UNLOCK(self) G_STMT_START { \
- g_mutex_unlock(&((GstAggregator*)self)->priv->mcontext_lock); \
- GST_LOG_OBJECT (self, "Unlocked MAIN_CONTEXT_LOCK in thread %p", \
- g_thread_self()); \
-} G_STMT_END
-
struct _GstAggregatorPrivate
{
gint padcount;
- GMainContext *mcontext;
+ GAsyncQueue *queue;
/* Our state is >= PAUSED */
gboolean running;
- /* Ensure that when we remove all sources from the maincontext
- * we can not add any source, avoiding:
- * "g_source_attach: assertion '!SOURCE_DESTROYED (source)' failed" */
- GMutex mcontext_lock;
- GList *gsources;
-
gint seqnum;
gboolean send_stream_start;
gboolean send_segment;
@@ -177,6 +199,9 @@ struct _GstAggregatorPrivate
GstTagList *tags;
gboolean tags_changed;
+
+ /* Lock to prevent two src setcaps from happening at the same time */
+ GMutex setcaps_lock;
};
typedef struct
@@ -287,7 +312,9 @@ _check_all_pads_with_data_or_eos (GstAggregator * self,
void
gst_aggregator_set_src_caps (GstAggregator * self, GstCaps * caps)
{
+ GST_AGGREGATOR_SETCAPS_LOCK (self);
gst_caps_replace (&self->priv->srccaps, caps);
+ GST_AGGREGATOR_SETCAPS_UNLOCK (self);
}
static void
@@ -390,29 +417,19 @@ _push_eos (GstAggregator * self)
static void
-_destroy_gsource (GSource * source)
-{
- g_source_destroy (source);
- g_source_unref (source);
-}
-
-static void
-_remove_all_sources (GstAggregator * self)
-{
- GstAggregatorPrivate *priv = self->priv;
-
- MAIN_CONTEXT_LOCK (self);
- g_list_free_full (priv->gsources, (GDestroyNotify) _destroy_gsource);
- priv->gsources = NULL;
- MAIN_CONTEXT_UNLOCK (self);
-}
-
-static gboolean
aggregate_func (GstAggregator * self)
{
GstAggregatorPrivate *priv = self->priv;
GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (self);
+ if (self->priv->running == FALSE) {
+ GST_DEBUG_OBJECT (self, "Not running anymore");
+
+ return;
+ }
+
+ QUEUE_POP (self);
+
GST_LOG_OBJECT (self, "Checking aggregate");
while (priv->send_eos && gst_aggregator_iterate_sinkpads (self,
(GstAggregatorPadForeachFunc) _check_all_pads_with_data_or_eos,
@@ -422,8 +439,7 @@ aggregate_func (GstAggregator * self)
priv->flow_return = klass->aggregate (self);
if (priv->flow_return == GST_FLOW_EOS) {
- g_main_context_wakeup (self->priv->mcontext);
- _remove_all_sources (self);
+ QUEUE_FLUSH (self);
_push_eos (self);
}
@@ -437,20 +453,6 @@ aggregate_func (GstAggregator * self)
if (priv->flow_return != GST_FLOW_OK)
break;
}
-
- return G_SOURCE_REMOVE;
-}
-
-static void
-iterate_main_context_func (GstAggregator * self)
-{
- if (self->priv->running == FALSE) {
- GST_DEBUG_OBJECT (self, "Not running anymore");
-
- return;
- }
-
- g_main_context_iteration (self->priv->mcontext, TRUE);
}
static gboolean
@@ -481,15 +483,14 @@ _stop_srcpad_task (GstAggregator * self, GstEvent * flush_start)
flush_start ? "Pausing" : "Stopping");
self->priv->running = FALSE;
+ QUEUE_PUSH (self);
- /* Clean the stack of GSource set on the MainContext */
- g_main_context_wakeup (self->priv->mcontext);
- _remove_all_sources (self);
if (flush_start) {
res = gst_pad_push_event (self->srcpad, flush_start);
}
gst_pad_stop_task (self->srcpad);
+ QUEUE_FLUSH (self);
return res;
}
@@ -501,21 +502,7 @@ _start_srcpad_task (GstAggregator * self)
self->priv->running = TRUE;
gst_pad_start_task (GST_PAD (self->srcpad),
- (GstTaskFunction) iterate_main_context_func, self, NULL);
-}
-
-static inline void
-_add_aggregate_gsource (GstAggregator * self)
-{
- GSource *source;
- GstAggregatorPrivate *priv = self->priv;
-
- MAIN_CONTEXT_LOCK (self);
- source = g_idle_source_new ();
- g_source_set_callback (source, (GSourceFunc) aggregate_func, self, NULL);
- priv->gsources = g_list_prepend (priv->gsources, source);
- g_source_attach (source, priv->mcontext);
- MAIN_CONTEXT_UNLOCK (self);
+ (GstTaskFunction) aggregate_func, self, NULL);
}
static GstFlowReturn
@@ -617,7 +604,7 @@ _sink_event (GstAggregator * self, GstAggregatorPad * aggpad, GstEvent * event)
gst_pad_push_event (self->srcpad, event);
priv->send_eos = TRUE;
event = NULL;
- _add_aggregate_gsource (self);
+ QUEUE_PUSH (self);
GST_INFO_OBJECT (self, "Releasing source pad STREAM_LOCK");
GST_PAD_STREAM_UNLOCK (self->srcpad);
@@ -645,7 +632,7 @@ _sink_event (GstAggregator * self, GstAggregatorPad * aggpad, GstEvent * event)
}
PAD_UNLOCK_EVENT (aggpad);
- _add_aggregate_gsource (self);
+ QUEUE_PUSH (self);
goto eat;
}
case GST_EVENT_SEGMENT:
@@ -769,7 +756,7 @@ _release_pad (GstElement * element, GstPad * pad)
gst_element_remove_pad (element, pad);
/* Something changed make sure we try to aggregate */
- _add_aggregate_gsource (self);
+ QUEUE_PUSH (self);
}
static GstPad *
@@ -1055,7 +1042,7 @@ gst_aggregator_finalize (GObject * object)
{
GstAggregator *self = (GstAggregator *) object;
- g_mutex_clear (&self->priv->mcontext_lock);
+ g_mutex_clear (&self->priv->setcaps_lock);
G_OBJECT_CLASS (aggregator_parent_class)->finalize (object);
}
@@ -1067,8 +1054,10 @@ gst_aggregator_dispose (GObject * object)
G_OBJECT_CLASS (aggregator_parent_class)->dispose (object);
- g_main_context_unref (self->priv->mcontext);
- _remove_all_sources (self);
+ if (AGGREGATOR_QUEUE (self)) {
+ g_async_queue_unref (AGGREGATOR_QUEUE (self));
+ AGGREGATOR_QUEUE (self) = NULL;
+ }
}
/* GObject vmethods implementations */
@@ -1124,7 +1113,7 @@ gst_aggregator_init (GstAggregator * self, GstAggregatorClass * klass)
priv->tags_changed = FALSE;
_reset_flow_values (self);
- priv->mcontext = g_main_context_new ();
+ AGGREGATOR_QUEUE (self) = g_async_queue_new ();
self->srcpad = gst_pad_new_from_template (pad_template, "src");
gst_pad_set_event_function (self->srcpad,
@@ -1136,7 +1125,7 @@ gst_aggregator_init (GstAggregator * self, GstAggregatorClass * klass)
gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
- g_mutex_init (&self->priv->mcontext_lock);
+ g_mutex_init (&self->priv->setcaps_lock);
}
/* we can't use G_DEFINE_ABSTRACT_TYPE because we need the klass in the _init
@@ -1205,7 +1194,7 @@ _chain (GstPad * pad, GstObject * object, GstBuffer * buffer)
aggpad->buffer = actual_buf;
PAD_UNLOCK_EVENT (aggpad);
- _add_aggregate_gsource (self);
+ QUEUE_PUSH (self);
GST_DEBUG_OBJECT (aggpad, "Done chaining");
--
1.7.9.5

View File

@ -1,56 +0,0 @@
From a639dc1c5bd4e5ff6f3c98995149f556e8528985 Mon Sep 17 00:00:00 2001
From: Jian Li <jian.li@freescale.com>
Date: Tue, 4 Aug 2015 17:11:17 +0800
Subject: [PATCH] MMFMWK-6778 Support more format in direct viv
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Supports I420, YV12, NV12, NV21, YUY2, UYVY,
RGBA, BGRA, RGB16
Upstream-Status: Inappropriate [i.MX specific]
Signed-off-by: Jian Li <jian.li@freescale.com>
---
gst-libs/gst/gl/gstglvivdirecttexture.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.c b/gst-libs/gst/gl/gstglvivdirecttexture.c
index 9131101..c19b617 100644
--- a/gst-libs/gst/gl/gstglvivdirecttexture.c
+++ b/gst-libs/gst/gl/gstglvivdirecttexture.c
@@ -105,12 +105,30 @@ gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideo
case GST_VIDEO_FORMAT_I420:
viv_fmt = GL_VIV_I420;
break;
+ case GST_VIDEO_FORMAT_YV12:
+ viv_fmt = GL_VIV_YV12;
+ break;
case GST_VIDEO_FORMAT_NV12:
viv_fmt = GL_VIV_NV12;
break;
+ case GST_VIDEO_FORMAT_NV21:
+ viv_fmt = GL_VIV_NV21;
+ break;
+ case GST_VIDEO_FORMAT_YUY2:
+ viv_fmt = GL_VIV_YUY2;
+ break;
+ case GST_VIDEO_FORMAT_UYVY:
+ viv_fmt = GL_VIV_UYVY;
+ break;
case GST_VIDEO_FORMAT_RGBA:
viv_fmt = GL_RGBA;
break;
+ case GST_VIDEO_FORMAT_BGRA:
+ viv_fmt = GL_BGRA_EXT;
+ break;
+ case GST_VIDEO_FORMAT_RGB16:
+ viv_fmt = GL_RGB565_OES;
+ break;
default:
GST_ERROR ("Not supported format %d for viv direct texture upload.", fmt);
viv_fmt = GL_NONE;
--
1.7.9.5

View File

@ -1,266 +0,0 @@
From 60e055de185f0d911ad2bbd4e842fb5b088530e2 Mon Sep 17 00:00:00 2001
From: Jian <Jian.Li@freescale.com>
Date: Wed, 4 Mar 2015 16:41:53 +0800
Subject: [PATCH] Use viv direct texture to bind buffer
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Use viv direct texture to bind physical continious
buffer with texture to avoid memory copy from video
buffer to texture to gain good performance.
Upstream Status: Inappropriate [i.MX specific]
Signed-off-by: Jian <Jian.Li@freescale.com>
---
gst-libs/gst/gl/Makefile.am | 4 +-
gst-libs/gst/gl/gstglfilter.c | 8 +-
gst-libs/gst/gl/gstglupload.c | 10 ++-
gst-libs/gst/gl/gstglvivdirecttexture.c | 123 +++++++++++++++++++++++++++++++
gst-libs/gst/gl/gstglvivdirecttexture.h | 34 +++++++++
5 files changed, 176 insertions(+), 3 deletions(-)
create mode 100644 gst-libs/gst/gl/gstglvivdirecttexture.c
create mode 100644 gst-libs/gst/gl/gstglvivdirecttexture.h
diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
index ed35144..86bc439 100644
--- a/gst-libs/gst/gl/Makefile.am
+++ b/gst-libs/gst/gl/Makefile.am
@@ -24,7 +24,8 @@ libgstgl_@GST_API_VERSION@_la_SOURCES = \
gstglapi.c \
gstglfeature.c \
gstglutils.c \
- gstglframebuffer.c
+ gstglframebuffer.c \
+ gstglvivdirecttexture.c
libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl
libgstgl_@GST_API_VERSION@include_HEADERS = \
@@ -44,6 +45,7 @@ libgstgl_@GST_API_VERSION@include_HEADERS = \
gstglfeature.h \
gstglutils.h \
gstglframebuffer.h \
+ gstglvivdirecttexture.h \
gstgl_fwd.h \
gl.h
diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c
index 26bf3f9..eef4ec7 100644
--- a/gst-libs/gst/gl/gstglfilter.c
+++ b/gst-libs/gst/gl/gstglfilter.c
@@ -1202,7 +1202,13 @@ gst_gl_filter_filter_texture (GstGLFilter * filter, GstBuffer * inbuf,
if (!to_download) {
out_tex = *(guint *) out_frame.data[0];
- } else {
+ } else if (gst_is_physical_buffer (outbuf)) {
+ GST_DEBUG ("Physical continious buffer, attempting viv direct texture binding");
+ gst_gl_viv_direct_bind_gstbuffer (filter->context, filter->out_tex_id, &filter->out_info, outbuf);
+ to_download = FALSE;
+ out_tex = filter->out_tex_id;
+ }
+ else {
GST_LOG ("Output Buffer does not contain correct memory, "
"attempting to wrap for download");
diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c
index ecf6ebb..38185bb 100644
--- a/gst-libs/gst/gl/gstglupload.c
+++ b/gst-libs/gst/gl/gstglupload.c
@@ -68,7 +68,7 @@ struct _GstGLUploadPrivate
gboolean released;
};
-GST_DEBUG_CATEGORY_STATIC (gst_gl_upload_debug);
+GST_DEBUG_CATEGORY (gst_gl_upload_debug);
#define GST_CAT_DEFAULT gst_gl_upload_debug
#define DEBUG_INIT \
@@ -307,6 +307,14 @@ gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer,
}
}
+ GST_LOG_OBJECT (upload, "Attempting viv direct upload");
+ if (gst_is_physical_buffer (buffer)) {
+ if (gst_gl_viv_direct_bind_gstbuffer (upload->context, upload->priv->tex_id, &upload->in_info, buffer)) {
+ *tex_id = upload->priv->tex_id;
+ return TRUE;
+ }
+ }
+
raw_data_upload:
GST_LOG_OBJECT (upload, "Attempting upload with raw data");
/* GstVideoMeta map */
diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.c b/gst-libs/gst/gl/gstglvivdirecttexture.c
new file mode 100644
index 0000000..4806335
--- /dev/null
+++ b/gst-libs/gst/gl/gstglvivdirecttexture.c
@@ -0,0 +1,123 @@
+/*
+ * GStreamer
+ * Copyright (c) 2015, Freescale Semiconductor, Inc.
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gl.h"
+
+GST_DEBUG_CATEGORY_EXTERN (gst_gl_upload_debug);
+#define GST_CAT_DEFAULT gst_gl_upload_debug
+
+typedef struct {
+ guint tex_id;
+ guint w;
+ guint h;
+ guint fmt;
+ void *vaddr;
+ guint paddr;
+ gboolean ret;
+} GstVivDirectTexture;
+
+gboolean
+gst_is_physical_buffer (GstBuffer *buffer)
+{
+
+ GstMemory *mem;
+
+ mem = gst_buffer_peek_memory (buffer, 0);
+ if (!mem->allocator)
+ return FALSE;
+
+ return g_type_check_instance_is_a (mem->allocator, g_type_from_name("GstAllocatorPhyMem"));
+}
+
+static void
+_do_viv_direct_tex_bind_mem (GstGLContext * context, GstVivDirectTexture * viv_tex)
+{
+ GST_DEBUG ("viv direct upload, tex_id %d, fmt: %d, res: (%dx%d)", viv_tex->tex_id, viv_tex->fmt, viv_tex->w, viv_tex->h);
+ GST_DEBUG ("Physical memory buffer, vaddr: %p, paddr: %p", viv_tex->vaddr, viv_tex->paddr);
+
+ glBindTexture (GL_TEXTURE_2D, viv_tex->tex_id);
+ glTexDirectVIVMap (GL_TEXTURE_2D, viv_tex->w, viv_tex->h, viv_tex->fmt, &viv_tex->vaddr, &viv_tex->paddr);
+ glTexDirectInvalidateVIV (GL_TEXTURE_2D);
+ viv_tex->ret = TRUE;
+
+ return;
+}
+
+gboolean
+gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideoInfo * info, GstBuffer * buffer)
+{
+ typedef struct {
+ guint8 *vaddr;
+ guint8 *paddr;
+ guint8 *caddr;
+ gsize size;
+ gpointer *user_data;
+ } PhyMemBlock;
+ //Note: structure PhyMemBlock is copied from gst1.0-fsl-plugin/libs/allocator/gstallocatorphymem.h
+
+ typedef struct {
+ GstMemory mem;
+ guint8 *vaddr;
+ guint8 *paddr;
+ PhyMemBlock block;
+ } GstMemoryPhy;
+ //Note: structure GstMemoryPhy is copied from gst1.0-fsl-plugin/libs/allocator/gstallocatorphymem.c
+
+ GstMemory *mem = gst_buffer_peek_memory (buffer, 0);
+ GstMemoryPhy *memphy = (GstMemoryPhy*) mem;
+ PhyMemBlock *memblk = &memphy->block;
+
+ GstVideoFormat fmt = GST_VIDEO_INFO_FORMAT (info);
+ guint viv_fmt;
+
+ switch (fmt) {
+ case GST_VIDEO_FORMAT_I420:
+ viv_fmt = GL_VIV_I420;
+ break;
+ case GST_VIDEO_FORMAT_NV12:
+ viv_fmt = GL_VIV_NV12;
+ break;
+ case GST_VIDEO_FORMAT_RGBA:
+ viv_fmt = GL_RGBA;
+ break;
+ default:
+ GST_ERROR ("Not supported format %d for viv direct texture upload.", fmt);
+ viv_fmt = GL_NONE;
+ return FALSE;
+ }
+
+ GstVivDirectTexture viv_tex = {
+ tex_id,
+ GST_VIDEO_INFO_WIDTH (info),
+ GST_VIDEO_INFO_HEIGHT (info),
+ viv_fmt,
+ memblk->vaddr,
+ memblk->paddr,
+ FALSE};
+
+ gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _do_viv_direct_tex_bind_mem, &viv_tex);
+
+ return viv_tex.ret;
+}
+
diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.h b/gst-libs/gst/gl/gstglvivdirecttexture.h
new file mode 100644
index 0000000..c94403b
--- /dev/null
+++ b/gst-libs/gst/gl/gstglvivdirecttexture.h
@@ -0,0 +1,34 @@
+/*
+ * GStreamer
+ * Copyright (c) 2015, Freescale Semiconductor, Inc.
+ *
+ * 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_VIVDIRECT_H__
+#define __GST_GL_VIVDIRECT_H__
+
+#include <gst/video/video.h>
+#include <gst/gl/gstgl_fwd.h>
+
+G_BEGIN_DECLS
+
+gboolean gst_is_physical_buffer (GstBuffer *buffer);
+gboolean gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideoInfo * info, GstBuffer * buffer)
+
+G_END_DECLS
+
+#endif /* __GST_GL_VIVDIRECT_H__ */
--
1.7.9.5

View File

@ -1,125 +0,0 @@
From 8489b90f5ed6b7f9b98b123b521d41aec00cc8bd Mon Sep 17 00:00:00 2001
From: Jian <Jian.Li@freescale.com>
Date: Wed, 25 Mar 2015 13:45:57 +0800
Subject: [PATCH] Adding some fragment shaders for glshader plugin
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Upstream Status: Inappropriate [i.MX specific]
Signed-off-by: Jian <Jian.Li@freescale.com>
---
ext/gl/Makefile.am | 3 +++
ext/gl/shaders/fisheye_shader.fs | 14 ++++++++++++++
ext/gl/shaders/gray_shader.fs | 12 ++++++++++++
ext/gl/shaders/tunnel_shader.fs | 14 ++++++++++++++
ext/gl/shaders/twirl_shader.fs | 21 +++++++++++++++++++++
5 files changed, 64 insertions(+)
create mode 100755 ext/gl/shaders/fisheye_shader.fs
create mode 100755 ext/gl/shaders/gray_shader.fs
create mode 100755 ext/gl/shaders/tunnel_shader.fs
create mode 100755 ext/gl/shaders/twirl_shader.fs
diff --git a/ext/gl/Makefile.am b/ext/gl/Makefile.am
index b1796f6..b8442f8 100644
--- a/ext/gl/Makefile.am
+++ b/ext/gl/Makefile.am
@@ -110,6 +110,9 @@ libgstopengl_la_LIBADD = \
$(LIBM) \
$(GRAPHENE_LIBS)
+data_DATA = shaders/gray_shader.fs shaders/fisheye_shader.fs shaders/tunnel_shader.fs shaders/twirl_shader.fs
+EXTRA_DIST = shaders/gray_shader.fs shaders/fisheye_shader.fs shaders/tunnel_shader.fs shaders/twirl_shader.fs
+
libgstopengl_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstopengl_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
diff --git a/ext/gl/shaders/fisheye_shader.fs b/ext/gl/shaders/fisheye_shader.fs
new file mode 100755
index 0000000..a57a203
--- /dev/null
+++ b/ext/gl/shaders/fisheye_shader.fs
@@ -0,0 +1,14 @@
+precision mediump float;
+varying vec2 v_texcoord;
+uniform sampler2D tex;
+void main () {
+ vec2 texturecoord = v_texcoord.xy;
+ vec2 normcoord;
+ normcoord = texturecoord - 0.5;
+ float r = length (normcoord);
+ normcoord *= r * 1.414;
+ texturecoord = normcoord + 0.5;
+ vec4 color = texture2D (tex, texturecoord);
+ gl_FragColor = color;
+}
+
diff --git a/ext/gl/shaders/gray_shader.fs b/ext/gl/shaders/gray_shader.fs
new file mode 100755
index 0000000..75e9790
--- /dev/null
+++ b/ext/gl/shaders/gray_shader.fs
@@ -0,0 +1,12 @@
+precision mediump float;
+varying vec2 v_texcoord;
+uniform sampler2D tex;
+void main () {
+ vec4 color = texture2D (tex, v_texcoord.xy);
+ float y = dot(color.rgb, vec3(0.2125, 0.7154, 0.0721));
+ color.r = y;
+ color.g = y;
+ color.b = y;
+ gl_FragColor = color;
+}
+
diff --git a/ext/gl/shaders/tunnel_shader.fs b/ext/gl/shaders/tunnel_shader.fs
new file mode 100755
index 0000000..5888c92
--- /dev/null
+++ b/ext/gl/shaders/tunnel_shader.fs
@@ -0,0 +1,14 @@
+precision mediump float;
+varying vec2 v_texcoord;
+uniform sampler2D tex;
+void main () {
+ vec2 texturecoord = v_texcoord.xy;
+ vec2 normcoord;
+ normcoord = (texturecoord - 0.5);
+ float r = length(normcoord);
+ normcoord *= clamp (r, 0.0, 0.275) / r;
+ texturecoord = normcoord + 0.5;
+ vec4 color = texture2D (tex, texturecoord);
+ gl_FragColor = color;
+}
+
diff --git a/ext/gl/shaders/twirl_shader.fs b/ext/gl/shaders/twirl_shader.fs
new file mode 100755
index 0000000..2b9d5fd
--- /dev/null
+++ b/ext/gl/shaders/twirl_shader.fs
@@ -0,0 +1,21 @@
+precision mediump float;
+varying vec2 v_texcoord;
+uniform sampler2D tex;
+void main () {
+ vec2 texturecoord = v_texcoord.xy;
+ vec2 normcoord;
+ normcoord = texturecoord - 0.5;
+ float r = length (normcoord);
+ // calculate rotation angle: maximum (about pi/2) at the origin and
+ // gradually decrease it up to 0.6 of each quadrant
+ float phi = (1.0 - smoothstep (0.0, 0.3, r)) * 1.6;
+ // precalculate sin phi and cos phi, save some alu
+ float s = sin(phi);
+ float c = cos(phi);
+ // rotate
+ normcoord *= mat2(c, s, -s, c);
+ texturecoord = normcoord + 0.5;
+ vec4 color = texture2D (tex, texturecoord);
+ gl_FragColor = color;
+}
+
--
1.7.9.5

View File

@ -1,57 +0,0 @@
From 1be24d5658bd01b2e622be54b7d7f862560d8181 Mon Sep 17 00:00:00 2001
From: Jian <Jian.Li@freescale.com>
Date: Wed, 25 Mar 2015 16:05:09 +0800
Subject: [PATCH] Fix warnnig log in glfilter
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Upstream Status: Inappropriate [i.MX specific]
Signed-off-by: Jian <Jian.Li@freescale.com>
---
gst-libs/gst/gl/gstglfilter.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c
index eef4ec7..d038dcc 100644
--- a/gst-libs/gst/gl/gstglfilter.c
+++ b/gst-libs/gst/gl/gstglfilter.c
@@ -759,12 +759,13 @@ gst_gl_filter_transform_caps (GstBaseTransform * bt,
tmp = gst_caps_new_empty ();
- tmp = gst_caps_merge (tmp, glcaps);
+ tmp = gst_caps_merge (tmp, gst_gl_filter_caps_remove_format_info (glcaps));
#if GST_GL_HAVE_PLATFORM_EGL
- tmp = gst_caps_merge (tmp, eglcaps);
+ tmp = gst_caps_merge (tmp, gst_gl_filter_caps_remove_format_info (eglcaps));
#endif
- tmp = gst_caps_merge (tmp, uploadcaps);
- tmp = gst_caps_merge (tmp, raw_caps);
+ tmp =
+ gst_caps_merge (tmp, gst_gl_filter_caps_remove_format_info (uploadcaps));
+ tmp = gst_caps_merge (tmp, gst_gl_filter_caps_remove_format_info (raw_caps));
tmp = gst_caps_merge (tmp, gst_gl_filter_caps_remove_format_info (caps));
@@ -775,16 +776,6 @@ gst_gl_filter_transform_caps (GstBaseTransform * bt,
result = tmp;
}
- /* if output still intersects input then prefer the intersection */
- f = gst_caps_get_features (caps, 0);
-
- if (!gst_caps_features_is_any (f)
- && !gst_caps_features_is_equal (f,
- GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY)) {
- tmp = gst_caps_intersect_full (result, caps, GST_CAPS_INTERSECT_FIRST);
- result = gst_caps_merge (tmp, result);
- }
-
GST_DEBUG_OBJECT (bt, "returning caps: %" GST_PTR_FORMAT, result);
return result;
--
1.7.9.5

View File

@ -1,63 +0,0 @@
From b50d8cf5301afc160fbe7cb720b362c40e42978f Mon Sep 17 00:00:00 2001
From: Song Bing <b06498@freescale.com>
Date: Tue, 10 Feb 2015 15:53:21 +0800
Subject: [PATCH 1/2] camerabin examples: memory leak in camerabin examples
code
should unref after set object. The object will be refed when set
property.
Upstream Status: Accepted
https://bugzilla.gnome.org/show_bug.cgi?id=744219
Signed-off-by: Song Bing <b06498@freescale.com>
---
tests/examples/camerabin2/gst-camerabin2-test.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tests/examples/camerabin2/gst-camerabin2-test.c b/tests/examples/camerabin2/gst-camerabin2-test.c
index dfbd055..b68ec51 100644
--- a/tests/examples/camerabin2/gst-camerabin2-test.c
+++ b/tests/examples/camerabin2/gst-camerabin2-test.c
@@ -595,6 +595,7 @@ setup_pipeline_element (GstElement * element, const gchar * property_name,
elem = gst_parse_launch (element_name, &error);
if (elem) {
g_object_set (element, property_name, elem, NULL);
+ g_object_unref (elem);
} else {
GST_WARNING ("can't create element '%s' for property '%s'", element_name,
property_name);
@@ -695,6 +696,7 @@ setup_pipeline (void)
if (setup_pipeline_element (wrapper, "video-source", videosrc_name, NULL)) {
g_object_set (camerabin, "camera-source", wrapper, NULL);
+ g_object_unref (wrapper);
} else {
GST_WARNING ("Failed to set videosrc to %s", videosrc_name);
}
@@ -718,15 +720,19 @@ setup_pipeline (void)
if (imagepp_name) {
ipp = create_ipp_bin ();
- if (ipp)
+ if (ipp) {
g_object_set (camerabin, "image-filter", ipp, NULL);
+ g_object_unref (ipp);
+ }
else
GST_WARNING ("Could not create ipp elements");
}
prof = load_encoding_profile ();
- if (prof)
+ if (prof) {
g_object_set (G_OBJECT (camerabin), "video-profile", prof, NULL);
+ gst_encoding_profile_unref (prof);
+ }
GST_INFO_OBJECT (camerabin, "elements created");
--
1.7.9.5

View File

@ -1,109 +0,0 @@
From 2213750b7568c08846a71866fc53d9807545d298 Mon Sep 17 00:00:00 2001
From: Song Bing <b06498@freescale.com>
Date: Tue, 10 Feb 2015 15:55:50 +0800
Subject: [PATCH 2/2] camerabin examples: memory leak in camerabin examples
code
should unref caps after set to profile. profile will ref it.
Upstream Status: Accepted
https://bugzilla.gnome.org/show_bug.cgi?id=744219
Signed-off-by: Song Bing <b06498@freescale.com>
---
tests/examples/camerabin2/gst-camera2.c | 53 ++++++++++++++++++++-----------
1 file changed, 34 insertions(+), 19 deletions(-)
diff --git a/tests/examples/camerabin2/gst-camera2.c b/tests/examples/camerabin2/gst-camera2.c
index 45047f5..2eb544c 100644
--- a/tests/examples/camerabin2/gst-camera2.c
+++ b/tests/examples/camerabin2/gst-camera2.c
@@ -56,16 +56,21 @@ static GstEncodingProfile *
create_ogg_profile (void)
{
GstEncodingContainerProfile *container;
+ GstCaps *caps = NULL;
- container = gst_encoding_container_profile_new ("ogg", NULL,
- gst_caps_new_empty_simple ("application/ogg"), NULL);
+ caps = gst_caps_new_empty_simple ("application/ogg");
+ container = gst_encoding_container_profile_new ("ogg", NULL, caps, NULL);
+ gst_caps_unref (caps);
+ caps = gst_caps_new_empty_simple ("video/x-theora");
gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
- gst_encoding_video_profile_new (gst_caps_new_empty_simple
- ("video/x-theora"), NULL, NULL, 1));
+ gst_encoding_video_profile_new (caps, NULL, NULL, 1));
+ gst_caps_unref (caps);
+
+ caps = gst_caps_new_empty_simple ("audio/x-vorbis");
gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
- gst_encoding_audio_profile_new (gst_caps_new_empty_simple
- ("audio/x-vorbis"), NULL, NULL, 1));
+ gst_encoding_audio_profile_new (caps, NULL, NULL, 1));
+ gst_caps_unref (caps);
return (GstEncodingProfile *) container;
}
@@ -74,16 +79,21 @@ static GstEncodingProfile *
create_webm_profile (void)
{
GstEncodingContainerProfile *container;
+ GstCaps *caps = NULL;
- container = gst_encoding_container_profile_new ("webm", NULL,
- gst_caps_new_empty_simple ("video/webm"), NULL);
+ caps = gst_caps_new_empty_simple ("video/webm");
+ container = gst_encoding_container_profile_new ("webm", NULL, caps, NULL);
+ gst_caps_unref (caps);
+ caps = gst_caps_new_empty_simple ("video/x-vp8");
gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
- gst_encoding_video_profile_new (gst_caps_new_empty_simple ("video/x-vp8"),
- NULL, NULL, 1));
+ gst_encoding_video_profile_new (caps, NULL, NULL, 1));
+ gst_caps_unref (caps);
+
+ caps = gst_caps_new_empty_simple ("audio/x-vorbis");
gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
- gst_encoding_audio_profile_new (gst_caps_new_empty_simple
- ("audio/x-vorbis"), NULL, NULL, 1));
+ gst_encoding_audio_profile_new (caps, NULL, NULL, 1));
+ gst_caps_unref (caps);
return (GstEncodingProfile *) container;
}
@@ -92,17 +102,22 @@ static GstEncodingProfile *
create_mp4_profile (void)
{
GstEncodingContainerProfile *container;
+ GstCaps *caps = NULL;
- container = gst_encoding_container_profile_new ("mp4", NULL,
- gst_caps_new_simple ("video/quicktime", "variant", G_TYPE_STRING, "iso",
- NULL), NULL);
+ caps = gst_caps_new_simple ("video/quicktime", "variant", G_TYPE_STRING, "iso",
+ NULL);
+ container = gst_encoding_container_profile_new ("mp4", NULL, caps, NULL);
+ gst_caps_unref (caps);
+ caps = gst_caps_new_empty_simple ("video/x-h264");
gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
- gst_encoding_video_profile_new (gst_caps_new_empty_simple
- ("video/x-h264"), NULL, NULL, 1));
+ gst_encoding_video_profile_new (caps, NULL, NULL, 1));
+ gst_caps_unref (caps);
+
+ caps = gst_caps_new_simple ("audio/mpeg", "version", G_TYPE_INT, 4, NULL);
gst_encoding_container_profile_add_profile (container, (GstEncodingProfile *)
- gst_encoding_audio_profile_new (gst_caps_new_simple ("audio/mpeg",
- "version", G_TYPE_INT, 4, NULL), NULL, NULL, 1));
+ gst_encoding_audio_profile_new (caps, NULL, NULL, 1));
+ gst_caps_unref (caps);
return (GstEncodingProfile *) container;
}
--
1.7.9.5

View File

@ -1,33 +0,0 @@
From 518cc8a9af3797fbed2916497bb1cf83725265c4 Mon Sep 17 00:00:00 2001
From: Song Bing <b06498@freescale.com>
Date: Tue, 3 Mar 2015 10:12:11 +0800
Subject: [PATCH] dvbsuboverlay: Set query ALLOCATION need_pool to FALSE
Set query ALLOCATION need_pool to FALSE as it only need query if can
support video overlay composition meta.
https://bugzilla.gnome.org/show_bug.cgi?id=745495
Upstream Status: Accepted 
Signed-off-by: Song Bing <b06498@freescale.com>
---
gst/dvbsuboverlay/gstdvbsuboverlay.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gst/dvbsuboverlay/gstdvbsuboverlay.c b/gst/dvbsuboverlay/gstdvbsuboverlay.c
index 3965b65..341b153 100644
--- a/gst/dvbsuboverlay/gstdvbsuboverlay.c
+++ b/gst/dvbsuboverlay/gstdvbsuboverlay.c
@@ -720,7 +720,7 @@ gst_dvbsub_overlay_negotiate (GstDVBSubOverlay * overlay, GstCaps * caps)
GstQuery *query;
/* find supported meta */
- query = gst_query_new_allocation (caps, TRUE);
+ query = gst_query_new_allocation (caps, FALSE);
if (!gst_pad_peer_query (overlay->srcpad, query)) {
/* no problem, we use the query defaults */
--
1.7.9.5

View File

@ -1,42 +0,0 @@
From 0d979b3a2a4e2db571545e84aeb854b326fa2234 Mon Sep 17 00:00:00 2001
From: Song Bing <b06498@freescale.com>
Date: Tue, 17 Mar 2015 10:21:28 +0800
Subject: [PATCH] [egl] workaround for eglCreateContext () isn't thread safe
Workaround for eglCreateContext () isn't thread safe
Upstream Status: Inappropriate [i.MX specific]
Signed-off-by: Song Bing b06498@freescale.com
---
gst-libs/gst/gl/egl/gstglcontext_egl.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.c b/gst-libs/gst/gl/egl/gstglcontext_egl.c
index 4ccec8d..7ba1782 100644
--- a/gst-libs/gst/gl/egl/gstglcontext_egl.c
+++ b/gst-libs/gst/gl/egl/gstglcontext_egl.c
@@ -208,6 +208,8 @@ failure:
return FALSE;
}
+static GMutex test_mutex;
+
static gboolean
gst_gl_context_egl_create_context (GstGLContext * context,
GstGLAPI gl_api, GstGLContext * other_context, GError ** error)
@@ -336,9 +338,11 @@ gst_gl_context_egl_create_context (GstGLContext * context,
}
context_attrib[i++] = EGL_NONE;
+ g_mutex_lock (&test_mutex);
egl->egl_context =
eglCreateContext (egl->egl_display, egl->egl_config,
(EGLContext) external_gl_context, context_attrib);
+ g_mutex_unlock (&test_mutex);
if (egl->egl_context != EGL_NO_CONTEXT) {
GST_INFO ("gl context created: %" G_GUINTPTR_FORMAT,
--
1.7.9.5

View File

@ -1,4 +1,4 @@
From 315a61197dafe6df4ee6e81b1fff46b3696cc9c6 Mon Sep 17 00:00:00 2001
From a3118c47585d98891454731f66e62d79fff153d9 Mon Sep 17 00:00:00 2001
From: Song Bing <b06498@freescale.com>
Date: Wed, 22 Apr 2015 18:06:35 +0800
Subject: [PATCH] mpegtsmux: Need get pid when create streams.
@ -11,15 +11,16 @@ https://bugzilla.gnome.org/show_bug.cgi?id=748288
UpStream Status: Pending
Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
---
gst/mpegtsmux/mpegtsmux.c | 15 +++++++++++++++
gst/mpegtsmux/mpegtsmux.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c
index af246a2..c9918a8 100644
index 4c68e3e95f96..d93374520e36 100644
--- a/gst/mpegtsmux/mpegtsmux.c
+++ b/gst/mpegtsmux/mpegtsmux.c
@@ -769,6 +769,21 @@ mpegtsmux_create_streams (MpegTsMux * mux)
@@ -833,6 +833,21 @@ mpegtsmux_create_streams (MpegTsMux * mux)
} else {
ts_data->prog_id = DEFAULT_PROG_ID;
}
@ -40,7 +41,4 @@ index af246a2..c9918a8 100644
+ }
}
ts_data->prog = mux->programs[ts_data->prog_id];
--
1.7.9.5
ts_data->prog =

View File

@ -1,8 +1,7 @@
From 6e49c3547f2a99882542c64fdcd4d77c88b44c17 Mon Sep 17 00:00:00 2001
From ede36691cbd17db3f8a65d7ed61402111dea6140 Mon Sep 17 00:00:00 2001
From: Song Bing <b06498@freescale.com>
Date: Wed, 20 May 2015 15:13:20 +0800
Subject: [PATCH 1/2] mpeg4videoparse: Need detect picture coding type when
drain
Subject: [PATCH] mpeg4videoparse: Need detect picture coding type when drain
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@ -16,12 +15,13 @@ drain.
Upstream Status: Waiting for review.
https://bugzilla.gnome.org/show_bug.cgi?id=749617
Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
---
gst/videoparsers/gstmpeg4videoparse.c | 12 ++++++++++++
gst/videoparsers/gstmpeg4videoparse.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/gst/videoparsers/gstmpeg4videoparse.c b/gst/videoparsers/gstmpeg4videoparse.c
index 1afaa17..a5a41c7 100644
index a1fd3b2a3b4c..453effddd680 100644
--- a/gst/videoparsers/gstmpeg4videoparse.c
+++ b/gst/videoparsers/gstmpeg4videoparse.c
@@ -502,6 +502,18 @@ next:
@ -43,6 +43,3 @@ index 1afaa17..a5a41c7 100644
framesize = size;
ret = TRUE;
} else {
--
1.7.9.5

View File

@ -1,8 +1,7 @@
From af20e70625ca3cd521c32feb0d53f18bdfbaf5e0 Mon Sep 17 00:00:00 2001
From cd3bd818c9bfd28bd5eef99181d6343a6a6f2c91 Mon Sep 17 00:00:00 2001
From: Song Bing <b06498@freescale.com>
Date: Wed, 20 May 2015 15:15:08 +0800
Subject: [PATCH 2/2] mpegvideoparse: Need detect picture coding type when
drain
Subject: [PATCH] mpegvideoparse: Need detect picture coding type when drain
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@ -12,12 +11,13 @@ Need detect picture coding type when drain
Upstream Status: Waiting for review.
https://bugzilla.gnome.org/show_bug.cgi?id=749617
Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
---
gst/videoparsers/gstmpegvideoparse.c | 16 ++++++++++++++++
gst/videoparsers/gstmpegvideoparse.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/gst/videoparsers/gstmpegvideoparse.c b/gst/videoparsers/gstmpegvideoparse.c
index dadab94..5ba4e9f 100644
index bf71a3e7cf1d..7ba624eb8c74 100644
--- a/gst/videoparsers/gstmpegvideoparse.c
+++ b/gst/videoparsers/gstmpegvideoparse.c
@@ -717,6 +717,22 @@ need_more:
@ -43,6 +43,3 @@ index dadab94..5ba4e9f 100644
ret = TRUE;
} else {
GST_LOG_OBJECT (mpvparse, "need more data");
--
1.7.9.5

View File

@ -1,11 +1,10 @@
From 7146faaa2c7a6add79c290870e5de90cb5f72479 Mon Sep 17 00:00:00 2001
From 6d38b354a7b6496b208d03fdb45e49b70d825080 Mon Sep 17 00:00:00 2001
From: Lyon Wang <lyon.wang@freescale.com>
Date: Fri, 29 May 2015 09:54:56 +0800
Subject: [PATCH] [videoparse] modifiy the videoparse rank
Subject: [PATCH] modifiy the videoparse rank
- Modify the videparsers rank down to avoid link them in
. h263parse rank down to 63
. h264parse rank down to 63
. mpegvideoparse rank down to 63
. mpeg4videpparse rank down to 63
. pngparse, rank down to 63
@ -13,13 +12,27 @@ Subject: [PATCH] [videoparse] modifiy the videoparse rank
Upstream status: [i.MX specific] internal use only
Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
[vidoeparse] Roll-back h264parse rank
Roll back the h264parse rank.
MMFMWK-7012
For SW video decoder, it only support aligment au,
But in GST1.6, rtph264depay output aligment nal format video.
Need link h264parse to convert it to au alginment,
make the sw decodear work
http://sw-jira.freescale.net/browse/MMFMWK-7012
Upstream Status: [i.MX specific]
Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
---
gst/videoparsers/plugin.c | 21 +++++++++++++++++++--
gst/videoparsers/plugin.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/gst/videoparsers/plugin.c b/gst/videoparsers/plugin.c
index 79d1df6..c070b93 100644
index 79d1df65d577..6fb01614fb4a 100644
--- a/gst/videoparsers/plugin.c
+++ b/gst/videoparsers/plugin.c
@@ -35,7 +35,7 @@ static gboolean
@ -40,7 +53,7 @@ index 79d1df6..c070b93 100644
+ ret |= gst_element_register (plugin, "h263parse",
+ GST_RANK_MARGINAL - 1, GST_TYPE_H263_PARSE);
+ ret |= gst_element_register (plugin, "h264parse",
+ GST_RANK_MARGINAL - 1, GST_TYPE_H264_PARSE);
+ GST_RANK_PRIMARY + 1, GST_TYPE_H264_PARSE);
+ ret |= gst_element_register (plugin, "diracparse",
+ GST_RANK_NONE, GST_TYPE_DIRAC_PARSE);
+ ret |= gst_element_register (plugin, "mpegvideoparse",
@ -57,6 +70,3 @@ index 79d1df6..c070b93 100644
return ret;
}
--
1.7.9.5

View File

@ -1,4 +1,4 @@
From 901e9e6fa16ed9558022f64bdc3cc6b8ac761c71 Mon Sep 17 00:00:00 2001
From a4f0b87d5c4bbe1de5e7cf223d107afbae126110 Mon Sep 17 00:00:00 2001
From: Song Bing <b06498@freescale.com>
Date: Mon, 8 Jun 2015 17:06:22 +0800
Subject: [PATCH] glfilter: Lost frame rate info when fixate caps
@ -12,15 +12,16 @@ down stream element fail, such avimux.
Upstream Status: Waiting for review.
https://bugzilla.gnome.org/show_bug.cgi?id=750545
Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
---
gst-libs/gst/gl/gstglfilter.c | 13 ++++++++++++-
gst-libs/gst/gl/gstglfilter.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c
index feff9de..d46e272 100644
index d25bb72988f1..6840f4ca97a7 100644
--- a/gst-libs/gst/gl/gstglfilter.c
+++ b/gst-libs/gst/gl/gstglfilter.c
@@ -356,7 +356,8 @@ gst_gl_filter_fixate_caps (GstBaseTransform * bt,
@@ -247,7 +247,8 @@ gst_gl_filter_fixate_caps (GstBaseTransform * bt,
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
{
GstStructure *ins, *outs;
@ -30,7 +31,7 @@ index feff9de..d46e272 100644
GValue fpar = { 0, }, tpar = {
0,};
@@ -369,6 +370,16 @@ gst_gl_filter_fixate_caps (GstBaseTransform * bt,
@@ -260,6 +261,16 @@ gst_gl_filter_fixate_caps (GstBaseTransform * bt,
ins = gst_caps_get_structure (caps, 0);
outs = gst_caps_get_structure (othercaps, 0);
@ -47,6 +48,3 @@ index feff9de..d46e272 100644
from_par = gst_structure_get_value (ins, "pixel-aspect-ratio");
to_par = gst_structure_get_value (outs, "pixel-aspect-ratio");
--
1.7.9.5

View File

@ -1,35 +1,35 @@
From aa485cfba8a06f767498bf707175134629fe2377 Mon Sep 17 00:00:00 2001
From 348adcf57d05bf396b457be2af3496d416a7c20b Mon Sep 17 00:00:00 2001
From: Song Bing <b06498@freescale.com>
Date: Mon, 1 Jun 2015 13:30:11 +0800
Subject: [PATCH 2/2] opencv: Add video stitching support.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [PATCH] opencv: Add video stitching support based on Open CV
Add video stitching element.
Upstream Status: Waiting for review.
Add video stitching element based on Open CV.
https://bugzilla.gnome.org/show_bug.cgi?id=751203
Conflicts:
ext/opencv/Makefile.am
Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
---
docs/plugins/Makefile.am | 1 +
ext/opencv/Makefile.am | 12 +-
ext/opencv/gstcvstitching.cpp | 834 ++++++++++++++++++++++++++++++++++++++
ext/opencv/gstcvstitching.h | 130 ++++++
ext/opencv/gstopencv.cpp | 4 +
ext/opencv/gstopencvaggregator.c | 708 ++++++++++++++++++++++++++++++++
ext/opencv/gstopencvaggregator.h | 118 ++++++
7 files changed, 1806 insertions(+), 1 deletion(-)
docs/plugins/Makefile.am | 1 +
ext/opencv/Makefile.am | 14 +-
ext/opencv/gstcvstitching.cpp | 834 +++++++++++++++++++++++++++++++++++++++
ext/opencv/gstcvstitching.h | 130 ++++++
ext/opencv/gstopencv.cpp | 4 +
ext/opencv/gstopencvaggregator.c | 705 +++++++++++++++++++++++++++++++++
ext/opencv/gstopencvaggregator.h | 118 ++++++
7 files changed, 1804 insertions(+), 2 deletions(-)
create mode 100644 ext/opencv/gstcvstitching.cpp
create mode 100644 ext/opencv/gstcvstitching.h
create mode 100644 ext/opencv/gstopencvaggregator.c
create mode 100644 ext/opencv/gstopencvaggregator.h
diff --git a/docs/plugins/Makefile.am b/docs/plugins/Makefile.am
index b093bcf..77593ed 100644
index 7607b558fd42..95f2661d0a42 100644
--- a/docs/plugins/Makefile.am
+++ b/docs/plugins/Makefile.am
@@ -98,6 +98,7 @@ EXTRA_HFILES = \
@@ -97,6 +97,7 @@ EXTRA_HFILES = \
$(top_srcdir)/ext/opencv/gstpyramidsegment.h \
$(top_srcdir)/ext/opencv/gsttemplatematch.h \
$(top_srcdir)/ext/opencv/gsttextoverlay.h \
@ -38,10 +38,10 @@ index b093bcf..77593ed 100644
$(top_srcdir)/ext/rsvg/gstrsvgdec.h \
$(top_srcdir)/ext/rsvg/gstrsvgoverlay.h \
diff --git a/ext/opencv/Makefile.am b/ext/opencv/Makefile.am
index 3c3418e..38f67fd 100644
index 0eee38c450d5..8cea91fda70f 100644
--- a/ext/opencv/Makefile.am
+++ b/ext/opencv/Makefile.am
@@ -24,10 +24,15 @@ libgstopencv_la_SOURCES = gstopencv.cpp \
@@ -24,11 +24,15 @@ libgstopencv_la_SOURCES = gstopencv.cpp \
gstsegmentation.cpp \
gstgrabcut.cpp \
gstdisparity.cpp \
@ -50,21 +50,22 @@ index 3c3418e..38f67fd 100644
motioncells_wrapper.cpp \
MotionCells.cpp
-libgstopencv_la_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(OPENCV_CFLAGS)
+libgstopencv_la_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \
+ $(GST_CXXFLAGS) $(OPENCV_CFLAGS) \
-libgstopencv_la_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(OPENCV_CFLAGS) \
- -DGST_HAAR_CASCADES_DIR=\"$(pkgdatadir)/@GST_API_VERSION@/opencv_haarcascades\"
+libgstopencv_la_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CXXFLAGS) $(OPENCV_CFLAGS) \
+ -DGST_HAAR_CASCADES_DIR=\"$(pkgdatadir)/@GST_API_VERSION@/opencv_haarcascades\" \
+ -I$(top_srcdir)/gst-libs \
+ -I$(top_builddir)/gst-libs
# flags used to compile this facedetect
# add other _CFLAGS and _LIBS as needed
@@ -36,11 +41,14 @@ libgstopencv_la_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_C
@@ -37,10 +41,14 @@ libgstopencv_la_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_C
# OpenCV's define isn't good enough to avoid 'unused' gcc warnings (at v2.1.0)
libgstopencv_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \
$(GST_CFLAGS) $(OPENCV_CFLAGS) \
+ -I$(top_srcdir)/gst-libs \
+ -I$(top_builddir)/gst-libs \
-DGST_HAAR_CASCADES_DIR=\"$(pkgdatadir)/@GST_API_VERSION@/opencv_haarcascades\" \
+ -DGST_HAAR_CASCADES_DIR=\"$(pkgdatadir)/@GST_API_VERSION@/opencv_haarcascades\" \
-DCV_INLINE="static inline" \
-DCV_NO_BACKWARD_COMPATIBILITY
@ -84,7 +85,7 @@ index 3c3418e..38f67fd 100644
MotionCells.h
diff --git a/ext/opencv/gstcvstitching.cpp b/ext/opencv/gstcvstitching.cpp
new file mode 100644
index 0000000..47105f7
index 000000000000..47105f723594
--- /dev/null
+++ b/ext/opencv/gstcvstitching.cpp
@@ -0,0 +1,834 @@
@ -924,7 +925,7 @@ index 0000000..47105f7
+}
diff --git a/ext/opencv/gstcvstitching.h b/ext/opencv/gstcvstitching.h
new file mode 100644
index 0000000..ec955d0
index 000000000000..ec955d063611
--- /dev/null
+++ b/ext/opencv/gstcvstitching.h
@@ -0,0 +1,130 @@
@ -1059,7 +1060,7 @@ index 0000000..ec955d0
+G_END_DECLS
+#endif /* __GST_CV_STITCHING_H__ */
diff --git a/ext/opencv/gstopencv.cpp b/ext/opencv/gstopencv.cpp
index 3184518..f01aa1d 100644
index 4077ba6e2ca8..6ae73c46ec00 100644
--- a/ext/opencv/gstopencv.cpp
+++ b/ext/opencv/gstopencv.cpp
@@ -42,6 +42,7 @@
@ -1082,10 +1083,10 @@ index 3184518..f01aa1d 100644
diff --git a/ext/opencv/gstopencvaggregator.c b/ext/opencv/gstopencvaggregator.c
new file mode 100644
index 0000000..3c69edf
index 000000000000..8a813fc2d9ca
--- /dev/null
+++ b/ext/opencv/gstopencvaggregator.c
@@ -0,0 +1,708 @@
@@ -0,0 +1,705 @@
+/*
+ * GStreamer
+ * Copyright (C) 2015 Song Bing <b06498@freescale.com>
@ -1265,7 +1266,6 @@ index 0000000..3c69edf
+ agg_class->stop = gst_opencv_aggregator_stop;
+ agg_class->start = gst_opencv_aggregator_start;
+
+ videoaggregator_class->disable_frame_conversion = TRUE;
+ videoaggregator_class->aggregate_frames =
+ gst_opencv_aggregator_aggregate_frames;
+ videoaggregator_class->get_output_buffer =
@ -1695,11 +1695,9 @@ index 0000000..3c69edf
+
+ walk = g_list_next (walk);
+
+ GST_WARNING_OBJECT (aggregator, "sink pad caps: %"
+ GST_PTR_FORMAT, caps);
+ GST_WARNING_OBJECT (aggregator, "sink pad caps: %" GST_PTR_FORMAT, caps);
+ if (!gst_opencv_parse_iplimage_params_from_caps (caps, &in_width,
+ &in_height, &in_depth, &in_channels,
+ &in_err)) {
+ &in_height, &in_depth, &in_channels, &in_err)) {
+ GST_WARNING_OBJECT (aggregator, "Failed to parse input caps: %s",
+ in_err->message);
+ g_error_free (in_err);
@ -1796,7 +1794,7 @@ index 0000000..3c69edf
+}
diff --git a/ext/opencv/gstopencvaggregator.h b/ext/opencv/gstopencvaggregator.h
new file mode 100644
index 0000000..1fc65a5
index 000000000000..1fc65a5a1783
--- /dev/null
+++ b/ext/opencv/gstopencvaggregator.h
@@ -0,0 +1,118 @@
@ -1918,6 +1916,3 @@ index 0000000..1fc65a5
+
+G_END_DECLS
+#endif /* __GST_OPENCV_AGGREGATOR_H__ */
--
1.7.9.5

View File

@ -1,4 +1,4 @@
From 59726a9af8d439f2a4bbe51d0cac909c936d86f3 Mon Sep 17 00:00:00 2001
From b19b98028730e772d7044375b79e4f5508c5a6a3 Mon Sep 17 00:00:00 2001
From: Song Bing <b06498@freescale.com>
Date: Fri, 13 Mar 2015 17:31:29 +0800
Subject: [PATCH] camerabin: Add one property to set sink element for video
@ -11,16 +11,17 @@ https://bugzilla.gnome.org/show_bug.cgi?id=744508
Upstream Status: Inappropriate [i.MX specific]
Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
---
gst/camerabin2/gstcamerabin2.c | 73 ++++++++++++++++++++++++++++++++++------
gst/camerabin2/gstcamerabin2.h | 1 +
gst/camerabin2/gstcamerabin2.c | 73 +++++++++++++++++++++++++++++++++++-------
gst/camerabin2/gstcamerabin2.h | 1 +
2 files changed, 63 insertions(+), 11 deletions(-)
diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c
index c77585a..01037ff 100644
index d0876d5ecc59..31c1e7f5668d 100644
--- a/gst/camerabin2/gstcamerabin2.c
+++ b/gst/camerabin2/gstcamerabin2.c
@@ -226,6 +226,7 @@ enum
@@ -220,6 +220,7 @@ enum
PROP_MUTE_AUDIO,
PROP_AUDIO_CAPTURE_SUPPORTED_CAPS,
PROP_AUDIO_CAPTURE_CAPS,
@ -28,7 +29,7 @@ index c77585a..01037ff 100644
PROP_ZOOM,
PROP_MAX_ZOOM,
PROP_IMAGE_ENCODING_PROFILE,
@@ -365,7 +366,7 @@ gst_camera_bin_start_capture (GstCameraBin2 * camerabin)
@@ -359,7 +360,7 @@ gst_camera_bin_start_capture (GstCameraBin2 * camerabin)
/* check that we have a valid location */
if (camerabin->mode == MODE_VIDEO) {
@ -37,7 +38,7 @@ index c77585a..01037ff 100644
GST_ELEMENT_ERROR (camerabin, RESOURCE, OPEN_WRITE,
(_("File location is set to NULL, please set it to a valid filename")), (NULL));
return;
@@ -500,10 +501,13 @@ gst_camera_bin_src_notify_readyforcapture (GObject * obj, GParamSpec * pspec,
@@ -494,10 +495,13 @@ gst_camera_bin_src_notify_readyforcapture (GObject * obj, GParamSpec * pspec,
if (camera->mode == MODE_VIDEO) {
/* a video recording is about to start, change the filesink location */
gst_element_set_state (camera->videosink, GST_STATE_NULL);
@ -55,7 +56,7 @@ index c77585a..01037ff 100644
if (gst_element_set_state (camera->videosink, GST_STATE_PLAYING) ==
GST_STATE_CHANGE_FAILURE) {
/* Resets the latest state change return, that would be a failure
@@ -558,6 +562,8 @@ gst_camera_bin_dispose (GObject * object)
@@ -552,6 +556,8 @@ gst_camera_bin_dispose (GObject * object)
if (camerabin->videosink)
gst_object_unref (camerabin->videosink);
@ -64,7 +65,7 @@ index c77585a..01037ff 100644
if (camerabin->video_encodebin)
gst_object_unref (camerabin->video_encodebin);
if (camerabin->videobin_capsfilter)
@@ -678,6 +684,12 @@ gst_camera_bin_class_init (GstCameraBin2Class * klass)
@@ -672,6 +678,12 @@ gst_camera_bin_class_init (GstCameraBin2Class * klass)
" taken into use on the next null to ready transition",
GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
@ -77,7 +78,7 @@ index c77585a..01037ff 100644
g_object_class_install_property (object_class, PROP_MUTE_AUDIO,
g_param_spec_boolean ("mute", "Mute",
"If the audio recording should be muted. Note that this still "
@@ -1534,13 +1546,30 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
@@ -1536,13 +1548,30 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
g_signal_connect (camera->video_encodebin, "element-added",
(GCallback) encodebin_element_added, camera);
@ -113,7 +114,7 @@ index c77585a..01037ff 100644
/* audio elements */
if (!camera->audio_volume) {
@@ -1663,7 +1692,9 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
@@ -1665,7 +1694,9 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
gst_element_set_locked_state (camera->videosink, TRUE);
gst_element_set_locked_state (camera->imagesink, TRUE);
@ -124,7 +125,7 @@ index c77585a..01037ff 100644
g_object_set (camera->imagesink, "location", camera->location, NULL);
}
@@ -2029,6 +2060,20 @@ gst_camera_bin_set_audio_src (GstCameraBin2 * camera, GstElement * src)
@@ -2031,6 +2062,20 @@ gst_camera_bin_set_audio_src (GstCameraBin2 * camera, GstElement * src)
}
static void
@ -145,7 +146,7 @@ index c77585a..01037ff 100644
gst_camera_bin_set_camera_src (GstCameraBin2 * camera, GstElement * src)
{
GST_DEBUG_OBJECT (GST_OBJECT (camera),
@@ -2061,6 +2106,9 @@ gst_camera_bin_set_property (GObject * object, guint prop_id,
@@ -2063,6 +2108,9 @@ gst_camera_bin_set_property (GObject * object, guint prop_id,
case PROP_AUDIO_SRC:
gst_camera_bin_set_audio_src (camera, g_value_get_object (value));
break;
@ -155,7 +156,7 @@ index c77585a..01037ff 100644
case PROP_MUTE_AUDIO:
g_object_set (camera->audio_volume, "mute", g_value_get_boolean (value),
NULL);
@@ -2244,6 +2292,9 @@ gst_camera_bin_get_property (GObject * object, guint prop_id,
@@ -2246,6 +2294,9 @@ gst_camera_bin_get_property (GObject * object, guint prop_id,
case PROP_AUDIO_SRC:
g_value_set_object (value, camera->user_audio_src);
break;
@ -166,7 +167,7 @@ index c77585a..01037ff 100644
gboolean mute;
diff --git a/gst/camerabin2/gstcamerabin2.h b/gst/camerabin2/gstcamerabin2.h
index ba55a7e..9e090b6 100644
index ba55a7ea0dff..9e090b62b677 100644
--- a/gst/camerabin2/gstcamerabin2.h
+++ b/gst/camerabin2/gstcamerabin2.h
@@ -71,6 +71,7 @@ struct _GstCameraBin2
@ -177,6 +178,3 @@ index ba55a7e..9e090b6 100644
GstElement *videobin_capsfilter;
GstElement *viewfinderbin;
--
1.7.9.5

View File

@ -1,4 +1,4 @@
From 7cf34dcec06acaf3278ef48feafe68b5cb3c7789 Mon Sep 17 00:00:00 2001
From 9af5efc2a92bc1ade61eed31a5192ea4bb253549 Mon Sep 17 00:00:00 2001
From: Jian <Jian.Li@freescale.com>
Date: Fri, 24 Apr 2015 17:12:02 +0800
Subject: [PATCH] Fix for gl plugin not built in wayland backend
@ -9,15 +9,16 @@ Content-Transfer-Encoding: 8bit
Upstream Status: Inappropriate [i.MX specific]
Signed-off-by: Jian <Jian.Li@freescale.com>
Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
---
configure.ac | 2 +-
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index cd55e22..099d0eb 100644
index 622e5bb16278..63cc7161cec5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -745,7 +745,7 @@ case $host in
@@ -789,7 +789,7 @@ case $host in
LIBS=$old_LIBS
CFLAGS=$old_CFLAGS
@ -26,6 +27,3 @@ index cd55e22..099d0eb 100644
;;
esac
--
1.7.9.5

View File

@ -0,0 +1,140 @@
From e15e7af522d381cf84f350d1415f1f4571ff9b26 Mon Sep 17 00:00:00 2001
From: Haihua Hu <b55597@freescale.com>
Date: Sun, 6 Dec 2015 14:25:44 +0800
Subject: [PATCH] gl/wayland: fix loop test hang in glimagesink
Root cause: In glimagesink, gl thread will dispatch event queue and window_show()
is called from streaming thread. Gl thread will empty event queue and
potentially cause gst_gl_wl_display_roundtrip_queue() blocking the
streaming thread to wait for an event occur. Actually, no event can occur
becaue the swap_buffer event is queued by streaming thread but it is blocked.
Solution: Use two event queue, One for surface and another for gl thread
Upstream Status: Pending
bugzilla URL: https://bugzilla.gnome.org/show_bug.cgi?id=758984
Signed-off-by: Haihua Hu <b55597@freescale.com>
Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
---
gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c | 33 +++++++++++++++--------
gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h | 2 +-
2 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
index 48b37a2e5a22..da35bf06d666 100644
--- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
+++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
@@ -245,6 +245,10 @@ destroy_surfaces (GstGLWindowWaylandEGL * window_egl)
wl_egl_window_destroy (window_egl->window.native);
window_egl->window.native = NULL;
}
+ if(window_egl->window.surface_queue) {
+ wl_event_queue_destroy (window_egl->window.surface_queue);
+ window_egl->window.surface_queue = NULL;
+ }
}
static void
@@ -253,13 +257,15 @@ create_surfaces (GstGLWindowWaylandEGL * window_egl)
GstGLDisplayWayland *display =
GST_GL_DISPLAY_WAYLAND (GST_GL_WINDOW (window_egl)->display);
gint width, height;
+ if (!window_egl->window.surface_queue)
+ window_egl->window.surface_queue = wl_display_create_queue (display->display);
if (!window_egl->window.surface) {
window_egl->window.surface =
wl_compositor_create_surface (display->compositor);
- if (window_egl->window.queue)
+ if (window_egl->window.surface_queue)
wl_proxy_set_queue ((struct wl_proxy *) window_egl->window.surface,
- window_egl->window.queue);
+ window_egl->window.surface_queue);
}
if (window_egl->window.foreign_surface) {
@@ -275,9 +281,9 @@ create_surfaces (GstGLWindowWaylandEGL * window_egl)
window_egl->window.subsurface =
wl_subcompositor_get_subsurface (display->subcompositor,
window_egl->window.surface, window_egl->window.foreign_surface);
- if (window_egl->window.queue)
+ if (window_egl->window.surface_queue)
wl_proxy_set_queue ((struct wl_proxy *) window_egl->window.subsurface,
- window_egl->window.queue);
+ window_egl->window.surface_queue);
wl_subsurface_set_position (window_egl->window.subsurface,
window_egl->window.window_x, window_egl->window.window_y);
@@ -289,9 +295,9 @@ create_surfaces (GstGLWindowWaylandEGL * window_egl)
window_egl->window.shell_surface =
wl_shell_get_shell_surface (display->shell,
window_egl->window.surface);
- if (window_egl->window.queue)
+ if (window_egl->window.surface_queue)
wl_proxy_set_queue ((struct wl_proxy *) window_egl->window.
- shell_surface, window_egl->window.queue);
+ shell_surface, window_egl->window.surface_queue);
wl_shell_surface_add_listener (window_egl->window.shell_surface,
&shell_surface_listener, window_egl);
@@ -319,9 +325,9 @@ create_surfaces (GstGLWindowWaylandEGL * window_egl)
window_egl->window.native =
wl_egl_window_create (window_egl->window.surface, width, height);
- if (window_egl->window.queue)
+ if (window_egl->window.surface_queue)
wl_proxy_set_queue ((struct wl_proxy *) window_egl->window.native,
- window_egl->window.queue);
+ window_egl->window.surface_queue);
}
}
@@ -372,6 +378,11 @@ gst_gl_window_wayland_egl_close (GstGLWindow * window)
destroy_surfaces (window_egl);
+ if(window_egl->window.wl_queue) {
+ wl_event_queue_destroy (window_egl->window.wl_queue);
+ window_egl->window.wl_queue = NULL;
+ }
+
g_source_destroy (window_egl->wl_source);
g_source_unref (window_egl->wl_source);
window_egl->wl_source = NULL;
@@ -400,10 +411,10 @@ gst_gl_window_wayland_egl_open (GstGLWindow * window, GError ** error)
return FALSE;
}
- window_egl->window.queue = wl_display_create_queue (display->display);
+ window_egl->window.wl_queue = wl_display_create_queue (display->display);
window_egl->wl_source = wayland_event_source_new (display->display,
- window_egl->window.queue);
+ window_egl->window.wl_queue);
if (!GST_GL_WINDOW_CLASS (parent_class)->open (window, error))
return FALSE;
@@ -452,7 +463,7 @@ gst_gl_window_wayland_egl_show (GstGLWindow * window)
create_surfaces (window_egl);
if (gst_gl_wl_display_roundtrip_queue (display_wayland->display,
- window_egl->window.queue) < 0)
+ window_egl->window.surface_queue) < 0)
GST_WARNING_OBJECT (window, "failed a roundtrip");
}
diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h
index e0166dabb7af..d148a449a216 100644
--- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h
+++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h
@@ -63,7 +63,7 @@ struct display {
struct window {
struct display *display;
- struct wl_event_queue *queue;
+ struct wl_event_queue *wl_queue, *surface_queue;
struct wl_surface *surface;
struct wl_shell_surface *shell_surface;
struct wl_egl_window *native;

View File

@ -0,0 +1,30 @@
From 057c8d382366f51501a014749f953ce4b702c076 Mon Sep 17 00:00:00 2001
From: Haihua Hu <b55597@freescale.com>
Date: Tue, 8 Dec 2015 16:06:34 +0800
Subject: [PATCH] Fix glimagesink wayland resize showed blurred screen
For imx, wl_egl_window type is not a wl_proxy object. Can not set
queue to wl_egl_window object.
Upstream Status: Inappropriate [i.MX specific]
Signed-off-by: Haihua Hu <b55597@freescale.com>
Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
---
gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
index da35bf06d666..b20be22f1fbf 100644
--- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
+++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
@@ -325,9 +325,6 @@ create_surfaces (GstGLWindowWaylandEGL * window_egl)
window_egl->window.native =
wl_egl_window_create (window_egl->window.surface, width, height);
- if (window_egl->window.surface_queue)
- wl_proxy_set_queue ((struct wl_proxy *) window_egl->window.native,
- window_egl->window.surface_queue);
}
}

View File

@ -0,0 +1,149 @@
From 226e80315925bb722cfdd5716e078832f3f6b3c4 Mon Sep 17 00:00:00 2001
From: Haihua Hu <b55597@freescale.com>
Date: Fri, 13 Nov 2015 10:51:25 +0800
Subject: [PATCH] support video crop for glimagesink
1.Add video crop meta copy in glupload
2.Calculate the new texture coordinate in vertices array and bind to buffer object
3.Make glimagesink only updating vertices array when video crop meta changed
Upstream-Status: Inappropriate [i.MX specific]
Signed-off-by: Haihua Hu <b55597@freescale.com>
Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
---
ext/gl/gstglimagesink.c | 58 +++++++++++++++++++++++++++++++++++++++++++++
ext/gl/gstglimagesink.h | 3 +++
ext/gl/gstgluploadelement.c | 14 +++++++++--
3 files changed, 73 insertions(+), 2 deletions(-)
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index 0bac4fb1c118..196757adfbac 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -601,6 +601,8 @@ gst_glimage_sink_init (GstGLImageSink * glimage_sink)
glimage_sink->handle_events = TRUE;
glimage_sink->ignore_alpha = TRUE;
glimage_sink->overlay_compositor = NULL;
+ glimage_sink->cropmeta = NULL;
+ glimage_sink->prev_cropmeta = NULL;
glimage_sink->mview_output_mode = DEFAULT_MULTIVIEW_MODE;
glimage_sink->mview_output_flags = DEFAULT_MULTIVIEW_FLAGS;
@@ -1062,6 +1064,12 @@ gst_glimage_sink_change_state (GstElement * element, GstStateChange transition)
gst_object_unref (glimage_sink->display);
glimage_sink->display = NULL;
}
+
+ glimage_sink->cropmeta = NULL;
+ if (glimage_sink->prev_cropmeta)
+ g_slice_free(GstVideoCropMeta, glimage_sink->prev_cropmeta);
+ glimage_sink->prev_cropmeta = NULL;
+
break;
default:
break;
@@ -1546,6 +1554,8 @@ gst_glimage_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
GST_VIDEO_SINK_WIDTH (glimage_sink),
GST_VIDEO_SINK_HEIGHT (glimage_sink));
+ glimage_sink->cropmeta = gst_buffer_get_video_crop_meta (buf);
+
/* Ask the underlying window to redraw its content */
if (!gst_glimage_sink_redisplay (glimage_sink))
goto redisplay_failed;
@@ -2028,6 +2038,54 @@ gst_glimage_sink_on_draw (GstGLImageSink * gl_sink)
gst_gl_shader_use (gl_sink->redisplay_shader);
+ if (gl_sink->cropmeta) {
+ gint width = GST_VIDEO_SINK_WIDTH (gl_sink);
+ gint height = GST_VIDEO_SINK_HEIGHT (gl_sink);
+
+ if (!gl_sink->prev_cropmeta){
+ /* Initialize the previous crop meta and set all memroy to zero */
+ gl_sink->prev_cropmeta = (GstVideoCropMeta *) g_slice_new0(GstVideoCropMeta);
+ }
+
+ /* If crop meta not equal to the previous, recalculate the vertices */
+ if (gl_sink->prev_cropmeta->x != gl_sink->cropmeta->x
+ || gl_sink->prev_cropmeta->y != gl_sink->cropmeta->y
+ || gl_sink->prev_cropmeta->width != gl_sink->cropmeta->width
+ || gl_sink->prev_cropmeta->height != gl_sink->cropmeta->height){
+
+ GLfloat crop_vertices[] = {
+ 1.0f, 1.0f, 0.0f, 1.0f, 0.0f,
+ -1.0f, 1.0f, 0.0f, 0.0f, 0.0f,
+ -1.0f, -1.0f, 0.0f, 0.0f, 1.0f,
+ 1.0f, -1.0f, 0.0f, 1.0f, 1.0f
+ };
+
+ crop_vertices[8] = (float)(gl_sink->cropmeta->x) / width;
+ crop_vertices[9] = (float)(gl_sink->cropmeta->y) / height;
+
+ crop_vertices[3] = (float)(gl_sink->cropmeta->width + gl_sink->cropmeta->x) / width;
+ crop_vertices[4] = crop_vertices[9];
+
+ crop_vertices[13] = crop_vertices[8];
+ crop_vertices[14] = (float)(gl_sink->cropmeta->height + gl_sink->cropmeta->y) / height;
+
+ crop_vertices[18] = crop_vertices[3];
+ crop_vertices[19] = crop_vertices[14];
+
+ gl->BindBuffer (GL_ARRAY_BUFFER, gl_sink->vertex_buffer);
+ gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), crop_vertices,
+ GL_STATIC_DRAW);
+
+ gl->BindBuffer (GL_ARRAY_BUFFER, 0);
+
+ /* Store the previous crop meta */
+ gl_sink->prev_cropmeta->x = gl_sink->cropmeta->x;
+ gl_sink->prev_cropmeta->y = gl_sink->cropmeta->y;
+ gl_sink->prev_cropmeta->width = gl_sink->cropmeta->width;
+ gl_sink->prev_cropmeta->height = gl_sink->cropmeta->height;
+ }
+ }
+
if (gl->GenVertexArrays)
gl->BindVertexArray (gl_sink->vao);
else
diff --git a/ext/gl/gstglimagesink.h b/ext/gl/gstglimagesink.h
index 6e9b98e74a88..317055a016ed 100644
--- a/ext/gl/gstglimagesink.h
+++ b/ext/gl/gstglimagesink.h
@@ -107,6 +107,9 @@ struct _GstGLImageSink
guint window_width;
guint window_height;
+ GstVideoCropMeta *cropmeta;
+ GstVideoCropMeta *prev_cropmeta;
+
GstVideoRectangle display_rect;
GstGLShader *redisplay_shader;
diff --git a/ext/gl/gstgluploadelement.c b/ext/gl/gstgluploadelement.c
index 86e8b01e2407..1738c2f81c1d 100644
--- a/ext/gl/gstgluploadelement.c
+++ b/ext/gl/gstgluploadelement.c
@@ -232,9 +232,19 @@ gst_gl_upload_element_prepare_output_buffer (GstBaseTransform * bt,
/* basetransform doesn't unref if they're the same */
if (buffer == *outbuf)
gst_buffer_unref (*outbuf);
- else
+ else {
+ GstVideoCropMeta *incropmeta, *outcropmeta;
+ /* add video crop meta to out buffer if need */
+ incropmeta = gst_buffer_get_video_crop_meta (buffer);
+ if (incropmeta) {
+ outcropmeta = gst_buffer_add_video_crop_meta (*outbuf);
+ outcropmeta->x = incropmeta->x;
+ outcropmeta->y = incropmeta->y;
+ outcropmeta->width = incropmeta->width;
+ outcropmeta->height = incropmeta->height;
+ }
bclass->copy_metadata (bt, buffer, *outbuf);
-
+ }
return GST_FLOW_OK;
}

View File

@ -0,0 +1,81 @@
From f6edb394cc6ada3ce98e2cf9021e6a2ead3b4daf Mon Sep 17 00:00:00 2001
From: Haihua Hu <b55597@freescale.com>
Date: Wed, 18 Nov 2015 15:10:22 +0800
Subject: [PATCH] Add fps print in glimagesink
In GST-1.6, Pipeline will set start time to 0 when state
change form PAUSE to READY, so get start time in state change
PLAYING_PAUSE.
Upstream-Status: Inappropriate [i.MX specific]
Signed-off-by: Haihua Hu <b55597@freescale.com>
Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
---
ext/gl/gstglimagesink.c | 15 +++++++++++++++
ext/gl/gstglimagesink.h | 4 ++++
2 files changed, 19 insertions(+)
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index 196757adfbac..185577f2a07e 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -603,6 +603,8 @@ gst_glimage_sink_init (GstGLImageSink * glimage_sink)
glimage_sink->overlay_compositor = NULL;
glimage_sink->cropmeta = NULL;
glimage_sink->prev_cropmeta = NULL;
+ glimage_sink->frame_showed = 0;
+ glimage_sink->run_time = 0;
glimage_sink->mview_output_mode = DEFAULT_MULTIVIEW_MODE;
glimage_sink->mview_output_flags = DEFAULT_MULTIVIEW_FLAGS;
@@ -978,7 +980,10 @@ gst_glimage_sink_change_state (GstElement * element, GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+ {
+ glimage_sink->run_time = gst_element_get_start_time (GST_ELEMENT (glimage_sink));
break;
+ }
case GST_STATE_CHANGE_PAUSED_TO_READY:
{
GstBuffer *buf[2];
@@ -1070,6 +1075,14 @@ gst_glimage_sink_change_state (GstElement * element, GstStateChange transition)
g_slice_free(GstVideoCropMeta, glimage_sink->prev_cropmeta);
glimage_sink->prev_cropmeta = NULL;
+ if (glimage_sink->run_time > 0) {
+ g_print ("Total showed frames (%lld), playing for (%"GST_TIME_FORMAT"), fps (%.3f).\n",
+ glimage_sink->frame_showed, GST_TIME_ARGS (glimage_sink->run_time),
+ (gfloat)GST_SECOND * glimage_sink->frame_showed / glimage_sink->run_time);
+ }
+
+ glimage_sink->frame_showed = 0;
+ glimage_sink->run_time = 0;
break;
default:
break;
@@ -1568,6 +1581,8 @@ gst_glimage_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
return GST_FLOW_ERROR;
}
+ glimage_sink->frame_showed++;
+
return GST_FLOW_OK;
/* ERRORS */
diff --git a/ext/gl/gstglimagesink.h b/ext/gl/gstglimagesink.h
index 317055a016ed..f9a052a12ed8 100644
--- a/ext/gl/gstglimagesink.h
+++ b/ext/gl/gstglimagesink.h
@@ -125,6 +125,10 @@ struct _GstGLImageSink
GstGLStereoDownmix mview_downmix_mode;
GstGLOverlayCompositor *overlay_compositor;
+
+ /* fps print support */
+ guint64 frame_showed;
+ GstClockTime run_time;
};
struct _GstGLImageSinkClass

View File

@ -0,0 +1,570 @@
From 0d53611c59d1c29f1d1cf22f62a50ae1ee21096b Mon Sep 17 00:00:00 2001
From: Haihua Hu <jared.hu@nxp.com>
Date: Mon, 9 May 2016 20:26:51 +0800
Subject: [PATCH] glimagesink: support video rotation using transform matrix
Add "rotate-method" to glimagesink and apply transform matrix
to vertex coordinate to control rotation.
Upstream-Status: Accepted[1.9.1]
https://bugzilla.gnome.org/show_bug.cgi?id=765795
Signed-off-by: Haihua Hu <jared.hu@nxp.com>
---
ext/gl/gstglimagesink.c | 266 ++++++++++++++++++++++++++++++++---
ext/gl/gstglimagesink.h | 18 +++
gst-libs/gst/gl/gstglshaderstrings.c | 11 ++
gst-libs/gst/gl/gstglshaderstrings.h | 1 +
gst-libs/gst/gl/gstglutils.c | 60 ++++++++
gst-libs/gst/gl/gstglutils.h | 5 +
6 files changed, 344 insertions(+), 17 deletions(-)
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index 185577f2a07e..fb60468b361e 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -120,6 +120,7 @@ G_DEFINE_TYPE (GstGLImageSinkBin, gst_gl_image_sink_bin, GST_TYPE_GL_SINK_BIN);
enum
{
PROP_BIN_0,
+ PROP_BIN_ROTATE_METHOD,
PROP_BIN_FORCE_ASPECT_RATIO,
PROP_BIN_PIXEL_ASPECT_RATIO,
PROP_BIN_HANDLE_EVENTS,
@@ -181,6 +182,39 @@ _on_client_draw (GstGLImageSink * sink, GstGLContext * context,
return ret;
}
+#define DEFAULT_ROTATE_METHOD GST_GL_ROTATE_METHOD_IDENTITY
+
+#define GST_TYPE_GL_ROTATE_METHOD (gst_gl_rotate_method_get_type())
+
+static const GEnumValue rotate_methods[] = {
+ {GST_GL_ROTATE_METHOD_IDENTITY, "Identity (no rotation)", "none"},
+ {GST_GL_ROTATE_METHOD_90R, "Rotate clockwise 90 degrees", "clockwise"},
+ {GST_GL_ROTATE_METHOD_180, "Rotate 180 degrees", "rotate-180"},
+ {GST_GL_ROTATE_METHOD_90L, "Rotate counter-clockwise 90 degrees",
+ "counterclockwise"},
+ {GST_GL_ROTATE_METHOD_FLIP_HORIZ, "Flip horizontally", "horizontal-flip"},
+ {GST_GL_ROTATE_METHOD_FLIP_VERT, "Flip vertically", "vertical-flip"},
+ {GST_GL_ROTATE_METHOD_FLIP_UL_LR,
+ "Flip across upper left/lower right diagonal", "upper-left-diagonal"},
+ {GST_GL_ROTATE_METHOD_FLIP_UR_LL,
+ "Flip across upper right/lower left diagonal", "upper-right-diagonal"},
+ {GST_GL_ROTATE_METHOD_AUTO,
+ "Select rotate method based on image-orientation tag", "automatic"},
+ {0, NULL, NULL},
+};
+
+static GType
+gst_gl_rotate_method_get_type (void)
+{
+ static GType rotate_method_type = 0;
+
+ if (!rotate_method_type) {
+ rotate_method_type = g_enum_register_static ("GstGLRotateMethod",
+ rotate_methods);
+ }
+ return rotate_method_type;
+}
+
static void
gst_gl_image_sink_bin_init (GstGLImageSinkBin * self)
{
@@ -203,6 +237,12 @@ gst_gl_image_sink_bin_class_init (GstGLImageSinkBinClass * klass)
gobject_class->set_property = gst_gl_image_sink_bin_set_property;
/* gl sink */
+ g_object_class_install_property (gobject_class, PROP_BIN_ROTATE_METHOD,
+ g_param_spec_enum ("rotate-method",
+ "rotate method",
+ "rotate method",
+ GST_TYPE_GL_ROTATE_METHOD, DEFAULT_ROTATE_METHOD,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_BIN_FORCE_ASPECT_RATIO,
g_param_spec_boolean ("force-aspect-ratio",
"Force aspect ratio",
@@ -291,6 +331,7 @@ static void gst_glimage_sink_set_property (GObject * object, guint prop_id,
static void gst_glimage_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * param_spec);
+static gboolean gst_glimage_sink_event (GstBaseSink *sink, GstEvent * event);
static gboolean gst_glimage_sink_query (GstBaseSink * bsink, GstQuery * query);
static void gst_glimage_sink_set_context (GstElement * element,
GstContext * context);
@@ -347,6 +388,7 @@ enum
{
ARG_0,
ARG_DISPLAY,
+ PROP_ROTATE_METHOD,
PROP_FORCE_ASPECT_RATIO,
PROP_PIXEL_ASPECT_RATIO,
PROP_CONTEXT,
@@ -404,6 +446,128 @@ _display_size_to_stream_size (GstGLImageSink * gl_sink, gdouble x,
GST_TRACE ("transform %fx%f into %fx%f", x, y, *stream_x, *stream_y);
}
+/* rotate 90 */
+static const gfloat clockwise_matrix[] = {
+ 0.0f, -1.0f, 0.0, 0.0f,
+ 1.0f, 0.0f, 0.0, 0.0f,
+ 0.0f, 0.0f, 1.0, 0.0f,
+ 0.0f, 0.0f, 0.0, 1.0f,
+};
+
+/* rotate 180 */
+static const gfloat clockwise_180_matrix[] = {
+ -1.0f, 0.0f, 0.0, 0.0f,
+ 0.0f, -1.0f, 0.0, 0.0f,
+ 0.0f, 0.0f, 1.0, 0.0f,
+ 0.0f, 0.0f, 0.0, 1.0f,
+};
+
+/* rotate 270 */
+static const gfloat counterclockwise_matrix[] = {
+ 0.0f, 1.0f, 0.0, 0.0f,
+ -1.0f, 0.0f, 0.0, 0.0f,
+ 0.0f, 0.0f, 1.0, 0.0f,
+ 0.0f, 0.0f, 0.0, 1.0f,
+};
+
+/* horizontal-flip */
+static const gfloat horizontal_flip_matrix[] = {
+ 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, -1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f,
+};
+
+/* vertical-flip */
+static const gfloat vertical_flip_matrix[] = {
+ -1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f,
+};
+
+/* upper-left-diagonal */
+static const gfloat upper_left_matrix[] = {
+ 0.0f, 1.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f,
+};
+
+/* upper-right-diagonal */
+static const gfloat upper_right_matrix[] = {
+ 0.0f, -1.0f, 0.0f, 0.0f,
+ -1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f,
+};
+
+static void
+gst_glimage_sink_set_rotate_method(GstGLImageSink *gl_sink,
+ GstGLRotateMethod method, gboolean from_tag)
+{
+ GstGLRotateMethod tag_method;
+ GST_GLIMAGE_SINK_LOCK (gl_sink);
+ if (from_tag)
+ tag_method = method;
+ else
+ gl_sink->rotate_method = method;
+
+ if (gl_sink->rotate_method == GST_GL_ROTATE_METHOD_AUTO)
+ method = tag_method;
+ else
+ method = gl_sink->rotate_method;
+
+ if (method != gl_sink->current_rotate_method)
+ {
+ GST_DEBUG_OBJECT (gl_sink, "Changing method from %s to %s",
+ rotate_methods[gl_sink->current_rotate_method].value_nick,
+ rotate_methods[method].value_nick);
+
+ switch (method)
+ {
+ case GST_GL_ROTATE_METHOD_IDENTITY:
+ gl_sink->transform_matrix = NULL;
+ gl_sink->output_mode_changed = TRUE;
+ break;
+ case GST_GL_ROTATE_METHOD_90R:
+ gl_sink->transform_matrix = clockwise_matrix;
+ gl_sink->output_mode_changed = TRUE;
+ break;
+ case GST_GL_ROTATE_METHOD_180:
+ gl_sink->transform_matrix = clockwise_180_matrix;
+ gl_sink->output_mode_changed = TRUE;
+ break;
+ case GST_GL_ROTATE_METHOD_90L:
+ gl_sink->transform_matrix = counterclockwise_matrix;
+ gl_sink->output_mode_changed = TRUE;
+ break;
+ case GST_GL_ROTATE_METHOD_FLIP_HORIZ:
+ gl_sink->transform_matrix = horizontal_flip_matrix;
+ gl_sink->output_mode_changed = TRUE;
+ break;
+ case GST_GL_ROTATE_METHOD_FLIP_VERT:
+ gl_sink->transform_matrix = vertical_flip_matrix;
+ gl_sink->output_mode_changed = TRUE;
+ break;
+ case GST_GL_ROTATE_METHOD_FLIP_UL_LR:
+ gl_sink->transform_matrix = upper_left_matrix;
+ gl_sink->output_mode_changed = TRUE;
+ break;
+ case GST_GL_ROTATE_METHOD_FLIP_UR_LL:
+ gl_sink->transform_matrix = upper_right_matrix;
+ gl_sink->output_mode_changed = TRUE;
+ break;
+ default:
+ g_assert_not_reached();
+ break;
+ }
+
+ gl_sink->current_rotate_method = method;
+ }
+ GST_GLIMAGE_SINK_UNLOCK (gl_sink);
+}
+
static void
gst_glimage_sink_navigation_send_event (GstNavigation * navigation, GstStructure
* structure)
@@ -485,6 +649,13 @@ gst_glimage_sink_class_init (GstGLImageSinkClass * klass)
gobject_class->set_property = gst_glimage_sink_set_property;
gobject_class->get_property = gst_glimage_sink_get_property;
+ g_object_class_install_property (gobject_class, PROP_ROTATE_METHOD,
+ g_param_spec_enum ("rotate-method",
+ "rotate method",
+ "rotate method",
+ GST_TYPE_GL_ROTATE_METHOD, DEFAULT_ROTATE_METHOD,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
g_object_class_install_property (gobject_class, PROP_FORCE_ASPECT_RATIO,
g_param_spec_boolean ("force-aspect-ratio", "Force aspect ratio",
"When enabled, scaling will respect original aspect ratio",
@@ -577,6 +748,7 @@ gst_glimage_sink_class_init (GstGLImageSinkClass * klass)
gstelement_class->change_state = gst_glimage_sink_change_state;
gstelement_class->set_context = gst_glimage_sink_set_context;
+ gstbasesink_class->event = gst_glimage_sink_event;
gstbasesink_class->query = GST_DEBUG_FUNCPTR (gst_glimage_sink_query);
gstbasesink_class->set_caps = gst_glimage_sink_set_caps;
gstbasesink_class->get_caps = gst_glimage_sink_get_caps;
@@ -610,6 +782,9 @@ gst_glimage_sink_init (GstGLImageSink * glimage_sink)
glimage_sink->mview_output_flags = DEFAULT_MULTIVIEW_FLAGS;
glimage_sink->mview_downmix_mode = DEFAULT_MULTIVIEW_DOWNMIX;
+ glimage_sink->current_rotate_method = DEFAULT_ROTATE_METHOD;
+ glimage_sink->transform_matrix = NULL;
+
g_mutex_init (&glimage_sink->drawing_lock);
}
@@ -624,6 +799,9 @@ gst_glimage_sink_set_property (GObject * object, guint prop_id,
glimage_sink = GST_GLIMAGE_SINK (object);
switch (prop_id) {
+ case PROP_ROTATE_METHOD:
+ gst_glimage_sink_set_rotate_method (glimage_sink, g_value_get_enum (value), FALSE);
+ break;
case PROP_FORCE_ASPECT_RATIO:
{
glimage_sink->keep_aspect_ratio = g_value_get_boolean (value);
@@ -691,6 +869,9 @@ gst_glimage_sink_get_property (GObject * object, guint prop_id,
glimage_sink = GST_GLIMAGE_SINK (object);
switch (prop_id) {
+ case PROP_ROTATE_METHOD:
+ g_value_set_enum (value, glimage_sink->current_rotate_method);
+ break;
case PROP_FORCE_ASPECT_RATIO:
g_value_set_boolean (value, glimage_sink->keep_aspect_ratio);
break;
@@ -848,6 +1029,50 @@ context_error:
}
static gboolean
+gst_glimage_sink_event (GstBaseSink *sink, GstEvent * event)
+{
+ GstGLImageSink *gl_sink = GST_GLIMAGE_SINK (sink);
+ GstTagList *taglist;
+ gchar *orientation;
+ gboolean ret;
+
+ GST_DEBUG_OBJECT (gl_sink, "handling %s event", GST_EVENT_TYPE_NAME (event));
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_TAG:
+ gst_event_parse_tag (event, &taglist);
+
+ if (gst_tag_list_get_string (taglist, "image-orientation", &orientation)) {
+ if (!g_strcmp0 ("rotate-0", orientation))
+ gst_glimage_sink_set_rotate_method (gl_sink, GST_GL_ROTATE_METHOD_IDENTITY, TRUE);
+ else if (!g_strcmp0 ("rotate-90", orientation))
+ gst_glimage_sink_set_rotate_method (gl_sink, GST_GL_ROTATE_METHOD_90R, TRUE);
+ else if (!g_strcmp0 ("rotate-180", orientation))
+ gst_glimage_sink_set_rotate_method (gl_sink, GST_GL_ROTATE_METHOD_180, TRUE);
+ else if (!g_strcmp0 ("rotate-270", orientation))
+ gst_glimage_sink_set_rotate_method (gl_sink, GST_GL_ROTATE_METHOD_90L, TRUE);
+ else if (!g_strcmp0 ("flip-rotate-0", orientation))
+ gst_glimage_sink_set_rotate_method (gl_sink, GST_GL_ROTATE_METHOD_FLIP_HORIZ, TRUE);
+ else if (!g_strcmp0 ("flip-rotate-90", orientation))
+ gst_glimage_sink_set_rotate_method (gl_sink, GST_GL_ROTATE_METHOD_FLIP_UR_LL, TRUE);
+ else if (!g_strcmp0 ("flip-rotate-180", orientation))
+ gst_glimage_sink_set_rotate_method (gl_sink, GST_GL_ROTATE_METHOD_FLIP_VERT, TRUE);
+ else if (!g_strcmp0 ("flip-rotate-270", orientation))
+ gst_glimage_sink_set_rotate_method (gl_sink, GST_GL_ROTATE_METHOD_FLIP_UL_LR, TRUE);
+
+ g_free (orientation);
+ }
+ break;
+ default:
+ break;
+ }
+
+ ret = GST_BASE_SINK_CLASS (parent_class)->event (sink, event);
+
+ return ret;
+}
+
+static gboolean
gst_glimage_sink_query (GstBaseSink * bsink, GstQuery * query)
{
GstGLImageSink *glimage_sink = GST_GLIMAGE_SINK (bsink);
@@ -1817,7 +2042,10 @@ gst_glimage_sink_thread_init_redisplay (GstGLImageSink * gl_sink)
GST_GLSL_PROFILE_ES | GST_GLSL_PROFILE_COMPATIBILITY,
gst_gl_shader_string_fragment_external_oes_default);
} else {
- vert_stage = gst_glsl_stage_new_default_vertex (gl_sink->context);
+ vert_stage = gst_glsl_stage_new_with_string (gl_sink->context,
+ GL_VERTEX_SHADER, GST_GLSL_VERSION_NONE,
+ GST_GLSL_PROFILE_ES | GST_GLSL_PROFILE_COMPATIBILITY,
+ gst_gl_shader_string_vertex_mat4_vertex_transform);
frag_stage = gst_glsl_stage_new_default_fragment (gl_sink->context);
}
if (!vert_stage || !frag_stage) {
@@ -1943,8 +2171,16 @@ gst_glimage_sink_on_resize (GstGLImageSink * gl_sink, gint width, gint height)
src.x = 0;
src.y = 0;
- src.w = GST_VIDEO_SINK_WIDTH (gl_sink);
- src.h = GST_VIDEO_SINK_HEIGHT (gl_sink);
+ if (gl_sink->current_rotate_method == GST_GL_ROTATE_METHOD_90R
+ || gl_sink->current_rotate_method == GST_GL_ROTATE_METHOD_90L
+ || gl_sink->current_rotate_method == GST_GL_ROTATE_METHOD_FLIP_UL_LR
+ || gl_sink->current_rotate_method == GST_GL_ROTATE_METHOD_FLIP_UR_LL) {
+ src.h = GST_VIDEO_SINK_WIDTH (gl_sink);
+ src.w = GST_VIDEO_SINK_HEIGHT (gl_sink);
+ } else {
+ src.w = GST_VIDEO_SINK_WIDTH (gl_sink);
+ src.h = GST_VIDEO_SINK_HEIGHT (gl_sink);
+ }
dst.x = 0;
dst.y = 0;
@@ -1974,13 +2210,6 @@ gst_glimage_sink_on_resize (GstGLImageSink * gl_sink, gint width, gint height)
GST_GLIMAGE_SINK_UNLOCK (gl_sink);
}
-static const gfloat identity_matrix[] = {
- 1.0f, 0.0f, 0.0, 0.0f,
- 0.0f, 1.0f, 0.0, 0.0f,
- 0.0f, 0.0f, 1.0, 0.0f,
- 0.0f, 0.0f, 0.0, 1.0f,
-};
-
static void
gst_glimage_sink_on_draw (GstGLImageSink * gl_sink)
{
@@ -2109,18 +2338,21 @@ gst_glimage_sink_on_draw (GstGLImageSink * gl_sink)
gl->ActiveTexture (GL_TEXTURE0);
gl->BindTexture (gl_target, gl_sink->redisplay_texture);
gst_gl_shader_set_uniform_1i (gl_sink->redisplay_shader, "tex", 0);
- if (gl_sink->texture_target == GST_GL_TEXTURE_TARGET_EXTERNAL_OES) {
+ {
GstVideoAffineTransformationMeta *af_meta;
+ gfloat matrix[16];
af_meta =
gst_buffer_get_video_affine_transformation_meta
(gl_sink->stored_buffer[0]);
- if (af_meta)
- gst_gl_shader_set_uniform_matrix_4fv (gl_sink->redisplay_shader,
- "u_transformation", 1, FALSE, af_meta->matrix);
- else
- gst_gl_shader_set_uniform_matrix_4fv (gl_sink->redisplay_shader,
- "u_transformation", 1, FALSE, identity_matrix);
+
+ gst_gl_get_affine_transformation_meta_as_ndc (af_meta, matrix);
+
+ if (gl_sink->transform_matrix)
+ gst_gl_multiply_matrix4 (gl_sink->transform_matrix, matrix, matrix);
+
+ gst_gl_shader_set_uniform_matrix_4fv (gl_sink->redisplay_shader,
+ "u_transformation", 1, FALSE, matrix);
}
gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
diff --git a/ext/gl/gstglimagesink.h b/ext/gl/gstglimagesink.h
index f9a052a12ed8..c0ab3ffb3b47 100644
--- a/ext/gl/gstglimagesink.h
+++ b/ext/gl/gstglimagesink.h
@@ -44,6 +44,19 @@ GST_DEBUG_CATEGORY_EXTERN (gst_debug_glimage_sink);
#define GST_IS_GLIMAGE_SINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GLIMAGE_SINK))
+typedef enum
+{
+ GST_GL_ROTATE_METHOD_IDENTITY,
+ GST_GL_ROTATE_METHOD_90R,
+ GST_GL_ROTATE_METHOD_180,
+ GST_GL_ROTATE_METHOD_90L,
+ GST_GL_ROTATE_METHOD_FLIP_HORIZ,
+ GST_GL_ROTATE_METHOD_FLIP_VERT,
+ GST_GL_ROTATE_METHOD_FLIP_UL_LR,
+ GST_GL_ROTATE_METHOD_FLIP_UR_LL,
+ GST_GL_ROTATE_METHOD_AUTO
+}GstGLRotateMethod;
+
typedef struct _GstGLImageSink GstGLImageSink;
typedef struct _GstGLImageSinkClass GstGLImageSinkClass;
@@ -126,6 +139,11 @@ struct _GstGLImageSink
GstGLOverlayCompositor *overlay_compositor;
+ /* current video flip method */
+ GstGLRotateMethod current_rotate_method;
+ GstGLRotateMethod rotate_method;
+ const gfloat *transform_matrix;
+
/* fps print support */
guint64 frame_showed;
GstClockTime run_time;
diff --git a/gst-libs/gst/gl/gstglshaderstrings.c b/gst-libs/gst/gl/gstglshaderstrings.c
index 729be6f75100..10186f1b86ec 100644
--- a/gst-libs/gst/gl/gstglshaderstrings.c
+++ b/gst-libs/gst/gl/gstglshaderstrings.c
@@ -35,6 +35,17 @@ const gchar *gst_gl_shader_string_vertex_default =
" v_texcoord = a_texcoord;\n"
"}\n";
+const gchar *gst_gl_shader_string_vertex_mat4_vertex_transform =
+ "uniform mat4 u_transformation;\n"
+ "attribute vec4 a_position;\n"
+ "attribute vec2 a_texcoord;\n"
+ "varying vec2 v_texcoord;\n"
+ "void main()\n"
+ "{\n"
+ " gl_Position = u_transformation * a_position;\n"
+ " v_texcoord = a_texcoord;\n"
+ "}\n";
+
const gchar *gst_gl_shader_string_vertex_mat4_texture_transform =
"uniform mat4 u_transformation;\n"
"attribute vec4 a_position;\n"
diff --git a/gst-libs/gst/gl/gstglshaderstrings.h b/gst-libs/gst/gl/gstglshaderstrings.h
index 49ea8de427c5..f9a13c8b3d92 100644
--- a/gst-libs/gst/gl/gstglshaderstrings.h
+++ b/gst-libs/gst/gl/gstglshaderstrings.h
@@ -28,6 +28,7 @@ G_BEGIN_DECLS
extern const gchar *gst_gl_shader_string_vertex_default;
extern const gchar *gst_gl_shader_string_fragment_default;
+extern const gchar *gst_gl_shader_string_vertex_mat4_vertex_transform;
extern const gchar *gst_gl_shader_string_vertex_mat4_texture_transform;
extern const gchar *gst_gl_shader_string_fragment_external_oes_default;
diff --git a/gst-libs/gst/gl/gstglutils.c b/gst-libs/gst/gl/gstglutils.c
index e2e04e407ed7..a38772f10be3 100644
--- a/gst-libs/gst/gl/gstglutils.c
+++ b/gst-libs/gst/gl/gstglutils.c
@@ -1067,3 +1067,63 @@ gst_gl_value_set_texture_target_from_mask (GValue * value,
return ret;
}
}
+
+static const gfloat identity_matrix[] = {
+ 1.0f, 0.0f, 0.0, 0.0f,
+ 0.0f, 1.0f, 0.0, 0.0f,
+ 0.0f, 0.0f, 1.0, 0.0f,
+ 0.0f, 0.0f, 0.0, 1.0f,
+};
+
+static const gfloat from_ndc_matrix[] = {
+ 0.5f, 0.0f, 0.0, 0.5f,
+ 0.0f, 0.5f, 0.0, 0.5f,
+ 0.0f, 0.0f, 0.5, 0.5f,
+ 0.0f, 0.0f, 0.0, 1.0f,
+};
+
+static const gfloat to_ndc_matrix[] = {
+ 2.0f, 0.0f, 0.0, -1.0f,
+ 0.0f, 2.0f, 0.0, -1.0f,
+ 0.0f, 0.0f, 2.0, -1.0f,
+ 0.0f, 0.0f, 0.0, 1.0f,
+};
+
+void
+gst_gl_multiply_matrix4 (const gfloat * a, const gfloat * b, gfloat * result)
+{
+ int i, j, k;
+ gfloat tmp[16] = { 0.0f };
+
+ if (!a || !b || !result)
+ return;
+
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 4; j++) {
+ for (k = 0; k < 4; k++) {
+ tmp[i + (j * 4)] += a[i + (k * 4)] * b[k + (j * 4)];
+ }
+ }
+ }
+
+ for (i = 0; i < 16; i++)
+ result[i] = tmp[i];
+}
+
+void
+gst_gl_get_affine_transformation_meta_as_ndc (GstVideoAffineTransformationMeta *
+ meta, gfloat * matrix)
+{
+ if (!meta) {
+ int i;
+
+ for (i = 0; i < 16; i++) {
+ matrix[i] = identity_matrix[i];
+ }
+ } else {
+ gfloat tmp[16] = { 0.0f };
+
+ gst_gl_multiply_matrix4 (from_ndc_matrix, meta->matrix, tmp);
+ gst_gl_multiply_matrix4 (tmp, to_ndc_matrix, matrix);
+ }
+}
diff --git a/gst-libs/gst/gl/gstglutils.h b/gst-libs/gst/gl/gstglutils.h
index 1c5ab12344fe..fc12801978e9 100644
--- a/gst-libs/gst/gl/gstglutils.h
+++ b/gst-libs/gst/gl/gstglutils.h
@@ -24,6 +24,7 @@
#include <gst/video/video.h>
#include <gst/gl/gstgl_fwd.h>
+#include <gst/video/gstvideoaffinetransformationmeta.h>
G_BEGIN_DECLS
@@ -116,6 +117,10 @@ gboolean gst_gl_value_set_texture_target_from_mask (GValue * value,
gboolean gst_gl_value_set_texture_target (GValue * value, GstGLTextureTarget target);
GstGLTextureTarget gst_gl_value_get_texture_target_mask (const GValue * value);
+void gst_gl_multiply_matrix4 (const gfloat * a, const gfloat * b, gfloat * result);
+void gst_gl_get_affine_transformation_meta_as_ndc (GstVideoAffineTransformationMeta *
+ meta, gfloat * matrix);
+
G_END_DECLS
#endif /* __GST_GL_UTILS_H__ */

View File

@ -0,0 +1,481 @@
From 145ef8665f68fd716fc9def3d765973fd2c2fdd8 Mon Sep 17 00:00:00 2001
From: Song Bing <bing.song@nxp.com>
Date: Mon, 20 Jun 2016 10:28:34 +0800
Subject: [PATCH] ion: DMA Buf allocator based on ion.
DMA Buf allocator based on ion.
Upstream-Status: Pending
https://bugzilla.gnome.org/show_bug.cgi?id=768794
---
configure.ac | 7 +
gst-libs/gst/Makefile.am | 10 +-
gst-libs/gst/ion/Makefile.am | 16 +++
gst-libs/gst/ion/gstionmemory.c | 297 ++++++++++++++++++++++++++++++++++++++++
gst-libs/gst/ion/gstionmemory.h | 72 ++++++++++
5 files changed, 399 insertions(+), 3 deletions(-)
create mode 100644 gst-libs/gst/ion/Makefile.am
create mode 100755 gst-libs/gst/ion/gstionmemory.c
create mode 100755 gst-libs/gst/ion/gstionmemory.h
diff --git a/configure.ac b/configure.ac
index 63cc7161cec5..c0145ae19c76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2003,6 +2003,12 @@ AG_GST_CHECK_FEATURE(TINYALSA, [tinyalsa], tinyalsa, [
AC_CHECK_HEADER(tinyalsa/asoundlib.h, HAVE_TINYALSA="yes", HAVE_TINYALSA="no")
])
+dnl check for ion
+translit(dnm, m, l) AM_CONDITIONAL(USE_ION, true)
+AG_GST_CHECK_FEATURE(ION, [ion], ion, [
+ AC_CHECK_HEADER(linux/ion.h, HAVE_ION="yes", HAVE_ION="no")
+])
+
dnl *** ext plug-ins ***
dnl keep this list sorted alphabetically !
@@ -3656,6 +3662,7 @@ gst-libs/gst/uridownloader/Makefile
gst-libs/gst/wayland/Makefile
gst-libs/gst/base/Makefile
gst-libs/gst/player/Makefile
+gst-libs/gst/ion/Makefile
gst-libs/gst/video/Makefile
gst-libs/gst/audio/Makefile
sys/Makefile
diff --git a/gst-libs/gst/Makefile.am b/gst-libs/gst/Makefile.am
index 7d0b30925744..eb2031cf65b4 100644
--- a/gst-libs/gst/Makefile.am
+++ b/gst-libs/gst/Makefile.am
@@ -10,12 +10,16 @@ if USE_WAYLAND
WAYLAND_DIR=wayland
endif
+if USE_ION
+ION_DIR=ion
+endif
+
SUBDIRS = uridownloader adaptivedemux interfaces basecamerabinsrc codecparsers \
- insertbin mpegts base video audio player $(GL_DIR) $(WAYLAND_DIR)
+ insertbin mpegts base video audio player $(ION_DIR) $(GL_DIR) $(WAYLAND_DIR)
noinst_HEADERS = gst-i18n-plugin.h gettext.h glib-compat-private.h
DIST_SUBDIRS = uridownloader adaptivedemux interfaces gl basecamerabinsrc \
- codecparsers insertbin mpegts wayland base video audio player
+ codecparsers insertbin mpegts wayland base video audio player ion
#dependencies
video, audio: base
@@ -24,7 +28,7 @@ adaptivedemux: uridownloader
INDEPENDENT_SUBDIRS = \
interfaces basecamerabinsrc codecparsers insertbin uridownloader \
- mpegts base player $(GL_DIR) $(WAYLAND_DIR)
+ mpegts base player $(ION_DIR) $(GL_DIR) $(WAYLAND_DIR)
.PHONY: independent-subdirs $(INDEPENDENT_SUBDIRS)
diff --git a/gst-libs/gst/ion/Makefile.am b/gst-libs/gst/ion/Makefile.am
new file mode 100644
index 000000000000..0a9f9f3a8e48
--- /dev/null
+++ b/gst-libs/gst/ion/Makefile.am
@@ -0,0 +1,16 @@
+lib_LTLIBRARIES = libgstbadion-@GST_API_VERSION@.la
+
+libgstbadion_@GST_API_VERSION@_la_SOURCES = \
+ gstionmemory.c
+
+libgstbadion_@GST_API_VERSION@_la_CFLAGS = $(GST_CFLAGS) \
+ -DGST_USE_UNSTABLE_API
+
+libgstbadion_@GST_API_VERSION@_la_LIBADD = $(GST_LIBS)
+libgstbadion_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
+
+libgstion_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/ion
+libgstion_@GST_API_VERSION@include_HEADERS = gstionmemory.h
+
+EXTRA_DIST =
+
diff --git a/gst-libs/gst/ion/gstionmemory.c b/gst-libs/gst/ion/gstionmemory.c
new file mode 100755
index 000000000000..ea62ac4926c1
--- /dev/null
+++ b/gst-libs/gst/ion/gstionmemory.c
@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 2016, Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <linux/ion.h>
+
+#include <gst/allocators/gstdmabuf.h>
+#include "gstionmemory.h"
+
+GST_DEBUG_CATEGORY_STATIC(ion_allocator_debug);
+#define GST_CAT_DEFAULT ion_allocator_debug
+
+#define gst_ion_allocator_parent_class parent_class
+
+#define PAGE_ALIGN(x) (((x) + 4095) & ~4095)
+
+G_DEFINE_TYPE(GstIONAllocator, gst_ion_allocator, GST_TYPE_ALLOCATOR)
+
+static int
+gst_ion_open()
+{
+ int fd = open("/dev/ion", O_RDWR);
+ if (fd < 0)
+ GST_ERROR ("open /dev/ion failed!\n");
+ return fd;
+}
+
+static int
+gst_ion_close(int fd)
+{
+ int ret = close(fd);
+ if (ret < 0)
+ return -errno;
+ return ret;
+}
+
+static int
+gst_ion_ioctl(int fd, int req, void *arg)
+{
+ int ret = ioctl(fd, req, arg);
+ if (ret < 0) {
+ GST_ERROR ("ioctl %x failed with code %d: %s\n", req,
+ ret, strerror(errno));
+ return -errno;
+ }
+ return ret;
+}
+
+static int
+gst_ion_alloc(int fd, size_t len, size_t align, unsigned int heap_mask,
+ unsigned int flags, ion_user_handle_t *handle)
+{
+ int ret;
+ struct ion_allocation_data data = {
+ .len = len,
+ .align = align,
+ .heap_id_mask = heap_mask,
+ .flags = flags,
+ };
+
+ if (handle == NULL)
+ return -EINVAL;
+
+ ret = gst_ion_ioctl(fd, ION_IOC_ALLOC, &data);
+ if (ret < 0)
+ return ret;
+ *handle = data.handle;
+ return ret;
+}
+
+static int
+gst_ion_free(int fd, ion_user_handle_t handle)
+{
+ struct ion_handle_data data = {
+ .handle = handle,
+ };
+ return gst_ion_ioctl(fd, ION_IOC_FREE, &data);
+}
+
+static int
+gst_ion_map(int fd, ion_user_handle_t handle, size_t length, int prot,
+ int flags, off_t offset, unsigned char **ptr, int *map_fd)
+{
+ int ret;
+ unsigned char *tmp_ptr;
+ struct ion_fd_data data = {
+ .handle = handle,
+ };
+
+ if (map_fd == NULL)
+ return -EINVAL;
+ if (ptr == NULL)
+ return -EINVAL;
+
+ ret = gst_ion_ioctl(fd, ION_IOC_MAP, &data);
+ if (ret < 0)
+ return ret;
+ if (data.fd < 0) {
+ GST_ERROR ("map ioctl returned negative fd\n");
+ return -EINVAL;
+ }
+ tmp_ptr = mmap(NULL, length, prot, flags, data.fd, offset);
+ if (tmp_ptr == MAP_FAILED) {
+ GST_ERROR ("mmap failed: %s\n", strerror(errno));
+ return -errno;
+ }
+ *map_fd = data.fd;
+ *ptr = tmp_ptr;
+ return ret;
+}
+
+static void
+gst_ion_mem_init(void)
+{
+ GstAllocator *allocator = g_object_new(gst_ion_allocator_get_type(), NULL);
+ GstIONAllocator *self = GST_ION_ALLOCATOR (allocator);
+ gint fd;
+
+ fd = gst_ion_open();
+ if (fd < 0) {
+ GST_ERROR ("Could not open ion driver");
+ g_object_unref (self);
+ return;
+ }
+
+ self->fd = fd;
+ self->dma_allocator = gst_dmabuf_allocator_new();
+
+ gst_allocator_register(GST_TYPE_ION_ALLOCATOR, allocator);
+}
+
+GstAllocator*
+gst_ion_allocator_obtain(void)
+{
+ static GOnce ion_allocator_once = G_ONCE_INIT;
+ GstAllocator *allocator;
+
+ g_once(&ion_allocator_once, (GThreadFunc)gst_ion_mem_init, NULL);
+
+ allocator = gst_allocator_find(GST_TYPE_ION_ALLOCATOR);
+ if (allocator == NULL)
+ GST_WARNING("No allocator named %s found", GST_TYPE_ION_ALLOCATOR);
+
+ return allocator;
+}
+
+GQuark
+gst_ion_memory_quark (void)
+{
+ static GQuark quark = 0;
+
+ if (quark == 0)
+ quark = g_quark_from_string ("GstIONPrivate");
+
+ return quark;
+}
+
+static GstMemory *
+gst_ion_alloc_alloc (GstAllocator * allocator, gint size,
+ GstAllocationParams * params)
+{
+ GstIONAllocator *self = GST_ION_ALLOCATOR (allocator);
+ gint dmafd = -1;
+ guint8 *ptr = NULL;
+ ion_user_handle_t ionHandle;
+ gint ionSize = PAGE_ALIGN (size + params->prefix + params->padding);
+ gint err;
+
+ if (self->fd < 0)
+ return NULL;
+
+ err = gst_ion_alloc(self->fd, ionSize, 8, 1, 0, &ionHandle);
+ if (err) {
+ GST_ERROR ("gst_ion_alloc failed.");
+ return NULL;
+ }
+
+ err = gst_ion_map(self->fd, ionHandle, ionSize, PROT_READ | PROT_WRITE,
+ MAP_SHARED, 0, &ptr, &dmafd);
+ if (err) {
+ GST_ERROR ("gst_ion_map failed.");
+ goto bail;
+ }
+ GST_DEBUG ("phyalloc ptr:0x%x, ionSize:%d dmafd: %d", (int32_t)ptr,
+ ionSize, dmafd);
+
+ GstIONMemory *ion_mem = g_slice_new0 (GstIONMemory);
+ gst_memory_init (GST_MEMORY_CAST (ion_mem), GST_MEMORY_FLAG_NO_SHARE,
+ allocator, 0, size, 0, 0, size);
+
+ ion_mem->vaddr = ptr;
+ ion_mem->size = ionSize;
+ ion_mem->handle = ionHandle;
+ ion_mem->fd = dmafd;
+
+ GstMemory * mem =
+ gst_dmabuf_allocator_alloc(self->dma_allocator, dmafd, ionSize);
+
+ gst_mini_object_set_qdata (GST_MINI_OBJECT (mem), GST_ION_MEMORY_QUARK,
+ ion_mem, gst_memory_unref);
+
+ GST_LOG ("allocated memory %p by allocator %p with qdata %p\n",
+ mem, allocator, ion_mem);
+
+ return mem;
+
+bail:
+ gst_ion_free(self->fd, ionHandle);
+ if (ptr != MAP_FAILED) {
+ munmap(ptr, ionSize);
+ }
+ if (dmafd > 0) {
+ close(dmafd);
+ }
+ return NULL;
+}
+
+static void
+gst_ion_alloc_free (GstAllocator * allocator, GstMemory * memory)
+{
+ GstIONAllocator *self = GST_ION_ALLOCATOR (allocator);
+ GstIONMemory *ion_mem = (GstIONMemory *) memory;
+
+ if (!ion_mem || self->fd < 0)
+ return;
+
+ ion_user_handle_t ionHandle =
+ (ion_user_handle_t)ion_mem->handle;
+ munmap(ion_mem->vaddr, ion_mem->size);
+ close(ion_mem->fd);
+ gst_ion_free(self->fd, ionHandle);
+
+ g_slice_free (GstIONMemory, ion_mem);
+}
+
+static void
+gst_ion_allocator_dispose (GObject * object)
+{
+ GstIONAllocator *self = GST_ION_ALLOCATOR (object);
+
+ if (self->fd > 0) {
+ close(self->fd);
+ self->fd = -1;
+ }
+
+ if (self->dma_allocator)
+ gst_object_unref(self->dma_allocator);
+ self->dma_allocator = NULL;
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+gst_ion_allocator_class_init (GstIONAllocatorClass * klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GstAllocatorClass *allocator_class = GST_ALLOCATOR_CLASS (klass);
+
+ allocator_class->alloc = GST_DEBUG_FUNCPTR (gst_ion_alloc_alloc);
+ allocator_class->free = GST_DEBUG_FUNCPTR (gst_ion_alloc_free);
+ gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_ion_allocator_dispose);
+
+ GST_DEBUG_CATEGORY_INIT(ion_allocator_debug, "ionmemory", 0, "DMA FD memory allocator based on ion");
+}
+
+static void
+gst_ion_allocator_init (GstIONAllocator * self)
+{
+ GstAllocator *allocator = GST_ALLOCATOR (self);
+
+ allocator->mem_type = GST_ALLOCATOR_ION;
+ allocator->mem_map = NULL;
+ allocator->mem_unmap = NULL;
+}
+
diff --git a/gst-libs/gst/ion/gstionmemory.h b/gst-libs/gst/ion/gstionmemory.h
new file mode 100755
index 000000000000..b6dca5fb9bfe
--- /dev/null
+++ b/gst-libs/gst/ion/gstionmemory.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016, Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_IONMEMORY_H__
+#define __GST_IONMEMORY_H__
+
+#include <gst/gst.h>
+#include <gst/gstallocator.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstIONAllocator GstIONAllocator;
+typedef struct _GstIONAllocatorClass GstIONAllocatorClass;
+typedef struct _GstIONMemory GstIONMemory;
+
+#define GST_ALLOCATOR_ION "ionmem"
+
+#define GST_TYPE_ION_ALLOCATOR gst_ion_allocator_get_type ()
+#define GST_IS_ION_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ GST_TYPE_ION_ALLOCATOR))
+#define GST_ION_ALLOCATOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_ION_ALLOCATOR, GstIONAllocator))
+#define GST_ION_ALLOCATOR_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_ION_ALLOCATOR, GstIONAllocatorClass))
+#define GST_ION_ALLOCATOR_CAST(obj) ((GstIONAllocator *)(obj))
+
+#define GST_ION_MEMORY_QUARK gst_ion_memory_quark ()
+
+struct _GstIONAllocator
+{
+ GstAllocator parent;
+
+ gint fd;
+ GstAllocator *dma_allocator;
+};
+
+struct _GstIONAllocatorClass
+{
+ GstAllocatorClass parent;
+};
+
+struct _GstIONMemory {
+ GstMemory mem;
+
+ gint fd;
+ guint8 *vaddr;
+ gsize size;
+ gint handle;
+};
+
+GType gst_ion_allocator_get_type (void);
+GstAllocator* gst_ion_allocator_obtain (void);
+
+G_END_DECLS
+
+#endif /* __GST_IONMEMORY_H__ */

View File

@ -0,0 +1,191 @@
From a81404f3e2ceb89f54d1b2345c7606b3863e5c71 Mon Sep 17 00:00:00 2001
From: Song Bing <bing.song@nxp.com>
Date: Wed, 13 Jul 2016 17:15:44 +0800
Subject: [PATCH] EGL_DMA_Buf: Wrong attribute list type for EGL 1.5
For EGL 1.5 spec, the attribute list type should be EGLAttrib.
Upstream-Status: Pending
https://bugzilla.gnome.org/show_bug.cgi?id=768602
---
gst-libs/gst/gl/egl/gsteglimagememory.c | 78 ++++++++++++++++++++++-----------
gst-libs/gst/gl/egl/gstglcontext_egl.c | 20 +++++----
gst-libs/gst/gl/egl/gstglcontext_egl.h | 3 ++
3 files changed, 66 insertions(+), 35 deletions(-)
diff --git a/gst-libs/gst/gl/egl/gsteglimagememory.c b/gst-libs/gst/gl/egl/gsteglimagememory.c
index 46098b507c45..6c5ae47055df 100644
--- a/gst-libs/gst/gl/egl/gsteglimagememory.c
+++ b/gst-libs/gst/gl/egl/gsteglimagememory.c
@@ -432,6 +432,9 @@ gst_egl_image_memory_from_dmabuf (GstGLContext * context,
gint fourcc;
gint atti = 0;
EGLint attribs[13];
+#ifdef EGL_VERSION_1_5
+ EGLAttrib attribs_1_5[13];
+#endif
EGLImageKHR img = EGL_NO_IMAGE_KHR;
allocator = gst_egl_image_allocator_obtain ();
@@ -442,32 +445,55 @@ gst_egl_image_memory_from_dmabuf (GstGLContext * context,
GST_VIDEO_INFO_COMP_WIDTH (in_info, plane),
GST_VIDEO_INFO_COMP_HEIGHT (in_info, plane));
- attribs[atti++] = EGL_WIDTH;
- attribs[atti++] = GST_VIDEO_INFO_COMP_WIDTH (in_info, plane);
- attribs[atti++] = EGL_HEIGHT;
- attribs[atti++] = GST_VIDEO_INFO_COMP_HEIGHT (in_info, plane);
-
- attribs[atti++] = EGL_LINUX_DRM_FOURCC_EXT;
- attribs[atti++] = fourcc;
-
- attribs[atti++] = EGL_DMA_BUF_PLANE0_FD_EXT;
- attribs[atti++] = dmabuf;
-
- attribs[atti++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT;
- attribs[atti++] = offset;
- attribs[atti++] = EGL_DMA_BUF_PLANE0_PITCH_EXT;
- attribs[atti++] = GST_VIDEO_INFO_PLANE_STRIDE (in_info, plane);
-
- attribs[atti] = EGL_NONE;
-
- for (int i = 0; i < atti; i++)
- GST_LOG ("attr %i: %08X", i, attribs[i]);
-
- g_assert (atti == 12);
-
- img = ctx_egl->eglCreateImage (ctx_egl->egl_display, EGL_NO_CONTEXT,
- EGL_LINUX_DMA_BUF_EXT, NULL, attribs);
-
+#ifdef EGL_VERSION_1_5
+ if (GST_GL_CHECK_GL_VERSION (ctx_egl->egl_major, ctx_egl->egl_minor, 1, 5)) {
+ attribs_1_5[atti++] = EGL_WIDTH;
+ attribs_1_5[atti++] = GST_VIDEO_INFO_COMP_WIDTH (in_info, plane);
+ attribs_1_5[atti++] = EGL_HEIGHT;
+ attribs_1_5[atti++] = GST_VIDEO_INFO_COMP_HEIGHT (in_info, plane);
+ attribs_1_5[atti++] = EGL_LINUX_DRM_FOURCC_EXT;
+ attribs_1_5[atti++] = fourcc;
+ attribs_1_5[atti++] = EGL_DMA_BUF_PLANE0_FD_EXT;
+ attribs_1_5[atti++] = dmabuf;
+ attribs_1_5[atti++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT;
+ attribs_1_5[atti++] = offset;
+ attribs_1_5[atti++] = EGL_DMA_BUF_PLANE0_PITCH_EXT;
+ attribs_1_5[atti++] = GST_VIDEO_INFO_PLANE_STRIDE (in_info, plane);
+ attribs_1_5[atti] = EGL_NONE;
+
+ for (int i = 0; i < atti; i++)
+ GST_LOG ("attr %i: %" G_GINTPTR_FORMAT, i, attribs_1_5[i]);
+
+ g_assert (atti == 12);
+
+ img = ctx_egl->eglCreateImage (ctx_egl->egl_display, EGL_NO_CONTEXT,
+ EGL_LINUX_DMA_BUF_EXT, NULL, attribs_1_5);
+
+ } else
+#endif
+ {
+ attribs[atti++] = EGL_WIDTH;
+ attribs[atti++] = GST_VIDEO_INFO_COMP_WIDTH (in_info, plane);
+ attribs[atti++] = EGL_HEIGHT;
+ attribs[atti++] = GST_VIDEO_INFO_COMP_HEIGHT (in_info, plane);
+ attribs[atti++] = EGL_LINUX_DRM_FOURCC_EXT;
+ attribs[atti++] = fourcc;
+ attribs[atti++] = EGL_DMA_BUF_PLANE0_FD_EXT;
+ attribs[atti++] = dmabuf;
+ attribs[atti++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT;
+ attribs[atti++] = offset;
+ attribs[atti++] = EGL_DMA_BUF_PLANE0_PITCH_EXT;
+ attribs[atti++] = GST_VIDEO_INFO_PLANE_STRIDE (in_info, plane);
+ attribs[atti] = EGL_NONE;
+
+ for (int i = 0; i < atti; i++)
+ GST_LOG ("attr %i: %08X", i, attribs[i]);
+
+ g_assert (atti == 12);
+
+ img = ctx_egl->eglCreateImage (ctx_egl->egl_display, EGL_NO_CONTEXT,
+ EGL_LINUX_DMA_BUF_EXT, NULL, attribs);
+ }
if (!img) {
GST_WARNING_OBJECT (allocator, "eglCreateImage failed: %s",
gst_gl_context_egl_get_error_string (eglGetError ()));
diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.c b/gst-libs/gst/gl/egl/gstglcontext_egl.c
index ceafdf344db8..df6ba3ffd66f 100644
--- a/gst-libs/gst/gl/egl/gstglcontext_egl.c
+++ b/gst-libs/gst/gl/egl/gstglcontext_egl.c
@@ -309,8 +309,8 @@ gst_gl_context_egl_create_context (GstGLContext * context,
GstGLContextEGL *egl;
GstGLWindow *window = NULL;
EGLNativeWindowType window_handle = (EGLNativeWindowType) 0;
- EGLint majorVersion;
- EGLint minorVersion;
+ EGLint egl_major;
+ EGLint egl_minor;
gboolean need_surface = TRUE;
guintptr external_gl_context = 0;
GstGLDisplay *display;
@@ -363,8 +363,8 @@ gst_gl_context_egl_create_context (GstGLContext * context,
}
gst_object_unref (display);
- if (eglInitialize (egl->egl_display, &majorVersion, &minorVersion)) {
- GST_INFO ("egl initialized, version: %d.%d", majorVersion, minorVersion);
+ if (eglInitialize (egl->egl_display, &egl_major, &egl_minor)) {
+ GST_INFO ("egl initialized, version: %d.%d", egl_major, egl_minor);
} else {
g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE,
@@ -380,16 +380,16 @@ gst_gl_context_egl_create_context (GstGLContext * context,
gint i;
/* egl + opengl only available with EGL 1.4+ */
- if (majorVersion == 1 && minorVersion <= 3) {
+ if (egl_major == 1 && egl_minor <= 3) {
if ((gl_api & ~GST_GL_API_OPENGL) == GST_GL_API_NONE) {
g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_OLD_LIBS,
"EGL version (%i.%i) too old for OpenGL support, (needed at least 1.4)",
- majorVersion, minorVersion);
+ egl_major, egl_minor);
goto failure;
} else {
GST_WARNING
("EGL version (%i.%i) too old for OpenGL support, (needed at least 1.4)",
- majorVersion, minorVersion);
+ egl_major, egl_minor);
if (gl_api & GST_GL_API_GLES2) {
goto try_gles2;
} else {
@@ -599,7 +599,7 @@ gst_gl_context_egl_create_context (GstGLContext * context,
}
/* EGLImage functions */
- if (GST_GL_CHECK_GL_VERSION (majorVersion, minorVersion, 1, 5)) {
+ if (GST_GL_CHECK_GL_VERSION (egl_major, egl_minor, 1, 5)) {
egl->eglCreateImage = gst_gl_context_get_proc_address (context,
"eglCreateImage");
egl->eglDestroyImage = gst_gl_context_get_proc_address (context,
@@ -614,7 +614,9 @@ gst_gl_context_egl_create_context (GstGLContext * context,
egl->eglCreateImage = NULL;
egl->eglDestroyImage = NULL;
}
-
+ egl->egl_major = egl_major;
+ egl->egl_minor = egl_minor;
+
if (window)
gst_object_unref (window);
diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.h b/gst-libs/gst/gl/egl/gstglcontext_egl.h
index 90abb03f8d8e..4a72ddf225c2 100644
--- a/gst-libs/gst/gl/egl/gstglcontext_egl.h
+++ b/gst-libs/gst/gl/egl/gstglcontext_egl.h
@@ -46,6 +46,9 @@ struct _GstGLContextEGL {
EGLSurface egl_surface;
EGLConfig egl_config;
+ gint egl_major;
+ gint egl_minor;
+
GstGLAPI gl_api;
const gchar *egl_exts;

View File

@ -0,0 +1,41 @@
From b451128bcb719d042fe37b5cbab4efe14d92ddf1 Mon Sep 17 00:00:00 2001
From: Haihua Hu <jared.hu@nxp.com>
Date: Mon, 1 Aug 2016 14:12:35 +0800
Subject: [PATCH] glimagesink: Fix horizontal/vertical flip matrizes
They were swapped.
Upstream-Status: Backport [1.9.2]
https://bugzilla.gnome.org/show_bug.cgi?id=769371
Signed-off-by: Haihua Hu <jared.hu@nxp.com>
---
ext/gl/gstglimagesink.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index fb60468b361e..cd3147d3fcd4 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -472,16 +472,16 @@ static const gfloat counterclockwise_matrix[] = {
/* horizontal-flip */
static const gfloat horizontal_flip_matrix[] = {
- 1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, -1.0f, 0.0f, 0.0f,
+ -1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f,
};
/* vertical-flip */
static const gfloat vertical_flip_matrix[] = {
- -1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, -1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f,
};

View File

@ -0,0 +1,68 @@
From 76477c4516556b9cc8ba95c6402e7b45f4868937 Mon Sep 17 00:00:00 2001
From: Haihua Hu <jared.hu@nxp.com>
Date: Wed, 27 Jul 2016 10:55:01 +0800
Subject: [PATCH] glwindow: Fix glimagesink cannot show frame when connect to
qmlglsrc
1.When connect to qmlglsrc, x11 event loop will be replace by qt event loop
which will cause the window cannot receive event from xserver, such as resize
2.Also advertise support for the affine transformation meta in the allocation
query.
Upstream-Status: Backport [1.9.2]
https://bugzilla.gnome.org/show_bug.cgi?id=768160
Signed-off-by: Haihua Hu <jared.hu@nxp.com>
---
ext/gl/gstglimagesink.c | 2 ++
gst-libs/gst/gl/x11/gstglwindow_x11.c | 14 +++++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index cd3147d3fcd4..d81fcfb42330 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -1957,6 +1957,8 @@ gst_glimage_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
gst_query_add_allocation_meta (query,
GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE, allocation_meta);
+ gst_query_add_allocation_meta (query,
+ GST_VIDEO_AFFINE_TRANSFORMATION_META_API_TYPE, 0);
if (allocation_meta)
gst_structure_free (allocation_meta);
diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c
index 67160f6d700d..bc7b9c09cf5f 100644
--- a/gst-libs/gst/gl/x11/gstglwindow_x11.c
+++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c
@@ -399,6 +399,7 @@ draw_cb (gpointer data)
GstGLWindow *window = GST_GL_WINDOW (window_x11);
if (gst_gl_window_is_running (window)) {
+ guint width, height;
XWindowAttributes attr;
XGetWindowAttributes (window_x11->device, window_x11->internal_win_id,
@@ -422,13 +423,16 @@ draw_cb (gpointer data)
}
}
- if (window_x11->allow_extra_expose_events) {
- if (window->queue_resize) {
- guint width, height;
+ gst_gl_window_get_surface_dimensions (window, &width, &height);
+ if (attr.width != width || attr.height != height) {
+ width = attr.width;
+ height = attr.height;
+ gst_gl_window_queue_resize (window);
+ }
- gst_gl_window_get_surface_dimensions (window, &width, &height);
+ if (window_x11->allow_extra_expose_events) {
+ if (window->queue_resize)
gst_gl_window_resize (window, width, height);
- }
if (window->draw) {
GstGLContext *context = gst_gl_window_get_context (window);

View File

@ -0,0 +1,369 @@
From 8df54492568e25a91febd36190cb386be369195b Mon Sep 17 00:00:00 2001
From: Song Bing <bing.song@nxp.com>
Date: Fri, 12 Aug 2016 09:33:00 +0800
Subject: [PATCH] ion_allocator: refine ion allocator code.
Refine ion allocator code and remove all compile warning.
Changed ion allocated heap to DMA.
Upstream-Status: Pending
https://bugzilla.gnome.org/show_bug.cgi?id=768794
---
gst-libs/gst/ion/gstionmemory.c | 232 ++++++++++++++--------------------------
gst-libs/gst/ion/gstionmemory.h | 1 -
2 files changed, 82 insertions(+), 151 deletions(-)
diff --git a/gst-libs/gst/ion/gstionmemory.c b/gst-libs/gst/ion/gstionmemory.c
index ea62ac4926c1..4c160c94176a 100755
--- a/gst-libs/gst/ion/gstionmemory.c
+++ b/gst-libs/gst/ion/gstionmemory.c
@@ -21,6 +21,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/types.h>
@@ -29,116 +30,34 @@
#include <gst/allocators/gstdmabuf.h>
#include "gstionmemory.h"
-GST_DEBUG_CATEGORY_STATIC(ion_allocator_debug);
+GST_DEBUG_CATEGORY_STATIC (ion_allocator_debug);
#define GST_CAT_DEFAULT ion_allocator_debug
#define gst_ion_allocator_parent_class parent_class
#define PAGE_ALIGN(x) (((x) + 4095) & ~4095)
-G_DEFINE_TYPE(GstIONAllocator, gst_ion_allocator, GST_TYPE_ALLOCATOR)
+G_DEFINE_TYPE (GstIONAllocator, gst_ion_allocator, GST_TYPE_ALLOCATOR)
-static int
-gst_ion_open()
+static gint
+gst_ion_ioctl (gint fd, gint req, void *arg)
{
- int fd = open("/dev/ion", O_RDWR);
- if (fd < 0)
- GST_ERROR ("open /dev/ion failed!\n");
- return fd;
-}
-
-static int
-gst_ion_close(int fd)
-{
- int ret = close(fd);
- if (ret < 0)
- return -errno;
- return ret;
-}
-
-static int
-gst_ion_ioctl(int fd, int req, void *arg)
-{
- int ret = ioctl(fd, req, arg);
+ gint ret = ioctl (fd, req, arg);
if (ret < 0) {
- GST_ERROR ("ioctl %x failed with code %d: %s\n", req,
- ret, strerror(errno));
- return -errno;
- }
- return ret;
-}
-
-static int
-gst_ion_alloc(int fd, size_t len, size_t align, unsigned int heap_mask,
- unsigned int flags, ion_user_handle_t *handle)
-{
- int ret;
- struct ion_allocation_data data = {
- .len = len,
- .align = align,
- .heap_id_mask = heap_mask,
- .flags = flags,
- };
-
- if (handle == NULL)
- return -EINVAL;
-
- ret = gst_ion_ioctl(fd, ION_IOC_ALLOC, &data);
- if (ret < 0)
- return ret;
- *handle = data.handle;
- return ret;
-}
-
-static int
-gst_ion_free(int fd, ion_user_handle_t handle)
-{
- struct ion_handle_data data = {
- .handle = handle,
- };
- return gst_ion_ioctl(fd, ION_IOC_FREE, &data);
-}
-
-static int
-gst_ion_map(int fd, ion_user_handle_t handle, size_t length, int prot,
- int flags, off_t offset, unsigned char **ptr, int *map_fd)
-{
- int ret;
- unsigned char *tmp_ptr;
- struct ion_fd_data data = {
- .handle = handle,
- };
-
- if (map_fd == NULL)
- return -EINVAL;
- if (ptr == NULL)
- return -EINVAL;
-
- ret = gst_ion_ioctl(fd, ION_IOC_MAP, &data);
- if (ret < 0)
- return ret;
- if (data.fd < 0) {
- GST_ERROR ("map ioctl returned negative fd\n");
- return -EINVAL;
- }
- tmp_ptr = mmap(NULL, length, prot, flags, data.fd, offset);
- if (tmp_ptr == MAP_FAILED) {
- GST_ERROR ("mmap failed: %s\n", strerror(errno));
- return -errno;
+ GST_ERROR ("ioctl %x failed with code %d: %s\n", req, ret,
+ strerror (errno));
}
- *map_fd = data.fd;
- *ptr = tmp_ptr;
return ret;
}
-static void
-gst_ion_mem_init(void)
+static void
+gst_ion_mem_init (void)
{
- GstAllocator *allocator = g_object_new(gst_ion_allocator_get_type(), NULL);
+ GstAllocator *allocator = g_object_new (gst_ion_allocator_get_type (), NULL);
GstIONAllocator *self = GST_ION_ALLOCATOR (allocator);
gint fd;
- fd = gst_ion_open();
+ fd = open ("/dev/ion", O_RDWR);
if (fd < 0) {
GST_ERROR ("Could not open ion driver");
g_object_unref (self);
@@ -146,24 +65,24 @@ gst_ion_mem_init(void)
}
self->fd = fd;
- self->dma_allocator = gst_dmabuf_allocator_new();
+ self->dma_allocator = gst_dmabuf_allocator_new ();
- gst_allocator_register(GST_TYPE_ION_ALLOCATOR, allocator);
+ gst_allocator_register (GST_ALLOCATOR_ION, allocator);
}
-GstAllocator*
-gst_ion_allocator_obtain(void)
+GstAllocator *
+gst_ion_allocator_obtain (void)
{
- static GOnce ion_allocator_once = G_ONCE_INIT;
- GstAllocator *allocator;
+ static GOnce ion_allocator_once = G_ONCE_INIT;
+ GstAllocator *allocator;
- g_once(&ion_allocator_once, (GThreadFunc)gst_ion_mem_init, NULL);
+ g_once (&ion_allocator_once, (GThreadFunc) gst_ion_mem_init, NULL);
- allocator = gst_allocator_find(GST_TYPE_ION_ALLOCATOR);
- if (allocator == NULL)
- GST_WARNING("No allocator named %s found", GST_TYPE_ION_ALLOCATOR);
+ allocator = gst_allocator_find (GST_ALLOCATOR_ION);
+ if (allocator == NULL)
+ GST_WARNING ("No allocator named %s found", GST_ALLOCATOR_ION);
- return allocator;
+ return allocator;
}
GQuark
@@ -178,62 +97,69 @@ gst_ion_memory_quark (void)
}
static GstMemory *
-gst_ion_alloc_alloc (GstAllocator * allocator, gint size,
+gst_ion_alloc_alloc (GstAllocator * allocator, gsize size,
GstAllocationParams * params)
{
GstIONAllocator *self = GST_ION_ALLOCATOR (allocator);
- gint dmafd = -1;
- guint8 *ptr = NULL;
- ion_user_handle_t ionHandle;
- gint ionSize = PAGE_ALIGN (size + params->prefix + params->padding);
- gint err;
-
- if (self->fd < 0)
+ struct ion_allocation_data allocation_data = { 0 };
+ struct ion_fd_data fd_data = { 0 };
+ struct ion_handle_data handle_data = { 0 };
+ ion_user_handle_t ion_handle;
+ GstIONMemory *ion_mem;
+ GstMemory *mem;
+ gsize ion_size;
+ gint dma_fd = -1;
+ gint ret;
+
+ if (self->fd < 0) {
+ GST_ERROR ("ion allocate param wrong");
return NULL;
+ }
- err = gst_ion_alloc(self->fd, ionSize, 8, 1, 0, &ionHandle);
- if (err) {
- GST_ERROR ("gst_ion_alloc failed.");
+ ion_size = PAGE_ALIGN (size + params->prefix + params->padding);
+ allocation_data.len = ion_size;
+ allocation_data.align = params->align;
+ allocation_data.heap_id_mask = ION_HEAP_TYPE_DMA_MASK;
+ allocation_data.flags = 0;
+ if (gst_ion_ioctl (self->fd, ION_IOC_ALLOC, &allocation_data) < 0) {
+ GST_ERROR ("ion allocate failed.");
return NULL;
}
+ ion_handle = allocation_data.handle;
- err = gst_ion_map(self->fd, ionHandle, ionSize, PROT_READ | PROT_WRITE,
- MAP_SHARED, 0, &ptr, &dmafd);
- if (err) {
- GST_ERROR ("gst_ion_map failed.");
+ fd_data.handle = ion_handle;
+ ret = gst_ion_ioctl (self->fd, ION_IOC_MAP, &fd_data);
+ if (ret < 0 || fd_data.fd < 0) {
+ GST_ERROR ("map ioctl failed or returned negative fd");
goto bail;
}
- GST_DEBUG ("phyalloc ptr:0x%x, ionSize:%d dmafd: %d", (int32_t)ptr,
- ionSize, dmafd);
+ dma_fd = fd_data.fd;
- GstIONMemory *ion_mem = g_slice_new0 (GstIONMemory);
+ ion_mem = g_slice_new0 (GstIONMemory);
gst_memory_init (GST_MEMORY_CAST (ion_mem), GST_MEMORY_FLAG_NO_SHARE,
- allocator, 0, size, 0, 0, size);
+ allocator, NULL, ion_size, params->align, params->prefix, size);
- ion_mem->vaddr = ptr;
- ion_mem->size = ionSize;
- ion_mem->handle = ionHandle;
- ion_mem->fd = dmafd;
+ ion_mem->size = ion_size;
+ ion_mem->handle = ion_handle;
+ ion_mem->fd = dma_fd;
- GstMemory * mem =
- gst_dmabuf_allocator_alloc(self->dma_allocator, dmafd, ionSize);
+ mem = gst_dmabuf_allocator_alloc (self->dma_allocator, dma_fd, size);
gst_mini_object_set_qdata (GST_MINI_OBJECT (mem), GST_ION_MEMORY_QUARK,
- ion_mem, gst_memory_unref);
+ ion_mem, (GDestroyNotify) gst_memory_unref);
- GST_LOG ("allocated memory %p by allocator %p with qdata %p\n",
- mem, allocator, ion_mem);
+ GST_LOG ("ion allocated size: %" G_GSIZE_FORMAT "DMA FD: %d", ion_size,
+ dma_fd);
return mem;
bail:
- gst_ion_free(self->fd, ionHandle);
- if (ptr != MAP_FAILED) {
- munmap(ptr, ionSize);
- }
- if (dmafd > 0) {
- close(dmafd);
+ if (dma_fd >= 0) {
+ close (dma_fd);
}
+ handle_data.handle = ion_handle;
+ gst_ion_ioctl (self->fd, ION_IOC_FREE, &handle_data);
+
return NULL;
}
@@ -242,15 +168,20 @@ gst_ion_alloc_free (GstAllocator * allocator, GstMemory * memory)
{
GstIONAllocator *self = GST_ION_ALLOCATOR (allocator);
GstIONMemory *ion_mem = (GstIONMemory *) memory;
+ struct ion_handle_data handle_data = { 0 };
+ ion_user_handle_t ion_handle;
- if (!ion_mem || self->fd < 0)
+ if (self->fd < 0 || !ion_mem || ion_mem->fd < 0) {
+ GST_ERROR ("ion free param wrong");
return;
+ }
- ion_user_handle_t ionHandle =
- (ion_user_handle_t)ion_mem->handle;
- munmap(ion_mem->vaddr, ion_mem->size);
- close(ion_mem->fd);
- gst_ion_free(self->fd, ionHandle);
+ GST_LOG ("ion free size: %" G_GSIZE_FORMAT "DMA FD: %d", ion_mem->size,
+ ion_mem->fd);
+ close (ion_mem->fd);
+ ion_handle = (ion_user_handle_t) ion_mem->handle;
+ handle_data.handle = ion_handle;
+ gst_ion_ioctl (self->fd, ION_IOC_FREE, &handle_data);
g_slice_free (GstIONMemory, ion_mem);
}
@@ -261,13 +192,14 @@ gst_ion_allocator_dispose (GObject * object)
GstIONAllocator *self = GST_ION_ALLOCATOR (object);
if (self->fd > 0) {
- close(self->fd);
+ close (self->fd);
self->fd = -1;
}
- if (self->dma_allocator)
- gst_object_unref(self->dma_allocator);
- self->dma_allocator = NULL;
+ if (self->dma_allocator) {
+ gst_object_unref (self->dma_allocator);
+ self->dma_allocator = NULL;
+ }
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -282,7 +214,8 @@ gst_ion_allocator_class_init (GstIONAllocatorClass * klass)
allocator_class->free = GST_DEBUG_FUNCPTR (gst_ion_alloc_free);
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_ion_allocator_dispose);
- GST_DEBUG_CATEGORY_INIT(ion_allocator_debug, "ionmemory", 0, "DMA FD memory allocator based on ion");
+ GST_DEBUG_CATEGORY_INIT (ion_allocator_debug, "ionmemory", 0,
+ "DMA FD memory allocator based on ion");
}
static void
@@ -294,4 +227,3 @@ gst_ion_allocator_init (GstIONAllocator * self)
allocator->mem_map = NULL;
allocator->mem_unmap = NULL;
}
-
diff --git a/gst-libs/gst/ion/gstionmemory.h b/gst-libs/gst/ion/gstionmemory.h
index b6dca5fb9bfe..406806d8d7cb 100755
--- a/gst-libs/gst/ion/gstionmemory.h
+++ b/gst-libs/gst/ion/gstionmemory.h
@@ -59,7 +59,6 @@ struct _GstIONMemory {
GstMemory mem;
gint fd;
- guint8 *vaddr;
gsize size;
gint handle;
};

View File

@ -0,0 +1,32 @@
From 1ae4df222f7c0e141e61e22228c9d69b7966f84c Mon Sep 17 00:00:00 2001
From: Song Bing <bing.song@nxp.com>
Date: Tue, 16 Aug 2016 13:11:57 +0800
Subject: [PATCH] videocompositor: Remove output format alpha check
Remove output format alpha check, or output without alpha will
fail if input has alpha.
Upstream-Status: Pending
https://bugzilla.gnome.org/show_bug.cgi?id=769962
---
gst-libs/gst/video/gstvideoaggregator.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/gst-libs/gst/video/gstvideoaggregator.c b/gst-libs/gst/video/gstvideoaggregator.c
index 1254e2e53560..4bd57b482b5e 100644
--- a/gst-libs/gst/video/gstvideoaggregator.c
+++ b/gst-libs/gst/video/gstvideoaggregator.c
@@ -777,11 +777,9 @@ gst_videoaggregator_update_src_caps (GstVideoAggregator * vagg)
g_return_val_if_fail (finfo != NULL, FALSE);
if (at_least_one_alpha && !(finfo->flags & GST_VIDEO_FORMAT_FLAG_ALPHA)) {
- GST_ELEMENT_ERROR (vagg, CORE, NEGOTIATION,
+ GST_WARNING_OBJECT (vagg,
("At least one of the input pads contains alpha, but configured caps don't support alpha."),
("Either convert your inputs to not contain alpha or add a videoconvert after the aggregator"));
- ret = FALSE;
- goto done;
}
}

View File

@ -1,41 +0,0 @@
# Copyright (C) 2015 Digi International
FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:"
SRC_URI_append_ccimx6 = " \
file://egl-workaround-for-eglCreateContext-isn-t-thread-safe.patch \
file://camerabin-Add-one-property-to-set-sink-element-for-video.patch \
file://0011-videoparse-modifiy-the-videoparse-rank.patch \
file://camerabin-examples-memory-leak-in-camerabin-examples-01.patch \
file://camerabin-examples-memory-leak-in-camerabin-examples-02.patch \
file://dvbsuboverlay-Set-query-ALLOCATION-need_pool-to-FALSE.patch \
file://0002-mpegtsmux-Need-get-pid-when-create-streams.patch \
file://0006-h263parse_fix_CPFMT_parsing.patch \
file://0009-mpeg4videoparse-Need-detect-picture-coding-type-when.patch \
file://0010-mpegvideoparse-Need-detect-picture-coding-type-when-.patch \
file://0012-glfilter-Lost-frame-rate-info-when-fixate-caps.patch \
file://0014-opencv-rename-gstopencv.c-to-gstopencv.cpp.patch \
file://0015-opencv-Add-video-stitching-support.patch \
file://0016-PATCH-gstaggregator-memory-leak-increasing-a-lot-aft.patch \
file://1.4.5-Use-viv-direct-texture-to-bind-buffer.patch \
file://0001-Support-croping-and-alignment-handling.patch \
file://Fix-warnnig-log-in-glfilter.patch \
file://Adding-some-fragment-shaders-for-glshader-plugin.patch \
file://Fix-for-gl-plugin-not-built-in-wayland-backend.patch \
file://0003-glimagesink-Add-fps-print-in-glimagesink.patch \
file://0004-gl-fb-Support-fb-backend-for-gl-plugins.patch \
file://0005-gl-wayland-Make-it-always-fullscreen-1024x768.patch \
file://0007-glfilter-Fix-video-is-tearing-after-enab.patch \
file://0008-gl-Fix-glimagesink-loop-playback-failed-in-wayland.patch \
file://0017-MMFMWK-6778-Support-more-format-in-direct-viv.patch \
"
# Revert Poky commit cdc2c8aeaa96b07dfc431a4cf0bf51ef7f8802a3 (move EGL to Wayland)
# Otherwise 'glimagesink' for X11 is not compiled and for example this sink is needed
# by 'imxcamera' application (distributed by FSL in binary form)
PACKAGECONFIG[gles2] = "--enable-gles2 --enable-egl,--disable-gles2 --disable-egl,virtual/libgles2 virtual/egl"
PACKAGECONFIG[wayland] = "--enable-wayland --disable-x11,--disable-wayland,wayland"
# include fragment shaders
FILES_${PN}-opengl += "/usr/share/*.fs"

View File

@ -0,0 +1,32 @@
# Copyright 2015-2017, Digi International Inc.
FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:"
SRC_URI_append_imxgpu2d = " \
file://0001-mpegtsmux-Need-get-pid-when-create-streams.patch \
file://0002-mpeg4videoparse-Need-detect-picture-coding-type-when.patch \
file://0003-mpegvideoparse-Need-detect-picture-coding-type-when-.patch \
file://0004-modifiy-the-videoparse-rank.patch \
file://0005-glfilter-Lost-frame-rate-info-when-fixate-caps.patch \
file://0006-opencv-Add-video-stitching-support-based-on-Open-CV.patch \
file://0007-camerabin-Add-one-property-to-set-sink-element-for-v.patch \
file://0008-Fix-for-gl-plugin-not-built-in-wayland-backend.patch \
file://0009-gl-wayland-fix-loop-test-hang-in-glimagesink.patch \
file://0010-Fix-glimagesink-wayland-resize-showed-blurred-screen.patch \
file://0011-support-video-crop-for-glimagesink.patch \
file://0012-Add-fps-print-in-glimagesink.patch \
file://0013-glimagesink-support-video-rotation-using-transform-m.patch \
file://0014-ion-DMA-Buf-allocator-based-on-ion.patch \
file://0015-EGL_DMA_Buf-Wrong-attribute-list-type-for-EGL-1.5.patch \
file://0016-glimagesink-Fix-horizontal-vertical-flip-matrizes.patch \
file://0017-glwindow-Fix-glimagesink-cannot-show-frame-when-conn.patch \
file://0018-ion_allocator-refine-ion-allocator-code.patch \
file://0019-videocompositor-Remove-output-format-alpha-check.patch \
"
# Enable 'egl' packageconfig so 'glimagesink' is compiled
PACKAGECONFIG_GL_append_imxgpu3d = " ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'egl', '', d)}"
# include fragment shaders
FILES_${PN}-opengl += "/usr/share/*.fs"