[clutter-gst] add util functions



commit 1e04a35d25ac5a756e1fff25d15e1bc2613befdf
Author: Lionel Landwerlin <llandwerlin gmail com>
Date:   Thu Mar 14 02:35:48 2013 +0000

    add util functions

 clutter-gst/clutter-gst-private.h |    5 +++++
 clutter-gst/clutter-gst-util.c    |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/clutter-gst/clutter-gst-private.h b/clutter-gst/clutter-gst-private.h
index 18b3c66..c245e0a 100644
--- a/clutter-gst/clutter-gst-private.h
+++ b/clutter-gst/clutter-gst-private.h
@@ -48,8 +48,13 @@ G_BEGIN_DECLS
 gboolean
 _internal_plugin_init (GstPlugin *plugin);
 
+
+CoglContext *clutter_gst_get_cogl_context (void);
+
 ClutterGstFrame *clutter_gst_frame_new (CoglPipeline *pipeline);
 
+ClutterGstFrame *clutter_gst_create_blank_frame (const ClutterColor *color);
+
 void clutter_gst_util_update_frame (ClutterGstPlayer *player,
                                     ClutterGstFrame **frame,
                                     CoglPipeline     *pipeline);
diff --git a/clutter-gst/clutter-gst-util.c b/clutter-gst/clutter-gst-util.c
index 9b73d01..5766144 100644
--- a/clutter-gst/clutter-gst-util.c
+++ b/clutter-gst/clutter-gst-util.c
@@ -239,6 +239,8 @@ clutter_gst_init_with_args (int            *argc,
   return CLUTTER_INIT_SUCCESS;
 }
 
+/**/
+
 void
 clutter_gst_util_update_frame (ClutterGstPlayer *player,
                                ClutterGstFrame **frame,
@@ -263,3 +265,35 @@ clutter_gst_util_update_frame (ClutterGstPlayer *player,
 
   g_signal_emit_by_name (player, "new-frame", new_frame);
 }
+
+CoglContext *
+clutter_gst_get_cogl_context (void)
+{
+  return clutter_backend_get_cogl_context (clutter_get_default_backend ());
+}
+
+ClutterGstFrame *
+clutter_gst_create_blank_frame (const ClutterColor *color)
+{
+  CoglTexture *texture;
+  CoglPipeline *pipeline;
+  ClutterGstFrame *frame;
+  ClutterColor black_color = { 0x0, 0x0, 0x0, 0xff };
+  const guint8 *color_ptr = color != NULL ?
+    (const guint8 *) color : (const guint8 *) &black_color;
+
+  texture = cogl_texture_new_from_data (1, 1, COGL_TEXTURE_NONE,
+                                        COGL_PIXEL_FORMAT_RGBA_8888,
+                                        COGL_PIXEL_FORMAT_RGBA_8888,
+                                        1,
+                                        color_ptr);
+  pipeline = cogl_pipeline_new (clutter_gst_get_cogl_context ());
+  cogl_pipeline_set_layer_texture (pipeline, 0, texture);
+
+  frame = clutter_gst_frame_new (pipeline);
+
+  cogl_object_unref (pipeline);
+  cogl_object_unref (texture);
+
+  return frame;
+}


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