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>
This commit is contained in:
François Laignel 2023-05-10 17:02:08 +02:00
parent 8e93d294e5
commit 7ba0073052
65 changed files with 327 additions and 345 deletions

View file

@ -1690,7 +1690,7 @@ impl ObjectSubclass for AudioLoudNorm {
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,
@ -1705,7 +1705,7 @@ impl ObjectSubclass for AudioLoudNorm {
.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)
.query_function(|pad, parent, query| {
Self::catch_panic_pad_function(parent, || false, |this| this.src_query(pad, query))
})

View file

@ -526,10 +526,10 @@ impl ObjectSubclass for Decrypter {
fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap();
let sinkpad = gst::Pad::from_template(&templ, Some("sink"));
let sinkpad = gst::Pad::from_template(&templ);
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)
.getrange_function(|pad, parent, offset, buffer, size| {
Decrypter::catch_panic_pad_function(
parent,

View file

@ -329,7 +329,7 @@ impl ObjectSubclass for Encrypter {
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| {
Encrypter::catch_panic_pad_function(
parent,
@ -347,7 +347,7 @@ impl ObjectSubclass for Encrypter {
.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)
.query_function(|pad, parent, query| {
Encrypter::catch_panic_pad_function(
parent,

View file

@ -241,7 +241,7 @@ impl ObjectSubclass for AsyncMutexSink {
let sink_pad_handler = AsyncPadSinkHandler::default();
Self {
sink_pad: PadSink::new(
gst::Pad::from_template(&klass.pad_template("sink").unwrap(), Some("sink")),
gst::Pad::from_template(&klass.pad_template("sink").unwrap()),
sink_pad_handler.clone(),
),
sink_pad_handler,

View file

@ -234,7 +234,7 @@ impl ObjectSubclass for DirectSink {
let sink_pad_handler = SyncPadSinkHandler::default();
Self {
sink_pad: PadSink::new(
gst::Pad::from_template(&klass.pad_template("sink").unwrap(), Some("sink")),
gst::Pad::from_template(&klass.pad_template("sink").unwrap()),
sink_pad_handler.clone(),
),
sink_pad_handler,

View file

@ -305,7 +305,7 @@ impl ObjectSubclass for TaskSink {
fn with_class(klass: &Self::Class) -> Self {
Self {
sink_pad: PadSink::new(
gst::Pad::from_template(&klass.pad_template("sink").unwrap(), Some("sink")),
gst::Pad::from_template(&klass.pad_template("sink").unwrap()),
TaskPadSinkHandler,
),
task: Task::default(),

View file

@ -318,7 +318,7 @@ impl ObjectSubclass for TestSrc {
fn with_class(klass: &Self::Class) -> Self {
Self {
src_pad: PadSrc::new(
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
gst::Pad::from_template(&klass.pad_template("src").unwrap()),
TestSrcPadHandler,
),
task: Task::default(),

View file

@ -432,7 +432,7 @@ impl ObjectSubclass for AppSrc {
fn with_class(klass: &Self::Class) -> Self {
Self {
src_pad: PadSrc::new(
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
gst::Pad::from_template(&klass.pad_template("src").unwrap()),
AppSrcPadHandler,
),
task: Task::default(),

View file

@ -543,7 +543,7 @@ impl ObjectSubclass for AudioTestSrc {
fn with_class(klass: &Self::Class) -> Self {
Self {
src_pad: PadSrc::new(
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
gst::Pad::from_template(&klass.pad_template("src").unwrap()),
AudioTestSrcPadHandler,
),
task: Task::default(),

View file

@ -355,7 +355,7 @@ impl ObjectSubclass for InputSelector {
fn with_class(klass: &Self::Class) -> Self {
Self {
src_pad: PadSrc::new(
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
gst::Pad::from_template(&klass.pad_template("src").unwrap()),
InputSelectorPadSrcHandler,
),
state: Mutex::new(State::default()),
@ -545,8 +545,9 @@ impl ElementImpl for InputSelector {
) -> Option<gst::Pad> {
let mut state = self.state.lock().unwrap();
let mut pads = self.pads.lock().unwrap();
let sink_pad =
gst::Pad::from_template(templ, Some(format!("sink_{}", pads.pad_serial).as_str()));
let sink_pad = gst::Pad::builder_from_template(templ)
.name(format!("sink_{}", pads.pad_serial).as_str())
.build();
pads.pad_serial += 1;
sink_pad.set_active(true).unwrap();
self.obj().add_pad(&sink_pad).unwrap();

View file

@ -1302,11 +1302,11 @@ impl ObjectSubclass for JitterBuffer {
Self {
sink_pad: PadSink::new(
gst::Pad::from_template(&klass.pad_template("sink").unwrap(), Some("sink")),
gst::Pad::from_template(&klass.pad_template("sink").unwrap()),
sink_pad_handler.clone(),
),
src_pad: PadSrc::new(
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
gst::Pad::from_template(&klass.pad_template("src").unwrap()),
src_pad_handler.clone(),
),
sink_pad_handler,

View file

@ -542,7 +542,7 @@ impl ObjectSubclass for ProxySink {
fn with_class(klass: &Self::Class) -> Self {
Self {
sink_pad: PadSink::new(
gst::Pad::from_template(&klass.pad_template("sink").unwrap(), Some("sink")),
gst::Pad::from_template(&klass.pad_template("sink").unwrap()),
ProxySinkPadHandler,
),
proxy_ctx: Mutex::new(None),
@ -1045,7 +1045,7 @@ impl ObjectSubclass for ProxySrc {
fn with_class(klass: &Self::Class) -> Self {
Self {
src_pad: PadSrc::new(
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
gst::Pad::from_template(&klass.pad_template("src").unwrap()),
ProxySrcPadHandler,
),
task: Task::default(),

View file

@ -631,11 +631,11 @@ impl ObjectSubclass for Queue {
fn with_class(klass: &Self::Class) -> Self {
Self {
sink_pad: PadSink::new(
gst::Pad::from_template(&klass.pad_template("sink").unwrap(), Some("sink")),
gst::Pad::from_template(&klass.pad_template("sink").unwrap()),
QueuePadSinkHandler,
),
src_pad: PadSrc::new(
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
gst::Pad::from_template(&klass.pad_template("src").unwrap()),
QueuePadSrcHandler,
),
task: Task::default(),

View file

@ -485,7 +485,7 @@ impl ObjectSubclass for TcpClientSrc {
fn with_class(klass: &Self::Class) -> Self {
Self {
src_pad: PadSrc::new(
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
gst::Pad::from_template(&klass.pad_template("src").unwrap()),
TcpClientSrcPadHandler,
),
task: Task::default(),

View file

@ -848,7 +848,7 @@ impl ObjectSubclass for UdpSink {
let sink_pad_handler = UdpSinkPadHandler::default();
Self {
sink_pad: PadSink::new(
gst::Pad::from_template(&klass.pad_template("sink").unwrap(), Some("sink")),
gst::Pad::from_template(&klass.pad_template("sink").unwrap()),
sink_pad_handler.clone(),
),
sink_pad_handler,

View file

@ -620,7 +620,7 @@ impl ObjectSubclass for UdpSrc {
fn with_class(klass: &Self::Class) -> Self {
Self {
src_pad: PadSrc::new(
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
gst::Pad::from_template(&klass.pad_template("src").unwrap()),
UdpSrcPadHandler,
),
task: Task::default(),

View file

@ -282,7 +282,7 @@ mod imp_src {
fn with_class(klass: &Self::Class) -> Self {
ElementSrcTest {
src_pad: PadSrc::new(
gst::Pad::from_template(&klass.pad_template("src").unwrap(), Some("src")),
gst::Pad::from_template(&klass.pad_template("src").unwrap()),
PadSrcTestHandler,
),
task: Task::default(),
@ -575,7 +575,7 @@ mod imp_sink {
fn with_class(klass: &Self::Class) -> Self {
ElementSinkTest {
sink_pad: PadSink::new(
gst::Pad::from_template(&klass.pad_template("sink").unwrap(), Some("sink")),
gst::Pad::from_template(&klass.pad_template("sink").unwrap()),
PadSinkTestHandler,
),
flushing: AtomicBool::new(true),

View file

@ -129,7 +129,7 @@ impl ObjectSubclass for FlvDemux {
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)
.activate_function(|pad, parent| {
FlvDemux::catch_panic_pad_function(
parent,
@ -620,7 +620,7 @@ impl FlvDemux {
fn create_srcpad(&self, name: &str, caps: &gst::Caps) -> gst::Pad {
let templ = self.obj().element_class().pad_template(name).unwrap();
let srcpad = gst::Pad::builder_with_template(&templ, Some(name))
let srcpad = gst::Pad::builder_from_template(&templ)
.event_function(|pad, parent, event| {
FlvDemux::catch_panic_pad_function(
parent,

View file

@ -2890,8 +2890,7 @@ impl ObjectImpl for FMP4Mux {
templ.presence() == gst::PadPresence::Always
&& templ.direction() == gst::PadDirection::Sink
}) {
let sinkpad =
gst::PadBuilder::<gst_base::AggregatorPad>::from_template(&templ, Some("sink"))
let sinkpad = gst::PadBuilder::<gst_base::AggregatorPad>::from_template(&templ)
.flags(gst::PadFlags::ACCEPT_INTERSECT)
.build();

View file

@ -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;

View file

@ -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,

View file

@ -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,8 +607,7 @@ impl ObjectSubclass for Transcriber {
.build();
let templ = klass.pad_template("src").unwrap();
let static_srcpad =
gst::PadBuilder::<super::TranslateSrcPad>::from_template(&templ, Some("src"))
let static_srcpad = gst::PadBuilder::<super::TranslateSrcPad>::from_template(&templ)
.activatemode_function(|pad, parent, mode, active| {
Transcriber::catch_panic_pad_function(
parent,
@ -986,10 +985,8 @@ 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()),
)
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,

View file

@ -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;

View file

@ -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");

View file

@ -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();

View file

@ -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,

View file

@ -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();

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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| {

View file

@ -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,

View file

@ -399,9 +399,7 @@ 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(),
)
ret.add_pad(&gst::GhostPad::with_target(&head.static_pad("sink").unwrap()).unwrap())
.unwrap();
if video_info.fps().numer() != 0 {
@ -414,9 +412,7 @@ 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(),
)
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,

View file

@ -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();

View file

@ -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

View file

@ -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();

View file

@ -78,7 +78,7 @@ impl ObjectSubclass for TextAhead {
fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap();
let sink_pad = gst::Pad::builder_with_template(&templ, Some("sink"))
let sink_pad = gst::Pad::builder_from_template(&templ)
.chain_function(|pad, parent, buffer| {
TextAhead::catch_panic_pad_function(
parent,
@ -96,7 +96,7 @@ impl ObjectSubclass for TextAhead {
.build();
let templ = klass.pad_template("src").unwrap();
let src_pad = gst::Pad::builder_with_template(&templ, Some("src")).build();
let src_pad = gst::Pad::from_template(&templ);
Self {
sink_pad,

View file

@ -183,7 +183,7 @@ impl ObjectSubclass for JsonGstEnc {
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| {
JsonGstEnc::catch_panic_pad_function(
parent,
@ -201,7 +201,7 @@ impl ObjectSubclass for JsonGstEnc {
.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,

View file

@ -822,7 +822,7 @@ impl ObjectSubclass for JsonGstParse {
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)
.activate_function(|pad, parent| {
JsonGstParse::catch_panic_pad_function(
parent,
@ -859,7 +859,7 @@ impl ObjectSubclass for JsonGstParse {
.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| {
JsonGstParse::catch_panic_pad_function(
parent,

View file

@ -111,7 +111,7 @@ impl ObjectSubclass for RegEx {
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| {
RegEx::catch_panic_pad_function(
parent,
@ -123,7 +123,7 @@ impl ObjectSubclass for RegEx {
.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 | gst::PadFlags::FIXED_CAPS)
.build();

View file

@ -405,7 +405,7 @@ impl ObjectSubclass for TextWrap {
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| {
TextWrap::catch_panic_pad_function(
parent,
@ -424,7 +424,7 @@ impl ObjectSubclass for TextWrap {
.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)
.query_function(|pad, parent, query| {
TextWrap::catch_panic_pad_function(
parent,

View file

@ -123,7 +123,7 @@ impl ObjectSubclass for Identity {
//
// Details about what each function is good for is next to each function definition
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| {
Identity::catch_panic_pad_function(
parent,
@ -148,7 +148,7 @@ impl ObjectSubclass for Identity {
.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| {
Identity::catch_panic_pad_function(
parent,

View file

@ -58,9 +58,9 @@ impl ObjectSubclass for ProgressBin {
//
// We do that and adding the pads inside glib::Object::constructed() later.
let templ = klass.pad_template("sink").unwrap();
let sinkpad = gst::GhostPad::from_template(&templ, Some("sink"));
let sinkpad = gst::GhostPad::from_template(&templ);
let templ = klass.pad_template("src").unwrap();
let srcpad = gst::GhostPad::from_template(&templ, Some("src"));
let srcpad = gst::GhostPad::from_template(&templ);
// Create the progressreport element.
let progress = gst::ElementFactory::make("progressreport")

View file

@ -292,9 +292,10 @@ impl CustomSource {
(self.obj().pad_template("video_%u").unwrap(), name)
};
let ghost_pad = gst::GhostPad::builder_with_template(&templ, Some(&name))
.build_with_target(pad)
.unwrap();
let ghost_pad = gst::GhostPad::builder_from_template_with_target(&templ, pad)
.unwrap()
.name(name)
.build();
let stream = Stream {
source_pad: pad.clone(),

View file

@ -943,8 +943,7 @@ impl FallbackSrc {
])
.unwrap();
let ghostpad =
gst::GhostPad::with_target(Some("src"), &queue.static_pad("src").unwrap()).unwrap();
let ghostpad = gst::GhostPad::with_target(&queue.static_pad("src").unwrap()).unwrap();
ghostpad.set_active(true).unwrap();
bin.add_pad(&ghostpad).unwrap();
@ -1002,8 +1001,7 @@ impl FallbackSrc {
])
.unwrap();
let ghostpad =
gst::GhostPad::with_target(Some("src"), &queue.static_pad("src").unwrap()).unwrap();
let ghostpad = gst::GhostPad::with_target(&queue.static_pad("src").unwrap()).unwrap();
ghostpad.set_active(true).unwrap();
bin.add_pad(&ghostpad).unwrap();
@ -1204,7 +1202,9 @@ impl FallbackSrc {
.obj()
.pad_template(if is_audio { "audio" } else { "video" })
.unwrap();
let ghostpad = gst::GhostPad::builder_with_template(&templ, Some(&templ.name()))
let ghostpad = gst::GhostPad::builder_from_template_with_target(&templ, &srcpad)
.unwrap()
.name(templ.name())
.proxy_pad_chain_function({
move |pad, parent, buffer| {
let parent = parent.and_then(|p| p.parent());
@ -1215,8 +1215,7 @@ impl FallbackSrc {
)
}
})
.build_with_target(&srcpad)
.unwrap();
.build();
let _ = ghostpad.set_active(true);
@ -1612,14 +1611,11 @@ impl FallbackSrc {
gst::Element::link_many([&videoconvert, &videoscale, &imagefreeze, &capsfilter]).unwrap();
let ghostpad =
gst::GhostPad::with_target(Some("sink"), &videoconvert.static_pad("sink").unwrap())
.unwrap();
gst::GhostPad::with_target(&videoconvert.static_pad("sink").unwrap()).unwrap();
ghostpad.set_active(true).unwrap();
bin.add_pad(&ghostpad).unwrap();
let ghostpad =
gst::GhostPad::with_target(Some("src"), &capsfilter.static_pad("src").unwrap())
.unwrap();
let ghostpad = gst::GhostPad::with_target(&capsfilter.static_pad("src").unwrap()).unwrap();
ghostpad.set_active(true).unwrap();
bin.add_pad(&ghostpad).unwrap();
@ -1660,14 +1656,11 @@ impl FallbackSrc {
gst::Element::link_many([&videoconvert, &videoscale, &capsfilter]).unwrap();
let ghostpad =
gst::GhostPad::with_target(Some("sink"), &videoconvert.static_pad("sink").unwrap())
.unwrap();
gst::GhostPad::with_target(&videoconvert.static_pad("sink").unwrap()).unwrap();
ghostpad.set_active(true).unwrap();
bin.add_pad(&ghostpad).unwrap();
let ghostpad =
gst::GhostPad::with_target(Some("src"), &capsfilter.static_pad("src").unwrap())
.unwrap();
let ghostpad = gst::GhostPad::with_target(&capsfilter.static_pad("src").unwrap()).unwrap();
ghostpad.set_active(true).unwrap();
bin.add_pad(&ghostpad).unwrap();
@ -1708,14 +1701,11 @@ impl FallbackSrc {
gst::Element::link_many([&audioconvert, &audioresample, &capsfilter]).unwrap();
let ghostpad =
gst::GhostPad::with_target(Some("sink"), &audioconvert.static_pad("sink").unwrap())
.unwrap();
gst::GhostPad::with_target(&audioconvert.static_pad("sink").unwrap()).unwrap();
ghostpad.set_active(true).unwrap();
bin.add_pad(&ghostpad).unwrap();
let ghostpad =
gst::GhostPad::with_target(Some("src"), &capsfilter.static_pad("src").unwrap())
.unwrap();
let ghostpad = gst::GhostPad::with_target(&capsfilter.static_pad("src").unwrap()).unwrap();
ghostpad.set_active(true).unwrap();
bin.add_pad(&ghostpad).unwrap();
@ -1891,8 +1881,10 @@ impl FallbackSrc {
gst::Element::link_many([&converters, &queue, &clocksync]).unwrap();
let ghostpad =
gst::GhostPad::with_target(Some(type_), &clocksync.static_pad("src").unwrap()).unwrap();
let ghostpad = gst::GhostPad::builder_with_target(&clocksync.static_pad("src").unwrap())
.unwrap()
.name(type_)
.build();
let _ = ghostpad.set_active(true);
source.source.add_pad(&ghostpad).unwrap();

View file

@ -1043,7 +1043,7 @@ impl ObjectSubclass for FallbackSwitch {
fn with_class(klass: &Self::Class) -> Self {
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)
.query_function(|pad, parent, query| {
FallbackSwitch::catch_panic_pad_function(
parent,
@ -1334,10 +1334,8 @@ impl ElementImpl for FallbackSwitch {
let pad_serial = self.sink_pad_serial.fetch_add(1, Ordering::SeqCst);
let pad = gst::PadBuilder::<super::FallbackSwitchSinkPad>::from_template(
templ,
Some(format!("sink_{pad_serial}").as_str()),
)
let pad = gst::PadBuilder::<super::FallbackSwitchSinkPad>::from_template(templ)
.name(format!("sink_{pad_serial}").as_str())
.chain_function(|pad, parent, buffer| {
FallbackSwitch::catch_panic_pad_function(
parent,

View file

@ -199,8 +199,7 @@ impl ObjectSubclass for LiveSync {
type ParentType = gst::Element;
fn with_class(class: &Self::Class) -> Self {
let sinkpad =
gst::Pad::builder_with_template(&class.pad_template("sink").unwrap(), Some("sink"))
let sinkpad = gst::Pad::builder_from_template(&class.pad_template("sink").unwrap())
.activatemode_function(|pad, parent, mode, active| {
Self::catch_panic_pad_function(
parent,
@ -236,8 +235,7 @@ impl ObjectSubclass for LiveSync {
)
.build();
let srcpad =
gst::Pad::builder_with_template(&class.pad_template("src").unwrap(), Some("src"))
let srcpad = gst::Pad::builder_from_template(&class.pad_template("src").unwrap())
.activatemode_function(|pad, parent, mode, active| {
Self::catch_panic_pad_function(
parent,

View file

@ -1705,7 +1705,7 @@ impl ObjectSubclass for ToggleRecord {
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| {
ToggleRecord::catch_panic_pad_function(
parent,
@ -1737,7 +1737,7 @@ impl ObjectSubclass for ToggleRecord {
.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| {
ToggleRecord::catch_panic_pad_function(
parent,
@ -2002,7 +2002,8 @@ impl ElementImpl for ToggleRecord {
*pad_count += 1;
let templ = self.obj().pad_template("sink_%u").unwrap();
let sinkpad = gst::Pad::builder_with_template(&templ, Some(format!("sink_{id}").as_str()))
let sinkpad = gst::Pad::builder_from_template(&templ)
.name(format!("sink_{id}").as_str())
.chain_function(|pad, parent, buffer| {
ToggleRecord::catch_panic_pad_function(
parent,
@ -2034,7 +2035,8 @@ impl ElementImpl for ToggleRecord {
.build();
let templ = self.obj().pad_template("src_%u").unwrap();
let srcpad = gst::Pad::builder_with_template(&templ, Some(format!("src_{id}").as_str()))
let srcpad = gst::Pad::builder_from_template(&templ)
.name(format!("src_{id}").as_str())
.event_function(|pad, parent, event| {
ToggleRecord::catch_panic_pad_function(
parent,

View file

@ -1342,7 +1342,10 @@ impl UriPlaylistBin {
// ghost streamsynchronizer src pad
let sync_src_name = sync_sink.name().as_str().replace("sink", "src");
let src = state.streamsynchronizer.static_pad(&sync_src_name).unwrap();
let ghost = gst::GhostPad::with_target(Some(pad_name.as_str()), &src).unwrap();
let ghost = gst::GhostPad::builder_with_target(&src)
.unwrap()
.name(pad_name.as_str())
.build();
ghost.set_active(true).unwrap();
// proxy sticky events

View file

@ -522,7 +522,7 @@ impl ObjectSubclass for Cea608Overlay {
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| {
Cea608Overlay::catch_panic_pad_function(
parent,
@ -542,7 +542,7 @@ impl ObjectSubclass for Cea608Overlay {
.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();

View file

@ -721,7 +721,7 @@ impl ObjectSubclass for Cea608ToCea708 {
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| {
Cea608ToCea708::catch_panic_pad_function(
parent,
@ -740,7 +740,7 @@ impl ObjectSubclass for Cea608ToCea708 {
.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::FIXED_CAPS)
.build();

View file

@ -780,7 +780,7 @@ impl ObjectSubclass for Cea608ToJson {
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| {
Cea608ToJson::catch_panic_pad_function(
parent,
@ -799,7 +799,7 @@ impl ObjectSubclass for Cea608ToJson {
.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::FIXED_CAPS)
.build();

View file

@ -377,7 +377,7 @@ impl ObjectSubclass for Cea608ToTt {
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| {
Cea608ToTt::catch_panic_pad_function(
parent,
@ -396,7 +396,7 @@ impl ObjectSubclass for Cea608ToTt {
.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::FIXED_CAPS)
.build();

View file

@ -536,7 +536,7 @@ impl ObjectSubclass for JsonToVtt {
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| {
JsonToVtt::catch_panic_pad_function(
parent,
@ -555,7 +555,7 @@ impl ObjectSubclass for JsonToVtt {
.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::FIXED_CAPS)
.event_function(|pad, parent, event| {
JsonToVtt::catch_panic_pad_function(

View file

@ -424,7 +424,7 @@ impl ObjectSubclass for MccEnc {
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| {
MccEnc::catch_panic_pad_function(
parent,
@ -438,7 +438,7 @@ impl ObjectSubclass for MccEnc {
.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| {
MccEnc::catch_panic_pad_function(parent, || false, |enc| enc.src_event(pad, event))
})

View file

@ -1072,7 +1072,7 @@ impl ObjectSubclass for MccParse {
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)
.activate_function(|pad, parent| {
MccParse::catch_panic_pad_function(
parent,
@ -1109,7 +1109,7 @@ impl ObjectSubclass for MccParse {
.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| {
MccParse::catch_panic_pad_function(
parent,

View file

@ -355,7 +355,7 @@ impl ObjectSubclass for SccEnc {
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| {
SccEnc::catch_panic_pad_function(
parent,
@ -369,7 +369,7 @@ impl ObjectSubclass for SccEnc {
.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| {
SccEnc::catch_panic_pad_function(parent, || false, |enc| enc.src_event(pad, event))
})

View file

@ -951,7 +951,7 @@ impl ObjectSubclass for SccParse {
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)
.activate_function(|pad, parent| {
SccParse::catch_panic_pad_function(
parent,
@ -988,7 +988,7 @@ impl ObjectSubclass for SccParse {
.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| {
SccParse::catch_panic_pad_function(
parent,

View file

@ -149,9 +149,8 @@ impl TranscriberBin {
.build(),
);
let sinkpad = gst::GhostPad::with_target(Some("sink"), &queue.static_pad("sink").unwrap())?;
let srcpad =
gst::GhostPad::with_target(Some("src"), &converter.static_pad("src").unwrap())?;
let sinkpad = gst::GhostPad::with_target(&queue.static_pad("sink").unwrap()).unwrap();
let srcpad = gst::GhostPad::with_target(&converter.static_pad("src").unwrap()).unwrap();
bin.add_pad(&sinkpad)?;
bin.add_pad(&srcpad)?;
@ -214,14 +213,11 @@ impl TranscriberBin {
state.ccmux.set_property("latency", CEA608MUX_LATENCY);
let transcription_audio_sinkpad = gst::GhostPad::with_target(
Some("sink"),
&aqueue_transcription.static_pad("sink").unwrap(),
)?;
let transcription_audio_srcpad = gst::GhostPad::with_target(
Some("src"),
&state.transcription_valve.static_pad("src").unwrap(),
)?;
let transcription_audio_sinkpad =
gst::GhostPad::with_target(&aqueue_transcription.static_pad("sink").unwrap()).unwrap();
let transcription_audio_srcpad =
gst::GhostPad::with_target(&state.transcription_valve.static_pad("src").unwrap())
.unwrap();
state
.transcription_bin
@ -260,22 +256,27 @@ impl TranscriberBin {
.video_queue
.link_pads(Some("src"), &state.cccombiner, Some("sink"))?;
let internal_audio_sinkpad = gst::GhostPad::with_target(
Some("audio_sink"),
&aclocksync.static_pad("sink").unwrap(),
)?;
let internal_audio_srcpad = gst::GhostPad::with_target(
Some("audio_src"),
let internal_audio_sinkpad =
gst::GhostPad::builder_with_target(&aclocksync.static_pad("sink").unwrap())
.unwrap()
.name("audio_sink")
.build();
let internal_audio_srcpad = gst::GhostPad::builder_with_target(
&state.audio_queue_passthrough.static_pad("src").unwrap(),
)?;
let internal_video_sinkpad = gst::GhostPad::with_target(
Some("video_sink"),
&vclocksync.static_pad("sink").unwrap(),
)?;
let internal_video_srcpad = gst::GhostPad::with_target(
Some("video_src"),
&state.cccombiner.static_pad("src").unwrap(),
)?;
)
.unwrap()
.name("audio_src")
.build();
let internal_video_sinkpad =
gst::GhostPad::builder_with_target(&vclocksync.static_pad("sink").unwrap())
.unwrap()
.name("video_sink")
.build();
let internal_video_srcpad =
gst::GhostPad::builder_with_target(&state.cccombiner.static_pad("src").unwrap())
.unwrap()
.name("video_src")
.build();
state.internal_bin.add_pad(&internal_audio_sinkpad)?;
state.internal_bin.add_pad(&internal_audio_srcpad)?;
@ -835,9 +836,9 @@ impl ObjectSubclass for TranscriberBin {
fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink_audio").unwrap();
let audio_sinkpad = gst::GhostPad::from_template(&templ, Some("sink_audio"));
let audio_sinkpad = gst::GhostPad::from_template(&templ);
let templ = klass.pad_template("src_audio").unwrap();
let audio_srcpad = gst::GhostPad::builder_with_template(&templ, Some("src_audio"))
let audio_srcpad = gst::GhostPad::builder_from_template(&templ)
.query_function(|pad, parent, query| {
TranscriberBin::catch_panic_pad_function(
parent,
@ -848,7 +849,7 @@ impl ObjectSubclass for TranscriberBin {
.build();
let templ = klass.pad_template("sink_video").unwrap();
let video_sinkpad = gst::GhostPad::builder_with_template(&templ, Some("sink_video"))
let video_sinkpad = gst::GhostPad::builder_from_template(&templ)
.event_function(|pad, parent, event| {
TranscriberBin::catch_panic_pad_function(
parent,
@ -858,7 +859,7 @@ impl ObjectSubclass for TranscriberBin {
})
.build();
let templ = klass.pad_template("src_video").unwrap();
let video_srcpad = gst::GhostPad::builder_with_template(&templ, Some("src_video"))
let video_srcpad = gst::GhostPad::builder_from_template(&templ)
.query_function(|pad, parent, query| {
TranscriberBin::catch_panic_pad_function(
parent,

View file

@ -977,7 +977,7 @@ impl ObjectSubclass for TtToCea608 {
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| {
TtToCea608::catch_panic_pad_function(
parent,
@ -996,7 +996,7 @@ impl ObjectSubclass for TtToCea608 {
.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::FIXED_CAPS)
.build();

View file

@ -192,7 +192,7 @@ impl ObjectSubclass for TtToJson {
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| {
TtToJson::catch_panic_pad_function(
parent,
@ -210,7 +210,7 @@ impl ObjectSubclass for TtToJson {
.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,

View file

@ -44,7 +44,7 @@ fn test_decode(name: &str) {
.unwrap();
let srcpad = bin.by_name("ffv1dec").unwrap().static_pad("src").unwrap();
let _ = bin.add_pad(&gst::GhostPad::with_target(Some("src"), &srcpad).unwrap());
let _ = bin.add_pad(&gst::GhostPad::with_target(&srcpad).unwrap());
let mut h = gst_check::Harness::with_element(&bin, None, Some("src"));

View file

@ -48,10 +48,7 @@ fn create_ui(app: &gtk::Application) {
sink.add(&gtksink).unwrap();
convert.link(&gtksink).unwrap();
sink.add_pad(
&gst::GhostPad::with_target(Some("sink"), &convert.static_pad("sink").unwrap())
.unwrap(),
)
sink.add_pad(&gst::GhostPad::with_target(&convert.static_pad("sink").unwrap()).unwrap())
.unwrap();
(src, sink.upcast())

View file

@ -200,7 +200,9 @@ mod test {
let mut message = VideoCompareMessage::default();
message.pad_distances.push(PadDistance {
pad: gst::Pad::new(Some("sink_0"), gst::PadDirection::Sink),
pad: gst::Pad::builder(gst::PadDirection::Sink)
.name("sink_0")
.build(),
distance: 42_f64,
});
message.running_time = Some(running_time);
@ -236,7 +238,9 @@ mod test {
gst::Array::from_iter([gst::Structure::builder("pad-distance")
.field(
"pad",
gst::Pad::new(Some("sink_0"), gst::PadDirection::Sink),
gst::Pad::builder(gst::PadDirection::Sink)
.name("sink_0")
.build(),
)
.field("distance", 42f64)
.build()

View file

@ -273,7 +273,7 @@ impl ObjectSubclass for WebPDec {
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| {
WebPDec::catch_panic_pad_function(
parent,
@ -291,7 +291,7 @@ impl ObjectSubclass for WebPDec {
.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| {
WebPDec::catch_panic_pad_function(parent, || false, |dec| dec.src_event(pad, event))
})