diff options
author | François Laignel <francois@centricular.com> | 2023-05-10 18:02:08 +0300 |
---|---|---|
committer | François Laignel <francois@centricular.com> | 2023-05-12 13:55:31 +0300 |
commit | 7ba0073052c81c8f2f1ebe500048ed6d974e81d8 (patch) | |
tree | 26a4f2b74ac8a7129b6ecc95e8affcb302aa1bc2 /tutorial | |
parent | 8e93d294e5a61a94f14e812bef59cd0e529494e1 (diff) |
use Pad builders for optional name definition
Also, apply auto-naming in the following cases
* When building from a non wildcard-named template, the name of the template is
automatically assigned to the Pad. User can override with a specific name by
calling `name()` on the `PadBuilder`.
* When building with a target and no name was provided via the above, the
GhostPad is named after the target.
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/448
Auto-naming discussion: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1255#note_1891181
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1197>
Diffstat (limited to 'tutorial')
-rw-r--r-- | tutorial/src/identity/imp.rs | 4 | ||||
-rw-r--r-- | tutorial/src/progressbin/imp.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/tutorial/src/identity/imp.rs b/tutorial/src/identity/imp.rs index 92d566291..7b26806cf 100644 --- a/tutorial/src/identity/imp.rs +++ b/tutorial/src/identity/imp.rs @@ -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, diff --git a/tutorial/src/progressbin/imp.rs b/tutorial/src/progressbin/imp.rs index f0bdafff4..eee52691a 100644 --- a/tutorial/src/progressbin/imp.rs +++ b/tutorial/src/progressbin/imp.rs @@ -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") |