[clutter-gst] player: Pressing 'd' now removes the VideoTexture and controls
- From: Damien Lespiau <dlespiau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter-gst] player: Pressing 'd' now removes the VideoTexture and controls
- Date: Fri, 28 Oct 2011 10:33:59 +0000 (UTC)
commit a1a5a7221ed21f5ea43833cdd7839e2130fc6919
Author: Damien Lespiau <damien lespiau intel com>
Date: Fri Oct 28 11:30:21 2011 +0100
player: Pressing 'd' now removes the VideoTexture and controls
And allows to ensure the VideoTexture and the VideoSink are correctly
finalized.
examples/video-player.c | 30 +++++++++++++++++++++++++++---
1 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/examples/video-player.c b/examples/video-player.c
index c749c1d..ee656c9 100644
--- a/examples/video-player.c
+++ b/examples/video-player.c
@@ -88,6 +88,9 @@ controls_timeout_cb (gpointer data)
static void
show_controls (VideoApp *app, gboolean vis)
{
+ if (app->control == NULL)
+ return;
+
if (vis == TRUE && app->controls_showing == TRUE)
{
if (app->controls_timeout == 0)
@@ -126,6 +129,9 @@ show_controls (VideoApp *app, gboolean vis)
void
toggle_pause_state (VideoApp *app)
{
+ if (app->vtexture == NULL)
+ return;
+
if (app->paused)
{
clutter_media_set_playing (CLUTTER_MEDIA(app->vtexture),
@@ -148,7 +154,8 @@ static void
reset_animation (ClutterAnimation *animation,
VideoApp *app)
{
- clutter_actor_set_rotation (app->vtexture, CLUTTER_Y_AXIS, 0.0, 0, 0, 0);
+ if (app->vtexture)
+ clutter_actor_set_rotation (app->vtexture, CLUTTER_Y_AXIS, 0.0, 0, 0, 0);
}
static gboolean
@@ -208,16 +215,33 @@ input_cb (ClutterStage *stage,
ClutterVertex center = { 0, };
ClutterAnimation *animation = NULL;
- center.x = clutter_actor_get_width (app->vtexture) / 2;
-
switch (clutter_event_get_key_symbol (event))
{
+ case CLUTTER_d:
+ if (app->vtexture)
+ {
+ clutter_container_remove_actor (CLUTTER_CONTAINER (app->stage),
+ app->vtexture);
+ app->vtexture = NULL;
+ }
+ if (app->control)
+ {
+ clutter_container_remove_actor (CLUTTER_CONTAINER (app->stage),
+ app->control);
+ app->control = NULL;
+ }
+ break;
case CLUTTER_q:
case CLUTTER_Escape:
clutter_main_quit ();
break;
case CLUTTER_e:
+ if (app->vtexture == NULL)
+ break;
+
+ center.x = clutter_actor_get_width (app->vtexture) / 2;
+
animation =
clutter_actor_animate (app->vtexture, CLUTTER_LINEAR, 500,
"rotation-angle-y", 360.0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]