[Cogl] [PATCH] gst: Comb out bugs from hardware acceleration code

Plamena Manolova plamena.n.manolova at intel.com
Wed Mar 13 08:35:28 PDT 2013


---
 cogl-gst/cogl-gst-video-sink.c | 30 +++++++++++++++---------------
 configure.ac                   | 13 +++++++++++--
 2 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
index 8de2fb5..048094f 100644
--- a/cogl-gst/cogl-gst-video-sink.c
+++ b/cogl-gst/cogl-gst-video-sink.c
@@ -578,7 +578,7 @@ static CoglGstRenderer ayuv_glsl_renderer =
 static void
 cogl_gst_hw_init (CoglGstVideoSink *sink)
 {
-  create_template_pipeline (sink, NULL, NULL, FALSE, 1);
+  create_template_pipeline (sink, NULL, NULL, 1);
 }
 
 static void
@@ -589,15 +589,13 @@ cogl_gst_hw_deinit (CoglGstVideoSink* sink)
   sink->priv->converter = NULL;
 }
 
-static void
+static CoglBool
 cogl_gst_hw_upload (CoglGstVideoSink *sink,
                     GstBuffer *buffer)
 {
-  CoglGstVideoSinkPriv *priv = sink->priv;
+  CoglGstVideoSinkPrivate *priv = sink->priv;
   GstSurfaceMeta* surface = gst_buffer_get_surface_meta (buffer);
 
-  g_return_if_fail (surface != NULL);
-
   if (G_UNLIKELY (priv->converter == NULL))
     {
       unsigned int gl_tex;
@@ -609,20 +607,19 @@ cogl_gst_hw_upload (CoglGstVideoSink *sink,
       priv->frame[0] = cogl_texture_new_with_size (priv->ctx, priv->info.width,
                                                    priv->info.height,
                                                    COGL_GST_TEXTURE_FLAGS,
-                                                   COGL_PIXEL_FORMAT_BGRA_8888,
-                                                   NULL);
+                                                   COGL_PIXEL_FORMAT_BGRA_8888);
 
-      cogl_pipeline_set_layer_texture (priv->pipeline, 0, priv->frame[0]);
-      cogl_texture_get_gl_texture (tex, &gl_texture, &gl_target);
+      cogl_texture_get_gl_texture (priv->frame[0], &gl_tex, &gl_tar);
 
-      g_value_init (&value, gl_texture);
-      g_value_set_uint (&value, gl_texture);
+      g_value_init (&value, G_TYPE_UINT);
+      g_value_set_uint (&value, gl_tex);
 
-      priv->converter = gst_surface_meta_create_converter (surface, "opengl"
+      priv->converter = gst_surface_meta_create_converter (surface, "opengl",
                                                            &value);
-      g_return_if_fail (priv->converter);
     }
   gst_surface_converter_upload (priv->converter, buffer);
+
+  return TRUE;
 }
 
 static CoglGstRenderer hw_renderer = {
@@ -649,15 +646,16 @@ cogl_gst_build_renderers_list (CoglContext *ctx)
     &rgb32_renderer,
     &yv12_glsl_renderer,
     &i420_glsl_renderer,
+    &ayuv_glsl_renderer,
     #ifdef HAVE_HW_DECODER_SUPPORT
     &hw_renderer,
     #endif
-    &ayuv_glsl_renderer
+    NULL
   };
 
   has_glsl = cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL);
 
-  for (i = 0; i < G_N_ELEMENTS (renderers); i++)
+  for (i = 0; renderers[i]; i++)
     if (has_glsl || !(renderers[i]->flags & COGL_GST_RENDERER_NEEDS_GLSL))
       list = g_slist_prepend (list, renderers[i]);
 
@@ -800,6 +798,8 @@ cogl_gst_video_sink_parse_caps (GstCaps *caps,
 
   renderer = cogl_gst_find_renderer_by_format (sink, format);
 
+  g_warning ("found the %s renderer", renderer->name);
+
   if (G_UNLIKELY (renderer == NULL))
     goto no_suitable_renderer;
 
diff --git a/configure.ac b/configure.ac
index 28dc240..c31c271 100644
--- a/configure.ac
+++ b/configure.ac
@@ -450,8 +450,9 @@ AS_IF([test "x$enable_cogl_gst" = "xyes"],
   COGL_GST_PKG_REQUIRES="$COGL_GST_PKG_REQUIRES gstreamer-1.0  gstreamer-fft-1.0 \
                          gstreamer-audio-1.0 gstreamer-base-1.0 \
                          gstreamer-video-1.0 gstreamer-plugins-base-1.0 \
-                         gstreamer-tag-1.0 gstreamer-controller-1.0"
-                         
+                         gstreamer-tag-1.0 gstreamer-controller-1.0 \
+                         gstreamer-basevideo-1.0"
+
   GST_MAJORMINOR=1.0
 
   dnl define location of gstreamer plugin directory
@@ -1175,6 +1176,13 @@ AS_IF([test "x$enable_cogl_gst" = "xyes"],
 )
 AM_CONDITIONAL([BUILD_COGL_GST], [test "x$enable_cogl_gst" = "xyes"])
 
+have_hw_decoder_support=no
+#PKG_CHECK_MODULES(HW, [$COGL_GST_PKG_REQUIRES], [have_hw_decoder_support=yes
+#                  AC_DEFINE([HAVE_HW_DECODER_SUPPORT], [1],
+#                  ["Defined if building Cogl-Gst with HW decoder support"])
+#                  ],[ have_hw_decoder_support=no ])
+
+
 
 dnl ================================================================
 dnl Misc program dependencies.
@@ -1371,6 +1379,7 @@ echo "        Image backend: ${COGL_IMAGE_BACKEND}"
 echo "        Cogl Pango: ${enable_cogl_pango}"
 echo "        Profiling: ${enable_profile}"
 echo "        Cogl Gst: ${enable_cogl_gst}"
+echo "        Has HW suppport ${have_hw_decoder_support}"
 
 # Compiler/Debug related flags
 echo ""
-- 
1.8.1.2

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



More information about the Cogl mailing list