[the-board] [tb] Improve the way the sound player pipeline is created



commit 54d85f6e8393329a77ac5410ef92d44bc2c5dd2a
Author: Lucas Rocha <lucasr lucasr org>
Date:   Mon Jul 18 23:38:24 2011 +0100

    [tb] Improve the way the sound player pipeline is created
    
    And use the better supported and more stable playbin2 element (instead
    of playbin).

 src/tb/tb-sound-player.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/tb/tb-sound-player.c b/src/tb/tb-sound-player.c
index b47ad34..c7b6941 100644
--- a/src/tb/tb-sound-player.c
+++ b/src/tb/tb-sound-player.c
@@ -403,8 +403,8 @@ static gboolean
 tb_sound_player_ensure_pipeline (TbSoundPlayer *player)
 {
   TbSoundPlayerPrivate *priv;
+  GstElement *playbin;
   GError *error;
-  gchar *pipeline_desc;
 
   priv = TB_SOUND_PLAYER_GET_PRIVATE (player);
 
@@ -419,22 +419,25 @@ tb_sound_player_ensure_pipeline (TbSoundPlayer *player)
 
   error = NULL;
 
-  pipeline_desc = g_strdup_printf("playbin uri=\"%s\"",
-                                  priv->uri);
+  priv->pipeline = gst_pipeline_new (NULL);
 
-  priv->pipeline = gst_parse_launch (pipeline_desc, &error);
+  playbin = gst_element_factory_make ("playbin2", NULL);
 
-  g_free (pipeline_desc);
-
-  if (error)
+  if (playbin == NULL)
     {
-      g_error_free (error);
+      g_object_unref (priv->pipeline);
       priv->pipeline = NULL;
 
       tb_sound_player_set_state (player, TB_SOUND_PLAYER_STATE_ERROR);
       return FALSE;
     }
 
+  g_object_set (playbin,
+                "uri", priv->uri,
+                NULL);
+
+  gst_bin_add (GST_BIN (priv->pipeline), playbin);
+
   if (!gst_element_set_state (priv->pipeline, GST_STATE_READY))
     {
       g_object_unref (priv->pipeline);



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