gst-plugins-base: playsink: verify linking to overlay element

Mark Nauwelaerts mnauw at kemper.freedesktop.org
Thu Jan 19 07:51:45 PST 2012


Module: gst-plugins-base
Branch: master
Commit: be34d4c78ef9f31f5c7e3a58a546855e7e30dfae
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=be34d4c78ef9f31f5c7e3a58a546855e7e30dfae

Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date:   Thu Jan 19 16:32:37 2012 +0100

playsink: verify linking to overlay element

---

 gst/playback/gstplaysink.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c
index a757b2d..d02ec60 100644
--- a/gst/playback/gstplaysink.c
+++ b/gst/playback/gstplaysink.c
@@ -1603,10 +1603,18 @@ gen_text_chain (GstPlaySink * playsink)
               "max-size-bytes", 0, "max-size-time", (gint64) 0,
               "silent", TRUE, NULL);
           gst_bin_add (bin, element);
-          gst_element_link_pads_full (element, "src", chain->overlay,
-              "subtitle_sink", GST_PAD_LINK_CHECK_TEMPLATE_CAPS);
-          textsinkpad = gst_element_get_static_pad (element, "sink");
-          srcpad = gst_element_get_static_pad (chain->overlay, "src");
+          if (gst_element_link_pads_full (element, "src", chain->overlay,
+                  "subtitle_sink", GST_PAD_LINK_CHECK_TEMPLATE_CAPS)) {
+            textsinkpad = gst_element_get_static_pad (element, "sink");
+            srcpad = gst_element_get_static_pad (chain->overlay, "src");
+          } else {
+            gst_bin_remove (bin, chain->sink);
+            gst_bin_remove (bin, chain->overlay);
+            chain->sink = NULL;
+            chain->overlay = NULL;
+            gst_object_unref (videosinkpad);
+            videosinkpad = NULL;
+          }
         }
       }
     }



More information about the gstreamer-commits mailing list