Use gst_element_request_pad_simple...

Instead of the deprecated gst_element_get_request_pad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2180>
This commit is contained in:
François Laignel 2021-04-20 22:18:09 +02:00 committed by Sebastian Dröge
parent eb96f50c45
commit ad3d7d34cc
22 changed files with 43 additions and 40 deletions

View file

@ -804,7 +804,7 @@ gst_dash_sink_request_new_pad (GstElement * element, GstPadTemplate * templ,
goto done;
}
peer = gst_element_get_request_pad (stream->splitmuxsink, split_pad_name);
peer = gst_element_request_pad_simple (stream->splitmuxsink, split_pad_name);
if (!peer) {
GST_ERROR_OBJECT (sink, "Unable to request pad name %s", split_pad_name);
return NULL;

View file

@ -321,7 +321,7 @@ gst_dtls_srtp_dec_request_new_pad (GstElement * element,
if (templ == gst_element_class_get_pad_template (klass, "data_src")) {
GstPad *target_pad;
target_pad = gst_element_get_request_pad (self->bin.dtls_element, "src");
target_pad = gst_element_request_pad_simple (self->bin.dtls_element, "src");
ghost_pad = gst_ghost_pad_new_from_template (name, target_pad, templ);
gst_object_unref (target_pad);

View file

@ -402,7 +402,7 @@ gst_dtls_srtp_enc_request_new_pad (GstElement * element,
gst_bin_add (GST_BIN (self), clocksync);
gst_element_sync_state_with_parent (clocksync);
target_pad = gst_element_get_request_pad (self->srtp_enc, name);
target_pad = gst_element_request_pad_simple (self->srtp_enc, name);
g_return_val_if_fail (target_pad, NULL);
srtp_src_name = g_strdup_printf ("rtp_src_%d", pad_n);
@ -417,7 +417,7 @@ gst_dtls_srtp_enc_request_new_pad (GstElement * element,
GST_LOG_OBJECT (self, "added rtp sink pad");
} else if (templ == gst_element_class_get_pad_template (klass,
"rtcp_sink_%d")) {
target_pad = gst_element_get_request_pad (self->srtp_enc, name);
target_pad = gst_element_request_pad_simple (self->srtp_enc, name);
g_return_val_if_fail (target_pad, NULL);
sscanf (GST_PAD_NAME (target_pad), "rtcp_sink_%d", &pad_n);
@ -432,7 +432,8 @@ gst_dtls_srtp_enc_request_new_pad (GstElement * element,
GST_LOG_OBJECT (self, "added rtcp sink pad");
} else if (templ == gst_element_class_get_pad_template (klass, "data_sink")) {
g_return_val_if_fail (self->bin.dtls_element, NULL);
target_pad = gst_element_get_request_pad (self->bin.dtls_element, "sink");
target_pad =
gst_element_request_pad_simple (self->bin.dtls_element, "sink");
ghost_pad = add_ghost_pad (element, name, target_pad, templ);

View file

@ -523,7 +523,7 @@ gst_hls_sink2_request_new_pad (GstElement * element, GstPadTemplate * templ,
is_audio = strcmp (templ->name_template, "audio") == 0;
peer =
gst_element_get_request_pad (sink->splitmuxsink,
gst_element_request_pad_simple (sink->splitmuxsink,
is_audio ? "audio_0" : "video");
if (!peer)
return NULL;

View file

@ -718,7 +718,7 @@ connect_thru_mq (RsnDvdBin * dvdbin, GstPad * pad)
/* Request a pad from multiqueue, then connect this one, then
* discover the corresponding output pad and return it */
mq_sink = gst_element_get_request_pad (dvdbin->pieces[DVD_ELEM_MQUEUE],
mq_sink = gst_element_request_pad_simple (dvdbin->pieces[DVD_ELEM_MQUEUE],
"sink_%u");
if (mq_sink == NULL)
return FALSE;
@ -795,13 +795,13 @@ demux_pad_added (GstElement * element, GstPad * pad, RsnDvdBin * dvdbin)
GST_LOG_OBJECT (dvdbin, "Found subpicture pad w/ caps %" GST_PTR_FORMAT,
caps);
dest_pad =
gst_element_get_request_pad (dvdbin->pieces[DVD_ELEM_SPU_SELECT],
gst_element_request_pad_simple (dvdbin->pieces[DVD_ELEM_SPU_SELECT],
"sink_%u");
skip_mq = TRUE;
} else if (can_sink_caps (dvdbin->pieces[DVD_ELEM_AUDDEC], caps)) {
GST_LOG_OBJECT (dvdbin, "Found audio pad w/ caps %" GST_PTR_FORMAT, caps);
dest_pad =
gst_element_get_request_pad (dvdbin->pieces[DVD_ELEM_AUD_SELECT],
gst_element_request_pad_simple (dvdbin->pieces[DVD_ELEM_AUD_SELECT],
"sink_%u");
} else {
GstStructure *s;

View file

@ -3924,7 +3924,7 @@ _connect_input_stream (GstWebRTCBin * webrtc, GstWebRTCBinPad * pad)
} else {
gchar *pad_name = g_strdup_printf ("sink_%u", pad->trans->mline);
GstPad *funnel_sinkpad =
gst_element_get_request_pad (webrtc->rtpfunnel, pad_name);
gst_element_request_pad_simple (webrtc->rtpfunnel, pad_name);
gst_ghost_pad_set_target (GST_GHOST_PAD (pad), funnel_sinkpad);
@ -4592,7 +4592,7 @@ _connect_rtpfunnel (GstWebRTCBin * webrtc, guint session_id)
queue_srcpad = gst_element_get_static_pad (queue, "src");
pad_name = g_strdup_printf ("send_rtp_sink_%d", session_id);
rtp_sink = gst_element_get_request_pad (webrtc->rtpbin, pad_name);
rtp_sink = gst_element_request_pad_simple (webrtc->rtpbin, pad_name);
g_free (pad_name);
gst_pad_link (queue_srcpad, rtp_sink);
gst_object_unref (queue_srcpad);

View file

@ -324,7 +324,7 @@ transport_receive_bin_constructed (GObject * object)
gst_object_unref (pad);
/* expose data_src */
pad = gst_element_get_request_pad (receive->stream->transport->dtlssrtpdec,
pad = gst_element_request_pad_simple (receive->stream->transport->dtlssrtpdec,
"data_src");
ghost = gst_ghost_pad_new ("data_src", pad);
gst_element_add_pad (GST_ELEMENT (receive), ghost);

View file

@ -598,10 +598,10 @@ gst_wrapper_camera_bin_src_construct_pipeline (GstBaseCameraSrc * bcamsrc)
video_recording_tee = gst_element_factory_make ("tee", "video_rec_tee");
gst_bin_add (GST_BIN_CAST (self), video_recording_tee); /* TODO check returns */
self->video_tee_vf_pad =
gst_element_get_request_pad (video_recording_tee, "src_%u");
gst_element_request_pad_simple (video_recording_tee, "src_%u");
self->video_tee_sink =
gst_element_get_static_pad (video_recording_tee, "sink");
tee_pad = gst_element_get_request_pad (video_recording_tee, "src_%u");
tee_pad = gst_element_request_pad_simple (video_recording_tee, "src_%u");
gst_ghost_pad_set_target (GST_GHOST_PAD (self->vidsrc), tee_pad);
gst_object_unref (tee_pad);

View file

@ -259,7 +259,7 @@ gst_rist_sink_add_bond (GstRistSink * sink)
gst_element_add_pad (sink->rtxbin, pad);
g_snprintf (name, 32, "send_rtp_sink_%u", bond->session);
pad = gst_element_get_request_pad (sink->rtpbin, name);
pad = gst_element_request_pad_simple (sink->rtpbin, name);
gst_object_unref (pad);
}
@ -761,7 +761,7 @@ gst_rist_sink_start (GstRistSink * sink)
g_object_unref (session);
g_snprintf (name, 32, "src_%u", bond->session);
pad = gst_element_get_request_pad (sink->dispatcher, name);
pad = gst_element_request_pad_simple (sink->dispatcher, name);
gst_element_link_pads (sink->dispatcher, name, bond->rtx_queue, "sink");
gst_object_unref (pad);

View file

@ -253,7 +253,7 @@ gst_rtp_sink_request_new_pad (GstElement * element,
return NULL;
GST_RTP_SINK_LOCK (self);
pad = gst_element_get_request_pad (self->rtpbin, "send_rtp_sink_%u");
pad = gst_element_request_pad_simple (self->rtpbin, "send_rtp_sink_%u");
GST_RTP_SINK_UNLOCK (self);
g_return_val_if_fail (pad != NULL, NULL);

View file

@ -784,7 +784,8 @@ gst_sdp_demux_stream_configure_udp (GstSDPDemux * demux, GstSDPStream * stream)
pad = gst_element_get_static_pad (stream->udpsrc[0], "src");
name = g_strdup_printf ("recv_rtp_sink_%u", stream->id);
stream->channelpad[0] = gst_element_get_request_pad (demux->session, name);
stream->channelpad[0] =
gst_element_request_pad_simple (demux->session, name);
g_free (name);
GST_DEBUG_OBJECT (demux, "connecting RTP source 0 to manager");
@ -814,7 +815,8 @@ gst_sdp_demux_stream_configure_udp (GstSDPDemux * demux, GstSDPStream * stream)
GST_DEBUG_OBJECT (demux, "connecting RTCP source to manager");
name = g_strdup_printf ("recv_rtcp_sink_%u", stream->id);
stream->channelpad[1] = gst_element_get_request_pad (demux->session, name);
stream->channelpad[1] =
gst_element_request_pad_simple (demux->session, name);
g_free (name);
pad = gst_element_get_static_pad (stream->udpsrc[1], "src");
@ -890,7 +892,7 @@ gst_sdp_demux_stream_configure_udp_sink (GstSDPDemux * demux,
/* get session RTCP pad */
name = g_strdup_printf ("send_rtcp_src_%u", stream->id);
pad = gst_element_get_request_pad (demux->session, name);
pad = gst_element_request_pad_simple (demux->session, name);
g_free (name);
/* and link */

View file

@ -841,7 +841,7 @@ gst_transcode_bin_request_pad (GstElement * element, GstPadTemplate * temp,
{
GstTranscodeBin *self = (GstTranscodeBin *) element;
GstPad *gpad, *decodebin_pad =
gst_element_get_request_pad (self->decodebin, "sink_%u");
gst_element_request_pad_simple (self->decodebin, "sink_%u");
if (!decodebin_pad) {
GST_ERROR_OBJECT (element,

View file

@ -272,7 +272,7 @@ src_pad_added_cb (GstElement * src, GstPad * pad, GstUriTranscodeBin * self)
sinkpad = gst_element_get_static_pad (self->transcodebin, "sink");
if (gst_pad_is_linked (sinkpad))
sinkpad = gst_element_get_request_pad (self->transcodebin, "sink_%u");
sinkpad = gst_element_request_pad_simple (self->transcodebin, "sink_%u");
if (sinkpad) {
GST_DEBUG_OBJECT (self,

View file

@ -751,7 +751,7 @@ dvb_base_bin_request_new_pad (GstElement * element,
if (name == NULL)
name = GST_PAD_TEMPLATE_NAME_TEMPLATE (templ);
pad = gst_element_get_request_pad (dvbbasebin->tsparse, name);
pad = gst_element_request_pad_simple (dvbbasebin->tsparse, name);
if (pad == NULL)
return NULL;

View file

@ -2816,8 +2816,8 @@ gst_uvc_h264_src_construct_pipeline (GstBaseCameraSrc * bcamsrc)
}
if (!gst_element_link (self->v4l2_src, tee))
goto error_remove_all;
vf_pad = gst_element_get_request_pad (tee, "src_%u");
vid_pad = gst_element_get_request_pad (tee, "src_%u");
vf_pad = gst_element_request_pad_simple (tee, "src_%u");
vid_pad = gst_element_request_pad_simple (tee, "src_%u");
}
break;
}

View file

@ -66,7 +66,7 @@ setup_src_pad (GstElement * element,
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
if (!(sinkpad = gst_element_get_static_pad (element, sinkname)))
sinkpad = gst_element_get_request_pad (element, sinkname);
sinkpad = gst_element_request_pad_simple (element, sinkname);
fail_if (sinkpad == NULL, "Could not get sink pad from %s",
GST_ELEMENT_NAME (element));
/* references are owned by: 1) us, 2) asfmux, 3) collect pads */
@ -90,7 +90,7 @@ teardown_src_pad (GstElement * element, const gchar * sinkname)
/* clean up floating src pad */
padname = g_strdup_printf (sinkname, 1);
if (!(sinkpad = gst_element_get_static_pad (element, padname)))
sinkpad = gst_element_get_request_pad (element, padname);
sinkpad = gst_element_request_pad_simple (element, padname);
g_free (padname);
fail_if (sinkpad == NULL, "sinkpad is null");

View file

@ -107,7 +107,7 @@ GST_START_TEST (captions_and_eos)
h = gst_harness_new_with_padnames ("cccombiner", "sink", "src");
h2 = gst_harness_new_with_element (h->element, NULL, NULL);
caption_pad = gst_element_get_request_pad (h->element, "caption");
caption_pad = gst_element_request_pad_simple (h->element, "caption");
gst_harness_add_element_sink_pad (h2, caption_pad);
gst_object_unref (caption_pad);

View file

@ -147,22 +147,22 @@ GST_START_TEST (test_data_transfer)
gst_element_set_state (c_enc, GST_STATE_PAUSED);
target = gst_element_get_request_pad (c_dec, "src");
target = gst_element_request_pad_simple (c_dec, "src");
ghost = gst_ghost_pad_new ("src", target);
gst_element_add_pad (s_bin, ghost);
gst_object_unref (target);
target = gst_element_get_request_pad (s_enc, "sink");
target = gst_element_request_pad_simple (s_enc, "sink");
ghost = gst_ghost_pad_new ("sink", target);
gst_element_add_pad (s_bin, ghost);
gst_object_unref (target);
target = gst_element_get_request_pad (s_dec, "src");
target = gst_element_request_pad_simple (s_dec, "src");
ghost = gst_ghost_pad_new ("src", target);
gst_element_add_pad (c_bin, ghost);
gst_object_unref (target);
target = gst_element_get_request_pad (c_enc, "sink");
target = gst_element_request_pad_simple (c_enc, "sink");
ghost = gst_ghost_pad_new ("sink", target);
gst_element_add_pad (c_bin, ghost);
gst_object_unref (target);

View file

@ -71,7 +71,7 @@ setup_src_pad (GstElement * element,
fail_if (srcpad == NULL, "Could not create a srcpad");
if (!(sinkpad = gst_element_get_static_pad (element, sinkname)))
sinkpad = gst_element_get_request_pad (element, sinkname);
sinkpad = gst_element_request_pad_simple (element, sinkname);
fail_if (sinkpad == NULL, "Could not get sink pad from %s",
GST_ELEMENT_NAME (element));
/* we can't test the reference count of the sinkpad here because it's either
@ -95,7 +95,7 @@ teardown_src_pad (GstElement * element, const gchar * sinkname)
/* clean up floating src pad */
if (!(sinkpad = gst_element_get_static_pad (element, sinkname)))
sinkpad = gst_element_get_request_pad (element, sinkname);
sinkpad = gst_element_request_pad_simple (element, sinkname);
srcpad = gst_pad_get_peer (sinkpad);
gst_pad_unlink (srcpad, sinkpad);

View file

@ -128,7 +128,7 @@ setup_src_pad (GstElement * element,
fail_if (srcpad == NULL, "Could not create a srcpad");
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
sinkpad = gst_element_get_request_pad (element, sinkname);
sinkpad = gst_element_request_pad_simple (element, sinkname);
fail_if (sinkpad == NULL, "Could not get sink pad from %s",
GST_ELEMENT_NAME (element));
/* references are owned by: 1) us, 2) mplex, 3) mplex list */

View file

@ -1266,7 +1266,7 @@ GST_START_TEST (test_no_nice_elements_request_pad)
t->bus_message = NULL;
pad = gst_element_get_request_pad (t->webrtc1, "sink_0");
pad = gst_element_request_pad_simple (t->webrtc1, "sink_0");
fail_unless (pad == NULL);
test_webrtc_wait_for_answer_error_eos (t);
@ -3422,7 +3422,7 @@ GST_START_TEST (test_reject_request_pad)
test_validate_sdp (t, &offer, &answer);
/* This should fail because the direction is wrong */
pad = gst_element_get_request_pad (t->webrtc1, "sink_0");
pad = gst_element_request_pad_simple (t->webrtc1, "sink_0");
fail_unless (pad == NULL);
g_object_set (trans, "direction",
@ -3445,7 +3445,7 @@ GST_START_TEST (test_reject_request_pad)
gst_caps_unref (caps);
/* This should succeed and give us sink_0 */
pad = gst_element_get_request_pad (t->webrtc1, "sink_0");
pad = gst_element_request_pad_simple (t->webrtc1, "sink_0");
fail_unless (pad != NULL);
g_object_get (pad, "transceiver", &trans2, NULL);

View file

@ -824,7 +824,7 @@ playout_app_activate_item (PlayoutItem * item)
/* Hook up to mixers and remove the probes blocking the pads */
if (item->audio_pad) {
GST_DEBUG ("%s: hooking up audio pad to mixer", item->fn);
sinkpad = gst_element_get_request_pad (app->audio_mixer, "sink_%u");
sinkpad = gst_element_request_pad_simple (app->audio_mixer, "sink_%u");
gst_pad_link (item->audio_pad, sinkpad);
segment_time = playout_item_pad_get_segment_time (item->audio_pad);
@ -857,7 +857,7 @@ playout_app_activate_item (PlayoutItem * item)
if (item->video_pad) {
GST_DEBUG ("%s: hooking up video pad to mixer", item->fn);
sinkpad = gst_element_get_request_pad (app->video_mixer, "sink_%u");
sinkpad = gst_element_request_pad_simple (app->video_mixer, "sink_%u");
/* Get new height/width/xpos/ypos such that the video scales up or down to
* fit within the output video size without any cropping */