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 { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
Self::catch_panic_pad_function( Self::catch_panic_pad_function(
parent, parent,
@ -1705,7 +1705,7 @@ impl ObjectSubclass for AudioLoudNorm {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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| { .query_function(|pad, parent, query| {
Self::catch_panic_pad_function(parent, || false, |this| this.src_query(pad, 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 { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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 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| { .getrange_function(|pad, parent, offset, buffer, size| {
Decrypter::catch_panic_pad_function( Decrypter::catch_panic_pad_function(
parent, parent,

View file

@ -329,7 +329,7 @@ impl ObjectSubclass for Encrypter {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
Encrypter::catch_panic_pad_function( Encrypter::catch_panic_pad_function(
parent, parent,
@ -347,7 +347,7 @@ impl ObjectSubclass for Encrypter {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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| { .query_function(|pad, parent, query| {
Encrypter::catch_panic_pad_function( Encrypter::catch_panic_pad_function(
parent, parent,

View file

@ -241,7 +241,7 @@ impl ObjectSubclass for AsyncMutexSink {
let sink_pad_handler = AsyncPadSinkHandler::default(); let sink_pad_handler = AsyncPadSinkHandler::default();
Self { Self {
sink_pad: PadSink::new( 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.clone(),
), ),
sink_pad_handler, sink_pad_handler,

View file

@ -234,7 +234,7 @@ impl ObjectSubclass for DirectSink {
let sink_pad_handler = SyncPadSinkHandler::default(); let sink_pad_handler = SyncPadSinkHandler::default();
Self { Self {
sink_pad: PadSink::new( 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.clone(),
), ),
sink_pad_handler, sink_pad_handler,

View file

@ -305,7 +305,7 @@ impl ObjectSubclass for TaskSink {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
Self { Self {
sink_pad: PadSink::new( 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, TaskPadSinkHandler,
), ),
task: Task::default(), task: Task::default(),

View file

@ -318,7 +318,7 @@ impl ObjectSubclass for TestSrc {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
Self { Self {
src_pad: PadSrc::new( 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, TestSrcPadHandler,
), ),
task: Task::default(), task: Task::default(),

View file

@ -432,7 +432,7 @@ impl ObjectSubclass for AppSrc {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
Self { Self {
src_pad: PadSrc::new( 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, AppSrcPadHandler,
), ),
task: Task::default(), task: Task::default(),

View file

@ -543,7 +543,7 @@ impl ObjectSubclass for AudioTestSrc {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
Self { Self {
src_pad: PadSrc::new( 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, AudioTestSrcPadHandler,
), ),
task: Task::default(), task: Task::default(),

View file

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

View file

@ -1302,11 +1302,11 @@ impl ObjectSubclass for JitterBuffer {
Self { Self {
sink_pad: PadSink::new( 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.clone(),
), ),
src_pad: PadSrc::new( 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(), src_pad_handler.clone(),
), ),
sink_pad_handler, sink_pad_handler,

View file

@ -542,7 +542,7 @@ impl ObjectSubclass for ProxySink {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
Self { Self {
sink_pad: PadSink::new( 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, ProxySinkPadHandler,
), ),
proxy_ctx: Mutex::new(None), proxy_ctx: Mutex::new(None),
@ -1045,7 +1045,7 @@ impl ObjectSubclass for ProxySrc {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
Self { Self {
src_pad: PadSrc::new( 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, ProxySrcPadHandler,
), ),
task: Task::default(), task: Task::default(),

View file

@ -631,11 +631,11 @@ impl ObjectSubclass for Queue {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
Self { Self {
sink_pad: PadSink::new( 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, QueuePadSinkHandler,
), ),
src_pad: PadSrc::new( 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, QueuePadSrcHandler,
), ),
task: Task::default(), task: Task::default(),

View file

@ -485,7 +485,7 @@ impl ObjectSubclass for TcpClientSrc {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
Self { Self {
src_pad: PadSrc::new( 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, TcpClientSrcPadHandler,
), ),
task: Task::default(), task: Task::default(),

View file

@ -848,7 +848,7 @@ impl ObjectSubclass for UdpSink {
let sink_pad_handler = UdpSinkPadHandler::default(); let sink_pad_handler = UdpSinkPadHandler::default();
Self { Self {
sink_pad: PadSink::new( 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.clone(),
), ),
sink_pad_handler, sink_pad_handler,

View file

@ -620,7 +620,7 @@ impl ObjectSubclass for UdpSrc {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
Self { Self {
src_pad: PadSrc::new( 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, UdpSrcPadHandler,
), ),
task: Task::default(), task: Task::default(),

View file

@ -282,7 +282,7 @@ mod imp_src {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
ElementSrcTest { ElementSrcTest {
src_pad: PadSrc::new( 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, PadSrcTestHandler,
), ),
task: Task::default(), task: Task::default(),
@ -575,7 +575,7 @@ mod imp_sink {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
ElementSinkTest { ElementSinkTest {
sink_pad: PadSink::new( 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, PadSinkTestHandler,
), ),
flushing: AtomicBool::new(true), flushing: AtomicBool::new(true),

View file

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

View file

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

View file

@ -884,9 +884,7 @@ impl ElementImpl for S3HlsSink {
} }
let audio_pad = self.hlssink.request_pad_simple("audio").unwrap(); let audio_pad = self.hlssink.request_pad_simple("audio").unwrap();
let sink_pad = let sink_pad = gst::GhostPad::from_template_with_target(templ, &audio_pad).unwrap();
gst::GhostPad::from_template_with_target(templ, Some("audio"), &audio_pad)
.unwrap();
self.obj().add_pad(&sink_pad).unwrap(); self.obj().add_pad(&sink_pad).unwrap();
sink_pad.set_active(true).unwrap(); sink_pad.set_active(true).unwrap();
settings.audio_sink = true; settings.audio_sink = true;
@ -904,9 +902,7 @@ impl ElementImpl for S3HlsSink {
} }
let video_pad = self.hlssink.request_pad_simple("video").unwrap(); let video_pad = self.hlssink.request_pad_simple("video").unwrap();
let sink_pad = let sink_pad = gst::GhostPad::from_template_with_target(templ, &video_pad).unwrap();
gst::GhostPad::from_template_with_target(templ, Some("video"), &video_pad)
.unwrap();
self.obj().add_pad(&sink_pad).unwrap(); self.obj().add_pad(&sink_pad).unwrap();
sink_pad.set_active(true).unwrap(); sink_pad.set_active(true).unwrap();
settings.video_sink = true; settings.video_sink = true;

View file

@ -252,7 +252,7 @@ impl ObjectSubclass for TranscribeParse {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
TranscribeParse::catch_panic_pad_function( TranscribeParse::catch_panic_pad_function(
parent, parent,
@ -270,7 +270,7 @@ impl ObjectSubclass for TranscribeParse {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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 { Self {
srcpad, srcpad,

View file

@ -589,7 +589,7 @@ impl ObjectSubclass for Transcriber {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
Transcriber::catch_panic_pad_function( Transcriber::catch_panic_pad_function(
parent, parent,
@ -607,29 +607,28 @@ impl ObjectSubclass for Transcriber {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); let templ = klass.pad_template("src").unwrap();
let static_srcpad = let static_srcpad = gst::PadBuilder::<super::TranslateSrcPad>::from_template(&templ)
gst::PadBuilder::<super::TranslateSrcPad>::from_template(&templ, Some("src")) .activatemode_function(|pad, parent, mode, active| {
.activatemode_function(|pad, parent, mode, active| { Transcriber::catch_panic_pad_function(
Transcriber::catch_panic_pad_function( parent,
parent, || {
|| { Err(gst::loggable_error!(
Err(gst::loggable_error!( CAT,
CAT, "Panic activating TranslateSrcPad"
"Panic activating TranslateSrcPad" ))
)) },
}, |elem| TranslateSrcPad::activatemode(elem, pad, mode, active),
|elem| TranslateSrcPad::activatemode(elem, pad, mode, active), )
) })
}) .query_function(|pad, parent, query| {
.query_function(|pad, parent, query| { Transcriber::catch_panic_pad_function(
Transcriber::catch_panic_pad_function( parent,
parent, || false,
|| false, |elem| TranslateSrcPad::src_query(elem, pad, query),
|elem| TranslateSrcPad::src_query(elem, pad, query), )
) })
}) .flags(gst::PadFlags::FIXED_CAPS)
.flags(gst::PadFlags::FIXED_CAPS) .build();
.build();
// Setting the channel capacity so that a TranslateSrcPad that would lag // Setting the channel capacity so that a TranslateSrcPad that would lag
// behind for some reasons get a chance to catch-up without loosing items. // behind for some reasons get a chance to catch-up without loosing items.
@ -986,31 +985,29 @@ impl ElementImpl for Transcriber {
) -> Option<gst::Pad> { ) -> Option<gst::Pad> {
let mut state = self.state.lock().unwrap(); let mut state = self.state.lock().unwrap();
let pad = gst::PadBuilder::<super::TranslateSrcPad>::from_template( let pad = gst::PadBuilder::<super::TranslateSrcPad>::from_template(templ)
templ, .name(format!("translate_src_{}", state.pad_serial).as_str())
Some(format!("translate_src_{}", state.pad_serial).as_str()), .activatemode_function(|pad, parent, mode, active| {
) Transcriber::catch_panic_pad_function(
.activatemode_function(|pad, parent, mode, active| { parent,
Transcriber::catch_panic_pad_function( || {
parent, Err(gst::loggable_error!(
|| { CAT,
Err(gst::loggable_error!( "Panic activating TranslateSrcPad"
CAT, ))
"Panic activating TranslateSrcPad" },
)) |elem| TranslateSrcPad::activatemode(elem, pad, mode, active),
}, )
|elem| TranslateSrcPad::activatemode(elem, pad, mode, active), })
) .query_function(|pad, parent, query| {
}) Transcriber::catch_panic_pad_function(
.query_function(|pad, parent, query| { parent,
Transcriber::catch_panic_pad_function( || false,
parent, |elem| TranslateSrcPad::src_query(elem, pad, query),
|| false, )
|elem| TranslateSrcPad::src_query(elem, pad, query), })
) .flags(gst::PadFlags::FIXED_CAPS)
}) .build();
.flags(gst::PadFlags::FIXED_CAPS)
.build();
state.srcpads.insert(pad.clone()); state.srcpads.insert(pad.clone());

View file

@ -797,9 +797,7 @@ impl ElementImpl for HlsSink3 {
} }
let peer_pad = settings.splitmuxsink.request_pad_simple("audio_0").unwrap(); let peer_pad = settings.splitmuxsink.request_pad_simple("audio_0").unwrap();
let sink_pad = let sink_pad = gst::GhostPad::from_template_with_target(templ, &peer_pad).unwrap();
gst::GhostPad::from_template_with_target(templ, Some("audio"), &peer_pad)
.unwrap();
self.obj().add_pad(&sink_pad).unwrap(); self.obj().add_pad(&sink_pad).unwrap();
sink_pad.set_active(true).unwrap(); sink_pad.set_active(true).unwrap();
settings.audio_sink = true; settings.audio_sink = true;
@ -817,9 +815,7 @@ impl ElementImpl for HlsSink3 {
} }
let peer_pad = settings.splitmuxsink.request_pad_simple("video").unwrap(); let peer_pad = settings.splitmuxsink.request_pad_simple("video").unwrap();
let sink_pad = let sink_pad = gst::GhostPad::from_template_with_target(templ, &peer_pad).unwrap();
gst::GhostPad::from_template_with_target(templ, Some("video"), &peer_pad)
.unwrap();
self.obj().add_pad(&sink_pad).unwrap(); self.obj().add_pad(&sink_pad).unwrap();
sink_pad.set_active(true).unwrap(); sink_pad.set_active(true).unwrap();
settings.video_sink = true; settings.video_sink = true;

View file

@ -52,9 +52,7 @@ impl ObjectSubclass for NdiSinkCombiner {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("video").unwrap(); let templ = klass.pad_template("video").unwrap();
let video_pad = let video_pad = gst::PadBuilder::<gst_base::AggregatorPad>::from_template(&templ).build();
gst::PadBuilder::<gst_base::AggregatorPad>::from_template(&templ, Some("video"))
.build();
Self { Self {
video_pad, video_pad,
@ -176,8 +174,7 @@ impl AggregatorImpl for NdiSinkCombiner {
return None; return None;
} }
let pad = let pad = gst::PadBuilder::<gst_base::AggregatorPad>::from_template(templ).build();
gst::PadBuilder::<gst_base::AggregatorPad>::from_template(templ, Some("audio")).build();
*audio_pad_storage = Some(pad.clone()); *audio_pad_storage = Some(pad.clone());
gst::debug!(CAT, imp: self, "Requested audio pad"); 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 { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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) .flags(gst::PadFlags::FIXED_CAPS)
.chain_function(|pad, parent, buffer| { .chain_function(|pad, parent, buffer| {
NdiSrcDemux::catch_panic_pad_function( NdiSrcDemux::catch_panic_pad_function(
@ -180,7 +180,7 @@ impl NdiSrcDemux {
gst::debug!(CAT, imp: self, "Adding audio pad with caps {}", caps); gst::debug!(CAT, imp: self, "Adding audio pad with caps {}", caps);
let templ = self.obj().element_class().pad_template("audio").unwrap(); 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) .flags(gst::PadFlags::FIXED_CAPS)
.build(); .build();
@ -229,7 +229,7 @@ impl NdiSrcDemux {
gst::debug!(CAT, imp: self, "Adding video pad with caps {}", caps); gst::debug!(CAT, imp: self, "Adding video pad with caps {}", caps);
let templ = self.obj().element_class().pad_template("video").unwrap(); 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) .flags(gst::PadFlags::FIXED_CAPS)
.build(); .build();

View file

@ -42,12 +42,11 @@ impl ObjectSubclass for OnvifMetadataCombiner {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("media").unwrap(); let templ = klass.pad_template("media").unwrap();
let media_sink_pad = let media_sink_pad =
gst::PadBuilder::<gst_base::AggregatorPad>::from_template(&templ, Some("media")) gst::PadBuilder::<gst_base::AggregatorPad>::from_template(&templ).build();
.build();
let templ = klass.pad_template("meta").unwrap(); let templ = klass.pad_template("meta").unwrap();
let meta_sink_pad = 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 { Self {
media_sink_pad, media_sink_pad,

View file

@ -715,7 +715,7 @@ impl ObjectSubclass for OnvifMetadataOverlay {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
OnvifMetadataOverlay::catch_panic_pad_function( OnvifMetadataOverlay::catch_panic_pad_function(
parent, parent,
@ -735,7 +735,7 @@ impl ObjectSubclass for OnvifMetadataOverlay {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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_CAPS)
.flags(gst::PadFlags::PROXY_ALLOCATION) .flags(gst::PadFlags::PROXY_ALLOCATION)
.build(); .build();

View file

@ -1407,7 +1407,7 @@ impl ObjectSubclass for OnvifMetadataParse {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
OnvifMetadataParse::catch_panic_pad_function( OnvifMetadataParse::catch_panic_pad_function(
parent, parent,
@ -1433,7 +1433,7 @@ impl ObjectSubclass for OnvifMetadataParse {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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| { .event_function(|pad, parent, event| {
OnvifMetadataParse::catch_panic_pad_function( OnvifMetadataParse::catch_panic_pad_function(
parent, parent,

View file

@ -590,7 +590,7 @@ impl ObjectSubclass for RaptorqDec {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
Self::catch_panic_pad_function( Self::catch_panic_pad_function(
parent, parent,
@ -612,7 +612,7 @@ impl ObjectSubclass for RaptorqDec {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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| { .iterate_internal_links_function(|pad, parent| {
Self::catch_panic_pad_function( Self::catch_panic_pad_function(
parent, parent,
@ -821,7 +821,8 @@ impl ElementImpl for RaptorqDec {
return None; 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| { .chain_function(|pad, parent, buffer| {
Self::catch_panic_pad_function( Self::catch_panic_pad_function(
parent, parent,

View file

@ -659,7 +659,7 @@ impl ObjectSubclass for RaptorqEnc {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
Self::catch_panic_pad_function( Self::catch_panic_pad_function(
parent, parent,
@ -681,7 +681,7 @@ impl ObjectSubclass for RaptorqEnc {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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| { .iterate_internal_links_function(|pad, parent| {
Self::catch_panic_pad_function( Self::catch_panic_pad_function(
parent, parent,
@ -693,7 +693,7 @@ impl ObjectSubclass for RaptorqEnc {
.build(); .build();
let templ = klass.pad_template("fec_0").unwrap(); 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| { .activatemode_function(move |pad, parent, mode, active| {
Self::catch_panic_pad_function( Self::catch_panic_pad_function(
parent, parent,

View file

@ -72,7 +72,8 @@ impl Harness {
let (sender, receiver) = mpsc::sync_channel(0); let (sender, receiver) = mpsc::sync_channel(0);
// Sink pad that receives everything the source is generating // 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({ .chain_function({
let sender_clone = sender.clone(); let sender_clone = sender.clone();
move |_pad, _parent, buffer| { move |_pad, _parent, buffer| {

View file

@ -1146,7 +1146,7 @@ impl ObjectSubclass for BandwidthEstimator {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|_pad, parent, mut buffer| {
BandwidthEstimator::catch_panic_pad_function( BandwidthEstimator::catch_panic_pad_function(
parent, parent,
@ -1166,7 +1166,7 @@ impl ObjectSubclass for BandwidthEstimator {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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| { .event_function(|pad, parent, event| {
BandwidthEstimator::catch_panic_pad_function( BandwidthEstimator::catch_panic_pad_function(
parent, parent,

View file

@ -399,10 +399,8 @@ fn make_converter_for_video_caps(caps: &gst::Caps) -> Result<gst::Element, Error
} }
}; };
ret.add_pad( ret.add_pad(&gst::GhostPad::with_target(&head.static_pad("sink").unwrap()).unwrap())
&gst::GhostPad::with_target(Some("sink"), &head.static_pad("sink").unwrap()).unwrap(), .unwrap();
)
.unwrap();
if video_info.fps().numer() != 0 { if video_info.fps().numer() != 0 {
let vrate = make_element("videorate", None)?; 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; tail = vrate;
} }
ret.add_pad( ret.add_pad(&gst::GhostPad::with_target(&tail.static_pad("src").unwrap()).unwrap())
&gst::GhostPad::with_target(Some("src"), &tail.static_pad("src").unwrap()).unwrap(), .unwrap();
)
.unwrap();
Ok(ret.upcast()) Ok(ret.upcast())
} }
@ -3503,7 +3499,8 @@ impl ElementImpl for BaseWebRTCSink {
(name, false) (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| { .event_function(|pad, parent, event| {
BaseWebRTCSink::catch_panic_pad_function( BaseWebRTCSink::catch_panic_pad_function(
parent, parent,

View file

@ -417,7 +417,9 @@ impl WebRTCSrc {
pad.store_sticky_event(&builder.build()).ok(); 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 .proxy_pad_chain_function(glib::clone!(@weak self as this => @default-panic, move
|pad, parent, buffer| { |pad, parent, buffer| {
let padret = gst::ProxyPad::chain_default(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) gst::Pad::event_default(pad, parent, event)
})) }))
.build_with_target(pad) .build();
.unwrap();
bin.add_pad(&ghostpad) bin.add_pad(&ghostpad)
.expect("Adding ghostpad to the bin should always work"); .expect("Adding ghostpad to the bin should always work");
@ -550,7 +551,7 @@ impl WebRTCSrc {
webrtcbin.set_property("stun-server", stun_server); 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| bin.connect_pad_removed(glib::clone!(@weak self as this => move |_, pad|
this.state.lock().unwrap().flow_combiner.remove_pad(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()] let caps_with_raw = [caps.clone(), raw_caps.clone()]
.into_iter() .into_iter()
.collect::<gst::Caps>(); .collect::<gst::Caps>();
let ghost = gst::GhostPad::builder_with_template(&template, Some(&name)) let ghost = gst::GhostPad::builder_from_template(&template)
.name(name)
.build() .build()
.downcast::<WebRTCSrcPad>() .downcast::<WebRTCSrcPad>()
.unwrap(); .unwrap();

View file

@ -534,9 +534,7 @@ impl WhepSrc {
); );
let templ = self_.obj().pad_template("src_%u").unwrap(); let templ = self_.obj().pad_template("src_%u").unwrap();
let src_pad = gst::GhostPad::builder_with_template(&templ, Some(&pad.name())) let src_pad = gst::GhostPad::from_template_with_target(&templ, pad).unwrap();
.build_with_target(pad)
.unwrap();
src_pad.set_target(Some(pad)).unwrap(); src_pad.set_target(Some(pad)).unwrap();
src_pad src_pad

View file

@ -135,7 +135,9 @@ impl ElementImpl for WhipSink {
caps: Option<&gst::Caps>, caps: Option<&gst::Caps>,
) -> Option<gst::Pad> { ) -> Option<gst::Pad> {
let wb_sink_pad = self.webrtcbin.request_pad(templ, name, caps)?; 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(); sink_pad.set_target(Some(&wb_sink_pad)).unwrap();
self.obj().add_pad(&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 { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
TextAhead::catch_panic_pad_function( TextAhead::catch_panic_pad_function(
parent, parent,
@ -96,7 +96,7 @@ impl ObjectSubclass for TextAhead {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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 { Self {
sink_pad, sink_pad,

View file

@ -183,7 +183,7 @@ impl ObjectSubclass for JsonGstEnc {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
JsonGstEnc::catch_panic_pad_function( JsonGstEnc::catch_panic_pad_function(
parent, parent,
@ -201,7 +201,7 @@ impl ObjectSubclass for JsonGstEnc {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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 { Self {
srcpad, srcpad,

View file

@ -822,7 +822,7 @@ impl ObjectSubclass for JsonGstParse {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .activate_function(|pad, parent| {
JsonGstParse::catch_panic_pad_function( JsonGstParse::catch_panic_pad_function(
parent, parent,
@ -859,7 +859,7 @@ impl ObjectSubclass for JsonGstParse {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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| { .event_function(|pad, parent, event| {
JsonGstParse::catch_panic_pad_function( JsonGstParse::catch_panic_pad_function(
parent, parent,

View file

@ -111,7 +111,7 @@ impl ObjectSubclass for RegEx {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
RegEx::catch_panic_pad_function( RegEx::catch_panic_pad_function(
parent, parent,
@ -123,7 +123,7 @@ impl ObjectSubclass for RegEx {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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) .flags(gst::PadFlags::PROXY_CAPS | gst::PadFlags::FIXED_CAPS)
.build(); .build();

View file

@ -405,7 +405,7 @@ impl ObjectSubclass for TextWrap {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
TextWrap::catch_panic_pad_function( TextWrap::catch_panic_pad_function(
parent, parent,
@ -424,7 +424,7 @@ impl ObjectSubclass for TextWrap {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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| { .query_function(|pad, parent, query| {
TextWrap::catch_panic_pad_function( TextWrap::catch_panic_pad_function(
parent, 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 // Details about what each function is good for is next to each function definition
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
Identity::catch_panic_pad_function( Identity::catch_panic_pad_function(
parent, parent,
@ -148,7 +148,7 @@ impl ObjectSubclass for Identity {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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| { .event_function(|pad, parent, event| {
Identity::catch_panic_pad_function( Identity::catch_panic_pad_function(
parent, parent,

View file

@ -58,9 +58,9 @@ impl ObjectSubclass for ProgressBin {
// //
// We do that and adding the pads inside glib::Object::constructed() later. // We do that and adding the pads inside glib::Object::constructed() later.
let templ = klass.pad_template("sink").unwrap(); 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 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. // Create the progressreport element.
let progress = gst::ElementFactory::make("progressreport") let progress = gst::ElementFactory::make("progressreport")

View file

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

View file

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

View file

@ -1043,7 +1043,7 @@ impl ObjectSubclass for FallbackSwitch {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("src").unwrap(); 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| { .query_function(|pad, parent, query| {
FallbackSwitch::catch_panic_pad_function( FallbackSwitch::catch_panic_pad_function(
parent, parent,
@ -1334,42 +1334,40 @@ impl ElementImpl for FallbackSwitch {
let pad_serial = self.sink_pad_serial.fetch_add(1, Ordering::SeqCst); let pad_serial = self.sink_pad_serial.fetch_add(1, Ordering::SeqCst);
let pad = gst::PadBuilder::<super::FallbackSwitchSinkPad>::from_template( let pad = gst::PadBuilder::<super::FallbackSwitchSinkPad>::from_template(templ)
templ, .name(format!("sink_{pad_serial}").as_str())
Some(format!("sink_{pad_serial}").as_str()), .chain_function(|pad, parent, buffer| {
) FallbackSwitch::catch_panic_pad_function(
.chain_function(|pad, parent, buffer| { parent,
FallbackSwitch::catch_panic_pad_function( || Err(gst::FlowError::Error),
parent, |fallbackswitch| fallbackswitch.sink_chain(pad, buffer),
|| Err(gst::FlowError::Error), )
|fallbackswitch| fallbackswitch.sink_chain(pad, buffer), })
) .chain_list_function(|pad, parent, bufferlist| {
}) FallbackSwitch::catch_panic_pad_function(
.chain_list_function(|pad, parent, bufferlist| { parent,
FallbackSwitch::catch_panic_pad_function( || Err(gst::FlowError::Error),
parent, |fallbackswitch| fallbackswitch.sink_chain_list(pad, bufferlist),
|| Err(gst::FlowError::Error), )
|fallbackswitch| fallbackswitch.sink_chain_list(pad, bufferlist), })
) .event_function(|pad, parent, event| {
}) FallbackSwitch::catch_panic_pad_function(
.event_function(|pad, parent, event| { parent,
FallbackSwitch::catch_panic_pad_function( || false,
parent, |fallbackswitch| fallbackswitch.sink_event(pad, event),
|| false, )
|fallbackswitch| fallbackswitch.sink_event(pad, event), })
) .query_function(|pad, parent, query| {
}) FallbackSwitch::catch_panic_pad_function(
.query_function(|pad, parent, query| { parent,
FallbackSwitch::catch_panic_pad_function( || false,
parent, |fallbackswitch| fallbackswitch.sink_query(pad, query),
|| false, )
|fallbackswitch| fallbackswitch.sink_query(pad, query), })
) .activatemode_function(|pad, _parent, mode, activate| {
}) Self::sink_activatemode(pad, mode, activate)
.activatemode_function(|pad, _parent, mode, activate| { })
Self::sink_activatemode(pad, mode, activate) .build();
})
.build();
pad.set_active(true).unwrap(); pad.set_active(true).unwrap();
self.obj().add_pad(&pad).unwrap(); self.obj().add_pad(&pad).unwrap();

View file

@ -199,72 +199,70 @@ impl ObjectSubclass for LiveSync {
type ParentType = gst::Element; type ParentType = gst::Element;
fn with_class(class: &Self::Class) -> Self { fn with_class(class: &Self::Class) -> Self {
let sinkpad = let sinkpad = gst::Pad::builder_from_template(&class.pad_template("sink").unwrap())
gst::Pad::builder_with_template(&class.pad_template("sink").unwrap(), Some("sink")) .activatemode_function(|pad, parent, mode, active| {
.activatemode_function(|pad, parent, mode, active| { Self::catch_panic_pad_function(
Self::catch_panic_pad_function( parent,
parent, || Err(gst::loggable_error!(CAT, "sink_activate_mode panicked")),
|| Err(gst::loggable_error!(CAT, "sink_activate_mode panicked")), |livesync| livesync.sink_activate_mode(pad, mode, active),
|livesync| livesync.sink_activate_mode(pad, mode, active),
)
})
.event_function(|pad, parent, event| {
Self::catch_panic_pad_function(
parent,
|| false,
|livesync| livesync.sink_event(pad, event),
)
})
.query_function(|pad, parent, query| {
Self::catch_panic_pad_function(
parent,
|| false,
|livesync| livesync.sink_query(pad, query),
)
})
.chain_function(|pad, parent, buffer| {
Self::catch_panic_pad_function(
parent,
|| Err(gst::FlowError::Error),
|livesync| livesync.sink_chain(pad, buffer),
)
})
.flags(
gst::PadFlags::PROXY_CAPS
| gst::PadFlags::PROXY_ALLOCATION
| gst::PadFlags::PROXY_SCHEDULING,
) )
.build(); })
.event_function(|pad, parent, event| {
Self::catch_panic_pad_function(
parent,
|| false,
|livesync| livesync.sink_event(pad, event),
)
})
.query_function(|pad, parent, query| {
Self::catch_panic_pad_function(
parent,
|| false,
|livesync| livesync.sink_query(pad, query),
)
})
.chain_function(|pad, parent, buffer| {
Self::catch_panic_pad_function(
parent,
|| Err(gst::FlowError::Error),
|livesync| livesync.sink_chain(pad, buffer),
)
})
.flags(
gst::PadFlags::PROXY_CAPS
| gst::PadFlags::PROXY_ALLOCATION
| gst::PadFlags::PROXY_SCHEDULING,
)
.build();
let srcpad = let srcpad = gst::Pad::builder_from_template(&class.pad_template("src").unwrap())
gst::Pad::builder_with_template(&class.pad_template("src").unwrap(), Some("src")) .activatemode_function(|pad, parent, mode, active| {
.activatemode_function(|pad, parent, mode, active| { Self::catch_panic_pad_function(
Self::catch_panic_pad_function( parent,
parent, || Err(gst::loggable_error!(CAT, "src_activate_mode panicked")),
|| Err(gst::loggable_error!(CAT, "src_activate_mode panicked")), |livesync| livesync.src_activate_mode(pad, mode, active),
|livesync| livesync.src_activate_mode(pad, mode, active),
)
})
.event_function(|pad, parent, event| {
Self::catch_panic_pad_function(
parent,
|| false,
|livesync| livesync.src_event(pad, event),
)
})
.query_function(|pad, parent, query| {
Self::catch_panic_pad_function(
parent,
|| false,
|livesync| livesync.src_query(pad, query),
)
})
.flags(
gst::PadFlags::PROXY_CAPS
| gst::PadFlags::PROXY_ALLOCATION
| gst::PadFlags::PROXY_SCHEDULING,
) )
.build(); })
.event_function(|pad, parent, event| {
Self::catch_panic_pad_function(
parent,
|| false,
|livesync| livesync.src_event(pad, event),
)
})
.query_function(|pad, parent, query| {
Self::catch_panic_pad_function(
parent,
|| false,
|livesync| livesync.src_query(pad, query),
)
})
.flags(
gst::PadFlags::PROXY_CAPS
| gst::PadFlags::PROXY_ALLOCATION
| gst::PadFlags::PROXY_SCHEDULING,
)
.build();
Self { Self {
state: Default::default(), state: Default::default(),

View file

@ -1705,7 +1705,7 @@ impl ObjectSubclass for ToggleRecord {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
ToggleRecord::catch_panic_pad_function( ToggleRecord::catch_panic_pad_function(
parent, parent,
@ -1737,7 +1737,7 @@ impl ObjectSubclass for ToggleRecord {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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| { .event_function(|pad, parent, event| {
ToggleRecord::catch_panic_pad_function( ToggleRecord::catch_panic_pad_function(
parent, parent,
@ -2002,7 +2002,8 @@ impl ElementImpl for ToggleRecord {
*pad_count += 1; *pad_count += 1;
let templ = self.obj().pad_template("sink_%u").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
ToggleRecord::catch_panic_pad_function( ToggleRecord::catch_panic_pad_function(
parent, parent,
@ -2034,7 +2035,8 @@ impl ElementImpl for ToggleRecord {
.build(); .build();
let templ = self.obj().pad_template("src_%u").unwrap(); 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| { .event_function(|pad, parent, event| {
ToggleRecord::catch_panic_pad_function( ToggleRecord::catch_panic_pad_function(
parent, parent,

View file

@ -1342,7 +1342,10 @@ impl UriPlaylistBin {
// ghost streamsynchronizer src pad // ghost streamsynchronizer src pad
let sync_src_name = sync_sink.name().as_str().replace("sink", "src"); let sync_src_name = sync_sink.name().as_str().replace("sink", "src");
let src = state.streamsynchronizer.static_pad(&sync_src_name).unwrap(); 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(); ghost.set_active(true).unwrap();
// proxy sticky events // proxy sticky events

View file

@ -522,7 +522,7 @@ impl ObjectSubclass for Cea608Overlay {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
Cea608Overlay::catch_panic_pad_function( Cea608Overlay::catch_panic_pad_function(
parent, parent,
@ -542,7 +542,7 @@ impl ObjectSubclass for Cea608Overlay {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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_CAPS)
.flags(gst::PadFlags::PROXY_ALLOCATION) .flags(gst::PadFlags::PROXY_ALLOCATION)
.build(); .build();

View file

@ -721,7 +721,7 @@ impl ObjectSubclass for Cea608ToCea708 {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
Cea608ToCea708::catch_panic_pad_function( Cea608ToCea708::catch_panic_pad_function(
parent, parent,
@ -740,7 +740,7 @@ impl ObjectSubclass for Cea608ToCea708 {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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) .flags(gst::PadFlags::FIXED_CAPS)
.build(); .build();

View file

@ -780,7 +780,7 @@ impl ObjectSubclass for Cea608ToJson {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
Cea608ToJson::catch_panic_pad_function( Cea608ToJson::catch_panic_pad_function(
parent, parent,
@ -799,7 +799,7 @@ impl ObjectSubclass for Cea608ToJson {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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) .flags(gst::PadFlags::FIXED_CAPS)
.build(); .build();

View file

@ -377,7 +377,7 @@ impl ObjectSubclass for Cea608ToTt {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
Cea608ToTt::catch_panic_pad_function( Cea608ToTt::catch_panic_pad_function(
parent, parent,
@ -396,7 +396,7 @@ impl ObjectSubclass for Cea608ToTt {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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) .flags(gst::PadFlags::FIXED_CAPS)
.build(); .build();

View file

@ -536,7 +536,7 @@ impl ObjectSubclass for JsonToVtt {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
JsonToVtt::catch_panic_pad_function( JsonToVtt::catch_panic_pad_function(
parent, parent,
@ -555,7 +555,7 @@ impl ObjectSubclass for JsonToVtt {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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) .flags(gst::PadFlags::FIXED_CAPS)
.event_function(|pad, parent, event| { .event_function(|pad, parent, event| {
JsonToVtt::catch_panic_pad_function( JsonToVtt::catch_panic_pad_function(

View file

@ -424,7 +424,7 @@ impl ObjectSubclass for MccEnc {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
MccEnc::catch_panic_pad_function( MccEnc::catch_panic_pad_function(
parent, parent,
@ -438,7 +438,7 @@ impl ObjectSubclass for MccEnc {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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| { .event_function(|pad, parent, event| {
MccEnc::catch_panic_pad_function(parent, || false, |enc| enc.src_event(pad, 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 { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .activate_function(|pad, parent| {
MccParse::catch_panic_pad_function( MccParse::catch_panic_pad_function(
parent, parent,
@ -1109,7 +1109,7 @@ impl ObjectSubclass for MccParse {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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| { .event_function(|pad, parent, event| {
MccParse::catch_panic_pad_function( MccParse::catch_panic_pad_function(
parent, parent,

View file

@ -355,7 +355,7 @@ impl ObjectSubclass for SccEnc {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
SccEnc::catch_panic_pad_function( SccEnc::catch_panic_pad_function(
parent, parent,
@ -369,7 +369,7 @@ impl ObjectSubclass for SccEnc {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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| { .event_function(|pad, parent, event| {
SccEnc::catch_panic_pad_function(parent, || false, |enc| enc.src_event(pad, 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 { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .activate_function(|pad, parent| {
SccParse::catch_panic_pad_function( SccParse::catch_panic_pad_function(
parent, parent,
@ -988,7 +988,7 @@ impl ObjectSubclass for SccParse {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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| { .event_function(|pad, parent, event| {
SccParse::catch_panic_pad_function( SccParse::catch_panic_pad_function(
parent, parent,

View file

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

View file

@ -977,7 +977,7 @@ impl ObjectSubclass for TtToCea608 {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
TtToCea608::catch_panic_pad_function( TtToCea608::catch_panic_pad_function(
parent, parent,
@ -996,7 +996,7 @@ impl ObjectSubclass for TtToCea608 {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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) .flags(gst::PadFlags::FIXED_CAPS)
.build(); .build();

View file

@ -192,7 +192,7 @@ impl ObjectSubclass for TtToJson {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
TtToJson::catch_panic_pad_function( TtToJson::catch_panic_pad_function(
parent, parent,
@ -210,7 +210,7 @@ impl ObjectSubclass for TtToJson {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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 { Self {
srcpad, srcpad,

View file

@ -44,7 +44,7 @@ fn test_decode(name: &str) {
.unwrap(); .unwrap();
let srcpad = bin.by_name("ffv1dec").unwrap().static_pad("src").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")); let mut h = gst_check::Harness::with_element(&bin, None, Some("src"));

View file

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

View file

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

View file

@ -273,7 +273,7 @@ impl ObjectSubclass for WebPDec {
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.pad_template("sink").unwrap(); 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| { .chain_function(|pad, parent, buffer| {
WebPDec::catch_panic_pad_function( WebPDec::catch_panic_pad_function(
parent, parent,
@ -291,7 +291,7 @@ impl ObjectSubclass for WebPDec {
.build(); .build();
let templ = klass.pad_template("src").unwrap(); 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| { .event_function(|pad, parent, event| {
WebPDec::catch_panic_pad_function(parent, || false, |dec| dec.src_event(pad, event)) WebPDec::catch_panic_pad_function(parent, || false, |dec| dec.src_event(pad, event))
}) })