playbin2/playsink: Use new "silent" property instead of unlinking
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Sat, 7 Nov 2009 20:38:10 +0000 (21:38 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 12 Nov 2009 12:20:41 +0000 (13:20 +0100)
This makes sure that subtitleoverlay still gets segment updates and
everything to pass on downstream. Without this segment problems happen.

gst/playback/gstplaybin2.c
gst/playback/gstplaysink.c

index 273aacf..a3fbdc2 100644 (file)
@@ -1238,24 +1238,8 @@ gst_play_bin_set_suburi (GstPlayBin * playbin, const gchar * suburi)
 static void
 gst_play_bin_set_flags (GstPlayBin * playbin, GstPlayFlags flags)
 {
-  GstPlayFlags oldflags = gst_play_sink_get_flags (playbin->playsink);
-  GstSourceGroup *group = playbin->curr_group;
-  gboolean unblock = FALSE;
-
-  if (group && group->suburidecodebin) {
-    if ((oldflags & GST_PLAY_FLAG_TEXT) && !(flags & GST_PLAY_FLAG_TEXT)) {
-      gst_play_bin_suburidecodebin_block (group->suburidecodebin, TRUE);
-    } else if (!(oldflags & GST_PLAY_FLAG_TEXT) && (flags & GST_PLAY_FLAG_TEXT)) {
-      gst_play_bin_suburidecodebin_seek_to_start (group->suburidecodebin);
-      unblock = TRUE;
-    }
-  }
-
   gst_play_sink_set_flags (playbin->playsink, flags);
   gst_play_sink_reconfigure (playbin->playsink);
-
-  if (unblock)
-    gst_play_bin_suburidecodebin_block (group->suburidecodebin, FALSE);
 }
 
 static GstPlayFlags
index 7993bc3..a6afa2e 100644 (file)
@@ -98,7 +98,6 @@ typedef struct
   GstElement *overlay;
   GstPad *videosinkpad;
   GstPad *textsinkpad;
-  GstPad *textsinkpad_target;
   GstPad *srcpad;               /* outgoing srcpad, used to connect to the next
                                  * chain */
   GstElement *sink;             /* custom sink to receive subtitle buffers */
@@ -1189,6 +1188,7 @@ gen_text_chain (GstPlaySink * playsink)
       } else {
         gst_bin_add (bin, chain->overlay);
 
+        g_object_set (G_OBJECT (chain->overlay), "silent", FALSE, NULL);
         if (playsink->font_desc) {
           g_object_set (G_OBJECT (chain->overlay), "font-desc",
               playsink->font_desc, NULL);
@@ -1224,7 +1224,6 @@ gen_text_chain (GstPlaySink * playsink)
   }
   if (textsinkpad) {
     chain->textsinkpad = gst_ghost_pad_new ("text_sink", textsinkpad);
-    chain->textsinkpad_target = textsinkpad;
     gst_object_unref (textsinkpad);
     gst_element_add_pad (chain->chain.bin, chain->textsinkpad);
   }
@@ -1825,20 +1824,11 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
       playsink->textchain = gen_text_chain (playsink);
     }
     if (playsink->textchain) {
-      GstPad *target;
-
       GST_DEBUG_OBJECT (playsink, "adding text chain");
+      g_object_set (G_OBJECT (playsink->textchain->overlay), "silent", FALSE,
+          NULL);
       add_chain (GST_PLAY_CHAIN (playsink->textchain), TRUE);
 
-      if (!(target =
-              gst_ghost_pad_get_target (GST_GHOST_PAD_CAST
-                  (playsink->textchain->textsinkpad)))) {
-        target = gst_object_ref (playsink->textchain->textsinkpad_target);
-        gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->
-                textchain->textsinkpad), target);
-      }
-      gst_object_unref (target);
-
       gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->text_pad),
           playsink->textchain->textsinkpad);
       gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->video_pad),
@@ -1859,8 +1849,8 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
       } else {
         /* we have a chain and a textpad, turn the subtitles off */
         GST_DEBUG_OBJECT (playsink, "turning off the text");
-        gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->
-                textchain->textsinkpad), NULL);
+        g_object_set (G_OBJECT (playsink->textchain->overlay), "silent", TRUE,
+            NULL);
       }
     }
     if (!need_video && playsink->video_pad)