[the-board] [tb] Ensure duration is available just after setting filename



commit bca183801e3f22ecc8282984268ba18c2f10393d
Author: Lucas Rocha <lucasr gnome org>
Date:   Fri Jan 28 15:59:08 2011 +0000

    [tb] Ensure duration is available just after setting filename

 src/tb/tb-sound-player.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/tb/tb-sound-player.c b/src/tb/tb-sound-player.c
index d2d9a40..8f4d3fa 100644
--- a/src/tb/tb-sound-player.c
+++ b/src/tb/tb-sound-player.c
@@ -40,6 +40,7 @@ struct _TbSoundPlayerPrivate
 };
 
 static void tb_sound_player_destroy_pipeline (TbSoundPlayer *player);
+static gboolean tb_sound_player_ensure_pipeline (TbSoundPlayer *player);
 
 static void
 tb_sound_player_set_state (TbSoundPlayer      *player,
@@ -79,6 +80,8 @@ tb_sound_player_set_filename (TbSoundPlayer *player,
   if (priv->pipeline)
     tb_sound_player_destroy_pipeline (player);
 
+  tb_sound_player_ensure_pipeline (player);
+
   g_object_notify (G_OBJECT (player), "filename");
 }
 
@@ -471,6 +474,10 @@ tb_sound_player_ensure_pipeline (TbSoundPlayer *player)
                     G_CALLBACK (tb_sound_player_on_duration),
                     player);
 
+  /* Pause pipeline so that the file duration becomes
+   * available as soon as possible */
+  gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
+
   return TRUE;
 }
 



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