[rhythmbox] use gst_element_get_static_pad instead of gst_element_get_pad



commit 6a844313210f84f549da10ab13ff550d02db69d9
Author: Jonathan Matthew <jonathan d14n org>
Date:   Tue May 12 22:38:25 2009 +1000

    use gst_element_get_static_pad instead of gst_element_get_pad
---
 backends/gstreamer/rb-encoder-gst.c       |    4 +-
 backends/gstreamer/rb-player-gst-xfade.c  |   30 ++++++++++++++--------------
 backends/gstreamer/rb-player-gst.c        |   20 +++++++++---------
 metadata/rb-metadata-gst.c                |    3 +-
 plugins/audiocd/rb-audiocd-plugin.c       |    2 +-
 plugins/cd-recorder/rb-recorder-gst.c     |    2 +-
 plugins/fmradio/rb-fm-radio-gst-src.c     |    2 +-
 plugins/visualizer/rb-visualizer-plugin.c |   10 ++++----
 8 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/backends/gstreamer/rb-encoder-gst.c b/backends/gstreamer/rb-encoder-gst.c
index c372712..933ae2c 100644
--- a/backends/gstreamer/rb-encoder-gst.c
+++ b/backends/gstreamer/rb-encoder-gst.c
@@ -519,7 +519,7 @@ new_decoded_pad_cb (GstElement *decodebin, GstPad *new_pad, gboolean arg1, RBEnc
 	/* only process audio data */
 	if (strncmp (caps_string, "audio/", 6) == 0) {
 		encoder->priv->decoded_pads++;
-		enc_sinkpad = gst_element_get_pad (encoder->priv->enc,
+		enc_sinkpad = gst_element_get_static_pad (encoder->priv->enc,
 				"sink");
 		if (gst_pad_link (new_pad, enc_sinkpad) != GST_PAD_LINK_OK)
 			rb_debug ("error linking pads");
@@ -677,7 +677,7 @@ encoder_match_mime (RBEncoderGst *rbencoder, GstElement *encoder, const gchar *m
 	gboolean match = FALSE;
 	char *tmp;
 
-	srcpad = gst_element_get_pad (encoder, "src");
+	srcpad = gst_element_get_static_pad (encoder, "src");
 	element_caps = gst_pad_get_caps (srcpad);
 
 	if (element_caps == NULL) {
diff --git a/backends/gstreamer/rb-player-gst-xfade.c b/backends/gstreamer/rb-player-gst-xfade.c
index 0eeb8b8..bfea931 100644
--- a/backends/gstreamer/rb-player-gst-xfade.c
+++ b/backends/gstreamer/rb-player-gst-xfade.c
@@ -1817,7 +1817,7 @@ stream_new_decoded_pad_cb (GstElement *decoder, GstPad *pad, gboolean last, RBXF
 		rb_debug ("hmm, decoder is already linked");
 	} else {
 		rb_debug ("got decoded audio pad for stream %s", stream->uri);
-		vpad = gst_element_get_pad (stream->audioconvert, "sink");
+		vpad = gst_element_get_static_pad (stream->audioconvert, "sink");
 		gst_pad_link (pad, vpad);
 		gst_object_unref (vpad);
 		stream->decoder_linked = TRUE;
@@ -2155,9 +2155,9 @@ create_stream (RBPlayerGstXFade *player, const char *uri, gpointer stream_data,
 			g_object_set (identity, "check-imperfect-offset", TRUE, NULL);
 		}
 
-		stream->src_pad = gst_element_get_pad (identity, "src");
+		stream->src_pad = gst_element_get_static_pad (identity, "src");
 	} else {
-		stream->src_pad = gst_element_get_pad (stream->volume, "src");
+		stream->src_pad = gst_element_get_static_pad (stream->volume, "src");
 	}
 
 	/* ghost the stream src pad up to the bin */
@@ -2980,12 +2980,12 @@ create_sink (RBPlayerGstXFade *player, GError **error)
 	audioconvert2 = gst_element_factory_make ("audioconvert", NULL);
 	gst_bin_add (GST_BIN (player->priv->filterbin), audioconvert2);
 
-	pad = gst_element_get_pad (audioconvert2, "sink");
+	pad = gst_element_get_static_pad (audioconvert2, "sink");
 	gst_element_add_pad (player->priv->filterbin,
 			     gst_ghost_pad_new ("sink", pad));
 	gst_object_unref (pad);
 
-	pad = gst_element_get_pad (audioconvert2, "src");
+	pad = gst_element_get_static_pad (audioconvert2, "src");
 	gst_element_add_pad (player->priv->filterbin,
 			     gst_ghost_pad_new ("src", pad));
 	gst_object_unref (pad);
@@ -3018,7 +3018,7 @@ create_sink (RBPlayerGstXFade *player, GError **error)
 		return FALSE;
 	}
 
-	filterpad = gst_element_get_pad (player->priv->capsfilter, "sink");
+	filterpad = gst_element_get_static_pad (player->priv->capsfilter, "sink");
 	outputghostpad = gst_ghost_pad_new ("sink", filterpad);
 	gst_element_add_pad (player->priv->outputbin, outputghostpad);
 	gst_object_unref (filterpad);
@@ -3060,7 +3060,7 @@ create_sink (RBPlayerGstXFade *player, GError **error)
 		return FALSE;
 	}
 
-	filterpad = gst_element_get_pad (capsfilter, "src");
+	filterpad = gst_element_get_static_pad (capsfilter, "src");
 	ghostpad = gst_ghost_pad_new (NULL, filterpad);
 	gst_element_add_pad (player->priv->silencebin, ghostpad);
 	gst_object_unref (filterpad);
@@ -3076,7 +3076,7 @@ create_sink (RBPlayerGstXFade *player, GError **error)
 			  player->priv->silencebin,
 			  NULL);
 
-	addersrcpad = gst_element_get_pad (player->priv->adder, "src");
+	addersrcpad = gst_element_get_static_pad (player->priv->adder, "src");
 	plr = gst_pad_link (addersrcpad, outputghostpad);
 	if (plr != GST_PAD_LINK_OK) {
 		g_set_error (error,
@@ -3811,7 +3811,7 @@ really_add_tee (GstPad *pad, gboolean blocked, RBPlayerGstXFadePipelineOp *op)
 	gst_element_link_many (queue, audioconvert, op->element, NULL);
 
 	/* add ghost pad */
-	sinkpad = gst_element_get_pad (queue, "sink");
+	sinkpad = gst_element_get_static_pad (queue, "sink");
 	ghostpad = gst_ghost_pad_new ("sink", sinkpad);
 	gst_element_add_pad (bin, ghostpad);
 	gst_object_unref (sinkpad);
@@ -3880,7 +3880,7 @@ pipeline_op (RBPlayerGstXFade *player,
 
 	op = new_pipeline_op (player, element);
 
-	block_pad = gst_element_get_pad (previous_element, "src");
+	block_pad = gst_element_get_static_pad (previous_element, "src");
 	if (player->priv->sink_state == SINK_PLAYING) {
 		rb_debug ("blocking the volume src pad to perform an operation");
 		gst_pad_set_blocked_async (block_pad,
@@ -3986,7 +3986,7 @@ really_add_filter (GstPad *pad,
 	binsinkpad = gst_ghost_pad_new ("sink", GST_PAD (element_sink_pad));
 	gst_element_add_pad (bin, binsinkpad);
 
-	realpad = gst_element_get_pad (audioconvert, "src");
+	realpad = gst_element_get_static_pad (audioconvert, "src");
 	binsrcpad = gst_ghost_pad_new ("src", realpad);
 	gst_element_add_pad (bin, binsrcpad);
 	gst_object_unref (realpad);
@@ -3994,7 +3994,7 @@ really_add_filter (GstPad *pad,
 	/* chuck it into the filter bin */
 	gst_bin_add (GST_BIN (op->player->priv->filterbin), bin);
 
-	ghostpad = gst_element_get_pad (op->player->priv->filterbin, "src");
+	ghostpad = gst_element_get_static_pad (op->player->priv->filterbin, "src");
 	realpad = gst_ghost_pad_get_target (GST_GHOST_PAD (ghostpad));
 	gst_ghost_pad_set_target (GST_GHOST_PAD (ghostpad), binsrcpad);
 	gst_object_unref (ghostpad);
@@ -4043,13 +4043,13 @@ really_remove_filter (GstPad *pad,
 	/* probably check return? */
 	gst_element_set_state (bin, GST_STATE_NULL);
 
-	mypad = gst_element_get_pad (bin, "sink");
+	mypad = gst_element_get_static_pad (bin, "sink");
 	prevpad = gst_pad_get_peer (mypad);
 	gst_pad_unlink (prevpad, mypad);
 	gst_object_unref (mypad);
 
-	ghostpad = gst_element_get_pad (bin, "src");
-	nextpad = gst_element_get_pad (op->player->priv->filterbin, "src");
+	ghostpad = gst_element_get_static_pad (bin, "src");
+	nextpad = gst_element_get_static_pad (op->player->priv->filterbin, "src");
 
 	targetpad = gst_ghost_pad_get_target (GST_GHOST_PAD (nextpad));
 	if (targetpad == ghostpad) {
diff --git a/backends/gstreamer/rb-player-gst.c b/backends/gstreamer/rb-player-gst.c
index c4e1d0c..7a35e41 100644
--- a/backends/gstreamer/rb-player-gst.c
+++ b/backends/gstreamer/rb-player-gst.c
@@ -502,12 +502,12 @@ rb_player_gst_construct (RBPlayerGst *mp, GError **error)
 		gst_bin_add (GST_BIN (mp->priv->filterbin), audioconvert);
 
 		/* ghost it to the bin */
-		pad = gst_element_get_pad (audioconvert, "sink");
+		pad = gst_element_get_static_pad (audioconvert, "sink");
 		ghostpad = gst_ghost_pad_new ("sink", pad);
 		gst_element_add_pad (mp->priv->filterbin, ghostpad);
 		gst_object_unref (pad);
 
-		pad = gst_element_get_pad (audioconvert, "src");
+		pad = gst_element_get_static_pad (audioconvert, "src");
 		ghostpad = gst_ghost_pad_new ("src", pad);
 		gst_element_add_pad (mp->priv->filterbin, ghostpad);
 		gst_object_unref (pad);
@@ -522,7 +522,7 @@ rb_player_gst_construct (RBPlayerGst *mp, GError **error)
 		gst_bin_add_many (GST_BIN (mp->priv->sinkbin), mp->priv->filterbin, mp->priv->tee, queue, sink, NULL);
 		gst_element_link_many (mp->priv->filterbin, mp->priv->tee, queue, sink, NULL);
 
-		pad = gst_element_get_pad (mp->priv->filterbin, "sink");
+		pad = gst_element_get_static_pad (mp->priv->filterbin, "sink");
 		ghostpad = gst_ghost_pad_new ("sink", pad);
 		gst_element_add_pad (mp->priv->sinkbin, ghostpad);
 		gst_object_unref (pad);
@@ -1079,7 +1079,7 @@ rb_player_gst_add_tee (RBPlayerGstTee *player, GstElement *element)
 	gst_element_link_many (queue, audioconvert, element, NULL);
 
 	/* link it to the tee */
-	pad = gst_element_get_pad (queue, "sink");
+	pad = gst_element_get_static_pad (queue, "sink");
 	ghostpad = gst_ghost_pad_new ("sink", pad);
 	gst_element_add_pad (bin, ghostpad);
 	gst_object_unref (pad);
@@ -1207,7 +1207,7 @@ rb_player_gst_add_filter (RBPlayerGstFilter *player, GstElement *element)
 	binsinkpad = gst_ghost_pad_new ("sink", GST_PAD (element_sink_pad));
 	gst_element_add_pad (bin, binsinkpad);
 
-	realpad = gst_element_get_pad (audioconvert, "src");
+	realpad = gst_element_get_static_pad (audioconvert, "src");
 	binsrcpad = gst_ghost_pad_new ("src", realpad);
 	gst_element_add_pad (bin, binsrcpad);
 	gst_object_unref (realpad);
@@ -1215,7 +1215,7 @@ rb_player_gst_add_filter (RBPlayerGstFilter *player, GstElement *element)
 	/* replace the filter chain ghost with the new bin */
 	gst_bin_add (GST_BIN (mp->priv->filterbin), bin);
 
-	ghostpad = gst_element_get_pad (mp->priv->filterbin, "src");
+	ghostpad = gst_element_get_static_pad (mp->priv->filterbin, "src");
 	realpad = gst_ghost_pad_get_target (GST_GHOST_PAD (ghostpad));
 	gst_ghost_pad_set_target (GST_GHOST_PAD (ghostpad), binsrcpad);
 	gst_object_unref (ghostpad);
@@ -1279,13 +1279,13 @@ rb_player_gst_remove_filter (RBPlayerGstFilter *player, GstElement *element)
 		}
 	}
 
-	mypad = gst_element_get_pad (bin, "sink");
+	mypad = gst_element_get_static_pad (bin, "sink");
 	prevpad = gst_pad_get_peer (mypad);
 	gst_pad_unlink (prevpad, mypad);
 	gst_object_unref (mypad);
 
-	ghostpad = gst_element_get_pad (bin, "src");
-	nextpad = gst_element_get_pad (mp->priv->filterbin, "src");
+	ghostpad = gst_element_get_static_pad (bin, "src");
+	nextpad = gst_element_get_static_pad (mp->priv->filterbin, "src");
 
 	targetpad = gst_ghost_pad_get_target (GST_GHOST_PAD (nextpad));
 	if (targetpad == ghostpad) {
@@ -1293,7 +1293,7 @@ rb_player_gst_remove_filter (RBPlayerGstFilter *player, GstElement *element)
 		gst_ghost_pad_set_target (GST_GHOST_PAD (nextpad), prevpad);
 	} else {
 		/* we are in the middle, so link the previous and next elements */
-		mypad = gst_element_get_pad (bin, "src");
+		mypad = gst_element_get_static_pad (bin, "src");
 		gst_object_unref (nextpad);
 		nextpad = gst_pad_get_peer (mypad);
 		gst_pad_unlink (mypad, nextpad);
diff --git a/metadata/rb-metadata-gst.c b/metadata/rb-metadata-gst.c
index 8dd03b6..85162bb 100644
--- a/metadata/rb-metadata-gst.c
+++ b/metadata/rb-metadata-gst.c
@@ -783,8 +783,9 @@ rb_metadata_gst_new_decoded_pad_cb (GstElement *decodebin, GstPad *pad, gboolean
 	} else {
 		GstPad *sink_pad;
 
-		sink_pad = gst_element_get_pad (md->priv->sink, "sink");
+		sink_pad = gst_element_get_static_pad (md->priv->sink, "sink");
 		gst_pad_link (pad, sink_pad);
+		gst_object_unref (sink_pad);
 
 		/* is this pad audio? */
 		structure = gst_caps_get_structure (caps, 0);
diff --git a/plugins/audiocd/rb-audiocd-plugin.c b/plugins/audiocd/rb-audiocd-plugin.c
index 5616786..917b623 100644
--- a/plugins/audiocd/rb-audiocd-plugin.c
+++ b/plugins/audiocd/rb-audiocd-plugin.c
@@ -216,7 +216,7 @@ rb_audiocd_plugin_reuse_stream_cb (RBPlayer *player,
 
 	rb_debug ("seeking to track %d on CD device %s", track, new_device+1);
 
-	ghost_pad = gst_element_get_pad (stream_bin, "src");
+	ghost_pad = gst_element_get_static_pad (stream_bin, "src");
 	if (GST_IS_GHOST_PAD (ghost_pad)) {
 		pad = gst_ghost_pad_get_target (GST_GHOST_PAD (ghost_pad));
 		gst_object_unref (ghost_pad);
diff --git a/plugins/cd-recorder/rb-recorder-gst.c b/plugins/cd-recorder/rb-recorder-gst.c
index 35179df..2f4c0d3 100644
--- a/plugins/cd-recorder/rb-recorder-gst.c
+++ b/plugins/cd-recorder/rb-recorder-gst.c
@@ -365,7 +365,7 @@ rb_recorder_new_pad_cb (GstElement *decodebin,
         GstStructure *str;
         GstPad       *audio_pad;
 
-        audio_pad = gst_element_get_pad (recorder->priv->audioconvert, "sink");
+        audio_pad = gst_element_get_static_pad (recorder->priv->audioconvert, "sink");
 
         /* Only link once. */
         if (GST_PAD_IS_LINKED (audio_pad))
diff --git a/plugins/fmradio/rb-fm-radio-gst-src.c b/plugins/fmradio/rb-fm-radio-gst-src.c
index 59bd928..041cd04 100644
--- a/plugins/fmradio/rb-fm-radio-gst-src.c
+++ b/plugins/fmradio/rb-fm-radio-gst-src.c
@@ -111,7 +111,7 @@ rb_fm_radio_src_init (RBFMRadioSrc *src, RBFMRadioSrcClass *klass)
 		      "wave", 4,
 		      NULL);
 
-	pad = gst_element_get_pad (src->audiotestsrc, "src");
+	pad = gst_element_get_static_pad (src->audiotestsrc, "src");
 	src->ghostpad = gst_ghost_pad_new ("src", pad);
 	gst_element_add_pad (GST_ELEMENT (src), src->ghostpad);
 	gst_object_ref (src->ghostpad);
diff --git a/plugins/visualizer/rb-visualizer-plugin.c b/plugins/visualizer/rb-visualizer-plugin.c
index 41f3601..fd16862 100644
--- a/plugins/visualizer/rb-visualizer-plugin.c
+++ b/plugins/visualizer/rb-visualizer-plugin.c
@@ -482,7 +482,7 @@ fixate_vis_caps (RBVisualizerPlugin *pi, GstElement *vis_element, GstElement *ca
 	else
 		q = &fake_vis_quality;
 
-	pad = gst_element_get_pad (vis_element, "src");
+	pad = gst_element_get_static_pad (vis_element, "src");
 	template_caps = gst_pad_get_pad_template_caps (pad);
 	gst_object_unref (pad);
 
@@ -567,7 +567,7 @@ update_playbin_visualizer (RBVisualizerPlugin *plugin,
 	plugin->capsfilter = gst_element_factory_make ("capsfilter", NULL);
 	gst_bin_add (GST_BIN (plugin->visualizer), plugin->capsfilter);
 
-	pad = gst_element_get_pad (plugin->capsfilter, "src");
+	pad = gst_element_get_static_pad (plugin->capsfilter, "src");
 	gst_element_add_pad (plugin->visualizer, gst_ghost_pad_new ("src", pad));
 	gst_object_unref (pad);
 
@@ -580,7 +580,7 @@ update_playbin_visualizer (RBVisualizerPlugin *plugin,
 		gst_bin_add (GST_BIN (plugin->visualizer), vis_plugin);
 	}
 
-	pad = gst_element_get_pad (vis_plugin, "sink");
+	pad = gst_element_get_static_pad (vis_plugin, "sink");
 	gst_element_add_pad (plugin->visualizer, gst_ghost_pad_new ("sink", pad));
 	gst_object_unref (pad);
 
@@ -682,7 +682,7 @@ update_tee_visualizer (RBVisualizerPlugin *plugin,
 
 			/* probably should do this async.. */
 			rb_debug ("blocking visualizer bin sink pad");
-			pad = gst_element_get_pad (plugin->visualizer, "sink");
+			pad = gst_element_get_static_pad (plugin->visualizer, "sink");
 			blocked_pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
 			gst_pad_set_blocked (blocked_pad, TRUE);
 			gst_object_unref (pad);
@@ -1681,7 +1681,7 @@ impl_activate (RBPlugin *plugin,
 		gst_element_link_many (pi->capsfilter, colorspace, videoscale, pi->video_sink, NULL);
 		/* leave identity unlinked until we have a visualizer element */
 
-		pad = gst_element_get_pad (pi->identity, "sink");
+		pad = gst_element_get_static_pad (pi->identity, "sink");
 		gst_element_add_pad (pi->visualizer, gst_ghost_pad_new ("sink", pad));
 		gst_object_unref (pad);
 



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