[cogl/wip/cogl-gst-1.x: 6/29] cogl-gst: Add the global function even for the RGB cap



commit 667e91349af1518708febc93df21af801033dbc8
Author: Neil Roberts <neil linux intel com>
Date:   Tue Feb 26 19:19:38 2013 +0000

    cogl-gst: Add the global function even for the RGB cap
    
    Previously if the RGB cap was used then CoglGst wouldn't add any
    snippets to the pipeline. Although this would work it would mean that
    the application can't add it's own snippets which use the sampling
    function. To fix that this patch just makes it always add the snippet
    if the driver supports GLSL. When using the RGB cap the sampling
    function is now just a dummy function that directly returns the texel
    from the texture.

 cogl-gst/cogl-gst-shader.c     |    6 ++++++
 cogl-gst/cogl-gst-shader.h     |    3 +++
 cogl-gst/cogl-gst-video-sink.c |    9 ++++++++-
 3 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/cogl-gst/cogl-gst-shader.c b/cogl-gst/cogl-gst-shader.c
index d964c72..652b3a8 100644
--- a/cogl-gst/cogl-gst-shader.c
+++ b/cogl-gst/cogl-gst-shader.c
@@ -37,6 +37,12 @@
 #include "cogl-gst-shader.h"
 
 const char
+_cogl_gst_shader_rgba_to_rgba_decl[] =
+  "vec4 cogl_gst_sample_video (vec2 UV) {\n"
+  "  return texture2D (cogl_sampler0, UV);\n"
+  "}";
+
+const char
 _cogl_gst_shader_yv12_to_rgba_decl[] =
   "vec4 cogl_gst_sample_video (vec2 UV) {\n"
   "  float y = 1.1640625 * (texture2D (cogl_sampler0, UV).g - 0.0625);\n"
diff --git a/cogl-gst/cogl-gst-shader.h b/cogl-gst/cogl-gst-shader.h
index e380814..bdf7164 100644
--- a/cogl-gst/cogl-gst-shader.h
+++ b/cogl-gst/cogl-gst-shader.h
@@ -34,6 +34,9 @@
 #define __COGL_GST_SHADER_PRIVATE_H__
 
 extern const char
+_cogl_gst_shader_rgba_to_rgba_decl[];
+
+extern const char
 _cogl_gst_shader_yv12_to_rgba_decl[];
 
 extern const char
diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
index 61b2e3f..47d87c6 100644
--- a/cogl-gst/cogl-gst-video-sink.c
+++ b/cogl-gst/cogl-gst-video-sink.c
@@ -378,7 +378,14 @@ cogl_gst_dummy_deinit (CoglGstVideoSink *sink)
 static void
 cogl_gst_rgb_init (CoglGstVideoSink *sink)
 {
-  create_template_pipeline (sink, NULL, 1);
+  CoglGstVideoSinkPrivate *priv = sink->priv;
+
+  if (cogl_has_feature (priv->ctx, COGL_FEATURE_ID_GLSL))
+    create_template_pipeline (sink,
+                              _cogl_gst_shader_rgba_to_rgba_decl,
+                              1);
+  else
+    create_template_pipeline (sink, NULL, 1);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]