From a4f454dc24dec6975ba4d3dbb201f1e436d5f2e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 23 Sep 2009 16:07:36 +0200 Subject: [PATCH] playbin2/playsink: Use gst_object_ref_sink() instead of calling both separately --- gst/playback/gstplaybin2.c | 10 ++++------ gst/playback/gstplaysink.c | 18 ++++++------------ 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c index 8020393c2b..129971e191 100644 --- a/gst/playback/gstplaybin2.c +++ b/gst/playback/gstplaybin2.c @@ -1531,10 +1531,9 @@ gst_play_bin_set_sink (GstPlayBin * playbin, GstElement ** elem, GstElement *old; old = *elem; - if (sink) { - gst_object_ref (sink); - gst_object_sink (sink); - } + if (sink) + gst_object_ref_sink (sink); + *elem = sink; if (old) gst_object_unref (old); @@ -2463,8 +2462,7 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad, /* store the sink in the group, we will configure it later when we * reconfigure the sink */ GST_DEBUG_OBJECT (playbin, "remember sink"); - gst_object_ref (element); - gst_object_sink (element); + gst_object_ref_sink (element); *sinkp = element; } else { /* some other thread configured a sink while we were testing the sink, set diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c index fb3993514e..5bed9a6990 100644 --- a/gst/playback/gstplaysink.c +++ b/gst/playback/gstplaysink.c @@ -611,8 +611,7 @@ gst_play_sink_set_vis_plugin (GstPlaySink * playsink, GstElement * vis) if (playsink->visualisation) gst_object_unref (playsink->visualisation); /* take ownership */ - gst_object_ref (vis); - gst_object_sink (vis); + gst_object_ref_sink (vis); playsink->visualisation = vis; /* now try to change the plugin in the running vis chain, if we have no chain, @@ -993,8 +992,7 @@ gen_video_chain (GstPlaySink * playsink, gboolean raw, gboolean async, * that when something goes wrong we only need to unref the bin */ chain->chain.bin = gst_bin_new ("vbin"); bin = GST_BIN_CAST (chain->chain.bin); - gst_object_ref (bin); - gst_object_sink (bin); + gst_object_ref_sink (bin); gst_bin_add (bin, chain->sink); if (queue) { @@ -1163,8 +1161,7 @@ gen_text_chain (GstPlaySink * playsink) chain->chain.bin = gst_bin_new ("tbin"); bin = GST_BIN_CAST (chain->chain.bin); - gst_object_ref (bin); - gst_object_sink (bin); + gst_object_ref_sink (bin); videosinkpad = textsinkpad = srcpad = NULL; @@ -1322,8 +1319,7 @@ gen_subp_chain (GstPlaySink * playsink) chain->chain.bin = gst_bin_new ("pbin"); bin = GST_BIN_CAST (chain->chain.bin); - gst_object_ref (bin); - gst_object_sink (bin); + gst_object_ref_sink (bin); subpsinkpad = srcpad = NULL; @@ -1480,8 +1476,7 @@ gen_audio_chain (GstPlaySink * playsink, gboolean raw, gboolean queue) chain->chain.bin = gst_bin_new ("abin"); bin = GST_BIN_CAST (chain->chain.bin); - gst_object_ref (bin); - gst_object_sink (bin); + gst_object_ref_sink (bin); gst_bin_add (bin, chain->sink); if (queue) { @@ -1750,8 +1745,7 @@ gen_vis_chain (GstPlaySink * playsink) chain->chain.bin = gst_bin_new ("visbin"); bin = GST_BIN_CAST (chain->chain.bin); - gst_object_ref (bin); - gst_object_sink (bin); + gst_object_ref_sink (bin); /* we're queuing raw audio here, we can remove this queue when we can disable * async behaviour in the video sink. */