[cogl/wip/cogl-gst-1.x: 16/29] basic-video-player: Add the Cogl GSource to the GMainContext



commit a946f891160b8342cf0d9f7199608fae6effcf10
Author: Neil Roberts <neil linux intel com>
Date:   Fri Mar 1 13:03:42 2013 +0000

    basic-video-player: Add the Cogl GSource to the GMainContext
    
    Cogl needs to have an opportunity to hook into the main loop otherwise
    it won't handle X events properly and it won't dispatch the frame
    callbacks.

 examples/cogl-basic-video-player.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/examples/cogl-basic-video-player.c b/examples/cogl-basic-video-player.c
index 85897e1..156c4eb 100644
--- a/examples/cogl-basic-video-player.c
+++ b/examples/cogl-basic-video-player.c
@@ -145,6 +145,7 @@ main (int argc,
   float fovy, aspect, z_near, z_2d, z_far;
   GstElement *pipeline;
   GstElement *bin;
+  GSource *cogl_source;
   GstBus *bus;
   char *uri;
 
@@ -203,6 +204,9 @@ main (int argc,
 
   data.main_loop = g_main_loop_new (NULL, FALSE);
 
+  cogl_source = cogl_glib_source_new (ctx, G_PRIORITY_DEFAULT);
+  g_source_attach (cogl_source, NULL);
+
   /*
     The cogl-pipeline-ready signal tells you when the cogl pipeline is
     initialized i.e. when cogl-gst has figured out the video format and
@@ -216,6 +220,9 @@ main (int argc,
 
   g_main_loop_run (data.main_loop);
 
+  g_source_destroy (cogl_source);
+  g_source_unref (cogl_source);
+
   g_main_loop_unref (data.main_loop);
 
   return 0;


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