Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2020-06-22 11:03:52 +0300
committerSebastian Dröge <sebastian@centricular.com>2020-06-22 11:28:19 +0300
commit9bb3e75fb9f64b531fa5ac60776c4c934b635e47 (patch)
tree7bd5447060340b6b0e12975734f1f9a94c610caa /audio
parentc917e77687f6d7b4de22c5a27bcf48a27982b2cc (diff)
Update to use the new pad builders for safely setting pad functions
Only two uses of unsafely setting the pad functions is left: - fallbacksrc for overriding the chain function of the proxy pad of a ghost pad - threadshare for overriding the pad functions after creationg, which probably needs some fixing at some point
Diffstat (limited to 'audio')
-rw-r--r--audio/audiofx/src/audioloudnorm.rs55
1 files changed, 28 insertions, 27 deletions
diff --git a/audio/audiofx/src/audioloudnorm.rs b/audio/audiofx/src/audioloudnorm.rs
index 1ea708225..9113111e7 100644
--- a/audio/audiofx/src/audioloudnorm.rs
+++ b/audio/audiofx/src/audioloudnorm.rs
@@ -1746,34 +1746,35 @@ impl ObjectSubclass for AudioLoudNorm {
fn with_class(klass: &subclass::simple::ClassStruct<Self>) -> Self {
let templ = klass.get_pad_template("sink").unwrap();
- let sinkpad = gst::Pad::from_template(&templ, Some("sink"));
- sinkpad.set_pad_flags(gst::PadFlags::PROXY_CAPS);
- let templ = klass.get_pad_template("src").unwrap();
- let srcpad = gst::Pad::from_template(&templ, Some("src"));
- srcpad.set_pad_flags(gst::PadFlags::PROXY_CAPS);
-
- sinkpad.set_chain_function(|pad, parent, buffer| {
- Self::catch_panic_pad_function(
- parent,
- || Err(gst::FlowError::Error),
- |this, element| this.sink_chain(pad, element, buffer),
- )
- });
- sinkpad.set_event_function(|pad, parent, event| {
- Self::catch_panic_pad_function(
- parent,
- || false,
- |this, element| this.sink_event(pad, element, event),
- )
- });
+ let sinkpad = gst::Pad::builder_with_template(&templ, Some("sink"))
+ .chain_function(|pad, parent, buffer| {
+ Self::catch_panic_pad_function(
+ parent,
+ || Err(gst::FlowError::Error),
+ |this, element| this.sink_chain(pad, element, buffer),
+ )
+ })
+ .event_function(|pad, parent, event| {
+ Self::catch_panic_pad_function(
+ parent,
+ || false,
+ |this, element| this.sink_event(pad, element, event),
+ )
+ })
+ .flags(gst::PadFlags::PROXY_CAPS)
+ .build();
- srcpad.set_query_function(|pad, parent, query| {
- Self::catch_panic_pad_function(
- parent,
- || false,
- |this, element| this.src_query(pad, element, query),
- )
- });
+ let templ = klass.get_pad_template("src").unwrap();
+ let srcpad = gst::Pad::builder_with_template(&templ, Some("src"))
+ .query_function(|pad, parent, query| {
+ Self::catch_panic_pad_function(
+ parent,
+ || false,
+ |this, element| this.src_query(pad, element, query),
+ )
+ })
+ .flags(gst::PadFlags::PROXY_CAPS)
+ .build();
Self {
sinkpad,