playbin2/playsink: Use gst_object_ref_sink() instead of calling both separately

This commit is contained in:
Sebastian Dröge 2009-09-23 16:07:36 +02:00
parent 4a6d97cda0
commit a4f454dc24
2 changed files with 10 additions and 18 deletions

View file

@ -1531,10 +1531,9 @@ gst_play_bin_set_sink (GstPlayBin * playbin, GstElement ** elem,
GstElement *old; GstElement *old;
old = *elem; old = *elem;
if (sink) { if (sink)
gst_object_ref (sink); gst_object_ref_sink (sink);
gst_object_sink (sink);
}
*elem = sink; *elem = sink;
if (old) if (old)
gst_object_unref (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 /* store the sink in the group, we will configure it later when we
* reconfigure the sink */ * reconfigure the sink */
GST_DEBUG_OBJECT (playbin, "remember sink"); GST_DEBUG_OBJECT (playbin, "remember sink");
gst_object_ref (element); gst_object_ref_sink (element);
gst_object_sink (element);
*sinkp = element; *sinkp = element;
} else { } else {
/* some other thread configured a sink while we were testing the sink, set /* some other thread configured a sink while we were testing the sink, set

View file

@ -611,8 +611,7 @@ gst_play_sink_set_vis_plugin (GstPlaySink * playsink, GstElement * vis)
if (playsink->visualisation) if (playsink->visualisation)
gst_object_unref (playsink->visualisation); gst_object_unref (playsink->visualisation);
/* take ownership */ /* take ownership */
gst_object_ref (vis); gst_object_ref_sink (vis);
gst_object_sink (vis);
playsink->visualisation = vis; playsink->visualisation = vis;
/* now try to change the plugin in the running vis chain, if we have no chain, /* 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 */ * that when something goes wrong we only need to unref the bin */
chain->chain.bin = gst_bin_new ("vbin"); chain->chain.bin = gst_bin_new ("vbin");
bin = GST_BIN_CAST (chain->chain.bin); bin = GST_BIN_CAST (chain->chain.bin);
gst_object_ref (bin); gst_object_ref_sink (bin);
gst_object_sink (bin);
gst_bin_add (bin, chain->sink); gst_bin_add (bin, chain->sink);
if (queue) { if (queue) {
@ -1163,8 +1161,7 @@ gen_text_chain (GstPlaySink * playsink)
chain->chain.bin = gst_bin_new ("tbin"); chain->chain.bin = gst_bin_new ("tbin");
bin = GST_BIN_CAST (chain->chain.bin); bin = GST_BIN_CAST (chain->chain.bin);
gst_object_ref (bin); gst_object_ref_sink (bin);
gst_object_sink (bin);
videosinkpad = textsinkpad = srcpad = NULL; videosinkpad = textsinkpad = srcpad = NULL;
@ -1322,8 +1319,7 @@ gen_subp_chain (GstPlaySink * playsink)
chain->chain.bin = gst_bin_new ("pbin"); chain->chain.bin = gst_bin_new ("pbin");
bin = GST_BIN_CAST (chain->chain.bin); bin = GST_BIN_CAST (chain->chain.bin);
gst_object_ref (bin); gst_object_ref_sink (bin);
gst_object_sink (bin);
subpsinkpad = srcpad = NULL; subpsinkpad = srcpad = NULL;
@ -1480,8 +1476,7 @@ gen_audio_chain (GstPlaySink * playsink, gboolean raw, gboolean queue)
chain->chain.bin = gst_bin_new ("abin"); chain->chain.bin = gst_bin_new ("abin");
bin = GST_BIN_CAST (chain->chain.bin); bin = GST_BIN_CAST (chain->chain.bin);
gst_object_ref (bin); gst_object_ref_sink (bin);
gst_object_sink (bin);
gst_bin_add (bin, chain->sink); gst_bin_add (bin, chain->sink);
if (queue) { if (queue) {
@ -1750,8 +1745,7 @@ gen_vis_chain (GstPlaySink * playsink)
chain->chain.bin = gst_bin_new ("visbin"); chain->chain.bin = gst_bin_new ("visbin");
bin = GST_BIN_CAST (chain->chain.bin); bin = GST_BIN_CAST (chain->chain.bin);
gst_object_ref (bin); gst_object_ref_sink (bin);
gst_object_sink (bin);
/* we're queuing raw audio here, we can remove this queue when we can disable /* we're queuing raw audio here, we can remove this queue when we can disable
* async behaviour in the video sink. */ * async behaviour in the video sink. */