From 92df13eeb126c75573be7492dab7795dafd34f94 Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Tue, 1 Dec 2020 20:01:05 +0100 Subject: [PATCH] Regenerate with trusted nullability --- gstreamer-base/src/auto/adapter.rs | 5 ++--- gstreamer-base/src/auto/base_sink.rs | 4 ++-- gstreamer/src/auto/clock.rs | 10 +++++----- gstreamer/src/auto/element.rs | 12 ++++++------ gstreamer/src/auto/pad.rs | 24 ++++++++++++------------ gstreamer/src/auto/pad_template.rs | 4 ++-- gstreamer/src/auto/pipeline.rs | 4 ++-- 7 files changed, 31 insertions(+), 32 deletions(-) diff --git a/gstreamer-base/src/auto/adapter.rs b/gstreamer-base/src/auto/adapter.rs index abf3a4754..1b7dbffb8 100644 --- a/gstreamer-base/src/auto/adapter.rs +++ b/gstreamer-base/src/auto/adapter.rs @@ -34,14 +34,13 @@ impl Adapter { } } - pub fn copy_bytes(&self, offset: usize, size: usize) -> Result { + pub fn copy_bytes(&self, offset: usize, size: usize) -> glib::Bytes { unsafe { - Option::<_>::from_glib_full(ffi::gst_adapter_copy_bytes( + from_glib_full(ffi::gst_adapter_copy_bytes( self.to_glib_none().0, offset, size, )) - .ok_or_else(|| glib::glib_bool_error!("Failed to copy bytes")) } } diff --git a/gstreamer-base/src/auto/base_sink.rs b/gstreamer-base/src/auto/base_sink.rs index 2b402e171..5c4696bbb 100644 --- a/gstreamer-base/src/auto/base_sink.rs +++ b/gstreamer-base/src/auto/base_sink.rs @@ -49,7 +49,7 @@ pub trait BaseSinkExt: 'static { #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] - fn get_stats(&self) -> Option; + fn get_stats(&self) -> gst::Structure; fn get_sync(&self) -> bool; @@ -236,7 +236,7 @@ impl> BaseSinkExt for O { #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] - fn get_stats(&self) -> Option { + fn get_stats(&self) -> gst::Structure { unsafe { from_glib_full(ffi::gst_base_sink_get_stats(self.as_ref().to_glib_none().0)) } } diff --git a/gstreamer/src/auto/clock.rs b/gstreamer/src/auto/clock.rs index 1e3e73794..685bd0653 100644 --- a/gstreamer/src/auto/clock.rs +++ b/gstreamer/src/auto/clock.rs @@ -37,7 +37,7 @@ impl Clock { // unsafe { TODO: call ffi:gst_clock_id_get_time() } //} - //pub fn id_ref(id: /*Unimplemented*/ClockID) -> /*Unimplemented*/Option { + //pub fn id_ref(id: /*Unimplemented*/ClockID) -> /*Unimplemented*/ClockID { // unsafe { TODO: call ffi:gst_clock_id_ref() } //} @@ -94,9 +94,9 @@ pub trait ClockExt: 'static { fn is_synced(&self) -> bool; - //fn new_periodic_id(&self, start_time: ClockTime, interval: ClockTime) -> /*Unimplemented*/Option; + //fn new_periodic_id(&self, start_time: ClockTime, interval: ClockTime) -> /*Unimplemented*/ClockID; - //fn new_single_shot_id(&self, time: ClockTime) -> /*Unimplemented*/Option; + //fn new_single_shot_id(&self, time: ClockTime) -> /*Unimplemented*/ClockID; //fn periodic_id_reinit(&self, id: /*Unimplemented*/ClockID, start_time: ClockTime, interval: ClockTime) -> bool; @@ -274,11 +274,11 @@ impl> ClockExt for O { unsafe { from_glib(ffi::gst_clock_is_synced(self.as_ref().to_glib_none().0)) } } - //fn new_periodic_id(&self, start_time: ClockTime, interval: ClockTime) -> /*Unimplemented*/Option { + //fn new_periodic_id(&self, start_time: ClockTime, interval: ClockTime) -> /*Unimplemented*/ClockID { // unsafe { TODO: call ffi:gst_clock_new_periodic_id() } //} - //fn new_single_shot_id(&self, time: ClockTime) -> /*Unimplemented*/Option { + //fn new_single_shot_id(&self, time: ClockTime) -> /*Unimplemented*/ClockID { // unsafe { TODO: call ffi:gst_clock_new_single_shot_id() } //} diff --git a/gstreamer/src/auto/element.rs b/gstreamer/src/auto/element.rs index 9b8b4794d..aa76d7249 100644 --- a/gstreamer/src/auto/element.rs +++ b/gstreamer/src/auto/element.rs @@ -102,11 +102,11 @@ pub trait ElementExt: 'static { fn is_locked_state(&self) -> bool; - //fn iterate_pads(&self) -> /*Ignored*/Option; + //fn iterate_pads(&self) -> /*Ignored*/Iterator; - //fn iterate_sink_pads(&self) -> /*Ignored*/Option; + //fn iterate_sink_pads(&self) -> /*Ignored*/Iterator; - //fn iterate_src_pads(&self) -> /*Ignored*/Option; + //fn iterate_src_pads(&self) -> /*Ignored*/Iterator; fn link>(&self, dest: &P) -> Result<(), glib::error::BoolError>; @@ -390,15 +390,15 @@ impl> ElementExt for O { } } - //fn iterate_pads(&self) -> /*Ignored*/Option { + //fn iterate_pads(&self) -> /*Ignored*/Iterator { // unsafe { TODO: call ffi:gst_element_iterate_pads() } //} - //fn iterate_sink_pads(&self) -> /*Ignored*/Option { + //fn iterate_sink_pads(&self) -> /*Ignored*/Iterator { // unsafe { TODO: call ffi:gst_element_iterate_sink_pads() } //} - //fn iterate_src_pads(&self) -> /*Ignored*/Option { + //fn iterate_src_pads(&self) -> /*Ignored*/Iterator { // unsafe { TODO: call ffi:gst_element_iterate_src_pads() } //} diff --git a/gstreamer/src/auto/pad.rs b/gstreamer/src/auto/pad.rs index 69fc52771..03d264641 100644 --- a/gstreamer/src/auto/pad.rs +++ b/gstreamer/src/auto/pad.rs @@ -52,11 +52,11 @@ pub trait PadExt: 'static { &self, parent: &P, stream_id: Option<&str>, - ) -> Option; + ) -> glib::GString; - //fn create_stream_id_printf>(&self, parent: &P, stream_id: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Option; + //fn create_stream_id_printf>(&self, parent: &P, stream_id: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> glib::GString; - //fn create_stream_id_printf_valist>(&self, parent: &P, stream_id: Option<&str>, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> Option; + //fn create_stream_id_printf_valist>(&self, parent: &P, stream_id: Option<&str>, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> glib::GString; fn forward bool>(&self, forward: P) -> bool; @@ -72,7 +72,7 @@ pub trait PadExt: 'static { fn get_pad_template(&self) -> Option; - fn get_pad_template_caps(&self) -> Option; + fn get_pad_template_caps(&self) -> Caps; fn get_parent_element(&self) -> Option; @@ -128,11 +128,11 @@ pub trait PadExt: 'static { fn peer_query_accept_caps(&self, caps: &Caps) -> bool; - fn peer_query_caps(&self, filter: Option<&Caps>) -> Option; + fn peer_query_caps(&self, filter: Option<&Caps>) -> Caps; fn query_accept_caps(&self, caps: &Caps) -> bool; - fn query_caps(&self, filter: Option<&Caps>) -> Option; + fn query_caps(&self, filter: Option<&Caps>) -> Caps; fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError>; @@ -199,7 +199,7 @@ impl> PadExt for O { &self, parent: &P, stream_id: Option<&str>, - ) -> Option { + ) -> glib::GString { unsafe { from_glib_full(ffi::gst_pad_create_stream_id( self.as_ref().to_glib_none().0, @@ -209,11 +209,11 @@ impl> PadExt for O { } } - //fn create_stream_id_printf>(&self, parent: &P, stream_id: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Option { + //fn create_stream_id_printf>(&self, parent: &P, stream_id: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> glib::GString { // unsafe { TODO: call ffi:gst_pad_create_stream_id_printf() } //} - //fn create_stream_id_printf_valist>(&self, parent: &P, stream_id: Option<&str>, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> Option { + //fn create_stream_id_printf_valist>(&self, parent: &P, stream_id: Option<&str>, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> glib::GString { // unsafe { TODO: call ffi:gst_pad_create_stream_id_printf_valist() } //} @@ -275,7 +275,7 @@ impl> PadExt for O { } } - fn get_pad_template_caps(&self) -> Option { + fn get_pad_template_caps(&self) -> Caps { unsafe { from_glib_full(ffi::gst_pad_get_pad_template_caps( self.as_ref().to_glib_none().0, @@ -428,7 +428,7 @@ impl> PadExt for O { } } - fn peer_query_caps(&self, filter: Option<&Caps>) -> Option { + fn peer_query_caps(&self, filter: Option<&Caps>) -> Caps { unsafe { from_glib_full(ffi::gst_pad_peer_query_caps( self.as_ref().to_glib_none().0, @@ -446,7 +446,7 @@ impl> PadExt for O { } } - fn query_caps(&self, filter: Option<&Caps>) -> Option { + fn query_caps(&self, filter: Option<&Caps>) -> Caps { unsafe { from_glib_full(ffi::gst_pad_query_caps( self.as_ref().to_glib_none().0, diff --git a/gstreamer/src/auto/pad_template.rs b/gstreamer/src/auto/pad_template.rs index 979526256..0460fd615 100644 --- a/gstreamer/src/auto/pad_template.rs +++ b/gstreamer/src/auto/pad_template.rs @@ -65,13 +65,13 @@ impl PadTemplate { } } - pub fn get_caps(&self) -> Option { + pub fn get_caps(&self) -> Caps { unsafe { from_glib_full(ffi::gst_pad_template_get_caps(self.to_glib_none().0)) } } #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] - pub fn get_documentation_caps(&self) -> Option { + pub fn get_documentation_caps(&self) -> Caps { unsafe { from_glib_full(ffi::gst_pad_template_get_documentation_caps( self.to_glib_none().0, diff --git a/gstreamer/src/auto/pipeline.rs b/gstreamer/src/auto/pipeline.rs index b65189429..8d5131b4f 100644 --- a/gstreamer/src/auto/pipeline.rs +++ b/gstreamer/src/auto/pipeline.rs @@ -47,7 +47,7 @@ pub trait PipelineExt: 'static { fn get_latency(&self) -> ClockTime; - fn get_pipeline_clock(&self) -> Option; + fn get_pipeline_clock(&self) -> Clock; fn set_auto_flush_bus(&self, auto_flush: bool); @@ -100,7 +100,7 @@ impl> PipelineExt for O { } } - fn get_pipeline_clock(&self) -> Option { + fn get_pipeline_clock(&self) -> Clock { unsafe { from_glib_full(ffi::gst_pipeline_get_pipeline_clock( self.as_ref().to_glib_none().0,