diff options
author | François Laignel <francois@centricular.com> | 2023-05-10 18:02:08 +0300 |
---|---|---|
committer | François Laignel <francois@centricular.com> | 2023-05-12 13:55:31 +0300 |
commit | 7ba0073052c81c8f2f1ebe500048ed6d974e81d8 (patch) | |
tree | 26a4f2b74ac8a7129b6ecc95e8affcb302aa1bc2 /net | |
parent | 8e93d294e5a61a94f14e812bef59cd0e529494e1 (diff) |
use Pad builders for optional name definition
Also, apply auto-naming in the following cases
* When building from a non wildcard-named template, the name of the template is
automatically assigned to the Pad. User can override with a specific name by
calling `name()` on the `PadBuilder`.
* When building with a target and no name was provided via the above, the
GhostPad is named after the target.
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/448
Auto-naming discussion: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1255#note_1891181
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1197>
Diffstat (limited to 'net')
-rw-r--r-- | net/aws/src/s3hlssink/imp.rs | 8 | ||||
-rw-r--r-- | net/aws/src/transcribe_parse/imp.rs | 4 | ||||
-rw-r--r-- | net/aws/src/transcriber/imp.rs | 95 | ||||
-rw-r--r-- | net/hlssink3/src/imp.rs | 8 | ||||
-rw-r--r-- | net/ndi/src/ndisinkcombiner/imp.rs | 7 | ||||
-rw-r--r-- | net/ndi/src/ndisrcdemux/imp.rs | 6 | ||||
-rw-r--r-- | net/onvif/src/onvifmetadatacombiner/imp.rs | 5 | ||||
-rw-r--r-- | net/onvif/src/onvifmetadataoverlay/imp.rs | 4 | ||||
-rw-r--r-- | net/onvif/src/onvifmetadataparse/imp.rs | 4 | ||||
-rw-r--r-- | net/raptorq/src/raptorqdec/imp.rs | 7 | ||||
-rw-r--r-- | net/raptorq/src/raptorqenc/imp.rs | 6 | ||||
-rw-r--r-- | net/reqwest/tests/reqwesthttpsrc.rs | 3 | ||||
-rw-r--r-- | net/rtp/src/gcc/imp.rs | 4 | ||||
-rw-r--r-- | net/webrtc/src/webrtcsink/imp.rs | 15 | ||||
-rw-r--r-- | net/webrtc/src/webrtcsrc/imp.rs | 12 | ||||
-rw-r--r-- | net/webrtchttp/src/whepsrc/imp.rs | 4 | ||||
-rw-r--r-- | net/webrtchttp/src/whipsink/imp.rs | 4 |
17 files changed, 91 insertions, 105 deletions
diff --git a/net/aws/src/s3hlssink/imp.rs b/net/aws/src/s3hlssink/imp.rs index e4255d8f..1c53189a 100644 --- a/net/aws/src/s3hlssink/imp.rs +++ b/net/aws/src/s3hlssink/imp.rs @@ -884,9 +884,7 @@ impl ElementImpl for S3HlsSink { } let audio_pad = self.hlssink.request_pad_simple("audio").unwrap(); - let sink_pad = - gst::GhostPad::from_template_with_target(templ, Some("audio"), &audio_pad) - .unwrap(); + let sink_pad = gst::GhostPad::from_template_with_target(templ, &audio_pad).unwrap(); self.obj().add_pad(&sink_pad).unwrap(); sink_pad.set_active(true).unwrap(); settings.audio_sink = true; @@ -904,9 +902,7 @@ impl ElementImpl for S3HlsSink { } let video_pad = self.hlssink.request_pad_simple("video").unwrap(); - let sink_pad = - gst::GhostPad::from_template_with_target(templ, Some("video"), &video_pad) - .unwrap(); + let sink_pad = gst::GhostPad::from_template_with_target(templ, &video_pad).unwrap(); self.obj().add_pad(&sink_pad).unwrap(); sink_pad.set_active(true).unwrap(); settings.video_sink = true; diff --git a/net/aws/src/transcribe_parse/imp.rs b/net/aws/src/transcribe_parse/imp.rs index b8ba0fd5..4a3a4865 100644 --- a/net/aws/src/transcribe_parse/imp.rs +++ b/net/aws/src/transcribe_parse/imp.rs @@ -252,7 +252,7 @@ impl ObjectSubclass for TranscribeParse { fn with_class(klass: &Self::Class) -> Self { let templ = klass.pad_template("sink").unwrap(); - let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink")) + let sinkpad = gst::Pad::builder_from_template(&templ) .chain_function(|pad, parent, buffer| { TranscribeParse::catch_panic_pad_function( parent, @@ -270,7 +270,7 @@ impl ObjectSubclass for TranscribeParse { .build(); let templ = klass.pad_template("src").unwrap(); - let srcpad = gst::Pad::builder_with_template(&templ, Some("src")).build(); + let srcpad = gst::Pad::from_template(&templ); Self { srcpad, diff --git a/net/aws/src/transcriber/imp.rs b/net/aws/src/transcriber/imp.rs index 9658b814..bc160b63 100644 --- a/net/aws/src/transcriber/imp.rs +++ b/net/aws/src/transcriber/imp.rs @@ -589,7 +589,7 @@ impl ObjectSubclass for Transcriber { fn with_class(klass: &Self::Class) -> Self { let templ = klass.pad_template("sink").unwrap(); - let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink")) + let sinkpad = gst::Pad::builder_from_template(&templ) .chain_function(|pad, parent, buffer| { Transcriber::catch_panic_pad_function( parent, @@ -607,29 +607,28 @@ impl ObjectSubclass for Transcriber { .build(); let templ = klass.pad_template("src").unwrap(); - let static_srcpad = - gst::PadBuilder::<super::TranslateSrcPad>::from_template(&templ, Some("src")) - .activatemode_function(|pad, parent, mode, active| { - Transcriber::catch_panic_pad_function( - parent, - || { - Err(gst::loggable_error!( - CAT, - "Panic activating TranslateSrcPad" - )) - }, - |elem| TranslateSrcPad::activatemode(elem, pad, mode, active), - ) - }) - .query_function(|pad, parent, query| { - Transcriber::catch_panic_pad_function( - parent, - || false, - |elem| TranslateSrcPad::src_query(elem, pad, query), - ) - }) - .flags(gst::PadFlags::FIXED_CAPS) - .build(); + let static_srcpad = gst::PadBuilder::<super::TranslateSrcPad>::from_template(&templ) + .activatemode_function(|pad, parent, mode, active| { + Transcriber::catch_panic_pad_function( + parent, + || { + Err(gst::loggable_error!( + CAT, + "Panic activating TranslateSrcPad" + )) + }, + |elem| TranslateSrcPad::activatemode(elem, pad, mode, active), + ) + }) + .query_function(|pad, parent, query| { + Transcriber::catch_panic_pad_function( + parent, + || false, + |elem| TranslateSrcPad::src_query(elem, pad, query), + ) + }) + .flags(gst::PadFlags::FIXED_CAPS) + .build(); // Setting the channel capacity so that a TranslateSrcPad that would lag // behind for some reasons get a chance to catch-up without loosing items. @@ -986,31 +985,29 @@ impl ElementImpl for Transcriber { ) -> Option<gst::Pad> { let mut state = self.state.lock().unwrap(); - let pad = gst::PadBuilder::<super::TranslateSrcPad>::from_template( - templ, - Some(format!("translate_src_{}", state.pad_serial).as_str()), - ) - .activatemode_function(|pad, parent, mode, active| { - Transcriber::catch_panic_pad_function( - parent, - || { - Err(gst::loggable_error!( - CAT, - "Panic activating TranslateSrcPad" - )) - }, - |elem| TranslateSrcPad::activatemode(elem, pad, mode, active), - ) - }) - .query_function(|pad, parent, query| { - Transcriber::catch_panic_pad_function( - parent, - || false, - |elem| TranslateSrcPad::src_query(elem, pad, query), - ) - }) - .flags(gst::PadFlags::FIXED_CAPS) - .build(); + let pad = gst::PadBuilder::<super::TranslateSrcPad>::from_template(templ) + .name(format!("translate_src_{}", state.pad_serial).as_str()) + .activatemode_function(|pad, parent, mode, active| { + Transcriber::catch_panic_pad_function( + parent, + || { + Err(gst::loggable_error!( + CAT, + "Panic activating TranslateSrcPad" + )) + }, + |elem| TranslateSrcPad::activatemode(elem, pad, mode, active), + ) + }) + .query_function(|pad, parent, query| { + Transcriber::catch_panic_pad_function( + parent, + || false, + |elem| TranslateSrcPad::src_query(elem, pad, query), + ) + }) + .flags(gst::PadFlags::FIXED_CAPS) + .build(); state.srcpads.insert(pad.clone()); diff --git a/net/hlssink3/src/imp.rs b/net/hlssink3/src/imp.rs index 324634b1..c629ce40 100644 --- a/net/hlssink3/src/imp.rs +++ b/net/hlssink3/src/imp.rs @@ -797,9 +797,7 @@ impl ElementImpl for HlsSink3 { } let peer_pad = settings.splitmuxsink.request_pad_simple("audio_0").unwrap(); - let sink_pad = - gst::GhostPad::from_template_with_target(templ, Some("audio"), &peer_pad) - .unwrap(); + let sink_pad = gst::GhostPad::from_template_with_target(templ, &peer_pad).unwrap(); self.obj().add_pad(&sink_pad).unwrap(); sink_pad.set_active(true).unwrap(); settings.audio_sink = true; @@ -817,9 +815,7 @@ impl ElementImpl for HlsSink3 { } let peer_pad = settings.splitmuxsink.request_pad_simple("video").unwrap(); - let sink_pad = - gst::GhostPad::from_template_with_target(templ, Some("video"), &peer_pad) - .unwrap(); + let sink_pad = gst::GhostPad::from_template_with_target(templ, &peer_pad).unwrap(); self.obj().add_pad(&sink_pad).unwrap(); sink_pad.set_active(true).unwrap(); settings.video_sink = true; diff --git a/net/ndi/src/ndisinkcombiner/imp.rs b/net/ndi/src/ndisinkcombiner/imp.rs index c2921091..eb83af97 100644 --- a/net/ndi/src/ndisinkcombiner/imp.rs +++ b/net/ndi/src/ndisinkcombiner/imp.rs @@ -52,9 +52,7 @@ impl ObjectSubclass for NdiSinkCombiner { fn with_class(klass: &Self::Class) -> Self { let templ = klass.pad_template("video").unwrap(); - let video_pad = - gst::PadBuilder::<gst_base::AggregatorPad>::from_template(&templ, Some("video")) - .build(); + let video_pad = gst::PadBuilder::<gst_base::AggregatorPad>::from_template(&templ).build(); Self { video_pad, @@ -176,8 +174,7 @@ impl AggregatorImpl for NdiSinkCombiner { return None; } - let pad = - gst::PadBuilder::<gst_base::AggregatorPad>::from_template(templ, Some("audio")).build(); + let pad = gst::PadBuilder::<gst_base::AggregatorPad>::from_template(templ).build(); *audio_pad_storage = Some(pad.clone()); gst::debug!(CAT, imp: self, "Requested audio pad"); diff --git a/net/ndi/src/ndisrcdemux/imp.rs b/net/ndi/src/ndisrcdemux/imp.rs index a64c280f..75901664 100644 --- a/net/ndi/src/ndisrcdemux/imp.rs +++ b/net/ndi/src/ndisrcdemux/imp.rs @@ -40,7 +40,7 @@ impl ObjectSubclass for NdiSrcDemux { fn with_class(klass: &Self::Class) -> Self { let templ = klass.pad_template("sink").unwrap(); - let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink")) + let sinkpad = gst::Pad::builder_from_template(&templ) .flags(gst::PadFlags::FIXED_CAPS) .chain_function(|pad, parent, buffer| { NdiSrcDemux::catch_panic_pad_function( @@ -180,7 +180,7 @@ impl NdiSrcDemux { gst::debug!(CAT, imp: self, "Adding audio pad with caps {}", caps); let templ = self.obj().element_class().pad_template("audio").unwrap(); - let pad = gst::Pad::builder_with_template(&templ, Some("audio")) + let pad = gst::Pad::builder_from_template(&templ) .flags(gst::PadFlags::FIXED_CAPS) .build(); @@ -229,7 +229,7 @@ impl NdiSrcDemux { gst::debug!(CAT, imp: self, "Adding video pad with caps {}", caps); let templ = self.obj().element_class().pad_template("video").unwrap(); - let pad = gst::Pad::builder_with_template(&templ, Some("video")) + let pad = gst::Pad::builder_from_template(&templ) .flags(gst::PadFlags::FIXED_CAPS) .build(); diff --git a/net/onvif/src/onvifmetadatacombiner/imp.rs b/net/onvif/src/onvifmetadatacombiner/imp.rs index 2a5e8737..9cd56f53 100644 --- a/net/onvif/src/onvifmetadatacombiner/imp.rs +++ b/net/onvif/src/onvifmetadatacombiner/imp.rs @@ -42,12 +42,11 @@ impl ObjectSubclass for OnvifMetadataCombiner { fn with_class(klass: &Self::Class) -> Self { let templ = klass.pad_template("media").unwrap(); let media_sink_pad = - gst::PadBuilder::<gst_base::AggregatorPad>::from_template(&templ, Some("media")) - .build(); + gst::PadBuilder::<gst_base::AggregatorPad>::from_template(&templ).build(); let templ = klass.pad_template("meta").unwrap(); let meta_sink_pad = - gst::PadBuilder::<gst_base::AggregatorPad>::from_template(&templ, Some("meta")).build(); + gst::PadBuilder::<gst_base::AggregatorPad>::from_template(&templ).build(); Self { media_sink_pad, diff --git a/net/onvif/src/onvifmetadataoverlay/imp.rs b/net/onvif/src/onvifmetadataoverlay/imp.rs index f1acaedd..6003ff3a 100644 --- a/net/onvif/src/onvifmetadataoverlay/imp.rs +++ b/net/onvif/src/onvifmetadataoverlay/imp.rs @@ -715,7 +715,7 @@ impl ObjectSubclass for OnvifMetadataOverlay { fn with_class(klass: &Self::Class) -> Self { let templ = klass.pad_template("sink").unwrap(); - let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink")) + let sinkpad = gst::Pad::builder_from_template(&templ) .chain_function(|pad, parent, buffer| { OnvifMetadataOverlay::catch_panic_pad_function( parent, @@ -735,7 +735,7 @@ impl ObjectSubclass for OnvifMetadataOverlay { .build(); let templ = klass.pad_template("src").unwrap(); - let srcpad = gst::Pad::builder_with_template(&templ, Some("src")) + let srcpad = gst::Pad::builder_from_template(&templ) .flags(gst::PadFlags::PROXY_CAPS) .flags(gst::PadFlags::PROXY_ALLOCATION) .build(); diff --git a/net/onvif/src/onvifmetadataparse/imp.rs b/net/onvif/src/onvifmetadataparse/imp.rs index 2e138d54..f1464e41 100644 --- a/net/onvif/src/onvifmetadataparse/imp.rs +++ b/net/onvif/src/onvifmetadataparse/imp.rs @@ -1407,7 +1407,7 @@ impl ObjectSubclass for OnvifMetadataParse { fn with_class(klass: &Self::Class) -> Self { let templ = klass.pad_template("sink").unwrap(); - let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink")) + let sinkpad = gst::Pad::builder_from_template(&templ) .chain_function(|pad, parent, buffer| { OnvifMetadataParse::catch_panic_pad_function( parent, @@ -1433,7 +1433,7 @@ impl ObjectSubclass for OnvifMetadataParse { .build(); let templ = klass.pad_template("src").unwrap(); - let srcpad = gst::Pad::builder_with_template(&templ, Some("src")) + let srcpad = gst::Pad::builder_from_template(&templ) .event_function(|pad, parent, event| { OnvifMetadataParse::catch_panic_pad_function( parent, diff --git a/net/raptorq/src/raptorqdec/imp.rs b/net/raptorq/src/raptorqdec/imp.rs index aba109eb..6c305b95 100644 --- a/net/raptorq/src/raptorqdec/imp.rs +++ b/net/raptorq/src/raptorqdec/imp.rs @@ -590,7 +590,7 @@ impl ObjectSubclass for RaptorqDec { fn with_class(klass: &Self::Class) -> Self { let templ = klass.pad_template("sink").unwrap(); - let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink")) + let sinkpad = gst::Pad::builder_from_template(&templ) .chain_function(|pad, parent, buffer| { Self::catch_panic_pad_function( parent, @@ -612,7 +612,7 @@ impl ObjectSubclass for RaptorqDec { .build(); let templ = klass.pad_template("src").unwrap(); - let srcpad = gst::Pad::builder_with_template(&templ, Some("src")) + let srcpad = gst::Pad::builder_from_template(&templ) .iterate_internal_links_function(|pad, parent| { Self::catch_panic_pad_function( parent, @@ -821,7 +821,8 @@ impl ElementImpl for RaptorqDec { return None; } - let sinkpad_fec = gst::Pad::builder_with_template(templ, name) + let sinkpad_fec = gst::Pad::builder_from_template(templ) + .maybe_name(name) .chain_function(|pad, parent, buffer| { Self::catch_panic_pad_function( parent, diff --git a/net/raptorq/src/raptorqenc/imp.rs b/net/raptorq/src/raptorqenc/imp.rs index 07264d7f..cb37a0a2 100644 --- a/net/raptorq/src/raptorqenc/imp.rs +++ b/net/raptorq/src/raptorqenc/imp.rs @@ -659,7 +659,7 @@ impl ObjectSubclass for RaptorqEnc { fn with_class(klass: &Self::Class) -> Self { let templ = klass.pad_template("sink").unwrap(); - let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink")) + let sinkpad = gst::Pad::builder_from_template(&templ) .chain_function(|pad, parent, buffer| { Self::catch_panic_pad_function( parent, @@ -681,7 +681,7 @@ impl ObjectSubclass for RaptorqEnc { .build(); let templ = klass.pad_template("src").unwrap(); - let srcpad = gst::Pad::builder_with_template(&templ, Some("src")) + let srcpad = gst::Pad::builder_from_template(&templ) .iterate_internal_links_function(|pad, parent| { Self::catch_panic_pad_function( parent, @@ -693,7 +693,7 @@ impl ObjectSubclass for RaptorqEnc { .build(); let templ = klass.pad_template("fec_0").unwrap(); - let srcpad_fec = gst::Pad::builder_with_template(&templ, Some("fec_0")) + let srcpad_fec = gst::Pad::builder_from_template(&templ) .activatemode_function(move |pad, parent, mode, active| { Self::catch_panic_pad_function( parent, diff --git a/net/reqwest/tests/reqwesthttpsrc.rs b/net/reqwest/tests/reqwesthttpsrc.rs index da5a9c85..9287822a 100644 --- a/net/reqwest/tests/reqwesthttpsrc.rs +++ b/net/reqwest/tests/reqwesthttpsrc.rs @@ -72,7 +72,8 @@ impl Harness { let (sender, receiver) = mpsc::sync_channel(0); // Sink pad that receives everything the source is generating - let pad = gst::Pad::builder(Some("sink"), gst::PadDirection::Sink) + let pad = gst::Pad::builder(gst::PadDirection::Sink) + .name("sink") .chain_function({ let sender_clone = sender.clone(); move |_pad, _parent, buffer| { diff --git a/net/rtp/src/gcc/imp.rs b/net/rtp/src/gcc/imp.rs index f56d0a78..1955ecf1 100644 --- a/net/rtp/src/gcc/imp.rs +++ b/net/rtp/src/gcc/imp.rs @@ -1146,7 +1146,7 @@ impl ObjectSubclass for BandwidthEstimator { fn with_class(klass: &Self::Class) -> Self { let templ = klass.pad_template("sink").unwrap(); - let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink")) + let sinkpad = gst::Pad::builder_from_template(&templ) .chain_function(|_pad, parent, mut buffer| { BandwidthEstimator::catch_panic_pad_function( parent, @@ -1166,7 +1166,7 @@ impl ObjectSubclass for BandwidthEstimator { .build(); let templ = klass.pad_template("src").unwrap(); - let srcpad = gst::Pad::builder_with_template(&templ, Some("src")) + let srcpad = gst::Pad::builder_from_template(&templ) .event_function(|pad, parent, event| { BandwidthEstimator::catch_panic_pad_function( parent, diff --git a/net/webrtc/src/webrtcsink/imp.rs b/net/webrtc/src/webrtcsink/imp.rs index c3fbda7c..5e5a8c89 100644 --- a/net/webrtc/src/webrtcsink/imp.rs +++ b/net/webrtc/src/webrtcsink/imp.rs @@ -399,10 +399,8 @@ fn make_converter_for_video_caps(caps: &gst::Caps) -> Result<gst::Element, Error } }; - ret.add_pad( - &gst::GhostPad::with_target(Some("sink"), &head.static_pad("sink").unwrap()).unwrap(), - ) - .unwrap(); + ret.add_pad(&gst::GhostPad::with_target(&head.static_pad("sink").unwrap()).unwrap()) + .unwrap(); if video_info.fps().numer() != 0 { let vrate = make_element("videorate", None)?; @@ -414,10 +412,8 @@ fn make_converter_for_video_caps(caps: &gst::Caps) -> Result<gst::Element, Error tail = vrate; } - ret.add_pad( - &gst::GhostPad::with_target(Some("src"), &tail.static_pad("src").unwrap()).unwrap(), - ) - .unwrap(); + ret.add_pad(&gst::GhostPad::with_target(&tail.static_pad("src").unwrap()).unwrap()) + .unwrap(); Ok(ret.upcast()) } @@ -3503,7 +3499,8 @@ impl ElementImpl for BaseWebRTCSink { (name, false) }; - let sink_pad = gst::GhostPad::builder_with_template(templ, Some(name.as_str())) + let sink_pad = gst::GhostPad::builder_from_template(templ) + .name(name.as_str()) .event_function(|pad, parent, event| { BaseWebRTCSink::catch_panic_pad_function( parent, diff --git a/net/webrtc/src/webrtcsrc/imp.rs b/net/webrtc/src/webrtcsrc/imp.rs index dfedcc73..86780034 100644 --- a/net/webrtc/src/webrtcsrc/imp.rs +++ b/net/webrtc/src/webrtcsrc/imp.rs @@ -417,7 +417,9 @@ impl WebRTCSrc { pad.store_sticky_event(&builder.build()).ok(); } - let ghostpad = gst::GhostPad::builder(None, gst::PadDirection::Src) + let ghostpad = gst::GhostPad::builder(gst::PadDirection::Src) + .with_target(pad) + .unwrap() .proxy_pad_chain_function(glib::clone!(@weak self as this => @default-panic, move |pad, parent, buffer| { let padret = gst::ProxyPad::chain_default(pad, parent, buffer); @@ -443,8 +445,7 @@ impl WebRTCSrc { gst::Pad::event_default(pad, parent, event) })) - .build_with_target(pad) - .unwrap(); + .build(); bin.add_pad(&ghostpad) .expect("Adding ghostpad to the bin should always work"); @@ -550,7 +551,7 @@ impl WebRTCSrc { webrtcbin.set_property("stun-server", stun_server); } - let bin = gst::Bin::new(None); + let bin = gst::Bin::new(); bin.connect_pad_removed(glib::clone!(@weak self as this => move |_, pad| this.state.lock().unwrap().flow_combiner.remove_pad(pad); )); @@ -751,7 +752,8 @@ impl WebRTCSrc { let caps_with_raw = [caps.clone(), raw_caps.clone()] .into_iter() .collect::<gst::Caps>(); - let ghost = gst::GhostPad::builder_with_template(&template, Some(&name)) + let ghost = gst::GhostPad::builder_from_template(&template) + .name(name) .build() .downcast::<WebRTCSrcPad>() .unwrap(); diff --git a/net/webrtchttp/src/whepsrc/imp.rs b/net/webrtchttp/src/whepsrc/imp.rs index e0752ac8..d8be2284 100644 --- a/net/webrtchttp/src/whepsrc/imp.rs +++ b/net/webrtchttp/src/whepsrc/imp.rs @@ -534,9 +534,7 @@ impl WhepSrc { ); let templ = self_.obj().pad_template("src_%u").unwrap(); - let src_pad = gst::GhostPad::builder_with_template(&templ, Some(&pad.name())) - .build_with_target(pad) - .unwrap(); + let src_pad = gst::GhostPad::from_template_with_target(&templ, pad).unwrap(); src_pad.set_target(Some(pad)).unwrap(); src_pad diff --git a/net/webrtchttp/src/whipsink/imp.rs b/net/webrtchttp/src/whipsink/imp.rs index c1ac7c28..1b3f5b65 100644 --- a/net/webrtchttp/src/whipsink/imp.rs +++ b/net/webrtchttp/src/whipsink/imp.rs @@ -135,7 +135,9 @@ impl ElementImpl for WhipSink { caps: Option<&gst::Caps>, ) -> Option<gst::Pad> { let wb_sink_pad = self.webrtcbin.request_pad(templ, name, caps)?; - let sink_pad = gst::GhostPad::new(Some(&wb_sink_pad.name()), gst::PadDirection::Sink); + let sink_pad = gst::GhostPad::builder(gst::PadDirection::Sink) + .name(wb_sink_pad.name()) + .build(); sink_pad.set_target(Some(&wb_sink_pad)).unwrap(); self.obj().add_pad(&sink_pad).unwrap(); |