diff --git a/audio/audiofx/tests/audioloudnorm.rs b/audio/audiofx/tests/audioloudnorm.rs index f0a9817b..c01c7a38 100644 --- a/audio/audiofx/tests/audioloudnorm.rs +++ b/audio/audiofx/tests/audioloudnorm.rs @@ -75,7 +75,7 @@ fn run_test( .downcast::() .unwrap(); - sink.set_property("sync", false).unwrap(); + sink.set_property("sync", false); let caps = gst_audio::AudioInfo::builder(gst_audio::AUDIO_FORMAT_F64, 192_000, channels) .build() .unwrap() diff --git a/audio/csound/examples/effect_example.rs b/audio/csound/examples/effect_example.rs index 050a1680..22269283 100644 --- a/audio/csound/examples/effect_example.rs +++ b/audio/csound/examples/effect_example.rs @@ -89,7 +89,7 @@ fn create_pipeline() -> Result> { let audio_sink = gst::parse_bin_from_description(AUDIO_SINK, true)?.upcast(); let csoundfilter = gst::ElementFactory::make("csoundfilter", None)?; - csoundfilter.set_property("csd-text", &CSD)?; + csoundfilter.set_property("csd-text", &CSD); pipeline.add_many(&[&audio_src, &csoundfilter, &audio_sink])?; diff --git a/audio/csound/tests/csound_filter.rs b/audio/csound/tests/csound_filter.rs index 87ef8d88..367e5e76 100644 --- a/audio/csound/tests/csound_filter.rs +++ b/audio/csound/tests/csound_filter.rs @@ -65,7 +65,7 @@ fn init() { fn build_harness(src_caps: gst::Caps, sink_caps: gst::Caps, csd: &str) -> gst_check::Harness { let filter = gst::ElementFactory::make("csoundfilter", None).unwrap(); - filter.set_property("csd-text", &csd).unwrap(); + filter.set_property("csd-text", &csd); let mut h = gst_check::Harness::with_element(&filter, Some("sink"), Some("src")); diff --git a/generic/sodium/examples/decrypt_example.rs b/generic/sodium/examples/decrypt_example.rs index d80c31c3..5f74669f 100644 --- a/generic/sodium/examples/decrypt_example.rs +++ b/generic/sodium/examples/decrypt_example.rs @@ -102,15 +102,11 @@ fn main() -> Result<(), Box> { let typefind = gst::ElementFactory::make("typefind", None).unwrap(); let filesink = gst::ElementFactory::make("filesink", None).unwrap(); - filesrc - .set_property("location", &input_loc) - .expect("Failed to set location property"); - filesink - .set_property("location", &out_loc) - .expect("Failed to set location property"); + filesrc.set_property("location", &input_loc); + filesink.set_property("location", &out_loc); - decrypter.set_property("receiver-key", glib::Bytes::from_owned(receiver.private.0))?; - decrypter.set_property("sender-key", glib::Bytes::from_owned(sender.public))?; + decrypter.set_property("receiver-key", glib::Bytes::from_owned(receiver.private.0)); + decrypter.set_property("sender-key", glib::Bytes::from_owned(sender.public)); let pipeline = gst::Pipeline::new(Some("test-pipeline")); pipeline diff --git a/generic/sodium/examples/encrypt_example.rs b/generic/sodium/examples/encrypt_example.rs index fa454c30..06ea9cda 100644 --- a/generic/sodium/examples/encrypt_example.rs +++ b/generic/sodium/examples/encrypt_example.rs @@ -101,15 +101,11 @@ fn main() -> Result<(), Box> { let encrypter = gst::ElementFactory::make("sodiumencrypter", None).unwrap(); let filesink = gst::ElementFactory::make("filesink", None).unwrap(); - filesrc - .set_property("location", &input_loc) - .expect("Failed to set location property"); - filesink - .set_property("location", &out_loc) - .expect("Failed to set location property"); + filesrc.set_property("location", &input_loc); + filesink.set_property("location", &out_loc); - encrypter.set_property("receiver-key", glib::Bytes::from_owned(receiver.public))?; - encrypter.set_property("sender-key", glib::Bytes::from_owned(sender.private.0))?; + encrypter.set_property("receiver-key", glib::Bytes::from_owned(receiver.public)); + encrypter.set_property("sender-key", glib::Bytes::from_owned(sender.private.0)); let pipeline = gst::Pipeline::new(Some("test-pipeline")); pipeline diff --git a/generic/sodium/tests/decrypter.rs b/generic/sodium/tests/decrypter.rs index a11a93d4..f5f968ec 100644 --- a/generic/sodium/tests/decrypter.rs +++ b/generic/sodium/tests/decrypter.rs @@ -73,15 +73,11 @@ fn test_pipeline() { }; let filesrc = gst::ElementFactory::make("filesrc", None).unwrap(); - filesrc - .set_property("location", &input_path.to_str().unwrap()) - .expect("failed to set property"); + filesrc.set_property("location", &input_path.to_str().unwrap()); let dec = gst::ElementFactory::make("sodiumdecrypter", None).unwrap(); - dec.set_property("sender-key", &*SENDER_PUBLIC) - .expect("failed to set property"); - dec.set_property("receiver-key", &*RECEIVER_PRIVATE) - .expect("failed to set property"); + dec.set_property("sender-key", &*SENDER_PUBLIC); + dec.set_property("receiver-key", &*RECEIVER_PRIVATE); // the typefind element here is cause the decrypter only supports // operating in pull mode bu the filesink wants push-mode. @@ -165,15 +161,11 @@ fn test_pull_range() { }; let filesrc = gst::ElementFactory::make("filesrc", None).unwrap(); - filesrc - .set_property("location", input_path.to_str().unwrap()) - .expect("failed to set property"); + filesrc.set_property("location", input_path.to_str().unwrap()); let dec = gst::ElementFactory::make("sodiumdecrypter", None).unwrap(); - dec.set_property("sender-key", &*SENDER_PUBLIC) - .expect("failed to set property"); - dec.set_property("receiver-key", &*RECEIVER_PRIVATE) - .expect("failed to set property"); + dec.set_property("sender-key", &*SENDER_PUBLIC); + dec.set_property("receiver-key", &*RECEIVER_PRIVATE); pipeline .add_many(&[&filesrc, &dec]) @@ -284,34 +276,28 @@ fn test_state_changes() { // Set only receiver key let dec = gst::ElementFactory::make("sodiumdecrypter", None).unwrap(); - dec.set_property("receiver-key", &*RECEIVER_PRIVATE) - .expect("failed to set property"); + dec.set_property("receiver-key", &*RECEIVER_PRIVATE); assert!(dec.change_state(gst::StateChange::NullToReady).is_err()); // Set only sender key let dec = gst::ElementFactory::make("sodiumdecrypter", None).unwrap(); - dec.set_property("sender-key", &*SENDER_PUBLIC) - .expect("failed to set property"); + dec.set_property("sender-key", &*SENDER_PUBLIC); assert!(dec.change_state(gst::StateChange::NullToReady).is_err()); } // NullToReady, no nonce provided { let dec = gst::ElementFactory::make("sodiumdecrypter", None).unwrap(); - dec.set_property("sender-key", &*SENDER_PUBLIC) - .expect("failed to set property"); - dec.set_property("receiver-key", &*RECEIVER_PRIVATE) - .expect("failed to set property"); + dec.set_property("sender-key", &*SENDER_PUBLIC); + dec.set_property("receiver-key", &*RECEIVER_PRIVATE); assert!(dec.change_state(gst::StateChange::NullToReady).is_ok()); } // ReadyToNull { let dec = gst::ElementFactory::make("sodiumdecrypter", None).unwrap(); - dec.set_property("sender-key", &*SENDER_PUBLIC) - .expect("failed to set property"); - dec.set_property("receiver-key", &*RECEIVER_PRIVATE) - .expect("failed to set property"); + dec.set_property("sender-key", &*SENDER_PUBLIC); + dec.set_property("receiver-key", &*RECEIVER_PRIVATE); assert!(dec.change_state(gst::StateChange::NullToReady).is_ok()); } } diff --git a/generic/sodium/tests/encrypter.rs b/generic/sodium/tests/encrypter.rs index 14f0b0fa..c17cb3ae 100644 --- a/generic/sodium/tests/encrypter.rs +++ b/generic/sodium/tests/encrypter.rs @@ -74,12 +74,9 @@ fn encrypt_file() { let mut adapter = gst_base::UniqueAdapter::new(); let enc = gst::ElementFactory::make("sodiumencrypter", None).unwrap(); - enc.set_property("sender-key", &*SENDER_PRIVATE) - .expect("failed to set property"); - enc.set_property("receiver-key", &*RECEIVER_PUBLIC) - .expect("failed to set property"); - enc.set_property("block-size", 1024u32) - .expect("failed to set property"); + enc.set_property("sender-key", &*SENDER_PRIVATE); + enc.set_property("receiver-key", &*RECEIVER_PUBLIC); + enc.set_property("block-size", 1024u32); let mut h = gst_check::Harness::with_element(&enc, None, None); h.add_element_src_pad(&enc.static_pad("src").expect("failed to get src pad")); @@ -117,34 +114,28 @@ fn test_state_changes() { // Set only receiver key let enc = gst::ElementFactory::make("sodiumencrypter", None).unwrap(); - enc.set_property("receiver-key", &*RECEIVER_PUBLIC) - .expect("failed to set property"); + enc.set_property("receiver-key", &*RECEIVER_PUBLIC); assert!(enc.change_state(gst::StateChange::NullToReady).is_err()); // Set only sender key let enc = gst::ElementFactory::make("sodiumencrypter", None).unwrap(); - enc.set_property("sender-key", &*SENDER_PRIVATE) - .expect("failed to set property"); + enc.set_property("sender-key", &*SENDER_PRIVATE); assert!(enc.change_state(gst::StateChange::NullToReady).is_err()); } // NullToReady { let enc = gst::ElementFactory::make("sodiumencrypter", None).unwrap(); - enc.set_property("sender-key", &*SENDER_PRIVATE) - .expect("failed to set property"); - enc.set_property("receiver-key", &*RECEIVER_PUBLIC) - .expect("failed to set property"); + enc.set_property("sender-key", &*SENDER_PRIVATE); + enc.set_property("receiver-key", &*RECEIVER_PUBLIC); assert!(enc.change_state(gst::StateChange::NullToReady).is_ok()); } // ReadyToNull { let enc = gst::ElementFactory::make("sodiumencrypter", None).unwrap(); - enc.set_property("sender-key", &*SENDER_PRIVATE) - .expect("failed to set property"); - enc.set_property("receiver-key", &*RECEIVER_PUBLIC) - .expect("failed to set property"); + enc.set_property("sender-key", &*SENDER_PRIVATE); + enc.set_property("receiver-key", &*RECEIVER_PUBLIC); assert!(enc.change_state(gst::StateChange::NullToReady).is_ok()); } } diff --git a/generic/threadshare/examples/benchmark.rs b/generic/threadshare/examples/benchmark.rs index 64369a93..aea91734 100644 --- a/generic/threadshare/examples/benchmark.rs +++ b/generic/threadshare/examples/benchmark.rs @@ -66,8 +66,8 @@ fn main() { for i in 0..n_streams { let sink = gst::ElementFactory::make("fakesink", Some(format!("sink-{}", i).as_str())).unwrap(); - sink.set_property("sync", false).unwrap(); - sink.set_property("async", false).unwrap(); + sink.set_property("sync", false); + sink.set_property("async", false); let counter_clone = Arc::clone(&counter); sink.static_pad("sink").unwrap().add_probe( @@ -83,10 +83,8 @@ fn main() { let source = gst::ElementFactory::make("udpsrc", Some(format!("source-{}", i).as_str())) .unwrap(); - source.set_property("port", 40000i32 + i as i32).unwrap(); - source - .set_property("retrieve-sender-address", false) - .unwrap(); + source.set_property("port", 40000i32 + i as i32); + source.set_property("retrieve-sender-address", false); source } @@ -94,11 +92,9 @@ fn main() { let source = gst::ElementFactory::make("ts-udpsrc", Some(format!("source-{}", i).as_str())) .unwrap(); - source.set_property("port", 40000i32 + i as i32).unwrap(); - source - .set_property("context", format!("context-{}", (i as u32) % n_groups)) - .unwrap(); - source.set_property("context-wait", wait).unwrap(); + source.set_property("port", 40000i32 + i as i32); + source.set_property("context", format!("context-{}", (i as u32) % n_groups)); + source.set_property("context-wait", wait); source } @@ -108,8 +104,8 @@ fn main() { Some(format!("source-{}", i).as_str()), ) .unwrap(); - source.set_property("host", "127.0.0.1").unwrap(); - source.set_property("port", 40000i32).unwrap(); + source.set_property("host", "127.0.0.1"); + source.set_property("port", 40000i32); source } @@ -119,12 +115,10 @@ fn main() { Some(format!("source-{}", i).as_str()), ) .unwrap(); - source.set_property("host", "127.0.0.1").unwrap(); - source.set_property("port", 40000i32).unwrap(); - source - .set_property("context", format!("context-{}", (i as u32) % n_groups)) - .unwrap(); - source.set_property("context-wait", wait).unwrap(); + source.set_property("host", "127.0.0.1"); + source.set_property("port", 40000i32); + source.set_property("context", format!("context-{}", (i as u32) % n_groups)); + source.set_property("context-wait", wait); source } @@ -134,11 +128,9 @@ fn main() { Some(format!("source-{}", i).as_str()), ) .unwrap(); - source - .set_property("samplesperbuffer", (wait as i32) * 8000 / 1000) - .unwrap(); + source.set_property("samplesperbuffer", (wait as i32) * 8000 / 1000); - sink.set_property("sync", true).unwrap(); + sink.set_property("sync", true); source } @@ -146,13 +138,9 @@ fn main() { let source = gst::ElementFactory::make("ts-tonesrc", Some(format!("source-{}", i).as_str())) .unwrap(); - source - .set_property("samples-per-buffer", (wait as u32) * 8000 / 1000) - .unwrap(); - source - .set_property("context", format!("context-{}", (i as u32) % n_groups)) - .unwrap(); - source.set_property("context-wait", wait).unwrap(); + source.set_property("samples-per-buffer", (wait as u32) * 8000 / 1000); + source.set_property("context", format!("context-{}", (i as u32) % n_groups)); + source.set_property("context-wait", wait); source } diff --git a/generic/threadshare/src/jitterbuffer/imp.rs b/generic/threadshare/src/jitterbuffer/imp.rs index ea568b75..3ce77713 100644 --- a/generic/threadshare/src/jitterbuffer/imp.rs +++ b/generic/threadshare/src/jitterbuffer/imp.rs @@ -369,7 +369,7 @@ impl SinkHandler { if state.clock_rate.is_none() { drop(state); let caps = element - .emit_by_name("request-pt-map", &[&(pt as u32)]) + .try_emit_by_name("request-pt-map", &[&(pt as u32)]) .map_err(|_| gst::FlowError::Error)? .ok_or(gst::FlowError::Error)? .get::>() diff --git a/generic/threadshare/tests/appsrc.rs b/generic/threadshare/tests/appsrc.rs index cac927d0..8cb42c1d 100644 --- a/generic/threadshare/tests/appsrc.rs +++ b/generic/threadshare/tests/appsrc.rs @@ -36,9 +36,9 @@ fn push() { let caps = gst::Caps::builder("foo/bar").build(); { let appsrc = h.element().unwrap(); - appsrc.set_property("caps", &caps).unwrap(); - appsrc.set_property("do-timestamp", true).unwrap(); - appsrc.set_property("context", "appsrc-push").unwrap(); + appsrc.set_property("caps", &caps); + appsrc.set_property("do-timestamp", true); + appsrc.set_property("context", "appsrc-push"); } h.play(); @@ -49,7 +49,6 @@ fn push() { assert!(appsrc .emit_by_name("push-buffer", &[&gst::Buffer::new()]) .unwrap() - .unwrap() .get::() .unwrap()); } @@ -57,7 +56,6 @@ fn push() { assert!(appsrc .emit_by_name("end-of-stream", &[]) .unwrap() - .unwrap() .get::() .unwrap()); } @@ -102,9 +100,9 @@ fn pause_regular() { let caps = gst::Caps::builder("foo/bar").build(); { let appsrc = h.element().unwrap(); - appsrc.set_property("caps", &caps).unwrap(); - appsrc.set_property("do-timestamp", true).unwrap(); - appsrc.set_property("context", "appsrc-pause").unwrap(); + appsrc.set_property("caps", &caps); + appsrc.set_property("do-timestamp", true); + appsrc.set_property("context", "appsrc-pause"); } h.play(); @@ -115,7 +113,6 @@ fn pause_regular() { assert!(appsrc .emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![1, 2, 3, 4])]) .unwrap() - .unwrap() .get::() .unwrap()); @@ -125,7 +122,6 @@ fn pause_regular() { assert!(appsrc .emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![5, 6, 7])]) .unwrap() - .unwrap() .get::() .unwrap()); @@ -137,7 +133,6 @@ fn pause_regular() { assert!(appsrc .emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![8, 9])]) .unwrap() - .unwrap() .get::() .unwrap()); @@ -155,7 +150,6 @@ fn pause_regular() { assert!(appsrc .emit_by_name("push-buffer", &[&gst::Buffer::new()]) .unwrap() - .unwrap() .get::() .unwrap()); @@ -172,9 +166,9 @@ fn flush_regular() { let caps = gst::Caps::builder("foo/bar").build(); { let appsrc = h.element().unwrap(); - appsrc.set_property("caps", &caps).unwrap(); - appsrc.set_property("do-timestamp", true).unwrap(); - appsrc.set_property("context", "appsrc-flush").unwrap(); + appsrc.set_property("caps", &caps); + appsrc.set_property("do-timestamp", true); + appsrc.set_property("context", "appsrc-flush"); } h.play(); @@ -185,7 +179,6 @@ fn flush_regular() { assert!(appsrc .emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![1, 2, 3, 4])]) .unwrap() - .unwrap() .get::() .unwrap()); @@ -198,7 +191,6 @@ fn flush_regular() { assert!(!appsrc .emit_by_name("push-buffer", &[&gst::Buffer::new()]) .unwrap() - .unwrap() .get::() .unwrap()); @@ -214,7 +206,6 @@ fn flush_regular() { assert!(appsrc .emit_by_name("push-buffer", &[&gst::Buffer::new()]) .unwrap() - .unwrap() .get::() .unwrap()); @@ -231,11 +222,9 @@ fn pause_flush() { let caps = gst::Caps::builder("foo/bar").build(); { let appsrc = h.element().unwrap(); - appsrc.set_property("caps", &caps).unwrap(); - appsrc.set_property("do-timestamp", true).unwrap(); - appsrc - .set_property("context", "appsrc-pause_flush") - .unwrap(); + appsrc.set_property("caps", &caps); + appsrc.set_property("do-timestamp", true); + appsrc.set_property("context", "appsrc-pause_flush"); } h.play(); @@ -246,7 +235,6 @@ fn pause_flush() { assert!(appsrc .emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![1, 2, 3, 4])]) .unwrap() - .unwrap() .get::() .unwrap()); @@ -263,7 +251,6 @@ fn pause_flush() { assert!(!appsrc .emit_by_name("push-buffer", &[&gst::Buffer::new()]) .unwrap() - .unwrap() .get::() .unwrap()); @@ -283,7 +270,6 @@ fn pause_flush() { assert!(appsrc .emit_by_name("push-buffer", &[&gst::Buffer::new()]) .unwrap() - .unwrap() .get::() .unwrap()); diff --git a/generic/threadshare/tests/inputselector.rs b/generic/threadshare/tests/inputselector.rs index 7f7dc826..5fd5ac40 100644 --- a/generic/threadshare/tests/inputselector.rs +++ b/generic/threadshare/tests/inputselector.rs @@ -36,20 +36,11 @@ fn test_active_pad() { let mut h1 = gst_check::Harness::with_element(&is, Some("sink_%u"), Some("src")); let mut h2 = gst_check::Harness::with_element(&is, Some("sink_%u"), None); - let active_pad = is - .property("active-pad") - .unwrap() - .get::>() - .unwrap(); + let active_pad = is.property::>("active-pad"); assert_eq!(active_pad, h1.srcpad().unwrap().peer()); - is.set_property("active-pad", h2.srcpad().unwrap().peer()) - .unwrap(); - let active_pad = is - .property("active-pad") - .unwrap() - .get::>() - .unwrap(); + is.set_property("active-pad", h2.srcpad().unwrap().peer()); + let active_pad = is.property::>("active-pad"); assert_eq!(active_pad, h2.srcpad().unwrap().peer()); h1.set_src_caps_str("foo/bar"); @@ -85,8 +76,7 @@ fn test_active_pad() { /* Switch the active pad and push a buffer, we should receive stream-start, segment and caps * again */ let buf = gst::Buffer::new(); - is.set_property("active-pad", h1.srcpad().unwrap().peer()) - .unwrap(); + is.set_property("active-pad", h1.srcpad().unwrap().peer()); assert_eq!(h1.push(buf), Ok(gst::FlowSuccess::Ok)); assert_eq!(h1.buffers_received(), 3); assert_eq!(h1.events_received(), 6); diff --git a/generic/threadshare/tests/jitterbuffer.rs b/generic/threadshare/tests/jitterbuffer.rs index 1949ff2d..478965d0 100644 --- a/generic/threadshare/tests/jitterbuffer.rs +++ b/generic/threadshare/tests/jitterbuffer.rs @@ -51,24 +51,24 @@ fn jb_pipeline() { let pipeline = gst::Pipeline::new(None); let src = gst::ElementFactory::make("audiotestsrc", Some("audiotestsrc")).unwrap(); - src.set_property("is-live", true).unwrap(); - src.set_property("num-buffers", BUFFER_NB).unwrap(); + src.set_property("is-live", true); + src.set_property("num-buffers", BUFFER_NB); let enc = gst::ElementFactory::make("alawenc", Some("alawenc")).unwrap(); let pay = gst::ElementFactory::make("rtppcmapay", Some("rtppcmapay")).unwrap(); let jb = gst::ElementFactory::make("ts-jitterbuffer", Some("ts-jitterbuffer")).unwrap(); - jb.set_property("context", "jb_pipeline").unwrap(); - jb.set_property("context-wait", CONTEXT_WAIT).unwrap(); - jb.set_property("latency", LATENCY).unwrap(); + jb.set_property("context", "jb_pipeline"); + jb.set_property("context-wait", CONTEXT_WAIT); + jb.set_property("latency", LATENCY); let depay = gst::ElementFactory::make("rtppcmadepay", Some("rtppcmadepay")).unwrap(); let dec = gst::ElementFactory::make("alawdec", Some("alawdec")).unwrap(); let sink = gst::ElementFactory::make("appsink", Some("appsink")).unwrap(); - sink.set_property("sync", false).unwrap(); - sink.set_property("async", false).unwrap(); - sink.set_property("emit-signals", true).unwrap(); + sink.set_property("sync", false); + sink.set_property("async", false); + sink.set_property("emit-signals", true); pipeline .add_many(&[&src, &enc, &pay, &jb, &depay, &dec, &sink]) @@ -83,7 +83,6 @@ fn jb_pipeline() { let _sample = appsink .emit_by_name("pull-sample", &[]) .unwrap() - .unwrap() .get::() .unwrap(); @@ -115,30 +114,28 @@ fn jb_ts_pipeline() { let pipeline = gst::Pipeline::new(None); let src = gst::ElementFactory::make("audiotestsrc", Some("audiotestsrc")).unwrap(); - src.set_property("is-live", true).unwrap(); - src.set_property("num-buffers", BUFFER_NB).unwrap(); + src.set_property("is-live", true); + src.set_property("num-buffers", BUFFER_NB); let queue = gst::ElementFactory::make("ts-queue", Some("ts-queue")).unwrap(); - queue - .set_property("context", "jb_ts_pipeline_queue") - .unwrap(); - queue.set_property("context-wait", CONTEXT_WAIT).unwrap(); + queue.set_property("context", "jb_ts_pipeline_queue"); + queue.set_property("context-wait", CONTEXT_WAIT); let enc = gst::ElementFactory::make("alawenc", Some("alawenc")).unwrap(); let pay = gst::ElementFactory::make("rtppcmapay", Some("rtppcmapay")).unwrap(); let jb = gst::ElementFactory::make("ts-jitterbuffer", Some("ts-jitterbuffer")).unwrap(); - jb.set_property("context", "jb_ts_pipeline").unwrap(); - jb.set_property("context-wait", CONTEXT_WAIT).unwrap(); - jb.set_property("latency", LATENCY).unwrap(); + jb.set_property("context", "jb_ts_pipeline"); + jb.set_property("context-wait", CONTEXT_WAIT); + jb.set_property("latency", LATENCY); let depay = gst::ElementFactory::make("rtppcmadepay", Some("rtppcmadepay")).unwrap(); let dec = gst::ElementFactory::make("alawdec", Some("alawdec")).unwrap(); let sink = gst::ElementFactory::make("appsink", Some("appsink")).unwrap(); - sink.set_property("sync", false).unwrap(); - sink.set_property("async", false).unwrap(); - sink.set_property("emit-signals", true).unwrap(); + sink.set_property("sync", false); + sink.set_property("async", false); + sink.set_property("emit-signals", true); pipeline .add_many(&[&src, &queue, &enc, &pay, &jb, &depay, &dec, &sink]) @@ -153,7 +150,6 @@ fn jb_ts_pipeline() { let _sample = appsink .emit_by_name("pull-sample", &[]) .unwrap() - .unwrap() .get::() .unwrap(); diff --git a/generic/threadshare/tests/pad.rs b/generic/threadshare/tests/pad.rs index c161c344..d958e4e7 100644 --- a/generic/threadshare/tests/pad.rs +++ b/generic/threadshare/tests/pad.rs @@ -772,7 +772,7 @@ fn setup( // Src let src_element = glib::Object::new::(&[]).unwrap(); - src_element.set_property("context", &context_name).unwrap(); + src_element.set_property("context", &context_name); pipeline.add(&src_element).unwrap(); let mut last_element = src_element.clone().upcast::(); @@ -969,12 +969,8 @@ fn src_tsqueue_sink_nominal() { let name = "src_tsqueue_sink"; let ts_queue = gst::ElementFactory::make("ts-queue", Some("ts-queue")).unwrap(); - ts_queue - .set_property("context", format!("{}_queue", name)) - .unwrap(); - ts_queue - .set_property("context-wait", THROTTLING_DURATION.as_millis() as u32) - .unwrap(); + ts_queue.set_property("context", format!("{}_queue", name)); + ts_queue.set_property("context-wait", THROTTLING_DURATION.as_millis() as u32); let (pipeline, src_element, _sink_element, receiver) = setup(name, Some(ts_queue), None); @@ -1000,20 +996,12 @@ fn src_tsproxy_sink_nominal() { let name = "src_tsproxy_sink"; let ts_proxy_sink = gst::ElementFactory::make("ts-proxysink", Some("ts-proxysink")).unwrap(); - ts_proxy_sink - .set_property("proxy-context", format!("{}_proxy_context", name)) - .unwrap(); + ts_proxy_sink.set_property("proxy-context", format!("{}_proxy_context", name)); let ts_proxy_src = gst::ElementFactory::make("ts-proxysrc", Some("ts-proxysrc")).unwrap(); - ts_proxy_src - .set_property("proxy-context", format!("{}_proxy_context", name)) - .unwrap(); - ts_proxy_src - .set_property("context", format!("{}_context", name)) - .unwrap(); - ts_proxy_src - .set_property("context-wait", THROTTLING_DURATION.as_millis() as u32) - .unwrap(); + ts_proxy_src.set_property("proxy-context", format!("{}_proxy_context", name)); + ts_proxy_src.set_property("context", format!("{}_context", name)); + ts_proxy_src.set_property("context-wait", THROTTLING_DURATION.as_millis() as u32); let (pipeline, src_element, _sink_element, receiver) = setup(name, Some(ts_proxy_sink), Some(ts_proxy_src)); diff --git a/generic/threadshare/tests/pipeline.rs b/generic/threadshare/tests/pipeline.rs index 2dd11ee5..143b48c6 100644 --- a/generic/threadshare/tests/pipeline.rs +++ b/generic/threadshare/tests/pipeline.rs @@ -63,23 +63,20 @@ fn multiple_contexts_queue() { for i in 0..SRC_NB { let src = gst::ElementFactory::make("ts-udpsrc", Some(format!("src-{}", i).as_str())).unwrap(); - src.set_property("context", format!("context-{}", (i as u32) % CONTEXT_NB)) - .unwrap(); - src.set_property("context-wait", CONTEXT_WAIT).unwrap(); - src.set_property("port", (FIRST_PORT + i) as i32).unwrap(); + src.set_property("context", format!("context-{}", (i as u32) % CONTEXT_NB)); + src.set_property("context-wait", CONTEXT_WAIT); + src.set_property("port", (FIRST_PORT + i) as i32); let queue = gst::ElementFactory::make("ts-queue", Some(format!("queue-{}", i).as_str())).unwrap(); - queue - .set_property("context", format!("context-{}", (i as u32) % CONTEXT_NB)) - .unwrap(); - queue.set_property("context-wait", CONTEXT_WAIT).unwrap(); + queue.set_property("context", format!("context-{}", (i as u32) % CONTEXT_NB)); + queue.set_property("context-wait", CONTEXT_WAIT); let sink = gst::ElementFactory::make("appsink", Some(format!("sink-{}", i).as_str())).unwrap(); - sink.set_property("sync", false).unwrap(); - sink.set_property("async", false).unwrap(); - sink.set_property("emit-signals", true).unwrap(); + sink.set_property("sync", false); + sink.set_property("async", false); + sink.set_property("emit-signals", true); pipeline.add_many(&[&src, &queue, &sink]).unwrap(); gst::Element::link_many(&[&src, &queue, &sink]).unwrap(); @@ -92,7 +89,6 @@ fn multiple_contexts_queue() { let _sample = appsink .emit_by_name("pull-sample", &[]) .unwrap() - .unwrap() .get::() .unwrap(); @@ -204,40 +200,33 @@ fn multiple_contexts_proxy() { Some(format!("src-{}", pipeline_index).as_str()), ) .unwrap(); - src.set_property("context", format!("context-{}", (i as u32) % CONTEXT_NB)) - .unwrap(); - src.set_property("context-wait", CONTEXT_WAIT).unwrap(); - src.set_property("port", (FIRST_PORT + i) as i32).unwrap(); + src.set_property("context", format!("context-{}", (i as u32) % CONTEXT_NB)); + src.set_property("context-wait", CONTEXT_WAIT); + src.set_property("port", (FIRST_PORT + i) as i32); let proxysink = gst::ElementFactory::make( "ts-proxysink", Some(format!("proxysink-{}", pipeline_index).as_str()), ) .unwrap(); - proxysink - .set_property("proxy-context", format!("proxy-{}", pipeline_index)) - .unwrap(); + proxysink.set_property("proxy-context", format!("proxy-{}", pipeline_index)); let proxysrc = gst::ElementFactory::make( "ts-proxysrc", Some(format!("proxysrc-{}", pipeline_index).as_str()), ) .unwrap(); - proxysrc - .set_property( - "context", - &format!("context-{}", (pipeline_index as u32) % CONTEXT_NB), - ) - .unwrap(); - proxysrc - .set_property("proxy-context", format!("proxy-{}", pipeline_index)) - .unwrap(); + proxysrc.set_property( + "context", + &format!("context-{}", (pipeline_index as u32) % CONTEXT_NB), + ); + proxysrc.set_property("proxy-context", format!("proxy-{}", pipeline_index)); let sink = gst::ElementFactory::make("appsink", Some(format!("sink-{}", pipeline_index).as_str())) .unwrap(); - sink.set_property("sync", false).unwrap(); - sink.set_property("async", false).unwrap(); - sink.set_property("emit-signals", true).unwrap(); + sink.set_property("sync", false); + sink.set_property("async", false); + sink.set_property("emit-signals", true); pipeline .add_many(&[&src, &proxysink, &proxysrc, &sink]) @@ -253,7 +242,6 @@ fn multiple_contexts_proxy() { let _sample = appsink .emit_by_name("pull-sample", &[]) .unwrap() - .unwrap() .get::() .unwrap(); @@ -349,22 +337,22 @@ fn eos() { let caps = gst::Caps::builder("foo/bar").build(); let src = gst::ElementFactory::make("ts-appsrc", Some("src-eos")).unwrap(); - src.set_property("caps", &caps).unwrap(); - src.set_property("do-timestamp", true).unwrap(); - src.set_property("context", &CONTEXT).unwrap(); + src.set_property("caps", &caps); + src.set_property("do-timestamp", true); + src.set_property("context", &CONTEXT); let queue = gst::ElementFactory::make("ts-queue", Some("queue-eos")).unwrap(); - queue.set_property("context", &CONTEXT).unwrap(); + queue.set_property("context", &CONTEXT); let appsink = gst::ElementFactory::make("appsink", Some("sink-eos")).unwrap(); pipeline.add_many(&[&src, &queue, &appsink]).unwrap(); gst::Element::link_many(&[&src, &queue, &appsink]).unwrap(); - appsink.set_property("sync", false).unwrap(); - appsink.set_property("async", false).unwrap(); + appsink.set_property("sync", false); + appsink.set_property("async", false); - appsink.set_property("emit-signals", true).unwrap(); + appsink.set_property("emit-signals", true); let (sample_notifier, sample_notif_rcv) = mpsc::channel(); let (eos_notifier, eos_notif_rcv) = mpsc::channel(); let appsink = appsink.dynamic_cast::().unwrap(); @@ -375,7 +363,6 @@ fn eos() { let _ = appsink .emit_by_name("pull-sample", &[]) .unwrap() - .unwrap() .get::() .unwrap(); @@ -390,7 +377,6 @@ fn eos() { fn push_buffer(src: &gst::Element) -> bool { gst_debug!(CAT, obj: src, "eos: pushing buffer"); src.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![0; 1024])]) - .unwrap() .unwrap() .get::() .unwrap() @@ -407,7 +393,6 @@ fn eos() { assert!(src .emit_by_name("end-of-stream", &[]) .unwrap() - .unwrap() .get::() .unwrap()); @@ -487,29 +472,24 @@ fn premature_shutdown() { let caps = gst::Caps::builder("foo/bar").build(); let src = gst::ElementFactory::make("ts-appsrc", Some("src-ps")).unwrap(); - src.set_property("caps", &caps).unwrap(); - src.set_property("do-timestamp", true).unwrap(); - src.set_property("context", "appsrc-context").unwrap(); - src.set_property("context-wait", APPSRC_CONTEXT_WAIT) - .unwrap(); + src.set_property("caps", &caps); + src.set_property("do-timestamp", true); + src.set_property("context", "appsrc-context"); + src.set_property("context-wait", APPSRC_CONTEXT_WAIT); let queue = gst::ElementFactory::make("ts-queue", Some("queue-ps")).unwrap(); - queue.set_property("context", "queue-context").unwrap(); - queue - .set_property("context-wait", QUEUE_CONTEXT_WAIT) - .unwrap(); - queue - .set_property("max-size-buffers", QUEUE_ITEMS_CAPACITY) - .unwrap(); + queue.set_property("context", "queue-context"); + queue.set_property("context-wait", QUEUE_CONTEXT_WAIT); + queue.set_property("max-size-buffers", QUEUE_ITEMS_CAPACITY); let appsink = gst::ElementFactory::make("appsink", Some("sink-ps")).unwrap(); pipeline.add_many(&[&src, &queue, &appsink]).unwrap(); gst::Element::link_many(&[&src, &queue, &appsink]).unwrap(); - appsink.set_property("emit-signals", true).unwrap(); - appsink.set_property("sync", false).unwrap(); - appsink.set_property("async", false).unwrap(); + appsink.set_property("emit-signals", true); + appsink.set_property("sync", false); + appsink.set_property("async", false); let (appsink_sender, appsink_receiver) = mpsc::channel(); @@ -521,7 +501,6 @@ fn premature_shutdown() { let _sample = appsink .emit_by_name("pull-sample", &[]) .unwrap() - .unwrap() .get::() .unwrap(); @@ -540,7 +519,6 @@ fn premature_shutdown() { intent ); src.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![0; 1024])]) - .unwrap() .unwrap() .get::() .unwrap() diff --git a/generic/threadshare/tests/proxy.rs b/generic/threadshare/tests/proxy.rs index 538ec40a..ca8c4afd 100644 --- a/generic/threadshare/tests/proxy.rs +++ b/generic/threadshare/tests/proxy.rs @@ -45,11 +45,11 @@ fn test_push() { fakesrc.link(&proxysink).unwrap(); proxysrc.link(&appsink).unwrap(); - fakesrc.set_property("num-buffers", 3i32).unwrap(); - proxysink.set_property("proxy-context", "test1").unwrap(); - proxysrc.set_property("proxy-context", "test1").unwrap(); + fakesrc.set_property("num-buffers", 3i32); + proxysink.set_property("proxy-context", "test1"); + proxysrc.set_property("proxy-context", "test1"); - appsink.set_property("emit-signals", true).unwrap(); + appsink.set_property("emit-signals", true); let samples = Arc::new(Mutex::new(Vec::new())); @@ -61,7 +61,6 @@ fn test_push() { let sample = appsink .emit_by_name("pull-sample", &[]) .unwrap() - .unwrap() .get::() .unwrap(); @@ -117,8 +116,8 @@ fn test_from_pipeline_to_pipeline() { pipe_2.add_many(&[&pxsrc, &fakesink]).unwrap(); pxsrc.link(&fakesink).unwrap(); - pxsink.set_property("proxy-context", "test2").unwrap(); - pxsrc.set_property("proxy-context", "test2").unwrap(); + pxsink.set_property("proxy-context", "test2"); + pxsrc.set_property("proxy-context", "test2"); pipe_1.set_state(gst::State::Paused).unwrap(); pipe_2.set_state(gst::State::Paused).unwrap(); @@ -149,11 +148,11 @@ fn test_from_pipeline_to_pipeline_and_back() { pipe_2.add_many(&[&pxsrc_2, &pxsink_2]).unwrap(); pxsrc_2.link(&pxsink_2).unwrap(); - pxsrc_1.set_property("proxy-context", "test3").unwrap(); - pxsink_2.set_property("proxy-context", "test3").unwrap(); + pxsrc_1.set_property("proxy-context", "test3"); + pxsink_2.set_property("proxy-context", "test3"); - pxsrc_2.set_property("proxy-context", "test4").unwrap(); - pxsink_1.set_property("proxy-context", "test4").unwrap(); + pxsrc_2.set_property("proxy-context", "test4"); + pxsink_1.set_property("proxy-context", "test4"); pipe_1.set_state(gst::State::Paused).unwrap(); pipe_2.set_state(gst::State::Paused).unwrap(); diff --git a/generic/threadshare/tests/queue.rs b/generic/threadshare/tests/queue.rs index 6d964209..cac56016 100644 --- a/generic/threadshare/tests/queue.rs +++ b/generic/threadshare/tests/queue.rs @@ -42,9 +42,9 @@ fn test_push() { fakesrc.link(&queue).unwrap(); queue.link(&appsink).unwrap(); - fakesrc.set_property("num-buffers", 3i32).unwrap(); + fakesrc.set_property("num-buffers", 3i32); - appsink.set_property("emit-signals", true).unwrap(); + appsink.set_property("emit-signals", true); let samples = Arc::new(Mutex::new(Vec::new())); @@ -56,7 +56,6 @@ fn test_push() { let sample = appsink .emit_by_name("pull-sample", &[]) .unwrap() - .unwrap() .get::() .unwrap(); diff --git a/generic/threadshare/tests/tcpclientsrc.rs b/generic/threadshare/tests/tcpclientsrc.rs index 919f20c1..b015ffe9 100644 --- a/generic/threadshare/tests/tcpclientsrc.rs +++ b/generic/threadshare/tests/tcpclientsrc.rs @@ -56,17 +56,17 @@ fn test_push() { let tcpclientsrc = gst::ElementFactory::make("ts-tcpclientsrc", None).unwrap(); let appsink = gst::ElementFactory::make("appsink", None).unwrap(); - appsink.set_property("sync", false).unwrap(); - appsink.set_property("async", false).unwrap(); + appsink.set_property("sync", false); + appsink.set_property("async", false); pipeline.add_many(&[&tcpclientsrc, &appsink]).unwrap(); tcpclientsrc.link(&appsink).unwrap(); let caps = gst::Caps::builder("foo/bar").build(); - tcpclientsrc.set_property("caps", &caps).unwrap(); - tcpclientsrc.set_property("port", 5000i32).unwrap(); + tcpclientsrc.set_property("caps", &caps); + tcpclientsrc.set_property("port", 5000i32); - appsink.set_property("emit-signals", true).unwrap(); + appsink.set_property("emit-signals", true); let samples = Arc::new(Mutex::new(Vec::new())); @@ -78,7 +78,6 @@ fn test_push() { let sample = appsink .emit_by_name("pull-sample", &[]) .unwrap() - .unwrap() .get::() .unwrap(); diff --git a/generic/threadshare/tests/udpsink.rs b/generic/threadshare/tests/udpsink.rs index 395ca2e8..7c1d1ac6 100644 --- a/generic/threadshare/tests/udpsink.rs +++ b/generic/threadshare/tests/udpsink.rs @@ -36,84 +36,40 @@ fn test_client_management() { let h = gst_check::Harness::new("ts-udpsink"); let udpsink = h.element().unwrap(); - let clients = udpsink - .property("clients") - .unwrap() - .get::() - .unwrap(); + let clients = udpsink.property::("clients"); assert_eq!(clients, "127.0.0.1:5004"); - udpsink - .emit_by_name("add", &[&"192.168.1.1", &57i32]) - .unwrap(); - let clients = udpsink - .property("clients") - .unwrap() - .get::() - .unwrap(); + udpsink.emit_by_name("add", &[&"192.168.1.1", &57i32]); + let clients = udpsink.property::("clients"); assert_eq!(clients, "127.0.0.1:5004,192.168.1.1:57"); /* Adding a client twice is not supported */ - udpsink - .emit_by_name("add", &[&"192.168.1.1", &57i32]) - .unwrap(); - let clients = udpsink - .property("clients") - .unwrap() - .get::() - .unwrap(); + udpsink.emit_by_name("add", &[&"192.168.1.1", &57i32]); + let clients = udpsink.property::("clients"); assert_eq!(clients, "127.0.0.1:5004,192.168.1.1:57"); - udpsink - .emit_by_name("remove", &[&"192.168.1.1", &57i32]) - .unwrap(); - let clients = udpsink - .property("clients") - .unwrap() - .get::() - .unwrap(); + udpsink.emit_by_name("remove", &[&"192.168.1.1", &57i32]); + let clients = udpsink.property::("clients"); assert_eq!(clients, "127.0.0.1:5004"); /* Removing a non-existing client should not be a problem */ - udpsink - .emit_by_name("remove", &[&"192.168.1.1", &57i32]) - .unwrap(); - let clients = udpsink - .property("clients") - .unwrap() - .get::() - .unwrap(); + udpsink.emit_by_name("remove", &[&"192.168.1.1", &57i32]); + let clients = udpsink.property::("clients"); assert_eq!(clients, "127.0.0.1:5004"); /* Removing the default client is possible */ - udpsink - .emit_by_name("remove", &[&"127.0.0.1", &5004i32]) - .unwrap(); - let clients = udpsink - .property("clients") - .unwrap() - .get::() - .unwrap(); + udpsink.emit_by_name("remove", &[&"127.0.0.1", &5004i32]); + let clients = udpsink.property::("clients"); assert_eq!(clients, ""); /* The client properties is writable too */ - udpsink - .set_property("clients", "127.0.0.1:5004,192.168.1.1:57") - .unwrap(); - let clients = udpsink - .property("clients") - .unwrap() - .get::() - .unwrap(); + udpsink.set_property("clients", "127.0.0.1:5004,192.168.1.1:57"); + let clients = udpsink.property::("clients"); assert_eq!(clients, "127.0.0.1:5004,192.168.1.1:57"); - udpsink.emit_by_name("clear", &[]).unwrap(); - let clients = udpsink - .property("clients") - .unwrap() - .get::() - .unwrap(); + udpsink.emit_by_name("clear", &[]); + let clients = udpsink.property::("clients"); assert_eq!(clients, ""); } @@ -125,7 +81,7 @@ fn test_chain() { h.set_src_caps_str("foo/bar"); { let udpsink = h.element().unwrap(); - udpsink.set_property("clients", "127.0.0.1:5005").unwrap(); + udpsink.set_property("clients", "127.0.0.1:5005"); } thread::spawn(move || { diff --git a/generic/threadshare/tests/udpsrc.rs b/generic/threadshare/tests/udpsrc.rs index 9a5adcee..9bba3e31 100644 --- a/generic/threadshare/tests/udpsrc.rs +++ b/generic/threadshare/tests/udpsrc.rs @@ -38,9 +38,9 @@ fn test_push() { let caps = gst::Caps::builder("foo/bar").build(); { let udpsrc = h.element().unwrap(); - udpsrc.set_property("caps", &caps).unwrap(); - udpsrc.set_property("port", 5000i32).unwrap(); - udpsrc.set_property("context", "test-push").unwrap(); + udpsrc.set_property("caps", &caps); + udpsrc.set_property("port", 5000i32); + udpsrc.set_property("context", "test-push"); } h.play(); @@ -105,31 +105,27 @@ fn test_socket_reuse() { { let udpsrc = ts_src_h.element().unwrap(); - udpsrc.set_property("port", 6000i32).unwrap(); - udpsrc.set_property("context", "test-socket-reuse").unwrap(); + udpsrc.set_property("port", 6000i32); + udpsrc.set_property("context", "test-socket-reuse"); } ts_src_h.play(); { let udpsrc = ts_src_h.element().unwrap(); - let socket = udpsrc - .property("used-socket") - .unwrap() - .get::() - .unwrap(); + let socket = udpsrc.property::("used-socket"); let udpsink = sink_h.element().unwrap(); - udpsink.set_property("socket", &socket).unwrap(); - udpsink.set_property("host", "127.0.0.1").unwrap(); - udpsink.set_property("port", 6001i32).unwrap(); + udpsink.set_property("socket", &socket); + udpsink.set_property("host", "127.0.0.1"); + udpsink.set_property("port", 6001i32); } sink_h.play(); sink_h.set_src_caps_str("application/test"); { let udpsrc = ts_src_h2.element().unwrap(); - udpsrc.set_property("port", 6001i32).unwrap(); - udpsrc.set_property("context", "test-socket-reuse").unwrap(); + udpsrc.set_property("port", 6001i32); + udpsrc.set_property("context", "test-socket-reuse"); } ts_src_h2.play(); diff --git a/net/reqwest/tests/reqwesthttpsrc.rs b/net/reqwest/tests/reqwesthttpsrc.rs index 1b9cba62..b42f0e51 100644 --- a/net/reqwest/tests/reqwesthttpsrc.rs +++ b/net/reqwest/tests/reqwesthttpsrc.rs @@ -142,8 +142,7 @@ impl Harness { }); let local_addr = futures::executor::block_on(local_addr_receiver).unwrap(); - src.set_property("location", format!("http://{}/", local_addr)) - .unwrap(); + src.set_property("location", format!("http://{}/", local_addr)); // Let the test setup anything needed on the HTTP source now setup_func(&src); @@ -410,10 +409,10 @@ fn test_basic_request_inverted_defaults() { Response::new(Body::from("Hello World")) }, |src| { - src.set_property("keep-alive", false).unwrap(); - src.set_property("compress", true).unwrap(); - src.set_property("iradio-mode", false).unwrap(); - src.set_property("user-agent", "test user-agent").unwrap(); + src.set_property("keep-alive", false); + src.set_property("compress", true); + src.set_property("iradio-mode", false); + src.set_property("user-agent", "test user-agent"); }, ); @@ -490,8 +489,7 @@ fn test_extra_headers() { .field("list", gst::List::new([1i32, 2i32])) .field("array", gst::Array::new([1i32, 2i32])) .build(), - ) - .unwrap(); + ); }, ); @@ -550,8 +548,7 @@ fn test_cookies_property() { String::from("bar=2"), String::from("baz=3"), ], - ) - .unwrap(); + ); }, ); @@ -760,8 +757,8 @@ fn test_authorization() { } }, |src| { - src.set_property("user-id", "user").unwrap(); - src.set_property("user-pw", "password").unwrap(); + src.set_property("user-id", "user"); + src.set_property("user-pw", "password"); }, ); @@ -860,7 +857,7 @@ fn test_network_error() { let mut h = Harness::new( |_req| unreachable!(), |src| { - src.set_property("location", "http://0.0.0.0:0").unwrap(); + src.set_property("location", "http://0.0.0.0:0"); }, ); @@ -1194,14 +1191,8 @@ fn test_proxy_prop_souphttpsrc_compatibility() { fn assert_proxy_set(set_to: Option<&str>, expected: Option<&str>) { // The same assertions should hold for "souphttpsrc". let src = gst::ElementFactory::make("reqwesthttpsrc", None).unwrap(); - src.set_property("proxy", set_to).unwrap(); - assert_eq!( - src.property("proxy") - .unwrap() - .get::>() - .unwrap(), - expected - ); + src.set_property("proxy", set_to); + assert_eq!(src.property::>("proxy").as_deref(), expected); } // Test env var proxy. @@ -1275,7 +1266,7 @@ fn test_proxy() { .unwrap() }, |src| { - src.set_property("proxy", proxy_addr.to_string()).unwrap(); + src.set_property("proxy", proxy_addr.to_string()); }, ); diff --git a/text/regex/tests/regex.rs b/text/regex/tests/regex.rs index 47164747..35c6045b 100644 --- a/text/regex/tests/regex.rs +++ b/text/regex/tests/regex.rs @@ -47,7 +47,7 @@ fn test_replace_all() { let commands = gst::Array::from(vec![command.to_send_value()]); - regex.set_property("commands", &commands).unwrap(); + regex.set_property("commands", &commands); } h.set_src_caps_str("text/x-raw, format=utf8"); diff --git a/text/wrap/tests/textwrap.rs b/text/wrap/tests/textwrap.rs index 73658d40..b399156c 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); } 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); + wrap.set_property("lines", 2u32); } h.set_src_caps_str("text/x-raw, format=utf8"); diff --git a/tutorial/src/progressbin/imp.rs b/tutorial/src/progressbin/imp.rs index 9546fc40..18c6b575 100644 --- a/tutorial/src/progressbin/imp.rs +++ b/tutorial/src/progressbin/imp.rs @@ -64,7 +64,7 @@ impl ObjectSubclass for ProgressBin { // Create the progressreport element. let progress = gst::ElementFactory::make("progressreport", Some("progress")).unwrap(); // Don't let progressreport print to stdout itself - progress.set_property("silent", true).unwrap(); + progress.set_property("silent", true); // Return an instance of our struct Self { diff --git a/utils/fallbackswitch/examples/gtk_fallbackswitch.rs b/utils/fallbackswitch/examples/gtk_fallbackswitch.rs index 1ffab88c..7af47645 100644 --- a/utils/fallbackswitch/examples/gtk_fallbackswitch.rs +++ b/utils/fallbackswitch/examples/gtk_fallbackswitch.rs @@ -41,9 +41,7 @@ fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element, gtk::Widget) { .upcast(); let fallbackswitch = gst::ElementFactory::make("fallbackswitch", None).unwrap(); - fallbackswitch - .set_property("timeout", gst::ClockTime::SECOND) - .unwrap(); + fallbackswitch.set_property("timeout", gst::ClockTime::SECOND); let decodebin = gst::ElementFactory::make("decodebin", None).unwrap(); let videoconvert = gst::ElementFactory::make("videoconvert", None).unwrap(); @@ -63,15 +61,15 @@ fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element, gtk::Widget) { let (video_sink, video_widget) = //if let Some(gtkglsink) = gst::ElementFactory::make("gtkglsink", None) { // let glsinkbin = gst::ElementFactory::make("glsinkbin", None).unwrap(); - // glsinkbin.set_property("sink", >kglsink).unwrap(); + // glsinkbin.set_property("sink", >kglsink); - // let widget = gtkglsink.get_property("widget").unwrap(); - // (glsinkbin, widget.get::().unwrap().unwrap()) + // let widget = gtkglsink.property::("widget"); + // (glsinkbin, widget) //} else { let sink = gst::ElementFactory::make("gtksink", None).unwrap(); - let widget = sink.property("widget").unwrap(); - (sink, widget.get::().unwrap()) + let widget = sink.property::("widget"); + (sink, widget) }; pipeline diff --git a/utils/fallbackswitch/src/fallbacksrc/imp.rs b/utils/fallbackswitch/src/fallbacksrc/imp.rs index 6a39a294..c2ced7ef 100644 --- a/utils/fallbackswitch/src/fallbacksrc/imp.rs +++ b/utils/fallbackswitch/src/fallbacksrc/imp.rs @@ -827,17 +827,14 @@ impl FallbackSrc { let uri = element .emit_by_name("update-uri", &[uri]) - .expect("Failed to emit update-uri signal") .expect("No value returned"); let uri = uri .get::<&str>() .expect("Wrong type returned from update-uri signal"); - source.set_property("uri", uri).unwrap(); - source.set_property("use-buffering", true).unwrap(); - source - .set_property("buffer-duration", buffer_duration) - .unwrap(); + source.set_property("uri", uri); + source.set_property("use-buffering", true); + source.set_property("buffer-duration", buffer_duration); source } @@ -846,7 +843,7 @@ impl FallbackSrc { // Handle any async state changes internally, they don't affect the pipeline because we // convert everything to a live stream - source.set_property("async-handling", true).unwrap(); + source.set_property("async-handling", true); // Don't let the bin handle state changes of the source. We want to do it manually to catch // possible errors and retry, without causing the whole bin state change to fail source.set_locked_state(true); @@ -894,10 +891,8 @@ impl FallbackSrc { .expect("No audiotestsrc found"); input.add_many(&[&audiotestsrc]).unwrap(); - audiotestsrc - .set_property_from_str("wave", "silence") - .unwrap(); - audiotestsrc.set_property("is-live", true).unwrap(); + audiotestsrc.set_property_from_str("wave", "silence"); + audiotestsrc.set_property("is-live", true); let srcpad = audiotestsrc.static_pad("src").unwrap(); input @@ -931,20 +926,18 @@ impl FallbackSrc { let clocksync = gst::ElementFactory::make("clocksync", None) .or_else(|_| -> Result<_, glib::BoolError> { let identity = gst::ElementFactory::make("identity", None)?; - identity.set_property("sync", true).unwrap(); + identity.set_property("sync", true); Ok(identity) }) .expect("No clocksync or identity found"); // Workaround for issues caused by https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/800 let clocksync_queue = gst::ElementFactory::make("queue", None).expect("No queue found"); - clocksync_queue - .set_properties(&[ - ("max-size-buffers", &0u32), - ("max-size-bytes", &0u32), - ("max-size-time", &gst::ClockTime::SECOND), - ]) - .unwrap(); + clocksync_queue.set_properties(&[ + ("max-size-buffers", &0u32), + ("max-size-bytes", &0u32), + ("max-size-time", &gst::ClockTime::SECOND), + ]); element .add_many(&[&fallback_input, &switch, &clocksync_queue, &clocksync]) @@ -960,13 +953,9 @@ impl FallbackSrc { let src = FallbackSrc::from_instance(&element); src.handle_switch_active_pad_change(&element); }); - switch.set_property("timeout", timeout.nseconds()).unwrap(); - switch - .set_property("min-upstream-latency", min_latency.nseconds()) - .unwrap(); - switch - .set_property("immediate-fallback", immediate_fallback) - .unwrap(); + switch.set_property("timeout", timeout.nseconds()); + switch.set_property("min-upstream-latency", min_latency.nseconds()); + switch.set_property("immediate-fallback", immediate_fallback); gst::Element::link_pads(&fallback_input, Some("src"), &switch, Some("fallback_sink")) .unwrap(); @@ -1341,7 +1330,7 @@ impl FallbackSrc { gst_debug!(CAT, "image stream, inserting imagefreeze"); element.add(&imagefreeze).unwrap(); - imagefreeze.set_property("is-live", true).unwrap(); + imagefreeze.set_property("is-live", true); if imagefreeze.sync_state_with_parent().is_err() { gst_error!(CAT, obj: element, "imagefreeze failed to change state",); return Err(gst::error_msg!( @@ -2014,10 +2003,7 @@ impl FallbackSrc { let prev_fallback_uri = video_stream .fallback_input - .property("uri") - .unwrap() - .get::>() - .unwrap(); + .property::>("uri"); // This means previously videotestsrc was configured // Something went wrong and there is no other way than to error out @@ -2383,13 +2369,7 @@ impl FallbackSrc { && state .audio_stream .as_ref() - .and_then(|s| { - s.switch - .property("active-pad") - .unwrap() - .get::>() - .unwrap() - }) + .and_then(|s| s.switch.property::>("active-pad")) .map(|p| p.name() == "fallback_sink") .unwrap_or(true)) || (have_video @@ -2397,13 +2377,7 @@ impl FallbackSrc { && state .video_stream .as_ref() - .and_then(|s| { - s.switch - .property("active-pad") - .unwrap() - .get::>() - .unwrap() - }) + .and_then(|s| s.switch.property::>("active-pad")) .map(|p| p.name() == "fallback_sink") .unwrap_or(true)) } diff --git a/utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs b/utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs index 0055dfe6..9e49b25c 100644 --- a/utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs +++ b/utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs @@ -303,22 +303,20 @@ impl VideoFallbackSource { .or_else(|_| -> Result<_, glib::BoolError> { let identity = gst::ElementFactory::make("identity", Some("fallback_clocksync"))?; - identity.set_property("sync", true).unwrap(); + identity.set_property("sync", true); Ok(identity) }) .expect("No clocksync or identity found"); let queue = gst::ElementFactory::make("queue", Some("fallback_queue")) .expect("No queue found"); - queue - .set_properties(&[ - ("max-size-buffers", &0u32), - ("max-size-bytes", &0u32), - ( - "max-size-time", - &min_latency.max(5 * gst::ClockTime::SECOND).nseconds(), - ), - ]) - .unwrap(); + queue.set_properties(&[ + ("max-size-buffers", &0u32), + ("max-size-bytes", &0u32), + ( + "max-size-time", + &min_latency.max(5 * gst::ClockTime::SECOND).nseconds(), + ), + ]); source .add_many(&[ @@ -341,7 +339,7 @@ impl VideoFallbackSource { ]) .unwrap(); - if imagefreeze.set_property("is-live", true).is_err() { + if imagefreeze.try_set_property("is-live", true).is_err() { gst_error!( CAT, obj: element, @@ -357,62 +355,60 @@ impl VideoFallbackSource { let element_weak = element.downgrade(); let source_weak = source.downgrade(); let videoconvert_weak = videoconvert.downgrade(); - typefind - .connect("have-type", false, move |args| { - let typefind = args[0].get::().unwrap(); - let _probability = args[1].get::().unwrap(); - let caps = args[2].get::().unwrap(); + typefind.connect("have-type", false, move |args| { + let typefind = args[0].get::().unwrap(); + let _probability = args[1].get::().unwrap(); + let caps = args[2].get::().unwrap(); - let element = match element_weak.upgrade() { - Some(element) => element, - None => return None, - }; + let element = match element_weak.upgrade() { + Some(element) => element, + None => return None, + }; - let source = match source_weak.upgrade() { - Some(element) => element, - None => return None, - }; + let source = match source_weak.upgrade() { + Some(element) => element, + None => return None, + }; - let videoconvert = match videoconvert_weak.upgrade() { - Some(element) => element, - None => return None, - }; + let videoconvert = match videoconvert_weak.upgrade() { + Some(element) => element, + None => return None, + }; - let s = caps.structure(0).unwrap(); - let decoder; - if s.name() == "image/jpeg" { - decoder = gst::ElementFactory::make("jpegdec", Some("decoder")) - .expect("jpegdec not found"); - } else if s.name() == "image/png" { - decoder = gst::ElementFactory::make("pngdec", Some("decoder")) - .expect("pngdec not found"); - } else { - gst_error!(CAT, obj: &element, "Unsupported caps {}", caps); - gst::element_error!( - element, - gst::StreamError::Format, - ["Unsupported caps {}", caps] - ); - return None; - } + let s = caps.structure(0).unwrap(); + let decoder; + if s.name() == "image/jpeg" { + decoder = gst::ElementFactory::make("jpegdec", Some("decoder")) + .expect("jpegdec not found"); + } else if s.name() == "image/png" { + decoder = gst::ElementFactory::make("pngdec", Some("decoder")) + .expect("pngdec not found"); + } else { + gst_error!(CAT, obj: &element, "Unsupported caps {}", caps); + gst::element_error!( + element, + gst::StreamError::Format, + ["Unsupported caps {}", caps] + ); + return None; + } - source.add(&decoder).unwrap(); - decoder.sync_state_with_parent().unwrap(); - if let Err(_err) = - gst::Element::link_many(&[&typefind, &decoder, &videoconvert]) - { - gst_error!(CAT, obj: &element, "Can't link fallback image decoder"); - gst::element_error!( - element, - gst::StreamError::Format, - ["Can't link fallback image decoder"] - ); - return None; - } + source.add(&decoder).unwrap(); + decoder.sync_state_with_parent().unwrap(); + if let Err(_err) = + gst::Element::link_many(&[&typefind, &decoder, &videoconvert]) + { + gst_error!(CAT, obj: &element, "Can't link fallback image decoder"); + gst::element_error!( + element, + gst::StreamError::Format, + ["Can't link fallback image decoder"] + ); + return None; + } - None - }) - .unwrap(); + None + }); queue.static_pad("src").unwrap() } @@ -422,10 +418,8 @@ impl VideoFallbackSource { .expect("No videotestsrc found"); source.add_many(&[&videotestsrc]).unwrap(); - videotestsrc - .set_property_from_str("pattern", "black") - .unwrap(); - videotestsrc.set_property("is-live", true).unwrap(); + videotestsrc.set_property_from_str("pattern", "black"); + videotestsrc.set_property("is-live", true); videotestsrc.static_pad("src").unwrap() } diff --git a/utils/fallbackswitch/tests/fallbackswitch.rs b/utils/fallbackswitch/tests/fallbackswitch.rs index dbe67dce..a978f747 100644 --- a/utils/fallbackswitch/tests/fallbackswitch.rs +++ b/utils/fallbackswitch/tests/fallbackswitch.rs @@ -371,9 +371,9 @@ fn setup_pipeline(with_live_fallback: Option) -> Pipeline { .unwrap() .downcast::() .unwrap(); - src.set_property("is-live", true).unwrap(); - src.set_property("format", gst::Format::Time).unwrap(); - src.set_property("min-latency", 10i64).unwrap(); + src.set_property("is-live", true); + src.set_property("format", gst::Format::Time); + src.set_property("min-latency", 10i64); src.set_property( "caps", &gst::Caps::builder("video/x-raw") @@ -382,19 +382,16 @@ fn setup_pipeline(with_live_fallback: Option) -> Pipeline { .field("height", 240) .field("framerate", gst::Fraction::new(1, 1)) .build(), - ) - .unwrap(); + ); let switch = gst::ElementFactory::make("fallbackswitch", Some("switch")).unwrap(); - switch - .set_property("timeout", 3 * gst::ClockTime::SECOND) - .unwrap(); + switch.set_property("timeout", 3 * gst::ClockTime::SECOND); let sink = gst::ElementFactory::make("appsink", Some("sink")) .unwrap() .downcast::() .unwrap(); - sink.set_property("sync", false).unwrap(); + sink.set_property("sync", false); let queue = gst::ElementFactory::make("queue", None).unwrap(); @@ -410,22 +407,18 @@ fn setup_pipeline(with_live_fallback: Option) -> Pipeline { .unwrap() .downcast::() .unwrap(); - fallback_src.set_property("is-live", live).unwrap(); - fallback_src - .set_property("format", gst::Format::Time) - .unwrap(); - fallback_src.set_property("min-latency", 10i64).unwrap(); - fallback_src - .set_property( - "caps", - &gst::Caps::builder("video/x-raw") - .field("format", "ARGB") - .field("width", 160) - .field("height", 120) - .field("framerate", gst::Fraction::new(1, 1)) - .build(), - ) - .unwrap(); + fallback_src.set_property("is-live", live); + fallback_src.set_property("format", gst::Format::Time); + fallback_src.set_property("min-latency", 10i64); + fallback_src.set_property( + "caps", + &gst::Caps::builder("video/x-raw") + .field("format", "ARGB") + .field("width", 160) + .field("height", 120) + .field("framerate", gst::Fraction::new(1, 1)) + .build(), + ); pipeline.add(&fallback_src).unwrap(); diff --git a/utils/togglerecord/examples/gtk_recording.rs b/utils/togglerecord/examples/gtk_recording.rs index 75c11488..73c66bf2 100644 --- a/utils/togglerecord/examples/gtk_recording.rs +++ b/utils/togglerecord/examples/gtk_recording.rs @@ -33,13 +33,11 @@ fn create_pipeline() -> ( let pipeline = gst::Pipeline::new(None); let video_src = gst::ElementFactory::make("videotestsrc", None).unwrap(); - video_src.set_property("is-live", true).unwrap(); - video_src.set_property_from_str("pattern", "ball").unwrap(); + video_src.set_property("is-live", true); + video_src.set_property_from_str("pattern", "ball"); let timeoverlay = gst::ElementFactory::make("timeoverlay", None).unwrap(); - timeoverlay - .set_property("font-desc", "Monospace 20") - .unwrap(); + timeoverlay.set_property("font-desc", "Monospace 20"); let video_tee = gst::ElementFactory::make("tee", None).unwrap(); let video_queue1 = gst::ElementFactory::make("queue", None).unwrap(); @@ -51,24 +49,24 @@ fn create_pipeline() -> ( let (video_sink, video_widget) = if let Ok(gtkglsink) = gst::ElementFactory::make("gtkglsink", None) { let glsinkbin = gst::ElementFactory::make("glsinkbin", None).unwrap(); - glsinkbin.set_property("sink", >kglsink).unwrap(); + glsinkbin.set_property("sink", >kglsink); - let widget = gtkglsink.property("widget").unwrap(); - (glsinkbin, widget.get::().unwrap()) + let widget = gtkglsink.property::("widget"); + (glsinkbin, widget) } else { let sink = gst::ElementFactory::make("gtksink", None).unwrap(); - let widget = sink.property("widget").unwrap(); - (sink, widget.get::().unwrap()) + let widget = sink.property::("widget"); + (sink, widget) }; let video_enc = gst::ElementFactory::make("x264enc", None).unwrap(); - video_enc.set_property("rc-lookahead", 10i32).unwrap(); - video_enc.set_property("key-int-max", 30u32).unwrap(); + video_enc.set_property("rc-lookahead", 10i32); + video_enc.set_property("key-int-max", 30u32); let video_parse = gst::ElementFactory::make("h264parse", None).unwrap(); let audio_src = gst::ElementFactory::make("audiotestsrc", None).unwrap(); - audio_src.set_property("is-live", true).unwrap(); - audio_src.set_property_from_str("wave", "ticks").unwrap(); + audio_src.set_property("is-live", true); + audio_src.set_property_from_str("wave", "ticks"); let audio_tee = gst::ElementFactory::make("tee", None).unwrap(); let audio_queue1 = gst::ElementFactory::make("queue", None).unwrap(); @@ -90,9 +88,9 @@ fn create_pipeline() -> ( let mux = gst::ElementFactory::make("mp4mux", None).unwrap(); let file_sink = gst::ElementFactory::make("filesink", None).unwrap(); - file_sink.set_property("location", "recording.mp4").unwrap(); - file_sink.set_property("async", false).unwrap(); - file_sink.set_property("sync", false).unwrap(); + file_sink.set_property("location", "recording.mp4"); + file_sink.set_property("async", false); + file_sink.set_property("sync", false); pipeline .add_many(&[ @@ -255,12 +253,8 @@ fn create_ui(app: >k::Application) { None => return, }; - let recording = !togglerecord - .property("record") - .unwrap() - .get::() - .unwrap(); - togglerecord.set_property("record", recording).unwrap(); + let recording = !togglerecord.property::("record"); + togglerecord.set_property("record", recording); button.set_label(if recording { "Stop" } else { "Record" }); }); diff --git a/utils/togglerecord/tests/tests.rs b/utils/togglerecord/tests/tests.rs index 14e5d0ba..ad926e2f 100644 --- a/utils/togglerecord/tests/tests.rs +++ b/utils/togglerecord/tests/tests.rs @@ -53,7 +53,7 @@ fn setup_sender_receiver( thread::JoinHandle<()>, ) { let fakesink = gst::ElementFactory::make("fakesink", None).unwrap(); - fakesink.set_property("async", false).unwrap(); + fakesink.set_property("async", false); pipeline.add(&fakesink).unwrap(); let main_stream = pad == "src"; @@ -298,7 +298,7 @@ fn test_one_stream_open() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input.send(SendData::Buffers(10)).unwrap(); drop(sender_input); @@ -330,7 +330,7 @@ fn test_one_stream_gaps_open() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input.send(SendData::Buffers(5)).unwrap(); sender_input.send(SendData::Gaps(5)).unwrap(); drop(sender_input); @@ -365,7 +365,7 @@ fn test_one_stream_close_open() { sender_input.send(SendData::Buffers(10)).unwrap(); receiver_input_done.recv().unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input.send(SendData::Buffers(10)).unwrap(); drop(sender_input); @@ -397,10 +397,10 @@ fn test_one_stream_open_close() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input.send(SendData::Buffers(10)).unwrap(); receiver_input_done.recv().unwrap(); - togglerecord.set_property("record", false).unwrap(); + togglerecord.set_property("record", false); sender_input.send(SendData::Buffers(10)).unwrap(); drop(sender_input); @@ -432,13 +432,13 @@ fn test_one_stream_open_close_open() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input.send(SendData::Buffers(10)).unwrap(); receiver_input_done.recv().unwrap(); - togglerecord.set_property("record", false).unwrap(); + togglerecord.set_property("record", false); sender_input.send(SendData::Buffers(10)).unwrap(); receiver_input_done.recv().unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input.send(SendData::Buffers(10)).unwrap(); drop(sender_input); @@ -478,7 +478,7 @@ fn test_two_stream_open() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input_1.send(SendData::Buffers(10)).unwrap(); sender_input_2.send(SendData::Buffers(11)).unwrap(); @@ -536,7 +536,7 @@ fn test_two_stream_open_shift() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input_1.send(SendData::Buffers(10)).unwrap(); sender_input_2.send(SendData::Buffers(11)).unwrap(); @@ -599,7 +599,7 @@ fn test_two_stream_open_shift_main() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input_1.send(SendData::Buffers(10)).unwrap(); sender_input_2.send(SendData::Buffers(12)).unwrap(); @@ -676,7 +676,7 @@ fn test_two_stream_open_close() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input_1.send(SendData::Buffers(10)).unwrap(); sender_input_2.send(SendData::Buffers(11)).unwrap(); @@ -686,7 +686,7 @@ fn test_two_stream_open_close() { // Stop recording and push new buffers to sender 1, which will advance // it and release the 11th buffer of sender 2 above - togglerecord.set_property("record", false).unwrap(); + togglerecord.set_property("record", false); sender_input_1.send(SendData::Buffers(10)).unwrap(); receiver_input_done_2.recv().unwrap(); @@ -745,7 +745,7 @@ fn test_two_stream_close_open() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", false).unwrap(); + togglerecord.set_property("record", false); sender_input_1.send(SendData::Buffers(10)).unwrap(); sender_input_2.send(SendData::Buffers(11)).unwrap(); @@ -755,7 +755,7 @@ fn test_two_stream_close_open() { // Start recording and push new buffers to sender 1, which will advance // it and release the 11th buffer of sender 2 above - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input_1.send(SendData::Buffers(10)).unwrap(); receiver_input_done_2.recv().unwrap(); @@ -814,7 +814,7 @@ fn test_two_stream_open_close_open() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input_1.send(SendData::Buffers(10)).unwrap(); sender_input_2.send(SendData::Buffers(11)).unwrap(); @@ -824,7 +824,7 @@ fn test_two_stream_open_close_open() { // Stop recording and push new buffers to sender 1, which will advance // it and release the 11th buffer of sender 2 above - togglerecord.set_property("record", false).unwrap(); + togglerecord.set_property("record", false); sender_input_1.send(SendData::Buffers(10)).unwrap(); receiver_input_done_2.recv().unwrap(); @@ -840,7 +840,7 @@ fn test_two_stream_open_close_open() { sender_input_2.send(SendData::Buffers(1)).unwrap(); // Start recording again and send another set of buffers to both senders - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input_1.send(SendData::Buffers(10)).unwrap(); sender_input_2.send(SendData::Buffers(10)).unwrap(); receiver_input_done_1.recv().unwrap(); @@ -908,7 +908,7 @@ fn test_two_stream_open_close_open_gaps() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input_1.send(SendData::Buffers(3)).unwrap(); sender_input_1.send(SendData::Gaps(3)).unwrap(); @@ -922,7 +922,7 @@ fn test_two_stream_open_close_open_gaps() { // Stop recording and push new buffers to sender 1, which will advance // it and release the 11th buffer of sender 2 above - togglerecord.set_property("record", false).unwrap(); + togglerecord.set_property("record", false); sender_input_1.send(SendData::Buffers(10)).unwrap(); receiver_input_done_2.recv().unwrap(); @@ -940,7 +940,7 @@ fn test_two_stream_open_close_open_gaps() { sender_input_2.send(SendData::Gaps(1)).unwrap(); // Start recording again and send another set of buffers to both senders - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input_1.send(SendData::Buffers(10)).unwrap(); sender_input_2.send(SendData::Buffers(10)).unwrap(); receiver_input_done_1.recv().unwrap(); @@ -1008,7 +1008,7 @@ fn test_two_stream_close_open_close_delta() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", false).unwrap(); + togglerecord.set_property("record", false); sender_input_1.send(SendData::Buffers(10)).unwrap(); sender_input_2.send(SendData::Buffers(11)).unwrap(); @@ -1019,7 +1019,7 @@ fn test_two_stream_close_open_close_delta() { // Start recording and push new buffers to sender 1. The first one is a delta frame, // so will be dropped, and as such the next frame of sender 2 will also be dropped // Sender 2 is empty now - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input_1.send(SendData::BuffersDelta(1)).unwrap(); sender_input_1.send(SendData::Buffers(9)).unwrap(); receiver_input_done_2.recv().unwrap(); @@ -1039,7 +1039,7 @@ fn test_two_stream_close_open_close_delta() { // Stop recording again and send another set of buffers to both senders // The first one is a delta frame, so we only actually stop recording // after recording another frame - togglerecord.set_property("record", false).unwrap(); + togglerecord.set_property("record", false); sender_input_1.send(SendData::BuffersDelta(1)).unwrap(); sender_input_1.send(SendData::Buffers(9)).unwrap(); sender_input_2.send(SendData::Buffers(10)).unwrap(); @@ -1099,7 +1099,7 @@ fn test_three_stream_open_close_open() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input_1.send(SendData::Buffers(10)).unwrap(); sender_input_2.send(SendData::Buffers(11)).unwrap(); @@ -1110,7 +1110,7 @@ fn test_three_stream_open_close_open() { // Stop recording and push new buffers to sender 1, which will advance // it and release the 11th buffer of sender 2/3 above - togglerecord.set_property("record", false).unwrap(); + togglerecord.set_property("record", false); sender_input_1.send(SendData::Buffers(10)).unwrap(); receiver_input_done_2.recv().unwrap(); @@ -1130,7 +1130,7 @@ fn test_three_stream_open_close_open() { sender_input_2.send(SendData::Buffers(1)).unwrap(); // Start recording again and send another set of buffers to both senders - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input_1.send(SendData::Buffers(10)).unwrap(); sender_input_2.send(SendData::Buffers(10)).unwrap(); sender_input_3.send(SendData::Buffers(5)).unwrap(); @@ -1221,7 +1221,7 @@ fn test_two_stream_main_eos() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); // Send 10 buffers to main stream first sender_input_1.send(SendData::Buffers(10)).unwrap(); @@ -1234,11 +1234,7 @@ fn test_two_stream_main_eos() { sender_input_1.send(SendData::Eos).unwrap(); receiver_input_done_1.recv().unwrap(); - let recording = togglerecord - .property("recording") - .unwrap() - .get::() - .unwrap(); + let recording = togglerecord.property::("recording"); assert!(recording); // Send 2 buffers to secondary stream. At this moment, main stream got eos @@ -1253,11 +1249,7 @@ fn test_two_stream_main_eos() { // At this moment, all streams should be in eos state. So togglerecord // must be in stopped state - let recording = togglerecord - .property("recording") - .unwrap() - .get::() - .unwrap(); + let recording = togglerecord.property::("recording"); assert!(!recording); let mut segment_1 = gst::FormattedSegment::::new(); @@ -1304,7 +1296,7 @@ fn test_two_stream_secondary_eos_first() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); // Send 10 buffers to main stream first sender_input_1.send(SendData::Buffers(10)).unwrap(); @@ -1317,22 +1309,14 @@ fn test_two_stream_secondary_eos_first() { receiver_input_done_2.recv().unwrap(); // Since main stream is not yet EOS state, we should be in recording state - let recording = togglerecord - .property("recording") - .unwrap() - .get::() - .unwrap(); + let recording = togglerecord.property::("recording"); assert!(recording); // And send EOS to the main stream then it will update state to Stopped sender_input_1.send(SendData::Eos).unwrap(); receiver_input_done_1.recv().unwrap(); - let recording = togglerecord - .property("recording") - .unwrap() - .get::() - .unwrap(); + let recording = togglerecord.property::("recording"); assert!(!recording); let mut segment_1 = gst::FormattedSegment::::new(); @@ -1382,7 +1366,7 @@ fn test_three_stream_main_eos() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input_1.send(SendData::Buffers(10)).unwrap(); sender_input_2.send(SendData::Buffers(9)).unwrap(); @@ -1396,11 +1380,7 @@ fn test_three_stream_main_eos() { sender_input_1.send(SendData::Eos).unwrap(); receiver_input_done_1.recv().unwrap(); - let recording = togglerecord - .property("recording") - .unwrap() - .get::() - .unwrap(); + let recording = togglerecord.property::("recording"); assert!(recording); // Send 2 buffers to non-main streams. At this moment, main stream got EOS @@ -1415,11 +1395,7 @@ fn test_three_stream_main_eos() { receiver_input_done_2.recv().unwrap(); // The third stream is not in EOS state yet, so still recording == true - let recording = togglerecord - .property("recording") - .unwrap() - .get::() - .unwrap(); + let recording = togglerecord.property::("recording"); assert!(recording); // And terminate the third thread without EOS @@ -1430,11 +1406,7 @@ fn test_three_stream_main_eos() { // At this moment, all streams should be in eos state. So togglerecord // must be in stopped state - let recording = togglerecord - .property("recording") - .unwrap() - .get::() - .unwrap(); + let recording = togglerecord.property::("recording"); assert!(!recording); let mut segment_1 = gst::FormattedSegment::::new(); @@ -1495,7 +1467,7 @@ fn test_three_stream_main_and_second_eos() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input_1.send(SendData::Buffers(10)).unwrap(); sender_input_2.send(SendData::Buffers(9)).unwrap(); @@ -1509,11 +1481,7 @@ fn test_three_stream_main_and_second_eos() { sender_input_1.send(SendData::Eos).unwrap(); receiver_input_done_1.recv().unwrap(); - let recording = togglerecord - .property("recording") - .unwrap() - .get::() - .unwrap(); + let recording = togglerecord.property::("recording"); assert!(recording); // And send EOS to the second stream, but state shouldn't be affected by @@ -1521,11 +1489,7 @@ fn test_three_stream_main_and_second_eos() { sender_input_2.send(SendData::Eos).unwrap(); receiver_input_done_2.recv().unwrap(); - let recording = togglerecord - .property("recording") - .unwrap() - .get::() - .unwrap(); + let recording = togglerecord.property::("recording"); assert!(recording); // Send 2 buffers to the third stream. At this moment, main stream and @@ -1542,11 +1506,7 @@ fn test_three_stream_main_and_second_eos() { // At this moment, all streams should be in eos state. So togglerecord // must be in stopped state - let recording = togglerecord - .property("recording") - .unwrap() - .get::() - .unwrap(); + let recording = togglerecord.property::("recording"); assert!(!recording); let mut segment_1 = gst::FormattedSegment::::new(); @@ -1608,7 +1568,7 @@ fn test_three_stream_secondary_eos_first() { pipeline.set_state(gst::State::Playing).unwrap(); - togglerecord.set_property("record", true).unwrap(); + togglerecord.set_property("record", true); sender_input_1.send(SendData::Buffers(10)).unwrap(); sender_input_2.send(SendData::Buffers(9)).unwrap(); @@ -1625,11 +1585,7 @@ fn test_three_stream_secondary_eos_first() { receiver_input_done_3.recv().unwrap(); // Since main stream is not yet EOS state, we should be in recording state - let recording = togglerecord - .property("recording") - .unwrap() - .get::() - .unwrap(); + let recording = togglerecord.property::("recording"); assert!(recording); // And send EOS, Send EOS to the main stream then it will update state to @@ -1637,11 +1593,7 @@ fn test_three_stream_secondary_eos_first() { sender_input_1.send(SendData::Eos).unwrap(); receiver_input_done_1.recv().unwrap(); - let recording = togglerecord - .property("recording") - .unwrap() - .get::() - .unwrap(); + let recording = togglerecord.property::("recording"); assert!(!recording); let mut segment_1 = gst::FormattedSegment::::new(); diff --git a/video/cdg/tests/cdgdec.rs b/video/cdg/tests/cdgdec.rs index 21d678dd..26305a39 100644 --- a/video/cdg/tests/cdgdec.rs +++ b/video/cdg/tests/cdgdec.rs @@ -36,9 +36,7 @@ fn test_cdgdec() { // Ensure we are in push mode so 'blocksize' prop is used let filesrc = gst::ElementFactory::make("pushfilesrc", None).unwrap(); - filesrc - .set_property("location", input_path.to_str().unwrap()) - .expect("failed to set 'location' property"); + filesrc.set_property("location", input_path.to_str().unwrap()); { let child_proxy = filesrc.dynamic_cast_ref::().unwrap(); child_proxy diff --git a/video/closedcaption/src/transcriberbin/imp.rs b/video/closedcaption/src/transcriberbin/imp.rs index 66f23712..b174b2a8 100644 --- a/video/closedcaption/src/transcriberbin/imp.rs +++ b/video/closedcaption/src/transcriberbin/imp.rs @@ -139,16 +139,12 @@ impl TranscriberBin { state .transcriber_queue - .set_property("max-size-buffers", 0u32) - .unwrap(); - state - .transcriber_queue - .set_property("max-size-time", 0u64) - .unwrap(); + .set_property("max-size-buffers", 0u32); + state.transcriber_queue.set_property("max-size-time", 0u64); state.internal_bin.add(&state.transcription_bin)?; - state.textwrap.set_property("lines", 2u32).unwrap(); + state.textwrap.set_property("lines", 2u32); state.transcription_bin.set_locked_state(true); @@ -208,8 +204,7 @@ impl TranscriberBin { state .cccombiner - .set_property("latency", 100 * gst::ClockTime::MSECOND) - .unwrap(); + .set_property("latency", 100 * gst::ClockTime::MSECOND); self.audio_sinkpad .set_target(Some(&state.internal_bin.static_pad("audio_sink").unwrap()))?; @@ -234,21 +229,18 @@ impl TranscriberBin { s.set("framerate", &state.framerate.unwrap()); - state.cccapsfilter.set_property("caps", &cc_caps).unwrap(); + state.cccapsfilter.set_property("caps", &cc_caps); let max_size_time = settings.latency + settings.accumulate_time; for queue in &[&state.audio_queue_passthrough, &state.video_queue] { - queue.set_property("max-size-bytes", 0u32).unwrap(); - queue.set_property("max-size-buffers", 0u32).unwrap(); - queue.set_property("max-size-time", max_size_time).unwrap(); + queue.set_property("max-size-bytes", 0u32); + queue.set_property("max-size-buffers", 0u32); + queue.set_property("max-size-time", max_size_time); } let latency_ms = settings.latency.mseconds() as u32; - state - .transcriber - .set_property("latency", latency_ms) - .unwrap(); + state.transcriber.set_property("latency", latency_ms); if !settings.passthrough { let audio_tee_pad = state.audio_tee.request_pad_simple("src_%u").unwrap(); @@ -349,20 +341,16 @@ impl TranscriberBin { gst_debug!(CAT, obj: element, "setting CC mode {:?}", mode); - state.tttocea608.set_property("mode", mode).unwrap(); + state.tttocea608.set_property("mode", mode); if mode.is_rollup() { - state - .textwrap - .set_property("accumulate-time", 0u64) - .unwrap(); + state.textwrap.set_property("accumulate-time", 0u64); } else { let accumulate_time = self.settings.lock().unwrap().accumulate_time; state .textwrap - .set_property("accumulate-time", accumulate_time) - .unwrap(); + .set_property("accumulate-time", accumulate_time); } } diff --git a/video/closedcaption/tests/ccdetect.rs b/video/closedcaption/tests/ccdetect.rs index 2153ff05..c456f797 100644 --- a/video/closedcaption/tests/ccdetect.rs +++ b/video/closedcaption/tests/ccdetect.rs @@ -71,10 +71,7 @@ fn test_have_cc_data_notify() { let mut h = gst_check::Harness::new("ccdetect"); h.set_src_caps_str("closedcaption/x-cea-708,format=cc_data"); h.set_sink_caps_str("closedcaption/x-cea-708,format=cc_data"); - h.element() - .unwrap() - .set_property("window", 500_000_000u64) - .unwrap(); + h.element().unwrap().set_property("window", 500_000_000u64); let state = Arc::new(Mutex::new(NotifyState::default())); let state_c = state.clone(); @@ -83,7 +80,7 @@ fn test_have_cc_data_notify() { .connect_notify(Some("cc608"), move |o, _pspec| { let mut state_guard = state_c.lock().unwrap(); state_guard.cc608_count += 1; - o.property("cc608").unwrap(); + o.property_value("cc608"); }); let state_c = state.clone(); h.element() @@ -91,7 +88,7 @@ fn test_have_cc_data_notify() { .connect_notify(Some("cc708"), move |o, _pspec| { let mut state_guard = state_c.lock().unwrap(); state_guard.cc708_count += 1; - o.property("cc708").unwrap(); + o.property_value("cc708"); }); /* valid cc608 data moves cc608 property to true */ @@ -137,10 +134,7 @@ fn test_cc_data_window() { let mut h = gst_check::Harness::new("ccdetect"); h.set_src_caps_str("closedcaption/x-cea-708,format=cc_data"); h.set_sink_caps_str("closedcaption/x-cea-708,format=cc_data"); - h.element() - .unwrap() - .set_property("window", 500_000_000u64) - .unwrap(); + h.element().unwrap().set_property("window", 500_000_000u64); let state = Arc::new(Mutex::new(NotifyState::default())); let state_c = state.clone(); @@ -236,10 +230,7 @@ fn test_have_cdp_notify() { let mut h = gst_check::Harness::new("ccdetect"); h.set_src_caps_str("closedcaption/x-cea-708,format=cdp"); h.set_sink_caps_str("closedcaption/x-cea-708,format=cdp"); - h.element() - .unwrap() - .set_property("window", 500_000_000u64) - .unwrap(); + h.element().unwrap().set_property("window", 500_000_000u64); let state = Arc::new(Mutex::new(NotifyState::default())); let state_c = state.clone(); @@ -307,7 +298,7 @@ fn test_malformed_cdp_notify() { let mut h = gst_check::Harness::new("ccdetect"); h.set_src_caps_str("closedcaption/x-cea-708,format=cdp"); h.set_sink_caps_str("closedcaption/x-cea-708,format=cdp"); - h.element().unwrap().set_property("window", 0u64).unwrap(); + h.element().unwrap().set_property("window", 0u64); let state = Arc::new(Mutex::new(NotifyState::default())); let state_c = state.clone(); @@ -386,10 +377,7 @@ fn test_gap_events() { let mut h = gst_check::Harness::new("ccdetect"); h.set_src_caps_str("closedcaption/x-cea-708,format=cc_data"); h.set_sink_caps_str("closedcaption/x-cea-708,format=cc_data"); - h.element() - .unwrap() - .set_property("window", 500_000_000u64) - .unwrap(); + h.element().unwrap().set_property("window", 500_000_000u64); let state = Arc::new(Mutex::new(NotifyState::default())); let state_c = state.clone(); diff --git a/video/closedcaption/tests/mcc_enc.rs b/video/closedcaption/tests/mcc_enc.rs index 8712dad0..f3e8c30c 100644 --- a/video/closedcaption/tests/mcc_enc.rs +++ b/video/closedcaption/tests/mcc_enc.rs @@ -93,13 +93,11 @@ Time Code Rate=30DF\r\n\ let mut h = gst_check::Harness::new("mccenc"); { let enc = h.element().expect("could not create encoder"); - enc.set_property("uuid", "14720C04-857D-40E2-86FC-F080DE44CE74") - .unwrap(); + enc.set_property("uuid", "14720C04-857D-40E2-86FC-F080DE44CE74"); enc.set_property( "creation-date", glib::DateTime::new_utc(2018, 12, 27, 17, 34, 47.0).unwrap(), - ) - .unwrap(); + ); } h.set_src_caps_str( diff --git a/video/gtk4/examples/gtksink.rs b/video/gtk4/examples/gtksink.rs index 82985b9c..eba0c94d 100644 --- a/video/gtk4/examples/gtksink.rs +++ b/video/gtk4/examples/gtksink.rs @@ -10,14 +10,10 @@ fn create_ui(app: >k::Application) { let src = gst::ElementFactory::make("videotestsrc", None).unwrap(); let overlay = gst::ElementFactory::make("clockoverlay", None).unwrap(); - overlay.set_property("font-desc", "Monospace 42").unwrap(); + overlay.set_property("font-desc", "Monospace 42"); let sink = gst::ElementFactory::make("gtk4paintablesink", None).unwrap(); - let paintable = sink - .property("paintable") - .unwrap() - .get::() - .unwrap(); + let paintable = sink.property::("paintable"); pipeline.add_many(&[&src, &overlay, &sink]).unwrap(); src.link_filtered( diff --git a/video/rav1e/tests/rav1enc.rs b/video/rav1e/tests/rav1enc.rs index 24cff4eb..04dec7d9 100644 --- a/video/rav1e/tests/rav1enc.rs +++ b/video/rav1e/tests/rav1enc.rs @@ -121,7 +121,7 @@ fn test_encode(video_info: &gst_video::VideoInfo) { let mut h = gst_check::Harness::new("rav1enc"); { let rav1enc = h.element().unwrap(); - rav1enc.set_property("speed-preset", 10u32).unwrap(); + rav1enc.set_property("speed-preset", 10u32); } h.play(); h.set_src_caps(video_info.to_caps().unwrap());