From ad3d7d34cccefb6551b5ed6545e49cc92fc76291 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Laignel?= Date: Tue, 20 Apr 2021 22:18:09 +0200 Subject: [PATCH] Use gst_element_request_pad_simple... Instead of the deprecated gst_element_get_request_pad. Part-of: --- ext/dash/gstdashsink.c | 2 +- ext/dtls/gstdtlssrtpdec.c | 2 +- ext/dtls/gstdtlssrtpenc.c | 7 ++++--- ext/hls/gsthlssink2.c | 2 +- ext/resindvd/resindvdbin.c | 6 +++--- ext/webrtc/gstwebrtcbin.c | 4 ++-- ext/webrtc/transportreceivebin.c | 2 +- gst/camerabin2/gstwrappercamerabinsrc.c | 4 ++-- gst/rist/gstristsink.c | 4 ++-- gst/rtp/gstrtpsink.c | 2 +- gst/sdp/gstsdpdemux.c | 8 +++++--- gst/transcode/gsttranscodebin.c | 2 +- gst/transcode/gsturitranscodebin.c | 2 +- sys/dvb/dvbbasebin.c | 2 +- sys/uvch264/gstuvch264_src.c | 4 ++-- tests/check/elements/asfmux.c | 4 ++-- tests/check/elements/cccombiner.c | 2 +- tests/check/elements/dtls.c | 8 ++++---- tests/check/elements/mpegtsmux.c | 4 ++-- tests/check/elements/mplex.c | 2 +- tests/check/elements/webrtcbin.c | 6 +++--- tests/examples/playout.c | 4 ++-- 22 files changed, 43 insertions(+), 40 deletions(-) diff --git a/ext/dash/gstdashsink.c b/ext/dash/gstdashsink.c index 9a09689..1815d3e 100644 --- a/ext/dash/gstdashsink.c +++ b/ext/dash/gstdashsink.c @@ -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; diff --git a/ext/dtls/gstdtlssrtpdec.c b/ext/dtls/gstdtlssrtpdec.c index 37121cd..8d90f4c 100644 --- a/ext/dtls/gstdtlssrtpdec.c +++ b/ext/dtls/gstdtlssrtpdec.c @@ -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); diff --git a/ext/dtls/gstdtlssrtpenc.c b/ext/dtls/gstdtlssrtpenc.c index 603d374..21734c6 100644 --- a/ext/dtls/gstdtlssrtpenc.c +++ b/ext/dtls/gstdtlssrtpenc.c @@ -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); diff --git a/ext/hls/gsthlssink2.c b/ext/hls/gsthlssink2.c index 16bda35..7b5cdfa 100644 --- a/ext/hls/gsthlssink2.c +++ b/ext/hls/gsthlssink2.c @@ -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; diff --git a/ext/resindvd/resindvdbin.c b/ext/resindvd/resindvdbin.c index 76727f2..9fe54f9 100644 --- a/ext/resindvd/resindvdbin.c +++ b/ext/resindvd/resindvdbin.c @@ -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; diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c index cde8a24..1386bdd 100644 --- a/ext/webrtc/gstwebrtcbin.c +++ b/ext/webrtc/gstwebrtcbin.c @@ -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); diff --git a/ext/webrtc/transportreceivebin.c b/ext/webrtc/transportreceivebin.c index df89e6e..fb556ed 100644 --- a/ext/webrtc/transportreceivebin.c +++ b/ext/webrtc/transportreceivebin.c @@ -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); diff --git a/gst/camerabin2/gstwrappercamerabinsrc.c b/gst/camerabin2/gstwrappercamerabinsrc.c index 491007e..fd595cb 100644 --- a/gst/camerabin2/gstwrappercamerabinsrc.c +++ b/gst/camerabin2/gstwrappercamerabinsrc.c @@ -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); diff --git a/gst/rist/gstristsink.c b/gst/rist/gstristsink.c index 1de516d..9ba1f55 100644 --- a/gst/rist/gstristsink.c +++ b/gst/rist/gstristsink.c @@ -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); diff --git a/gst/rtp/gstrtpsink.c b/gst/rtp/gstrtpsink.c index c94c6da..83739fb 100644 --- a/gst/rtp/gstrtpsink.c +++ b/gst/rtp/gstrtpsink.c @@ -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); diff --git a/gst/sdp/gstsdpdemux.c b/gst/sdp/gstsdpdemux.c index 1737ed8..6b1c580 100644 --- a/gst/sdp/gstsdpdemux.c +++ b/gst/sdp/gstsdpdemux.c @@ -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 */ diff --git a/gst/transcode/gsttranscodebin.c b/gst/transcode/gsttranscodebin.c index 0ceb163..da56a0d 100644 --- a/gst/transcode/gsttranscodebin.c +++ b/gst/transcode/gsttranscodebin.c @@ -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, diff --git a/gst/transcode/gsturitranscodebin.c b/gst/transcode/gsturitranscodebin.c index 8cf13d3..9e42856 100644 --- a/gst/transcode/gsturitranscodebin.c +++ b/gst/transcode/gsturitranscodebin.c @@ -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, diff --git a/sys/dvb/dvbbasebin.c b/sys/dvb/dvbbasebin.c index 3d2ba23..e85003a 100644 --- a/sys/dvb/dvbbasebin.c +++ b/sys/dvb/dvbbasebin.c @@ -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; diff --git a/sys/uvch264/gstuvch264_src.c b/sys/uvch264/gstuvch264_src.c index 55bde5a..1912479 100644 --- a/sys/uvch264/gstuvch264_src.c +++ b/sys/uvch264/gstuvch264_src.c @@ -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; } diff --git a/tests/check/elements/asfmux.c b/tests/check/elements/asfmux.c index 57526f8..b1e07c8 100644 --- a/tests/check/elements/asfmux.c +++ b/tests/check/elements/asfmux.c @@ -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"); diff --git a/tests/check/elements/cccombiner.c b/tests/check/elements/cccombiner.c index 390b984..cb7c809 100644 --- a/tests/check/elements/cccombiner.c +++ b/tests/check/elements/cccombiner.c @@ -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); diff --git a/tests/check/elements/dtls.c b/tests/check/elements/dtls.c index 74149d2..7d5ad3a 100644 --- a/tests/check/elements/dtls.c +++ b/tests/check/elements/dtls.c @@ -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); diff --git a/tests/check/elements/mpegtsmux.c b/tests/check/elements/mpegtsmux.c index be537c1..dc6b0f6 100644 --- a/tests/check/elements/mpegtsmux.c +++ b/tests/check/elements/mpegtsmux.c @@ -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); diff --git a/tests/check/elements/mplex.c b/tests/check/elements/mplex.c index b65632c..6a6b296 100644 --- a/tests/check/elements/mplex.c +++ b/tests/check/elements/mplex.c @@ -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 */ diff --git a/tests/check/elements/webrtcbin.c b/tests/check/elements/webrtcbin.c index 4fa5efa..282c4b0 100644 --- a/tests/check/elements/webrtcbin.c +++ b/tests/check/elements/webrtcbin.c @@ -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); diff --git a/tests/examples/playout.c b/tests/examples/playout.c index 0325631..315ef5b 100644 --- a/tests/examples/playout.c +++ b/tests/examples/playout.c @@ -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 */ -- 2.7.4