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 | |
parent | c99b7785f941fa4f9388a88e52d74c0fa34129ec (diff) |
Update for GLib/GStreamer API changes
And clean up a lot of related property/caps/structure code.
Diffstat (limited to 'text')
-rw-r--r-- | text/json/tests/json.rs | 9 | ||||
-rw-r--r-- | text/regex/src/gstregex/imp.rs | 16 | ||||
-rw-r--r-- | text/regex/tests/regex.rs | 10 | ||||
-rw-r--r-- | text/wrap/src/gsttextwrap/imp.rs | 2 | ||||
-rw-r--r-- | text/wrap/tests/textwrap.rs | 6 |
5 files changed, 22 insertions, 21 deletions
diff --git a/text/json/tests/json.rs b/text/json/tests/json.rs index f628e38d..234d8aab 100644 --- a/text/json/tests/json.rs +++ b/text/json/tests/json.rs @@ -89,10 +89,11 @@ fn test_parse() { match ev.view() { EventView::Caps(ev) => { - assert!(ev.caps().is_strictly_equal(&gst::Caps::new_simple( - "application/x-json", - &[("format", &"test")] - ))); + assert!(ev.caps().is_strictly_equal( + &gst::Caps::builder("application/x-json") + .field("format", "test") + .build() + )); } _ => (), } 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(); } diff --git a/text/wrap/src/gsttextwrap/imp.rs b/text/wrap/src/gsttextwrap/imp.rs index 2a51c953..369afa2b 100644 --- a/text/wrap/src/gsttextwrap/imp.rs +++ b/text/wrap/src/gsttextwrap/imp.rs @@ -632,7 +632,7 @@ impl ElementImpl for TextWrap { 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/wrap/tests/textwrap.rs b/text/wrap/tests/textwrap.rs index 618a8d0f..73658d40 100644 --- a/text/wrap/tests/textwrap.rs +++ b/text/wrap/tests/textwrap.rs @@ -39,7 +39,7 @@ fn test_columns() { { let wrap = h.element().expect("Could not create textwrap"); - wrap.set_property("columns", &5u32).unwrap(); + wrap.set_property("columns", 5u32).unwrap(); } h.set_src_caps_str("text/x-raw, format=utf8"); @@ -77,8 +77,8 @@ fn test_lines() { { let wrap = h.element().expect("Could not create textwrap"); - wrap.set_property("columns", &5u32).unwrap(); - wrap.set_property("lines", &2u32).unwrap(); + wrap.set_property("columns", 5u32).unwrap(); + wrap.set_property("lines", 2u32).unwrap(); } h.set_src_caps_str("text/x-raw, format=utf8"); |