From 7ba0073052c81c8f2f1ebe500048ed6d974e81d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Wed, 10 May 2023 17:02:08 +0200 Subject: 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: --- text/ahead/src/textahead/imp.rs | 4 ++-- text/json/src/jsongstenc/imp.rs | 4 ++-- text/json/src/jsongstparse/imp.rs | 4 ++-- text/regex/src/gstregex/imp.rs | 4 ++-- text/wrap/src/gsttextwrap/imp.rs | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'text') diff --git a/text/ahead/src/textahead/imp.rs b/text/ahead/src/textahead/imp.rs index 6af01de99..90c937eaa 100644 --- a/text/ahead/src/textahead/imp.rs +++ b/text/ahead/src/textahead/imp.rs @@ -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, diff --git a/text/json/src/jsongstenc/imp.rs b/text/json/src/jsongstenc/imp.rs index 84b81e6c5..42e870215 100644 --- a/text/json/src/jsongstenc/imp.rs +++ b/text/json/src/jsongstenc/imp.rs @@ -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, diff --git a/text/json/src/jsongstparse/imp.rs b/text/json/src/jsongstparse/imp.rs index 3550daf69..b15bb739f 100644 --- a/text/json/src/jsongstparse/imp.rs +++ b/text/json/src/jsongstparse/imp.rs @@ -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, diff --git a/text/regex/src/gstregex/imp.rs b/text/regex/src/gstregex/imp.rs index c09f251e3..bfe7987d7 100644 --- a/text/regex/src/gstregex/imp.rs +++ b/text/regex/src/gstregex/imp.rs @@ -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(); diff --git a/text/wrap/src/gsttextwrap/imp.rs b/text/wrap/src/gsttextwrap/imp.rs index 918476506..de98e2b8e 100644 --- a/text/wrap/src/gsttextwrap/imp.rs +++ b/text/wrap/src/gsttextwrap/imp.rs @@ -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, -- cgit v1.2.3