diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2021-11-06 10:34:10 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2021-11-06 10:34:10 +0300 |
commit | d9bda62a4720c0539a443a4e489645e9bb4af1eb (patch) | |
tree | d59eef871715fda4a9b37e355909a345dbd598d0 /text/regex | |
parent | c99b7785f941fa4f9388a88e52d74c0fa34129ec (diff) |
Update for GLib/GStreamer API changes
And clean up a lot of related property/caps/structure code.
Diffstat (limited to 'text/regex')
-rw-r--r-- | text/regex/src/gstregex/imp.rs | 16 | ||||
-rw-r--r-- | text/regex/tests/regex.rs | 10 |
2 files changed, 13 insertions, 13 deletions
diff --git a/text/regex/src/gstregex/imp.rs b/text/regex/src/gstregex/imp.rs index cee7083e..0dd73b3a 100644 --- a/text/regex/src/gstregex/imp.rs +++ b/text/regex/src/gstregex/imp.rs @@ -192,7 +192,7 @@ impl ObjectImpl for RegEx { "commands" => { let mut state = self.state.lock().unwrap(); state.commands = vec![]; - let commands: gst::Array = value.get().expect("type checked upstream"); + let commands = value.get::<gst::ArrayRef>().expect("type checked upstream"); for command in commands.as_slice() { let s = match command .get::<Option<gst::Structure>>() @@ -258,16 +258,16 @@ impl ObjectImpl for RegEx { match command.operation { Operation::ReplaceAll(ref replacement) => { commands.push( - gst::Structure::new( - "replace-all", - &[("pattern", &command.pattern), ("replacement", &replacement)], - ) - .to_send_value(), + gst::Structure::builder("replace-all") + .field("pattern", &command.pattern) + .field("replacement", replacement) + .build() + .to_send_value(), ); } } } - gst::Array::from_owned(commands).to_value() + gst::Array::from(commands).to_value() } _ => unimplemented!(), } @@ -293,7 +293,7 @@ impl ElementImpl for RegEx { fn pad_templates() -> &'static [gst::PadTemplate] { static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| { let caps = gst::Caps::builder("text/x-raw") - .field("format", &"utf8") + .field("format", "utf8") .build(); let src_pad_template = gst::PadTemplate::new( "src", diff --git a/text/regex/tests/regex.rs b/text/regex/tests/regex.rs index 38f2267a..47164747 100644 --- a/text/regex/tests/regex.rs +++ b/text/regex/tests/regex.rs @@ -40,12 +40,12 @@ fn test_replace_all() { { let regex = h.element().expect("Could not create regex"); - let command = gst::Structure::new( - "replace-all", - &[("pattern", &"crap"), ("replacement", &"trap")], - ); + let command = gst::Structure::builder("replace-all") + .field("pattern", "crap") + .field("replacement", "trap") + .build(); - let commands = gst::Array::from_owned(vec![command.to_send_value()]); + let commands = gst::Array::from(vec![command.to_send_value()]); regex.set_property("commands", &commands).unwrap(); } |