diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2021-04-25 15:41:22 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2021-04-25 15:48:55 +0300 |
commit | 15cf738616fac8390ff1bac144f6fac49148b47d (patch) | |
tree | d0b5b35c187d053cd49d0c0aa5bba8a149de4b5e /utils | |
parent | 40765f7c53237e798565f9568caed7f4a4d6373c (diff) |
Update for Value trait refactoring
Diffstat (limited to 'utils')
-rw-r--r-- | utils/fallbackswitch/examples/gtk_fallbackswitch.rs | 2 | ||||
-rw-r--r-- | utils/fallbackswitch/src/base/aggregator.rs | 1 | ||||
-rw-r--r-- | utils/fallbackswitch/src/base/auto/aggregator.rs | 1 | ||||
-rw-r--r-- | utils/fallbackswitch/src/base/auto/aggregator_pad.rs | 1 | ||||
-rw-r--r-- | utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs | 2 | ||||
-rw-r--r-- | utils/fallbackswitch/src/fallbacksrc/imp.rs | 24 | ||||
-rw-r--r-- | utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs | 8 | ||||
-rw-r--r-- | utils/fallbackswitch/src/fallbackswitch/imp.rs | 8 | ||||
-rw-r--r-- | utils/togglerecord/examples/gtk_recording.rs | 6 | ||||
-rw-r--r-- | utils/togglerecord/src/togglerecord/imp.rs | 2 | ||||
-rw-r--r-- | utils/togglerecord/tests/tests.rs | 24 |
11 files changed, 39 insertions, 40 deletions
diff --git a/utils/fallbackswitch/examples/gtk_fallbackswitch.rs b/utils/fallbackswitch/examples/gtk_fallbackswitch.rs index 72b996bcd..c86cdbfa2 100644 --- a/utils/fallbackswitch/examples/gtk_fallbackswitch.rs +++ b/utils/fallbackswitch/examples/gtk_fallbackswitch.rs @@ -70,7 +70,7 @@ fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element, gtk::Widget) { { let sink = gst::ElementFactory::make("gtksink", None).unwrap(); let widget = sink.property("widget").unwrap(); - (sink, widget.get::<gtk::Widget>().unwrap().unwrap()) + (sink, widget.get::<gtk::Widget>().unwrap()) }; pipeline diff --git a/utils/fallbackswitch/src/base/aggregator.rs b/utils/fallbackswitch/src/base/aggregator.rs index 2319ca1a1..78d794110 100644 --- a/utils/fallbackswitch/src/base/aggregator.rs +++ b/utils/fallbackswitch/src/base/aggregator.rs @@ -66,7 +66,6 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O { value .get() .expect("AggregatorExtManual::min_upstream_latency") - .unwrap() } } diff --git a/utils/fallbackswitch/src/base/auto/aggregator.rs b/utils/fallbackswitch/src/base/auto/aggregator.rs index d5db9713f..5433a2153 100644 --- a/utils/fallbackswitch/src/base/auto/aggregator.rs +++ b/utils/fallbackswitch/src/base/auto/aggregator.rs @@ -129,7 +129,6 @@ impl<O: IsA<Aggregator>> AggregatorExt for O { value .get() .expect("Return Value for property `start-time` getter") - .unwrap() } } diff --git a/utils/fallbackswitch/src/base/auto/aggregator_pad.rs b/utils/fallbackswitch/src/base/auto/aggregator_pad.rs index 2ae3f4b3a..b9c3c92f9 100644 --- a/utils/fallbackswitch/src/base/auto/aggregator_pad.rs +++ b/utils/fallbackswitch/src/base/auto/aggregator_pad.rs @@ -110,7 +110,6 @@ impl<O: IsA<AggregatorPad>> AggregatorPadExt for O { value .get() .expect("Return Value for property `emit-signals` getter") - .unwrap() } } diff --git a/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs b/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs index 67500082e..688187d72 100644 --- a/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs +++ b/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs @@ -85,7 +85,7 @@ impl ObjectImpl for CustomSource { ) { match pspec.name() { "source" => { - let source = value.get::<gst::Element>().unwrap().unwrap(); + let source = value.get::<gst::Element>().unwrap(); self.source.set(source.clone()).unwrap(); obj.add(&source).unwrap(); } diff --git a/utils/fallbackswitch/src/fallbacksrc/imp.rs b/utils/fallbackswitch/src/fallbacksrc/imp.rs index 99ce30336..bd48b16cd 100644 --- a/utils/fallbackswitch/src/fallbacksrc/imp.rs +++ b/utils/fallbackswitch/src/fallbacksrc/imp.rs @@ -302,7 +302,7 @@ impl ObjectImpl for FallbackSrc { match pspec.name() { "enable-audio" => { let mut settings = self.settings.lock().unwrap(); - let new_value = value.get_some().expect("type checked upstream"); + let new_value = value.get().expect("type checked upstream"); gst_info!( CAT, obj: obj, @@ -314,7 +314,7 @@ impl ObjectImpl for FallbackSrc { } "enable-video" => { let mut settings = self.settings.lock().unwrap(); - let new_value = value.get_some().expect("type checked upstream"); + let new_value = value.get().expect("type checked upstream"); gst_info!( CAT, obj: obj, @@ -362,7 +362,7 @@ impl ObjectImpl for FallbackSrc { } "timeout" => { let mut settings = self.settings.lock().unwrap(); - let new_value = value.get_some().expect("type checked upstream"); + let new_value = value.get().expect("type checked upstream"); gst_info!( CAT, obj: obj, @@ -374,7 +374,7 @@ impl ObjectImpl for FallbackSrc { } "restart-timeout" => { let mut settings = self.settings.lock().unwrap(); - let new_value = value.get_some().expect("type checked upstream"); + let new_value = value.get().expect("type checked upstream"); gst_info!( CAT, obj: obj, @@ -386,7 +386,7 @@ impl ObjectImpl for FallbackSrc { } "retry-timeout" => { let mut settings = self.settings.lock().unwrap(); - let new_value = value.get_some().expect("type checked upstream"); + let new_value = value.get().expect("type checked upstream"); gst_info!( CAT, obj: obj, @@ -398,7 +398,7 @@ impl ObjectImpl for FallbackSrc { } "restart-on-eos" => { let mut settings = self.settings.lock().unwrap(); - let new_value = value.get_some().expect("type checked upstream"); + let new_value = value.get().expect("type checked upstream"); gst_info!( CAT, obj: obj, @@ -410,7 +410,7 @@ impl ObjectImpl for FallbackSrc { } "min-latency" => { let mut settings = self.settings.lock().unwrap(); - let new_value = value.get_some().expect("type checked upstream"); + let new_value = value.get().expect("type checked upstream"); gst_info!( CAT, obj: obj, @@ -422,7 +422,7 @@ impl ObjectImpl for FallbackSrc { } "buffer-duration" => { let mut settings = self.settings.lock().unwrap(); - let new_value = value.get_some().expect("type checked upstream"); + let new_value = value.get().expect("type checked upstream"); gst_info!( CAT, obj: obj, @@ -1764,7 +1764,7 @@ impl FallbackSrc { .fallback_input .property("uri") .unwrap() - .get::<String>() + .get::<Option<String>>() .unwrap(); // This means previously videotestsrc was configured @@ -1777,7 +1777,7 @@ impl FallbackSrc { fallback_input.call_async(|fallback_input| { // Re-run video fallback input with videotestsrc let _ = fallback_input.set_state(gst::State::Null); - let _ = fallback_input.set_property("uri", &None::<&str>); + let _ = fallback_input.set_property("uri", None::<&str>); let _ = fallback_input.sync_state_with_parent(); }); @@ -2116,7 +2116,7 @@ impl FallbackSrc { s.switch .property("active-pad") .unwrap() - .get::<gst::Pad>() + .get::<Option<gst::Pad>>() .unwrap() }) .map(|p| p.name() == "fallback_sink") @@ -2130,7 +2130,7 @@ impl FallbackSrc { s.switch .property("active-pad") .unwrap() - .get::<gst::Pad>() + .get::<Option<gst::Pad>>() .unwrap() }) .map(|p| p.name() == "fallback_sink") diff --git a/utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs b/utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs index cf2f4f9a9..c51ed9caf 100644 --- a/utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs +++ b/utils/fallbackswitch/src/fallbacksrc/video_fallback/imp.rs @@ -128,7 +128,7 @@ impl ObjectImpl for VideoFallbackSource { } "min-latency" => { let mut settings = self.settings.lock().unwrap(); - let new_value = value.get_some().expect("type checked upstream"); + let new_value = value.get().expect("type checked upstream"); gst_info!( CAT, obj: obj, @@ -358,9 +358,9 @@ impl VideoFallbackSource { let videoconvert_weak = videoconvert.downgrade(); typefind .connect("have-type", false, move |args| { - let typefind = args[0].get::<gst::Element>().unwrap().unwrap(); - let _probability = args[1].get_some::<u32>().unwrap(); - let caps = args[2].get::<gst::Caps>().unwrap().unwrap(); + let typefind = args[0].get::<gst::Element>().unwrap(); + let _probability = args[1].get::<u32>().unwrap(); + let caps = args[2].get::<gst::Caps>().unwrap(); let element = match element_weak.upgrade() { Some(element) => element, diff --git a/utils/fallbackswitch/src/fallbackswitch/imp.rs b/utils/fallbackswitch/src/fallbackswitch/imp.rs index 1b624b775..0c856a97a 100644 --- a/utils/fallbackswitch/src/fallbackswitch/imp.rs +++ b/utils/fallbackswitch/src/fallbackswitch/imp.rs @@ -731,7 +731,7 @@ impl ObjectImpl for FallbackSwitch { match pspec.name() { "timeout" => { let mut settings = self.settings.lock().unwrap(); - let timeout = value.get_some().expect("type checked upstream"); + let timeout = value.get().expect("type checked upstream"); gst_info!( CAT, obj: obj, @@ -751,7 +751,9 @@ impl ObjectImpl for FallbackSwitch { "active-pad property setting ignored, because auto-switch=true" ); } else { - let active_pad = value.get::<gst::Pad>().expect("type checked upstream"); + let active_pad = value + .get::<Option<gst::Pad>>() + .expect("type checked upstream"); /* Trigger a pad switch if needed */ let mut cur_active_pad = self.active_sinkpad.lock().unwrap(); if *cur_active_pad != active_pad { @@ -763,7 +765,7 @@ impl ObjectImpl for FallbackSwitch { } "auto-switch" => { let mut settings = self.settings.lock().unwrap(); - settings.auto_switch = value.get_some().expect("type checked upstream"); + settings.auto_switch = value.get().expect("type checked upstream"); } _ => unimplemented!(), } diff --git a/utils/togglerecord/examples/gtk_recording.rs b/utils/togglerecord/examples/gtk_recording.rs index 13e1ebaa3..d3eef9a5b 100644 --- a/utils/togglerecord/examples/gtk_recording.rs +++ b/utils/togglerecord/examples/gtk_recording.rs @@ -53,11 +53,11 @@ fn create_pipeline() -> ( glsinkbin.set_property("sink", >kglsink).unwrap(); let widget = gtkglsink.property("widget").unwrap(); - (glsinkbin, widget.get::<gtk::Widget>().unwrap().unwrap()) + (glsinkbin, widget.get::<gtk::Widget>().unwrap()) } else { let sink = gst::ElementFactory::make("gtksink", None).unwrap(); let widget = sink.property("widget").unwrap(); - (sink, widget.get::<gtk::Widget>().unwrap().unwrap()) + (sink, widget.get::<gtk::Widget>().unwrap()) }; let video_enc = gst::ElementFactory::make("x264enc", None).unwrap(); @@ -259,7 +259,7 @@ fn create_ui(app: >k::Application) { let recording = !togglerecord .property("record") .unwrap() - .get_some::<bool>() + .get::<bool>() .unwrap(); togglerecord.set_property("record", &recording).unwrap(); diff --git a/utils/togglerecord/src/togglerecord/imp.rs b/utils/togglerecord/src/togglerecord/imp.rs index a191e254f..b916fbe44 100644 --- a/utils/togglerecord/src/togglerecord/imp.rs +++ b/utils/togglerecord/src/togglerecord/imp.rs @@ -1728,7 +1728,7 @@ impl ObjectImpl for ToggleRecord { match pspec.name() { "record" => { let mut settings = self.settings.lock(); - let record = value.get_some().expect("type checked upstream"); + let record = value.get().expect("type checked upstream"); gst_debug!( CAT, obj: obj, diff --git a/utils/togglerecord/tests/tests.rs b/utils/togglerecord/tests/tests.rs index f40e1d27c..6c96cb289 100644 --- a/utils/togglerecord/tests/tests.rs +++ b/utils/togglerecord/tests/tests.rs @@ -1203,7 +1203,7 @@ fn test_two_stream_main_eos() { let recording = togglerecord .property("recording") .unwrap() - .get_some::<bool>() + .get::<bool>() .unwrap(); assert_eq!(recording, true); @@ -1222,7 +1222,7 @@ fn test_two_stream_main_eos() { let recording = togglerecord .property("recording") .unwrap() - .get_some::<bool>() + .get::<bool>() .unwrap(); assert_eq!(recording, false); @@ -1286,7 +1286,7 @@ fn test_two_stream_secondary_eos_first() { let recording = togglerecord .property("recording") .unwrap() - .get_some::<bool>() + .get::<bool>() .unwrap(); assert_eq!(recording, true); @@ -1297,7 +1297,7 @@ fn test_two_stream_secondary_eos_first() { let recording = togglerecord .property("recording") .unwrap() - .get_some::<bool>() + .get::<bool>() .unwrap(); assert_eq!(recording, false); @@ -1365,7 +1365,7 @@ fn test_three_stream_main_eos() { let recording = togglerecord .property("recording") .unwrap() - .get_some::<bool>() + .get::<bool>() .unwrap(); assert_eq!(recording, true); @@ -1384,7 +1384,7 @@ fn test_three_stream_main_eos() { let recording = togglerecord .property("recording") .unwrap() - .get_some::<bool>() + .get::<bool>() .unwrap(); assert_eq!(recording, true); @@ -1399,7 +1399,7 @@ fn test_three_stream_main_eos() { let recording = togglerecord .property("recording") .unwrap() - .get_some::<bool>() + .get::<bool>() .unwrap(); assert_eq!(recording, false); @@ -1478,7 +1478,7 @@ fn test_three_stream_main_and_second_eos() { let recording = togglerecord .property("recording") .unwrap() - .get_some::<bool>() + .get::<bool>() .unwrap(); assert_eq!(recording, true); @@ -1490,7 +1490,7 @@ fn test_three_stream_main_and_second_eos() { let recording = togglerecord .property("recording") .unwrap() - .get_some::<bool>() + .get::<bool>() .unwrap(); assert_eq!(recording, true); @@ -1511,7 +1511,7 @@ fn test_three_stream_main_and_second_eos() { let recording = togglerecord .property("recording") .unwrap() - .get_some::<bool>() + .get::<bool>() .unwrap(); assert_eq!(recording, false); @@ -1594,7 +1594,7 @@ fn test_three_stream_secondary_eos_first() { let recording = togglerecord .property("recording") .unwrap() - .get_some::<bool>() + .get::<bool>() .unwrap(); assert_eq!(recording, true); @@ -1606,7 +1606,7 @@ fn test_three_stream_secondary_eos_first() { let recording = togglerecord .property("recording") .unwrap() - .get_some::<bool>() + .get::<bool>() .unwrap(); assert_eq!(recording, false); |