[clutter-gst] player: force reset of text bit in playing flags



commit 6ccd54b51cfad26ef21a8a9a31c6e5dd57794993
Author: Lionel Landwerlin <lionel g landwerlin linux intel com>
Date:   Tue Oct 11 15:12:08 2011 +0100

    player: force reset of text bit in playing flags
    
    It turns out that the playbin2 implementation applies no changes to
    the pipeline when you're setting the "suburi" or "current-text"
    properties. The changes are only applied when the pipeline is
    reconfigured. One way to reconfigure the pipeline is to touch the
    playing flags.
    
    This patch wrap the manipulation of these properties around a get/set
    of the "flags" property to force the reconfiguration of the pipeline.

 clutter-gst/clutter-gst-player.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/clutter-gst/clutter-gst-player.c b/clutter-gst/clutter-gst-player.c
index 9f4ecf5..196c981 100644
--- a/clutter-gst/clutter-gst-player.c
+++ b/clutter-gst/clutter-gst-player.c
@@ -408,13 +408,18 @@ set_subtitle_uri (ClutterGstPlayer *player,
                   const gchar      *uri)
 {
   ClutterGstPlayerPrivate *priv = PLAYER_GET_PRIVATE (player);
+  GstPlayFlags flags;
 
   if (!priv->pipeline)
     return;
 
   CLUTTER_GST_NOTE (MEDIA, "setting subtitle URI: %s", uri);
 
+  g_object_get (priv->pipeline, "flags", &flags, NULL);
+
   g_object_set (priv->pipeline, "suburi", uri, NULL);
+
+  g_object_set (priv->pipeline, "flags", flags, NULL);
 }
 
 static void
@@ -1835,6 +1840,7 @@ clutter_gst_player_set_subtitle_track_impl (ClutterGstPlayer *player,
                                             gint              index_)
 {
   ClutterGstPlayerPrivate *priv;
+  GstPlayFlags flags;
 
   priv = PLAYER_GET_PRIVATE (player);
 
@@ -1843,9 +1849,19 @@ clutter_gst_player_set_subtitle_track_impl (ClutterGstPlayer *player,
 
   CLUTTER_GST_NOTE (SUBTITLES, "set subtitle track to #%d", index_);
 
-  g_object_set (G_OBJECT (priv->pipeline),
-                "current-text", index_,
-                NULL);
+  g_object_get (priv->pipeline, "flags", &flags, NULL);
+  flags &= ~GST_PLAY_FLAG_TEXT;
+  g_object_set (priv->pipeline, "flags", flags, NULL);
+
+  if (index_ >= 0)
+    {
+      g_object_set (G_OBJECT (priv->pipeline),
+                    "current-text", index_,
+                    NULL);
+
+      flags |= GST_PLAY_FLAG_TEXT;
+      g_object_set (priv->pipeline, "flags", flags, NULL);
+    }
 }
 
 static gboolean



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