[meta-freescale] [PATCH 4/6] gstreamer1.0-plugins-bad: Convert YUV to RGB using directviv

Yuqing Zhu carol.zhu at nxp.com
Thu Dec 22 02:26:40 PST 2016


Add a property "disable_passthrough" in glcolorconvert for enable/disable passthrough.
When need convert YUV to RGB with directviv, set it to be TRUE.

Signed-off-by: Yuqing Zhu <carol.zhu at nxp.com>
---
 ...rconvert-convert-YUV-to-RGB-use-directviv.patch | 168 +++++++++++++++++++++
 .../gstreamer1.0-plugins-bad_1.10.%.bbappend       |   1 +
 2 files changed, 169 insertions(+)
 create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch

diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch
new file mode 100644
index 0000000..f126f17
--- /dev/null
+++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch
@@ -0,0 +1,168 @@
+From 64718397e93087ffe37ad3209535ef84e15854aa Mon Sep 17 00:00:00 2001
+From: Haihua Hu <b55597 at freescale.com>
+Date: Thu, 25 Feb 2016 13:53:20 +0800
+Subject: [PATCH 16/26] glcolorconvert: convert YUV to RGB use directviv
+
+Add a property "disable_passthrough" in glcolorconvert for enable/disable passthrough.
+When need convert YUV to RGB with directviv, set it to be TRUE.
+
+Upstream-Status: Inappropriate [i.MX specific]
+
+Signed-off-by: Haihua Hu <b55597 at freescale.com>
+
+Conflicts:
+	gst-libs/gst/gl/gstglcolorconvert.c
+---
+ ext/gl/gstglcolorconvertelement.c   | 70 +++++++++++++++++++++++++++++++++++++
+ ext/gl/gstglcolorconvertelement.h   |  1 +
+ gst-libs/gst/gl/gstglcolorconvert.c |  6 +++-
+ 3 files changed, 76 insertions(+), 1 deletion(-)
+
+diff --git a/ext/gl/gstglcolorconvertelement.c b/ext/gl/gstglcolorconvertelement.c
+index 642b494..5e26f84 100644
+--- a/ext/gl/gstglcolorconvertelement.c
++++ b/ext/gl/gstglcolorconvertelement.c
+@@ -35,6 +35,14 @@ G_DEFINE_TYPE_WITH_CODE (GstGLColorConvertElement, gst_gl_color_convert_element,
+         "glconvertelement", 0, "convert");
+     );
+ 
++enum
++{
++  GL_COLOR_CONVERT_PROP_0,
++  GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH
++};
++
++#define DISABLE_PASSTHROUGH_DAFAULT FALSE
++
+ static gboolean gst_gl_color_convert_element_set_caps (GstBaseTransform * bt,
+     GstCaps * in_caps, GstCaps * out_caps);
+ static GstCaps *gst_gl_color_convert_element_transform_caps (GstBaseTransform *
+@@ -54,6 +62,15 @@ static GstFlowReturn gst_gl_color_convert_element_transform (GstBaseTransform *
+ static GstCaps *gst_gl_color_convert_element_fixate_caps (GstBaseTransform *
+     bt, GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
+ 
++static void gst_gl_color_convert_set_property (GObject *object,
++    guint prop_id,
++    const GValue *value,
++    GParamSpec *pspec);
++static void gst_gl_color_convert_get_property (GObject *object,
++    guint prop_id,
++    GValue *value,
++    GParamSpec *pspec);
++
+ static GstStaticPadTemplate gst_gl_color_convert_element_src_pad_template =
+ GST_STATIC_PAD_TEMPLATE ("src",
+     GST_PAD_SRC,
+@@ -89,6 +106,10 @@ gst_gl_color_convert_element_class_init (GstGLColorConvertElementClass * klass)
+ {
+   GstBaseTransformClass *bt_class = GST_BASE_TRANSFORM_CLASS (klass);
+   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
++  GObjectClass *object_class = G_OBJECT_CLASS (klass);
++
++  object_class->set_property = gst_gl_color_convert_set_property;
++  object_class->get_property = gst_gl_color_convert_get_property;
+ 
+   bt_class->transform_caps = gst_gl_color_convert_element_transform_caps;
+   bt_class->set_caps = gst_gl_color_convert_element_set_caps;
+@@ -108,6 +129,13 @@ gst_gl_color_convert_element_class_init (GstGLColorConvertElementClass * klass)
+   gst_element_class_add_static_pad_template (element_class,
+       &gst_gl_color_convert_element_sink_pad_template);
+ 
++  g_object_class_install_property (object_class, GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH,
++      g_param_spec_boolean ("disable_passthrough",
++          "Disable passthrough",
++          "Disable passthrough mode",
++          DISABLE_PASSTHROUGH_DAFAULT,
++          G_PARAM_READWRITE));
++
+   gst_element_class_set_metadata (element_class,
+       "OpenGL color converter", "Filter/Converter/Video",
+       "Converts between color spaces using OpenGL shaders",
+@@ -119,6 +147,41 @@ gst_gl_color_convert_element_init (GstGLColorConvertElement * convert)
+ {
+   gst_base_transform_set_prefer_passthrough (GST_BASE_TRANSFORM (convert),
+       TRUE);
++  convert->disable_passthrough = FALSE;
++}
++
++static void
++gst_gl_color_convert_set_property (GObject *object,
++    guint prop_id,
++    const GValue *value,
++    GParamSpec *pspec)
++{
++  GstGLColorConvertElement *convert = GST_GL_COLOR_CONVERT_ELEMENT (object);
++  switch (prop_id) {
++    case GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH:
++      convert->disable_passthrough = g_value_get_boolean (value);
++      break;
++    default:
++      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
++      break;
++  }
++}
++
++static void
++gst_gl_color_convert_get_property (GObject *object,
++    guint prop_id,
++    GValue *value,
++    GParamSpec *pspec)
++{
++  GstGLColorConvertElement *convert = GST_GL_COLOR_CONVERT_ELEMENT (object);
++  switch (prop_id) {
++    case GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH:
++      g_value_set_boolean (value, convert->disable_passthrough);
++      break;
++    default:
++      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
++      break;
++  }
+ }
+ 
+ static gboolean
+@@ -133,6 +196,13 @@ gst_gl_color_convert_element_set_caps (GstBaseTransform * bt,
+   if (convert->convert)
+     gst_gl_color_convert_set_caps (convert->convert, in_caps, out_caps);
+ 
++  if(gst_base_transform_is_passthrough (bt) && convert->disable_passthrough){
++    /* if in passthrough mode and disable_passthrough is set to true, 
++     * set passthrough to FALSE*/
++    GST_DEBUG_OBJECT(convert, "Disable passthrough mode");
++    gst_base_transform_set_passthrough(bt, FALSE);
++  }
++
+   return TRUE;
+ }
+ 
+diff --git a/ext/gl/gstglcolorconvertelement.h b/ext/gl/gstglcolorconvertelement.h
+index 2a0dd1d..5cdbd3a 100644
+--- a/ext/gl/gstglcolorconvertelement.h
++++ b/ext/gl/gstglcolorconvertelement.h
+@@ -47,6 +47,7 @@ struct _GstGLColorConvertElement
+   GstGLColorConvert *convert;
+   GstCaps *in_caps;
+   GstCaps *out_caps;
++  gboolean disable_passthrough;
+ };
+ 
+ struct _GstGLColorConvertElementClass
+diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c
+index 908a53e..4f072f5 100644
+--- a/gst-libs/gst/gl/gstglcolorconvert.c
++++ b/gst-libs/gst/gl/gstglcolorconvert.c
+@@ -710,7 +710,11 @@ _gst_gl_color_convert_set_caps_unlocked (GstGLColorConvert * convert,
+   convert->priv->to_texture_target = to_target;
+   convert->initted = FALSE;
+ 
+-  convert->passthrough = passthrough;
++  /* We may disable passthrough via an external property
++   * By the way, when glconvertelement is in passthrough mode, 
++   * the plugin will not call gst_gl_color_convert_perform().*/
++
++  //convert->passthrough = passthrough;
+ #ifndef GST_DISABLE_GST_DEBUG
+   if (G_UNLIKELY (convert->passthrough))
+     GST_DEBUG_OBJECT (convert,
+-- 
+1.9.1
+
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend
index 2acd307..6ae6bad 100644
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend
+++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend
@@ -12,6 +12,7 @@ SRC_URI_append_imxgpu2d = " \
     file://0002-Support-fb-backend-for-gl-plugins.patch \
     file://0003-Add-directviv-to-glimagesink-to-improve-playback-per.patch \
     file://0004-MMFMWK-6930-glplugin-Accelerate-gldownload-with.patch \
+    file://0005-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch \
 "
 
 
-- 
1.9.1



More information about the meta-freescale mailing list