From 03e8e6d22f5614b80e8f9a0da831f259f611f219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Mon, 5 Apr 2021 12:48:30 +0200 Subject: [PATCH] regen: use TryFromGlib::Option for ClockTime --- gstreamer-app/src/auto/app_sink.rs | 14 ++-- gstreamer-app/src/auto/app_src.rs | 14 ++-- gstreamer-audio/src/auto/audio_base_sink.rs | 10 +-- gstreamer-audio/src/auto/audio_decoder.rs | 21 +++--- gstreamer-audio/src/auto/audio_encoder.rs | 32 +++++++-- .../src/auto/audio_stream_align.rs | 8 ++- gstreamer-base/src/auto/adapter.rs | 12 ++-- gstreamer-base/src/auto/aggregator.rs | 22 +++++-- gstreamer-base/src/auto/base_parse.rs | 14 +++- gstreamer-base/src/auto/base_sink.rs | 15 +++-- gstreamer-check/src/auto/test_clock.rs | 5 +- .../src/auto/timed_value_control_source.rs | 4 +- gstreamer-editing-services/src/auto/clip.rs | 27 ++++---- gstreamer-editing-services/src/auto/layer.rs | 57 +++++++++------- .../src/auto/timeline.rs | 17 ++--- .../src/auto/timeline_element.rs | 33 +++++----- .../src/auto/uri_clip_asset.rs | 8 +-- gstreamer-pbutils/src/auto/discoverer_info.rs | 2 +- gstreamer-player/src/auto/player.rs | 4 +- .../src/auto/player_media_info.rs | 2 +- gstreamer-rtsp-server/src/auto/rtsp_media.rs | 18 ++--- .../src/auto/rtsp_media_factory.rs | 10 +-- .../src/auto/rtsp_session_media.rs | 4 +- gstreamer-rtsp-server/src/auto/rtsp_stream.rs | 14 ++-- .../src/auto/rtsp_stream_transport.rs | 6 +- gstreamer-video/src/auto/video_encoder.rs | 19 +++--- gstreamer/src/auto/bus.rs | 4 +- gstreamer/src/auto/clock.rs | 66 +++++++++++-------- gstreamer/src/auto/control_binding.rs | 10 +-- gstreamer/src/auto/element.rs | 23 ++++--- gstreamer/src/auto/functions.rs | 2 +- gstreamer/src/auto/object.rs | 32 +++++---- gstreamer/src/auto/pipeline.rs | 18 +++-- 33 files changed, 326 insertions(+), 221 deletions(-) diff --git a/gstreamer-app/src/auto/app_sink.rs b/gstreamer-app/src/auto/app_sink.rs index 0ef799a15..abdf7b075 100644 --- a/gstreamer-app/src/auto/app_sink.rs +++ b/gstreamer-app/src/auto/app_sink.rs @@ -127,11 +127,14 @@ impl AppSink { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] #[doc(alias = "gst_app_sink_try_pull_preroll")] - pub fn try_pull_preroll(&self, timeout: gst::ClockTime) -> Option { + pub fn try_pull_preroll( + &self, + timeout: impl Into>, + ) -> Option { unsafe { from_glib_full(ffi::gst_app_sink_try_pull_preroll( self.to_glib_none().0, - timeout.into_glib(), + timeout.into().into_glib(), )) } } @@ -139,11 +142,14 @@ impl AppSink { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] #[doc(alias = "gst_app_sink_try_pull_sample")] - pub fn try_pull_sample(&self, timeout: gst::ClockTime) -> Option { + pub fn try_pull_sample( + &self, + timeout: impl Into>, + ) -> Option { unsafe { from_glib_full(ffi::gst_app_sink_try_pull_sample( self.to_glib_none().0, - timeout.into_glib(), + timeout.into().into_glib(), )) } } diff --git a/gstreamer-app/src/auto/app_src.rs b/gstreamer-app/src/auto/app_src.rs index fd385a72b..937ae8f8b 100644 --- a/gstreamer-app/src/auto/app_src.rs +++ b/gstreamer-app/src/auto/app_src.rs @@ -55,7 +55,7 @@ impl AppSrc { #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] #[doc(alias = "gst_app_src_get_current_level_time")] #[doc(alias = "get_current_level_time")] - pub fn current_level_time(&self) -> gst::ClockTime { + pub fn current_level_time(&self) -> Option { unsafe { from_glib(ffi::gst_app_src_get_current_level_time( self.to_glib_none().0, @@ -67,7 +67,7 @@ impl AppSrc { #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] #[doc(alias = "gst_app_src_get_duration")] #[doc(alias = "get_duration")] - pub fn duration(&self) -> gst::ClockTime { + pub fn duration(&self) -> Option { unsafe { from_glib(ffi::gst_app_src_get_duration(self.to_glib_none().0)) } } @@ -97,7 +97,7 @@ impl AppSrc { #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] #[doc(alias = "gst_app_src_get_max_time")] #[doc(alias = "get_max_time")] - pub fn max_time(&self) -> gst::ClockTime { + pub fn max_time(&self) -> Option { unsafe { from_glib(ffi::gst_app_src_get_max_time(self.to_glib_none().0)) } } @@ -138,9 +138,9 @@ impl AppSrc { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] #[doc(alias = "gst_app_src_set_duration")] - pub fn set_duration(&self, duration: gst::ClockTime) { + pub fn set_duration(&self, duration: impl Into>) { unsafe { - ffi::gst_app_src_set_duration(self.to_glib_none().0, duration.into_glib()); + ffi::gst_app_src_set_duration(self.to_glib_none().0, duration.into().into_glib()); } } @@ -172,9 +172,9 @@ impl AppSrc { #[cfg(any(feature = "v1_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] #[doc(alias = "gst_app_src_set_max_time")] - pub fn set_max_time(&self, max: gst::ClockTime) { + pub fn set_max_time(&self, max: impl Into>) { unsafe { - ffi::gst_app_src_set_max_time(self.to_glib_none().0, max.into_glib()); + ffi::gst_app_src_set_max_time(self.to_glib_none().0, max.into().into_glib()); } } diff --git a/gstreamer-audio/src/auto/audio_base_sink.rs b/gstreamer-audio/src/auto/audio_base_sink.rs index 6bdac9821..955fad3e3 100644 --- a/gstreamer-audio/src/auto/audio_base_sink.rs +++ b/gstreamer-audio/src/auto/audio_base_sink.rs @@ -58,7 +58,7 @@ pub trait AudioBaseSinkExt: 'static { fn set_alignment_threshold(&self, alignment_threshold: gst::ClockTime); //#[doc(alias = "gst_audio_base_sink_set_custom_slaving_callback")] - //fn set_custom_slaving_callback(&self, callback: /*Unimplemented*/Fn(&AudioBaseSink, gst::ClockTime, gst::ClockTime, gst::ClockTimeDiff, /*Ignored*/AudioBaseSinkDiscontReason), user_data: /*Unimplemented*/Option); + //fn set_custom_slaving_callback(&self, callback: /*Unimplemented*/Fn(&AudioBaseSink, impl Into>, impl Into>, gst::ClockTimeDiff, /*Ignored*/AudioBaseSinkDiscontReason), user_data: /*Unimplemented*/Option); #[doc(alias = "gst_audio_base_sink_set_discont_wait")] fn set_discont_wait(&self, discont_wait: gst::ClockTime); @@ -146,17 +146,19 @@ impl> AudioBaseSinkExt for O { fn alignment_threshold(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_audio_base_sink_get_alignment_threshold( + try_from_glib(ffi::gst_audio_base_sink_get_alignment_threshold( self.as_ref().to_glib_none().0, )) + .expect("mandatory glib value is None") } } fn discont_wait(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_audio_base_sink_get_discont_wait( + try_from_glib(ffi::gst_audio_base_sink_get_discont_wait( self.as_ref().to_glib_none().0, )) + .expect("mandatory glib value is None") } } @@ -191,7 +193,7 @@ impl> AudioBaseSinkExt for O { } } - //fn set_custom_slaving_callback(&self, callback: /*Unimplemented*/Fn(&AudioBaseSink, gst::ClockTime, gst::ClockTime, gst::ClockTimeDiff, /*Ignored*/AudioBaseSinkDiscontReason), user_data: /*Unimplemented*/Option) { + //fn set_custom_slaving_callback(&self, callback: /*Unimplemented*/Fn(&AudioBaseSink, impl Into>, impl Into>, gst::ClockTimeDiff, /*Ignored*/AudioBaseSinkDiscontReason), user_data: /*Unimplemented*/Option) { // unsafe { TODO: call ffi:gst_audio_base_sink_set_custom_slaving_callback() } //} diff --git a/gstreamer-audio/src/auto/audio_decoder.rs b/gstreamer-audio/src/auto/audio_decoder.rs index cec076a81..e6d5e96d9 100644 --- a/gstreamer-audio/src/auto/audio_decoder.rs +++ b/gstreamer-audio/src/auto/audio_decoder.rs @@ -49,7 +49,7 @@ pub trait AudioDecoderExt: 'static { #[doc(alias = "gst_audio_decoder_get_latency")] #[doc(alias = "get_latency")] - fn latency(&self) -> (gst::ClockTime, gst::ClockTime); + fn latency(&self) -> (gst::ClockTime, Option); #[doc(alias = "gst_audio_decoder_get_max_errors")] #[doc(alias = "get_max_errors")] @@ -97,7 +97,7 @@ pub trait AudioDecoderExt: 'static { fn set_estimate_rate(&self, enabled: bool); #[doc(alias = "gst_audio_decoder_set_latency")] - fn set_latency(&self, min: gst::ClockTime, max: gst::ClockTime); + fn set_latency(&self, min: gst::ClockTime, max: impl Into>); #[doc(alias = "gst_audio_decoder_set_max_errors")] fn set_max_errors(&self, num: i32); @@ -179,7 +179,7 @@ impl> AudioDecoderExt for O { unsafe { ffi::gst_audio_decoder_get_estimate_rate(self.as_ref().to_glib_none().0) } } - fn latency(&self) -> (gst::ClockTime, gst::ClockTime) { + fn latency(&self) -> (gst::ClockTime, Option) { unsafe { let mut min = mem::MaybeUninit::uninit(); let mut max = mem::MaybeUninit::uninit(); @@ -190,7 +190,10 @@ impl> AudioDecoderExt for O { ); let min = min.assume_init(); let max = max.assume_init(); - (from_glib(min), from_glib(max)) + ( + try_from_glib(min).expect("mandatory glib value is None"), + from_glib(max), + ) } } @@ -200,9 +203,10 @@ impl> AudioDecoderExt for O { fn min_latency(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_audio_decoder_get_min_latency( + try_from_glib(ffi::gst_audio_decoder_get_min_latency( self.as_ref().to_glib_none().0, )) + .expect("mandatory glib value is None") } } @@ -243,9 +247,10 @@ impl> AudioDecoderExt for O { fn tolerance(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_audio_decoder_get_tolerance( + try_from_glib(ffi::gst_audio_decoder_get_tolerance( self.as_ref().to_glib_none().0, )) + .expect("mandatory glib value is None") } } @@ -298,12 +303,12 @@ impl> AudioDecoderExt for O { } } - fn set_latency(&self, min: gst::ClockTime, max: gst::ClockTime) { + fn set_latency(&self, min: gst::ClockTime, max: impl Into>) { unsafe { ffi::gst_audio_decoder_set_latency( self.as_ref().to_glib_none().0, min.into_glib(), - max.into_glib(), + max.into().into_glib(), ); } } diff --git a/gstreamer-audio/src/auto/audio_encoder.rs b/gstreamer-audio/src/auto/audio_encoder.rs index b136befd2..111835823 100644 --- a/gstreamer-audio/src/auto/audio_encoder.rs +++ b/gstreamer-audio/src/auto/audio_encoder.rs @@ -10,6 +10,7 @@ use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use std::boxed::Box as Box_; +use std::mem; use std::mem::transmute; glib::wrapper! { @@ -58,6 +59,10 @@ pub trait AudioEncoderExt: 'static { #[doc(alias = "get_hard_resync")] fn is_hard_resync(&self) -> bool; + #[doc(alias = "gst_audio_encoder_get_latency")] + #[doc(alias = "get_latency")] + fn latency(&self) -> (gst::ClockTime, Option); + #[doc(alias = "gst_audio_encoder_get_lookahead")] #[doc(alias = "get_lookahead")] fn lookahead(&self) -> i32; @@ -107,7 +112,7 @@ pub trait AudioEncoderExt: 'static { fn set_headers(&self, headers: &[&gst::Buffer]); #[doc(alias = "gst_audio_encoder_set_latency")] - fn set_latency(&self, min: gst::ClockTime, max: gst::ClockTime); + fn set_latency(&self, min: gst::ClockTime, max: impl Into>); #[doc(alias = "gst_audio_encoder_set_lookahead")] fn set_lookahead(&self, num: i32); @@ -201,6 +206,24 @@ impl> AudioEncoderExt for O { } } + fn latency(&self) -> (gst::ClockTime, Option) { + unsafe { + let mut min = mem::MaybeUninit::uninit(); + let mut max = mem::MaybeUninit::uninit(); + ffi::gst_audio_encoder_get_latency( + self.as_ref().to_glib_none().0, + min.as_mut_ptr(), + max.as_mut_ptr(), + ); + let min = min.assume_init(); + let max = max.assume_init(); + ( + try_from_glib(min).expect("mandatory glib value is None"), + from_glib(max), + ) + } + } + fn lookahead(&self) -> i32 { unsafe { ffi::gst_audio_encoder_get_lookahead(self.as_ref().to_glib_none().0) } } @@ -223,9 +246,10 @@ impl> AudioEncoderExt for O { fn tolerance(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_audio_encoder_get_tolerance( + try_from_glib(ffi::gst_audio_encoder_get_tolerance( self.as_ref().to_glib_none().0, )) + .expect("mandatory glib value is None") } } @@ -314,12 +338,12 @@ impl> AudioEncoderExt for O { } } - fn set_latency(&self, min: gst::ClockTime, max: gst::ClockTime) { + fn set_latency(&self, min: gst::ClockTime, max: impl Into>) { unsafe { ffi::gst_audio_encoder_set_latency( self.as_ref().to_glib_none().0, min.into_glib(), - max.into_glib(), + max.into().into_glib(), ); } } diff --git a/gstreamer-audio/src/auto/audio_stream_align.rs b/gstreamer-audio/src/auto/audio_stream_align.rs index 5bda3bd22..0e490e90a 100644 --- a/gstreamer-audio/src/auto/audio_stream_align.rs +++ b/gstreamer-audio/src/auto/audio_stream_align.rs @@ -37,9 +37,10 @@ impl AudioStreamAlign { #[doc(alias = "get_alignment_threshold")] pub fn alignment_threshold(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_audio_stream_align_get_alignment_threshold( + try_from_glib(ffi::gst_audio_stream_align_get_alignment_threshold( self.to_glib_none().0, )) + .expect("mandatory glib value is None") } } @@ -47,9 +48,10 @@ impl AudioStreamAlign { #[doc(alias = "get_discont_wait")] pub fn discont_wait(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_audio_stream_align_get_discont_wait( + try_from_glib(ffi::gst_audio_stream_align_get_discont_wait( self.to_glib_none().0, )) + .expect("mandatory glib value is None") } } @@ -67,7 +69,7 @@ impl AudioStreamAlign { #[doc(alias = "gst_audio_stream_align_get_timestamp_at_discont")] #[doc(alias = "get_timestamp_at_discont")] - pub fn timestamp_at_discont(&self) -> gst::ClockTime { + pub fn timestamp_at_discont(&self) -> Option { unsafe { from_glib(ffi::gst_audio_stream_align_get_timestamp_at_discont( self.to_glib_none().0, diff --git a/gstreamer-base/src/auto/adapter.rs b/gstreamer-base/src/auto/adapter.rs index 64f9740b7..633484a6d 100644 --- a/gstreamer-base/src/auto/adapter.rs +++ b/gstreamer-base/src/auto/adapter.rs @@ -50,7 +50,7 @@ impl Adapter { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] #[doc(alias = "gst_adapter_dts_at_discont")] - pub fn dts_at_discont(&self) -> gst::ClockTime { + pub fn dts_at_discont(&self) -> Option { unsafe { from_glib(ffi::gst_adapter_dts_at_discont(self.to_glib_none().0)) } } @@ -62,7 +62,7 @@ impl Adapter { } #[doc(alias = "gst_adapter_prev_dts")] - pub fn prev_dts(&self) -> (gst::ClockTime, u64) { + pub fn prev_dts(&self) -> (Option, u64) { unsafe { let mut distance = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_adapter_prev_dts( @@ -75,7 +75,7 @@ impl Adapter { } #[doc(alias = "gst_adapter_prev_dts_at_offset")] - pub fn prev_dts_at_offset(&self, offset: usize) -> (gst::ClockTime, u64) { + pub fn prev_dts_at_offset(&self, offset: usize) -> (Option, u64) { unsafe { let mut distance = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_adapter_prev_dts_at_offset( @@ -101,7 +101,7 @@ impl Adapter { } #[doc(alias = "gst_adapter_prev_pts")] - pub fn prev_pts(&self) -> (gst::ClockTime, u64) { + pub fn prev_pts(&self) -> (Option, u64) { unsafe { let mut distance = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_adapter_prev_pts( @@ -114,7 +114,7 @@ impl Adapter { } #[doc(alias = "gst_adapter_prev_pts_at_offset")] - pub fn prev_pts_at_offset(&self, offset: usize) -> (gst::ClockTime, u64) { + pub fn prev_pts_at_offset(&self, offset: usize) -> (Option, u64) { unsafe { let mut distance = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_adapter_prev_pts_at_offset( @@ -130,7 +130,7 @@ impl Adapter { #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] #[doc(alias = "gst_adapter_pts_at_discont")] - pub fn pts_at_discont(&self) -> gst::ClockTime { + pub fn pts_at_discont(&self) -> Option { unsafe { from_glib(ffi::gst_adapter_pts_at_discont(self.to_glib_none().0)) } } } diff --git a/gstreamer-base/src/auto/aggregator.rs b/gstreamer-base/src/auto/aggregator.rs index d16cd3c0d..0a49b9b25 100644 --- a/gstreamer-base/src/auto/aggregator.rs +++ b/gstreamer-base/src/auto/aggregator.rs @@ -40,7 +40,7 @@ pub trait AggregatorExt: 'static { #[doc(alias = "gst_aggregator_get_latency")] #[doc(alias = "get_latency")] - fn latency(&self) -> gst::ClockTime; + fn latency(&self) -> Option; #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] @@ -53,7 +53,11 @@ pub trait AggregatorExt: 'static { fn peek_next_sample>(&self, pad: &P) -> Option; #[doc(alias = "gst_aggregator_set_latency")] - fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime); + fn set_latency( + &self, + min_latency: gst::ClockTime, + max_latency: impl Into>, + ); #[doc(alias = "gst_aggregator_set_src_caps")] fn set_src_caps(&self, caps: &gst::Caps); @@ -61,7 +65,7 @@ pub trait AggregatorExt: 'static { #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] #[doc(alias = "gst_aggregator_simple_get_next_time")] - fn simple_get_next_time(&self) -> gst::ClockTime; + fn simple_get_next_time(&self) -> Option; #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] @@ -127,7 +131,7 @@ impl> AggregatorExt for O { } } - fn latency(&self) -> gst::ClockTime { + fn latency(&self) -> Option { unsafe { from_glib(ffi::gst_aggregator_get_latency( self.as_ref().to_glib_none().0, @@ -156,12 +160,16 @@ impl> AggregatorExt for O { } } - fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime) { + fn set_latency( + &self, + min_latency: gst::ClockTime, + max_latency: impl Into>, + ) { unsafe { ffi::gst_aggregator_set_latency( self.as_ref().to_glib_none().0, min_latency.into_glib(), - max_latency.into_glib(), + max_latency.into().into_glib(), ); } } @@ -174,7 +182,7 @@ impl> AggregatorExt for O { #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] - fn simple_get_next_time(&self) -> gst::ClockTime { + fn simple_get_next_time(&self) -> Option { unsafe { from_glib(ffi::gst_aggregator_simple_get_next_time( self.as_ref().to_glib_none().0, diff --git a/gstreamer-base/src/auto/base_parse.rs b/gstreamer-base/src/auto/base_parse.rs index 2d962ea4b..ed667ba2a 100644 --- a/gstreamer-base/src/auto/base_parse.rs +++ b/gstreamer-base/src/auto/base_parse.rs @@ -49,7 +49,11 @@ pub trait BaseParseExt: 'static { fn set_infer_ts(&self, infer_ts: bool); #[doc(alias = "gst_base_parse_set_latency")] - fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime); + fn set_latency( + &self, + min_latency: gst::ClockTime, + max_latency: impl Into>, + ); #[doc(alias = "gst_base_parse_set_min_frame_size")] fn set_min_frame_size(&self, min_size: u32); @@ -131,12 +135,16 @@ impl> BaseParseExt for O { } } - fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime) { + fn set_latency( + &self, + min_latency: gst::ClockTime, + max_latency: impl Into>, + ) { unsafe { ffi::gst_base_parse_set_latency( self.as_ref().to_glib_none().0, min_latency.into_glib(), - max_latency.into_glib(), + max_latency.into().into_glib(), ); } } diff --git a/gstreamer-base/src/auto/base_sink.rs b/gstreamer-base/src/auto/base_sink.rs index 21db367a5..f7bd324d0 100644 --- a/gstreamer-base/src/auto/base_sink.rs +++ b/gstreamer-base/src/auto/base_sink.rs @@ -120,7 +120,7 @@ pub trait BaseSinkExt: 'static { #[doc(alias = "gst_base_sink_wait")] fn wait( &self, - time: gst::ClockTime, + time: impl Into>, ) -> (Result, gst::ClockTimeDiff); #[doc(alias = "gst_base_sink_wait_clock")] @@ -251,9 +251,10 @@ impl> BaseSinkExt for O { fn latency(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_base_sink_get_latency( + try_from_glib(ffi::gst_base_sink_get_latency( self.as_ref().to_glib_none().0, )) + .expect("mandatory glib value is None") } } @@ -269,17 +270,19 @@ impl> BaseSinkExt for O { #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] fn processing_deadline(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_base_sink_get_processing_deadline( + try_from_glib(ffi::gst_base_sink_get_processing_deadline( self.as_ref().to_glib_none().0, )) + .expect("mandatory glib value is None") } } fn render_delay(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_base_sink_get_render_delay( + try_from_glib(ffi::gst_base_sink_get_render_delay( self.as_ref().to_glib_none().0, )) + .expect("mandatory glib value is None") } } @@ -367,13 +370,13 @@ impl> BaseSinkExt for O { fn wait( &self, - time: gst::ClockTime, + time: impl Into>, ) -> (Result, gst::ClockTimeDiff) { unsafe { let mut jitter = mem::MaybeUninit::uninit(); let ret = try_from_glib(ffi::gst_base_sink_wait( self.as_ref().to_glib_none().0, - time.into_glib(), + time.into().into_glib(), jitter.as_mut_ptr(), )); let jitter = jitter.assume_init(); diff --git a/gstreamer-check/src/auto/test_clock.rs b/gstreamer-check/src/auto/test_clock.rs index 06335ca4d..3f1647845 100644 --- a/gstreamer-check/src/auto/test_clock.rs +++ b/gstreamer-check/src/auto/test_clock.rs @@ -57,9 +57,10 @@ impl TestClock { #[doc(alias = "get_next_entry_time")] pub fn next_entry_time(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::gst_test_clock_get_next_entry_time( + try_from_glib(ffi::gst_test_clock_get_next_entry_time( self.to_glib_none().0, )) + .expect("mandatory glib value is None") } } @@ -124,7 +125,7 @@ impl TestClock { } //#[doc(alias = "gst_test_clock_id_list_get_latest_time")] - //pub fn id_list_get_latest_time(pending_list: /*Unimplemented*/&[&gst::ClockID]) -> gst::ClockTime { + //pub fn id_list_get_latest_time(pending_list: /*Unimplemented*/&[&gst::ClockID]) -> Option { // unsafe { TODO: call ffi:gst_test_clock_id_list_get_latest_time() } //} diff --git a/gstreamer-controller/src/auto/timed_value_control_source.rs b/gstreamer-controller/src/auto/timed_value_control_source.rs index 9d22e8e6d..0b1923952 100644 --- a/gstreamer-controller/src/auto/timed_value_control_source.rs +++ b/gstreamer-controller/src/auto/timed_value_control_source.rs @@ -28,7 +28,7 @@ pub const NONE_TIMED_VALUE_CONTROL_SOURCE: Option<&TimedValueControlSource> = No pub trait TimedValueControlSourceExt: 'static { //#[doc(alias = "gst_timed_value_control_source_find_control_point_iter")] - //fn find_control_point_iter(&self, timestamp: gst::ClockTime) -> /*Ignored*/Option; + //fn find_control_point_iter(&self, timestamp: impl Into>) -> /*Ignored*/Option; //#[doc(alias = "gst_timed_value_control_source_get_all")] //#[doc(alias = "get_all")] @@ -70,7 +70,7 @@ pub trait TimedValueControlSourceExt: 'static { } impl> TimedValueControlSourceExt for O { - //fn find_control_point_iter(&self, timestamp: gst::ClockTime) -> /*Ignored*/Option { + //fn find_control_point_iter(&self, timestamp: impl Into>) -> /*Ignored*/Option { // unsafe { TODO: call ffi:gst_timed_value_control_source_find_control_point_iter() } //} diff --git a/gstreamer-editing-services/src/auto/clip.rs b/gstreamer-editing-services/src/auto/clip.rs index f7c184679..1af950417 100644 --- a/gstreamer-editing-services/src/auto/clip.rs +++ b/gstreamer-editing-services/src/auto/clip.rs @@ -84,8 +84,8 @@ pub trait ClipExt: 'static { fn internal_time_from_timeline_time>( &self, child: &P, - timeline_time: gst::ClockTime, - ) -> Result; + timeline_time: impl Into>, + ) -> Result, glib::Error>; #[doc(alias = "ges_clip_get_layer")] #[doc(alias = "get_layer")] @@ -102,8 +102,8 @@ pub trait ClipExt: 'static { fn timeline_time_from_internal_time>( &self, child: &P, - internal_time: gst::ClockTime, - ) -> Result; + internal_time: impl Into>, + ) -> Result, glib::Error>; #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] @@ -112,7 +112,7 @@ pub trait ClipExt: 'static { fn timeline_time_from_source_frame( &self, frame_number: FrameNumber, - ) -> Result; + ) -> Result, glib::Error>; #[doc(alias = "ges_clip_get_top_effect_index")] #[doc(alias = "get_top_effect_index")] @@ -276,9 +276,10 @@ impl> ClipExt for O { #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] fn duration_limit(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::ges_clip_get_duration_limit( + try_from_glib(ffi::ges_clip_get_duration_limit( self.as_ref().to_glib_none().0, )) + .expect("mandatory glib value is None") } } @@ -287,14 +288,14 @@ impl> ClipExt for O { fn internal_time_from_timeline_time>( &self, child: &P, - timeline_time: gst::ClockTime, - ) -> Result { + timeline_time: impl Into>, + ) -> Result, glib::Error> { unsafe { let mut error = ptr::null_mut(); let ret = ffi::ges_clip_get_internal_time_from_timeline_time( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, - timeline_time.into_glib(), + timeline_time.into().into_glib(), &mut error, ); if error.is_null() { @@ -322,14 +323,14 @@ impl> ClipExt for O { fn timeline_time_from_internal_time>( &self, child: &P, - internal_time: gst::ClockTime, - ) -> Result { + internal_time: impl Into>, + ) -> Result, glib::Error> { unsafe { let mut error = ptr::null_mut(); let ret = ffi::ges_clip_get_timeline_time_from_internal_time( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, - internal_time.into_glib(), + internal_time.into().into_glib(), &mut error, ); if error.is_null() { @@ -345,7 +346,7 @@ impl> ClipExt for O { fn timeline_time_from_source_frame( &self, frame_number: FrameNumber, - ) -> Result { + ) -> Result, glib::Error> { unsafe { let mut error = ptr::null_mut(); let ret = ffi::ges_clip_get_timeline_time_from_source_frame( diff --git a/gstreamer-editing-services/src/auto/layer.rs b/gstreamer-editing-services/src/auto/layer.rs index 15d8cf204..bd192aa1c 100644 --- a/gstreamer-editing-services/src/auto/layer.rs +++ b/gstreamer-editing-services/src/auto/layer.rs @@ -52,9 +52,9 @@ pub trait LayerExt: 'static { fn add_asset>( &self, asset: &P, - start: gst::ClockTime, - inpoint: gst::ClockTime, - duration: gst::ClockTime, + start: impl Into>, + inpoint: impl Into>, + duration: impl Into>, track_types: TrackType, ) -> Result; @@ -64,9 +64,9 @@ pub trait LayerExt: 'static { fn add_asset_full>( &self, asset: &P, - start: gst::ClockTime, - inpoint: gst::ClockTime, - duration: gst::ClockTime, + start: impl Into>, + inpoint: impl Into>, + duration: impl Into>, track_types: TrackType, ) -> Result; @@ -94,7 +94,11 @@ pub trait LayerExt: 'static { #[doc(alias = "ges_layer_get_clips_in_interval")] #[doc(alias = "get_clips_in_interval")] - fn clips_in_interval(&self, start: gst::ClockTime, end: gst::ClockTime) -> Vec; + fn clips_in_interval( + &self, + start: impl Into>, + end: impl Into>, + ) -> Vec; #[doc(alias = "ges_layer_get_duration")] #[doc(alias = "get_duration")] @@ -152,18 +156,18 @@ impl> LayerExt for O { fn add_asset>( &self, asset: &P, - start: gst::ClockTime, - inpoint: gst::ClockTime, - duration: gst::ClockTime, + start: impl Into>, + inpoint: impl Into>, + duration: impl Into>, track_types: TrackType, ) -> Result { unsafe { Option::<_>::from_glib_none(ffi::ges_layer_add_asset( self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0, - start.into_glib(), - inpoint.into_glib(), - duration.into_glib(), + start.into().into_glib(), + inpoint.into().into_glib(), + duration.into().into_glib(), track_types.into_glib(), )) .ok_or_else(|| glib::bool_error!("Failed to add asset")) @@ -175,9 +179,9 @@ impl> LayerExt for O { fn add_asset_full>( &self, asset: &P, - start: gst::ClockTime, - inpoint: gst::ClockTime, - duration: gst::ClockTime, + start: impl Into>, + inpoint: impl Into>, + duration: impl Into>, track_types: TrackType, ) -> Result { unsafe { @@ -185,9 +189,9 @@ impl> LayerExt for O { let ret = ffi::ges_layer_add_asset_full( self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0, - start.into_glib(), - inpoint.into_glib(), - duration.into_glib(), + start.into().into_glib(), + inpoint.into().into_glib(), + duration.into().into_glib(), track_types.into_glib(), &mut error, ); @@ -256,18 +260,25 @@ impl> LayerExt for O { } } - fn clips_in_interval(&self, start: gst::ClockTime, end: gst::ClockTime) -> Vec { + fn clips_in_interval( + &self, + start: impl Into>, + end: impl Into>, + ) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::ges_layer_get_clips_in_interval( self.as_ref().to_glib_none().0, - start.into_glib(), - end.into_glib(), + start.into().into_glib(), + end.into().into_glib(), )) } } fn duration(&self) -> gst::ClockTime { - unsafe { from_glib(ffi::ges_layer_get_duration(self.as_ref().to_glib_none().0)) } + unsafe { + try_from_glib(ffi::ges_layer_get_duration(self.as_ref().to_glib_none().0)) + .expect("mandatory glib value is None") + } } fn priority(&self) -> u32 { diff --git a/gstreamer-editing-services/src/auto/timeline.rs b/gstreamer-editing-services/src/auto/timeline.rs index f6c16bf04..6a99fc118 100644 --- a/gstreamer-editing-services/src/auto/timeline.rs +++ b/gstreamer-editing-services/src/auto/timeline.rs @@ -110,7 +110,7 @@ pub trait TimelineExt: 'static { #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[doc(alias = "ges_timeline_get_frame_time")] #[doc(alias = "get_frame_time")] - fn frame_time(&self, frame_number: FrameNumber) -> gst::ClockTime; + fn frame_time(&self, frame_number: FrameNumber) -> Option; #[doc(alias = "ges_timeline_get_groups")] #[doc(alias = "get_groups")] @@ -130,7 +130,7 @@ pub trait TimelineExt: 'static { #[doc(alias = "ges_timeline_get_snapping_distance")] #[doc(alias = "get_snapping_distance")] - fn snapping_distance(&self) -> gst::ClockTime; + fn snapping_distance(&self) -> Option; #[doc(alias = "ges_timeline_get_track_for_pad")] #[doc(alias = "get_track_for_pad")] @@ -181,7 +181,7 @@ pub trait TimelineExt: 'static { fn set_auto_transition(&self, auto_transition: bool); #[doc(alias = "ges_timeline_set_snapping_distance")] - fn set_snapping_distance(&self, snapping_distance: gst::ClockTime); + fn set_snapping_distance(&self, snapping_distance: impl Into>); #[doc(alias = "commited")] fn connect_commited(&self, f: F) -> SignalHandlerId; @@ -292,9 +292,10 @@ impl> TimelineExt for O { fn duration(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::ges_timeline_get_duration( + try_from_glib(ffi::ges_timeline_get_duration( self.as_ref().to_glib_none().0, )) + .expect("mandatory glib value is None") } } @@ -317,7 +318,7 @@ impl> TimelineExt for O { #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] - fn frame_time(&self, frame_number: FrameNumber) -> gst::ClockTime { + fn frame_time(&self, frame_number: FrameNumber) -> Option { unsafe { from_glib(ffi::ges_timeline_get_frame_time( self.as_ref().to_glib_none().0, @@ -360,7 +361,7 @@ impl> TimelineExt for O { } } - fn snapping_distance(&self) -> gst::ClockTime { + fn snapping_distance(&self) -> Option { unsafe { from_glib(ffi::ges_timeline_get_snapping_distance( self.as_ref().to_glib_none().0, @@ -496,11 +497,11 @@ impl> TimelineExt for O { } } - fn set_snapping_distance(&self, snapping_distance: gst::ClockTime) { + fn set_snapping_distance(&self, snapping_distance: impl Into>) { unsafe { ffi::ges_timeline_set_snapping_distance( self.as_ref().to_glib_none().0, - snapping_distance.into_glib(), + snapping_distance.into().into_glib(), ); } } diff --git a/gstreamer-editing-services/src/auto/timeline_element.rs b/gstreamer-editing-services/src/auto/timeline_element.rs index a7cf5252f..5e1894dba 100644 --- a/gstreamer-editing-services/src/auto/timeline_element.rs +++ b/gstreamer-editing-services/src/auto/timeline_element.rs @@ -94,7 +94,7 @@ pub trait TimelineElementExt: 'static { #[doc(alias = "ges_timeline_element_get_inpoint")] #[doc(alias = "get_inpoint")] - fn inpoint(&self) -> gst::ClockTime; + fn inpoint(&self) -> Option; #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] @@ -104,7 +104,7 @@ pub trait TimelineElementExt: 'static { #[doc(alias = "ges_timeline_element_get_max_duration")] #[doc(alias = "get_max_duration")] - fn max_duration(&self) -> gst::ClockTime; + fn max_duration(&self) -> Option; #[doc(alias = "ges_timeline_element_get_name")] #[doc(alias = "get_name")] @@ -126,7 +126,7 @@ pub trait TimelineElementExt: 'static { #[doc(alias = "ges_timeline_element_get_start")] #[doc(alias = "get_start")] - fn start(&self) -> gst::ClockTime; + fn start(&self) -> Option; #[doc(alias = "ges_timeline_element_get_timeline")] #[doc(alias = "get_timeline")] @@ -190,13 +190,13 @@ pub trait TimelineElementExt: 'static { //fn set_child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported); #[doc(alias = "ges_timeline_element_set_duration")] - fn set_duration(&self, duration: gst::ClockTime) -> bool; + fn set_duration(&self, duration: impl Into>) -> bool; #[doc(alias = "ges_timeline_element_set_inpoint")] fn set_inpoint(&self, inpoint: gst::ClockTime) -> bool; #[doc(alias = "ges_timeline_element_set_max_duration")] - fn set_max_duration(&self, maxduration: gst::ClockTime) -> bool; + fn set_max_duration(&self, maxduration: impl Into>) -> bool; #[doc(alias = "ges_timeline_element_set_name")] fn set_name(&self, name: Option<&str>) -> Result<(), glib::error::BoolError>; @@ -210,7 +210,7 @@ pub trait TimelineElementExt: 'static { fn set_priority(&self, priority: u32) -> bool; #[doc(alias = "ges_timeline_element_set_start")] - fn set_start(&self, start: gst::ClockTime) -> bool; + fn set_start(&self, start: impl Into>) -> bool; #[doc(alias = "ges_timeline_element_set_timeline")] fn set_timeline>(&self, timeline: &P) -> Result<(), glib::error::BoolError>; @@ -364,13 +364,14 @@ impl> TimelineElementExt for O { fn duration(&self) -> gst::ClockTime { unsafe { - from_glib(ffi::ges_timeline_element_get_duration( + try_from_glib(ffi::ges_timeline_element_get_duration( self.as_ref().to_glib_none().0, )) + .expect("mandatory glib value is None") } } - fn inpoint(&self) -> gst::ClockTime { + fn inpoint(&self) -> Option { unsafe { from_glib(ffi::ges_timeline_element_get_inpoint( self.as_ref().to_glib_none().0, @@ -384,7 +385,7 @@ impl> TimelineElementExt for O { unsafe { ffi::ges_timeline_element_get_layer_priority(self.as_ref().to_glib_none().0) } } - fn max_duration(&self) -> gst::ClockTime { + fn max_duration(&self) -> Option { unsafe { from_glib(ffi::ges_timeline_element_get_max_duration( self.as_ref().to_glib_none().0, @@ -433,7 +434,7 @@ impl> TimelineElementExt for O { unsafe { ffi::ges_timeline_element_get_priority(self.as_ref().to_glib_none().0) } } - fn start(&self) -> gst::ClockTime { + fn start(&self) -> Option { unsafe { from_glib(ffi::ges_timeline_element_get_start( self.as_ref().to_glib_none().0, @@ -581,11 +582,11 @@ impl> TimelineElementExt for O { // unsafe { TODO: call ffi:ges_timeline_element_set_child_property_valist() } //} - fn set_duration(&self, duration: gst::ClockTime) -> bool { + fn set_duration(&self, duration: impl Into>) -> bool { unsafe { from_glib(ffi::ges_timeline_element_set_duration( self.as_ref().to_glib_none().0, - duration.into_glib(), + duration.into().into_glib(), )) } } @@ -599,11 +600,11 @@ impl> TimelineElementExt for O { } } - fn set_max_duration(&self, maxduration: gst::ClockTime) -> bool { + fn set_max_duration(&self, maxduration: impl Into>) -> bool { unsafe { from_glib(ffi::ges_timeline_element_set_max_duration( self.as_ref().to_glib_none().0, - maxduration.into_glib(), + maxduration.into().into_glib(), )) } } @@ -644,11 +645,11 @@ impl> TimelineElementExt for O { } } - fn set_start(&self, start: gst::ClockTime) -> bool { + fn set_start(&self, start: impl Into>) -> bool { unsafe { from_glib(ffi::ges_timeline_element_set_start( self.as_ref().to_glib_none().0, - start.into_glib(), + start.into().into_glib(), )) } } diff --git a/gstreamer-editing-services/src/auto/uri_clip_asset.rs b/gstreamer-editing-services/src/auto/uri_clip_asset.rs index 412230a3a..b3fff01d5 100644 --- a/gstreamer-editing-services/src/auto/uri_clip_asset.rs +++ b/gstreamer-editing-services/src/auto/uri_clip_asset.rs @@ -60,7 +60,7 @@ pub const NONE_URI_CLIP_ASSET: Option<&UriClipAsset> = None; pub trait UriClipAssetExt: 'static { #[doc(alias = "ges_uri_clip_asset_get_duration")] #[doc(alias = "get_duration")] - fn duration(&self) -> gst::ClockTime; + fn duration(&self) -> Option; #[doc(alias = "ges_uri_clip_asset_get_info")] #[doc(alias = "get_info")] @@ -70,7 +70,7 @@ pub trait UriClipAssetExt: 'static { #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[doc(alias = "ges_uri_clip_asset_get_max_duration")] #[doc(alias = "get_max_duration")] - fn max_duration(&self) -> gst::ClockTime; + fn max_duration(&self) -> Option; #[doc(alias = "ges_uri_clip_asset_get_stream_assets")] #[doc(alias = "get_stream_assets")] @@ -98,7 +98,7 @@ pub trait UriClipAssetExt: 'static { } impl> UriClipAssetExt for O { - fn duration(&self) -> gst::ClockTime { + fn duration(&self) -> Option { unsafe { from_glib(ffi::ges_uri_clip_asset_get_duration( self.as_ref().to_glib_none().0, @@ -116,7 +116,7 @@ impl> UriClipAssetExt for O { #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] - fn max_duration(&self) -> gst::ClockTime { + fn max_duration(&self) -> Option { unsafe { from_glib(ffi::ges_uri_clip_asset_get_max_duration( self.as_ref().to_glib_none().0, diff --git a/gstreamer-pbutils/src/auto/discoverer_info.rs b/gstreamer-pbutils/src/auto/discoverer_info.rs index ae64f5348..78e6ca8a9 100644 --- a/gstreamer-pbutils/src/auto/discoverer_info.rs +++ b/gstreamer-pbutils/src/auto/discoverer_info.rs @@ -45,7 +45,7 @@ impl DiscovererInfo { #[doc(alias = "gst_discoverer_info_get_duration")] #[doc(alias = "get_duration")] - pub fn duration(&self) -> gst::ClockTime { + pub fn duration(&self) -> Option { unsafe { from_glib(ffi::gst_discoverer_info_get_duration(self.to_glib_none().0)) } } diff --git a/gstreamer-player/src/auto/player.rs b/gstreamer-player/src/auto/player.rs index 7fa68ac3e..ccfca26fd 100644 --- a/gstreamer-player/src/auto/player.rs +++ b/gstreamer-player/src/auto/player.rs @@ -85,7 +85,7 @@ impl Player { #[doc(alias = "gst_player_get_duration")] #[doc(alias = "get_duration")] - pub fn duration(&self) -> gst::ClockTime { + pub fn duration(&self) -> Option { unsafe { from_glib(ffi::gst_player_get_duration(self.to_glib_none().0)) } } @@ -121,7 +121,7 @@ impl Player { #[doc(alias = "gst_player_get_position")] #[doc(alias = "get_position")] - pub fn position(&self) -> gst::ClockTime { + pub fn position(&self) -> Option { unsafe { from_glib(ffi::gst_player_get_position(self.to_glib_none().0)) } } diff --git a/gstreamer-player/src/auto/player_media_info.rs b/gstreamer-player/src/auto/player_media_info.rs index 742ccb19a..73aa1ca4b 100644 --- a/gstreamer-player/src/auto/player_media_info.rs +++ b/gstreamer-player/src/auto/player_media_info.rs @@ -41,7 +41,7 @@ impl PlayerMediaInfo { #[doc(alias = "gst_player_media_info_get_duration")] #[doc(alias = "get_duration")] - pub fn duration(&self) -> gst::ClockTime { + pub fn duration(&self) -> Option { unsafe { from_glib(ffi::gst_player_media_info_get_duration( self.to_glib_none().0, diff --git a/gstreamer-rtsp-server/src/auto/rtsp_media.rs b/gstreamer-rtsp-server/src/auto/rtsp_media.rs index 8a9fb39ab..47989a2a2 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_media.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_media.rs @@ -71,7 +71,7 @@ pub trait RTSPMediaExt: 'static { #[doc(alias = "gst_rtsp_media_get_base_time")] #[doc(alias = "get_base_time")] - fn base_time(&self) -> gst::ClockTime; + fn base_time(&self) -> Option; #[doc(alias = "gst_rtsp_media_get_buffer_size")] #[doc(alias = "get_buffer_size")] @@ -145,7 +145,7 @@ pub trait RTSPMediaExt: 'static { #[doc(alias = "gst_rtsp_media_get_retransmission_time")] #[doc(alias = "get_retransmission_time")] - fn retransmission_time(&self) -> gst::ClockTime; + fn retransmission_time(&self) -> Option; #[doc(alias = "gst_rtsp_media_get_status")] #[doc(alias = "get_status")] @@ -222,7 +222,7 @@ pub trait RTSPMediaExt: 'static { //#[cfg(any(feature = "v1_18", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] //#[doc(alias = "gst_rtsp_media_seek_trickmode")] - //fn seek_trickmode(&self, range: /*Ignored*/&mut gst_rtsp::RTSPTimeRange, flags: /*Ignored*/gst::SeekFlags, rate: f64, trickmode_interval: gst::ClockTime) -> bool; + //fn seek_trickmode(&self, range: /*Ignored*/&mut gst_rtsp::RTSPTimeRange, flags: /*Ignored*/gst::SeekFlags, rate: f64, trickmode_interval: impl Into>) -> bool; //#[cfg(any(feature = "v1_14", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] @@ -288,7 +288,7 @@ pub trait RTSPMediaExt: 'static { fn set_rate_control(&self, enabled: bool); #[doc(alias = "gst_rtsp_media_set_retransmission_time")] - fn set_retransmission_time(&self, time: gst::ClockTime); + fn set_retransmission_time(&self, time: impl Into>); #[doc(alias = "gst_rtsp_media_set_reusable")] fn set_reusable(&self, reusable: bool); @@ -504,7 +504,7 @@ impl> RTSPMediaExt for O { } } - fn base_time(&self) -> gst::ClockTime { + fn base_time(&self) -> Option { unsafe { from_glib(ffi::gst_rtsp_media_get_base_time( self.as_ref().to_glib_none().0, @@ -635,7 +635,7 @@ impl> RTSPMediaExt for O { } } - fn retransmission_time(&self) -> gst::ClockTime { + fn retransmission_time(&self) -> Option { unsafe { from_glib(ffi::gst_rtsp_media_get_retransmission_time( self.as_ref().to_glib_none().0, @@ -793,7 +793,7 @@ impl> RTSPMediaExt for O { //#[cfg(any(feature = "v1_18", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] - //fn seek_trickmode(&self, range: /*Ignored*/&mut gst_rtsp::RTSPTimeRange, flags: /*Ignored*/gst::SeekFlags, rate: f64, trickmode_interval: gst::ClockTime) -> bool { + //fn seek_trickmode(&self, range: /*Ignored*/&mut gst_rtsp::RTSPTimeRange, flags: /*Ignored*/gst::SeekFlags, rate: f64, trickmode_interval: impl Into>) -> bool { // unsafe { TODO: call ffi:gst_rtsp_media_seek_trickmode() } //} @@ -940,11 +940,11 @@ impl> RTSPMediaExt for O { } } - fn set_retransmission_time(&self, time: gst::ClockTime) { + fn set_retransmission_time(&self, time: impl Into>) { unsafe { ffi::gst_rtsp_media_set_retransmission_time( self.as_ref().to_glib_none().0, - time.into_glib(), + time.into().into_glib(), ); } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_media_factory.rs b/gstreamer-rtsp-server/src/auto/rtsp_media_factory.rs index 3c38f077f..5e7a65ea4 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_media_factory.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_media_factory.rs @@ -120,7 +120,7 @@ pub trait RTSPMediaFactoryExt: 'static { #[doc(alias = "gst_rtsp_media_factory_get_retransmission_time")] #[doc(alias = "get_retransmission_time")] - fn retransmission_time(&self) -> gst::ClockTime; + fn retransmission_time(&self) -> Option; #[doc(alias = "gst_rtsp_media_factory_get_suspend_mode")] #[doc(alias = "get_suspend_mode")] @@ -211,7 +211,7 @@ pub trait RTSPMediaFactoryExt: 'static { fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode); #[doc(alias = "gst_rtsp_media_factory_set_retransmission_time")] - fn set_retransmission_time(&self, time: gst::ClockTime); + fn set_retransmission_time(&self, time: impl Into>); #[doc(alias = "gst_rtsp_media_factory_set_shared")] fn set_shared(&self, shared: bool); @@ -463,7 +463,7 @@ impl> RTSPMediaFactoryExt for O { } } - fn retransmission_time(&self) -> gst::ClockTime { + fn retransmission_time(&self) -> Option { unsafe { from_glib(ffi::gst_rtsp_media_factory_get_retransmission_time( self.as_ref().to_glib_none().0, @@ -680,11 +680,11 @@ impl> RTSPMediaFactoryExt for O { } } - fn set_retransmission_time(&self, time: gst::ClockTime) { + fn set_retransmission_time(&self, time: impl Into>) { unsafe { ffi::gst_rtsp_media_factory_set_retransmission_time( self.as_ref().to_glib_none().0, - time.into_glib(), + time.into().into_glib(), ); } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_session_media.rs b/gstreamer-rtsp-server/src/auto/rtsp_session_media.rs index d734af144..3ee678e33 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_session_media.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_session_media.rs @@ -42,7 +42,7 @@ pub trait RTSPSessionMediaExt: 'static { #[doc(alias = "gst_rtsp_session_media_get_base_time")] #[doc(alias = "get_base_time")] - fn base_time(&self) -> gst::ClockTime; + fn base_time(&self) -> Option; #[doc(alias = "gst_rtsp_session_media_get_media")] #[doc(alias = "get_media")] @@ -84,7 +84,7 @@ impl> RTSPSessionMediaExt for O { // unsafe { TODO: call ffi:gst_rtsp_session_media_alloc_channels() } //} - fn base_time(&self) -> gst::ClockTime { + fn base_time(&self) -> Option { unsafe { from_glib(ffi::gst_rtsp_session_media_get_base_time( self.as_ref().to_glib_none().0, diff --git a/gstreamer-rtsp-server/src/auto/rtsp_stream.rs b/gstreamer-rtsp-server/src/auto/rtsp_stream.rs index bb63949a1..6dde8a1ba 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_stream.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_stream.rs @@ -165,7 +165,7 @@ pub trait RTSPStreamExt: 'static { #[doc(alias = "gst_rtsp_stream_get_retransmission_time")] #[doc(alias = "get_retransmission_time")] - fn retransmission_time(&self) -> gst::ClockTime; + fn retransmission_time(&self) -> Option; #[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] @@ -187,7 +187,7 @@ pub trait RTSPStreamExt: 'static { #[doc(alias = "gst_rtsp_stream_get_rtpinfo")] #[doc(alias = "get_rtpinfo")] - fn rtpinfo(&self) -> Option<(u32, u32, u32, gst::ClockTime)>; + fn rtpinfo(&self) -> Option<(u32, u32, u32, Option)>; #[doc(alias = "gst_rtsp_stream_get_rtpsession")] #[doc(alias = "get_rtpsession")] @@ -384,7 +384,7 @@ pub trait RTSPStreamExt: 'static { fn set_retransmission_pt(&self, rtx_pt: u32); #[doc(alias = "gst_rtsp_stream_set_retransmission_time")] - fn set_retransmission_time(&self, time: gst::ClockTime); + fn set_retransmission_time(&self, time: impl Into>); #[doc(alias = "gst_rtsp_stream_set_seqnum_offset")] fn set_seqnum_offset(&self, seqnum: u16); @@ -649,7 +649,7 @@ impl> RTSPStreamExt for O { unsafe { ffi::gst_rtsp_stream_get_retransmission_pt(self.as_ref().to_glib_none().0) } } - fn retransmission_time(&self) -> gst::ClockTime { + fn retransmission_time(&self) -> Option { unsafe { from_glib(ffi::gst_rtsp_stream_get_retransmission_time( self.as_ref().to_glib_none().0, @@ -695,7 +695,7 @@ impl> RTSPStreamExt for O { } } - fn rtpinfo(&self) -> Option<(u32, u32, u32, gst::ClockTime)> { + fn rtpinfo(&self) -> Option<(u32, u32, u32, Option)> { unsafe { let mut rtptime = mem::MaybeUninit::uninit(); let mut seq = mem::MaybeUninit::uninit(); @@ -1148,11 +1148,11 @@ impl> RTSPStreamExt for O { } } - fn set_retransmission_time(&self, time: gst::ClockTime) { + fn set_retransmission_time(&self, time: impl Into>) { unsafe { ffi::gst_rtsp_stream_set_retransmission_time( self.as_ref().to_glib_none().0, - time.into_glib(), + time.into().into_glib(), ); } } diff --git a/gstreamer-rtsp-server/src/auto/rtsp_stream_transport.rs b/gstreamer-rtsp-server/src/auto/rtsp_stream_transport.rs index e71f1be1d..17abcc930 100644 --- a/gstreamer-rtsp-server/src/auto/rtsp_stream_transport.rs +++ b/gstreamer-rtsp-server/src/auto/rtsp_stream_transport.rs @@ -29,7 +29,7 @@ pub const NONE_RTSP_STREAM_TRANSPORT: Option<&RTSPStreamTransport> = None; pub trait RTSPStreamTransportExt: 'static { #[doc(alias = "gst_rtsp_stream_transport_get_rtpinfo")] #[doc(alias = "get_rtpinfo")] - fn rtpinfo(&self, start_time: gst::ClockTime) -> Option; + fn rtpinfo(&self, start_time: impl Into>) -> Option; #[doc(alias = "gst_rtsp_stream_transport_get_stream")] #[doc(alias = "get_stream")] @@ -110,11 +110,11 @@ pub trait RTSPStreamTransportExt: 'static { } impl> RTSPStreamTransportExt for O { - fn rtpinfo(&self, start_time: gst::ClockTime) -> Option { + fn rtpinfo(&self, start_time: impl Into>) -> Option { unsafe { from_glib_full(ffi::gst_rtsp_stream_transport_get_rtpinfo( self.as_ref().to_glib_none().0, - start_time.into_glib(), + start_time.into().into_glib(), )) } } diff --git a/gstreamer-video/src/auto/video_encoder.rs b/gstreamer-video/src/auto/video_encoder.rs index 14a9c9b38..5815710df 100644 --- a/gstreamer-video/src/auto/video_encoder.rs +++ b/gstreamer-video/src/auto/video_encoder.rs @@ -44,7 +44,7 @@ pub trait VideoEncoderExt: 'static { #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[doc(alias = "gst_video_encoder_get_min_force_key_unit_interval")] #[doc(alias = "get_min_force_key_unit_interval")] - fn min_force_key_unit_interval(&self) -> gst::ClockTime; + fn min_force_key_unit_interval(&self) -> Option; #[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] @@ -63,10 +63,10 @@ pub trait VideoEncoderExt: 'static { #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[doc(alias = "gst_video_encoder_set_min_force_key_unit_interval")] - fn set_min_force_key_unit_interval(&self, interval: gst::ClockTime); + fn set_min_force_key_unit_interval(&self, interval: impl Into>); #[doc(alias = "gst_video_encoder_set_min_pts")] - fn set_min_pts(&self, min_pts: gst::ClockTime); + fn set_min_pts(&self, min_pts: impl Into>); #[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] @@ -113,7 +113,7 @@ impl> VideoEncoderExt for O { #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] - fn min_force_key_unit_interval(&self) -> gst::ClockTime { + fn min_force_key_unit_interval(&self) -> Option { unsafe { from_glib(ffi::gst_video_encoder_get_min_force_key_unit_interval( self.as_ref().to_glib_none().0, @@ -162,18 +162,21 @@ impl> VideoEncoderExt for O { #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] - fn set_min_force_key_unit_interval(&self, interval: gst::ClockTime) { + fn set_min_force_key_unit_interval(&self, interval: impl Into>) { unsafe { ffi::gst_video_encoder_set_min_force_key_unit_interval( self.as_ref().to_glib_none().0, - interval.into_glib(), + interval.into().into_glib(), ); } } - fn set_min_pts(&self, min_pts: gst::ClockTime) { + fn set_min_pts(&self, min_pts: impl Into>) { unsafe { - ffi::gst_video_encoder_set_min_pts(self.as_ref().to_glib_none().0, min_pts.into_glib()); + ffi::gst_video_encoder_set_min_pts( + self.as_ref().to_glib_none().0, + min_pts.into().into_glib(), + ); } } diff --git a/gstreamer/src/auto/bus.rs b/gstreamer/src/auto/bus.rs index 4b846792c..82f036318 100644 --- a/gstreamer/src/auto/bus.rs +++ b/gstreamer/src/auto/bus.rs @@ -118,11 +118,11 @@ impl Bus { //} #[doc(alias = "gst_bus_timed_pop")] - pub fn timed_pop(&self, timeout: ClockTime) -> Option { + pub fn timed_pop(&self, timeout: impl Into>) -> Option { unsafe { from_glib_full(ffi::gst_bus_timed_pop( self.to_glib_none().0, - timeout.into_glib(), + timeout.into().into_glib(), )) } } diff --git a/gstreamer/src/auto/clock.rs b/gstreamer/src/auto/clock.rs index 44353b928..5474ebb63 100644 --- a/gstreamer/src/auto/clock.rs +++ b/gstreamer/src/auto/clock.rs @@ -39,7 +39,7 @@ impl Clock { //} //#[doc(alias = "gst_clock_id_get_time")] - //pub fn id_get_time(id: /*Unimplemented*/ClockID) -> ClockTime { + //pub fn id_get_time(id: /*Unimplemented*/ClockID) -> Option { // unsafe { TODO: call ffi:gst_clock_id_get_time() } //} @@ -71,7 +71,7 @@ impl Clock { //} //#[doc(alias = "gst_clock_id_wait_async")] - //pub fn id_wait_async(id: /*Unimplemented*/ClockID, func: /*Unimplemented*/Fn(&Clock, ClockTime, /*Unimplemented*/ClockID) -> bool, user_data: /*Unimplemented*/Option) -> Result { + //pub fn id_wait_async(id: /*Unimplemented*/ClockID, func: /*Unimplemented*/Fn(&Clock, impl Into>, /*Unimplemented*/ClockID) -> bool, user_data: /*Unimplemented*/Option) -> Result { // unsafe { TODO: call ffi:gst_clock_id_wait_async() } //} } @@ -93,7 +93,7 @@ pub trait ClockExt: 'static { ) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)>; #[doc(alias = "gst_clock_adjust_unlocked")] - fn adjust_unlocked(&self, internal: ClockTime) -> ClockTime; + fn adjust_unlocked(&self, internal: ClockTime) -> Option; #[doc(alias = "gst_clock_get_calibration")] #[doc(alias = "get_calibration")] @@ -113,11 +113,11 @@ pub trait ClockExt: 'static { #[doc(alias = "gst_clock_get_time")] #[doc(alias = "get_time")] - fn time(&self) -> ClockTime; + fn time(&self) -> Option; #[doc(alias = "gst_clock_get_timeout")] #[doc(alias = "get_timeout")] - fn timeout(&self) -> ClockTime; + fn timeout(&self) -> Option; #[doc(alias = "gst_clock_is_synced")] fn is_synced(&self) -> bool; @@ -141,13 +141,16 @@ pub trait ClockExt: 'static { fn set_synced(&self, synced: bool); #[doc(alias = "gst_clock_set_timeout")] - fn set_timeout(&self, timeout: ClockTime); + fn set_timeout(&self, timeout: impl Into>); #[doc(alias = "gst_clock_unadjust_unlocked")] - fn unadjust_unlocked(&self, external: ClockTime) -> ClockTime; + fn unadjust_unlocked(&self, external: ClockTime) -> Option; #[doc(alias = "gst_clock_wait_for_sync")] - fn wait_for_sync(&self, timeout: ClockTime) -> Result<(), glib::error::BoolError>; + fn wait_for_sync( + &self, + timeout: impl Into>, + ) -> Result<(), glib::error::BoolError>; #[doc(alias = "window-size")] fn window_size(&self) -> i32; @@ -229,10 +232,10 @@ impl> ClockExt for O { if ret { Some(( r_squared, - from_glib(internal), - from_glib(external), - from_glib(rate_num), - from_glib(rate_denom), + try_from_glib(internal).expect("mandatory glib value is None"), + try_from_glib(external).expect("mandatory glib value is None"), + try_from_glib(rate_num).expect("mandatory glib value is None"), + try_from_glib(rate_denom).expect("mandatory glib value is None"), )) } else { None @@ -240,7 +243,7 @@ impl> ClockExt for O { } } - fn adjust_unlocked(&self, internal: ClockTime) -> ClockTime { + fn adjust_unlocked(&self, internal: ClockTime) -> Option { unsafe { from_glib(ffi::gst_clock_adjust_unlocked( self.as_ref().to_glib_none().0, @@ -267,19 +270,20 @@ impl> ClockExt for O { let rate_num = rate_num.assume_init(); let rate_denom = rate_denom.assume_init(); ( - from_glib(internal), - from_glib(external), - from_glib(rate_num), - from_glib(rate_denom), + try_from_glib(internal).expect("mandatory glib value is None"), + try_from_glib(external).expect("mandatory glib value is None"), + try_from_glib(rate_num).expect("mandatory glib value is None"), + try_from_glib(rate_denom).expect("mandatory glib value is None"), ) } } fn internal_time(&self) -> ClockTime { unsafe { - from_glib(ffi::gst_clock_get_internal_time( + try_from_glib(ffi::gst_clock_get_internal_time( self.as_ref().to_glib_none().0, )) + .expect("mandatory glib value is None") } } @@ -289,17 +293,18 @@ impl> ClockExt for O { fn resolution(&self) -> ClockTime { unsafe { - from_glib(ffi::gst_clock_get_resolution( + try_from_glib(ffi::gst_clock_get_resolution( self.as_ref().to_glib_none().0, )) + .expect("mandatory glib value is None") } } - fn time(&self) -> ClockTime { + fn time(&self) -> Option { unsafe { from_glib(ffi::gst_clock_get_time(self.as_ref().to_glib_none().0)) } } - fn timeout(&self) -> ClockTime { + fn timeout(&self) -> Option { unsafe { from_glib(ffi::gst_clock_get_timeout(self.as_ref().to_glib_none().0)) } } @@ -339,10 +344,11 @@ impl> ClockExt for O { fn set_resolution(&self, resolution: ClockTime) -> ClockTime { unsafe { - from_glib(ffi::gst_clock_set_resolution( + try_from_glib(ffi::gst_clock_set_resolution( self.as_ref().to_glib_none().0, resolution.into_glib(), )) + .expect("mandatory glib value is None") } } @@ -352,13 +358,13 @@ impl> ClockExt for O { } } - fn set_timeout(&self, timeout: ClockTime) { + fn set_timeout(&self, timeout: impl Into>) { unsafe { - ffi::gst_clock_set_timeout(self.as_ref().to_glib_none().0, timeout.into_glib()); + ffi::gst_clock_set_timeout(self.as_ref().to_glib_none().0, timeout.into().into_glib()); } } - fn unadjust_unlocked(&self, external: ClockTime) -> ClockTime { + fn unadjust_unlocked(&self, external: ClockTime) -> Option { unsafe { from_glib(ffi::gst_clock_unadjust_unlocked( self.as_ref().to_glib_none().0, @@ -367,10 +373,16 @@ impl> ClockExt for O { } } - fn wait_for_sync(&self, timeout: ClockTime) -> Result<(), glib::error::BoolError> { + fn wait_for_sync( + &self, + timeout: impl Into>, + ) -> Result<(), glib::error::BoolError> { unsafe { glib::result_from_gboolean!( - ffi::gst_clock_wait_for_sync(self.as_ref().to_glib_none().0, timeout.into_glib()), + ffi::gst_clock_wait_for_sync( + self.as_ref().to_glib_none().0, + timeout.into().into_glib() + ), "Timed out waiting for sync" ) } diff --git a/gstreamer/src/auto/control_binding.rs b/gstreamer/src/auto/control_binding.rs index a61e719b6..323711a01 100644 --- a/gstreamer/src/auto/control_binding.rs +++ b/gstreamer/src/auto/control_binding.rs @@ -30,7 +30,7 @@ pub trait ControlBindingExt: 'static { //#[doc(alias = "gst_control_binding_get_value_array")] //#[doc(alias = "get_value_array")] - //fn is_value_array(&self, timestamp: ClockTime, interval: ClockTime, values: /*Unimplemented*/&[&Fundamental: Pointer]) -> bool; + //fn is_value_array(&self, timestamp: impl Into>, interval: impl Into>, values: /*Unimplemented*/&[&Fundamental: Pointer]) -> bool; #[doc(alias = "gst_control_binding_is_disabled")] fn is_disabled(&self) -> bool; @@ -43,7 +43,7 @@ pub trait ControlBindingExt: 'static { &self, object: &P, timestamp: ClockTime, - last_sync: ClockTime, + last_sync: impl Into>, ) -> bool; fn object(&self) -> Option; @@ -59,7 +59,7 @@ impl> ControlBindingExt for O { } } - //fn is_value_array(&self, timestamp: ClockTime, interval: ClockTime, values: /*Unimplemented*/&[&Fundamental: Pointer]) -> bool { + //fn is_value_array(&self, timestamp: impl Into>, interval: impl Into>, values: /*Unimplemented*/&[&Fundamental: Pointer]) -> bool { // unsafe { TODO: call ffi:gst_control_binding_get_value_array() } //} @@ -84,14 +84,14 @@ impl> ControlBindingExt for O { &self, object: &P, timestamp: ClockTime, - last_sync: ClockTime, + last_sync: impl Into>, ) -> bool { unsafe { from_glib(ffi::gst_control_binding_sync_values( self.as_ref().to_glib_none().0, object.as_ref().to_glib_none().0, timestamp.into_glib(), - last_sync.into_glib(), + last_sync.into().into_glib(), )) } } diff --git a/gstreamer/src/auto/element.rs b/gstreamer/src/auto/element.rs index e7cfe0e17..f410f3691 100644 --- a/gstreamer/src/auto/element.rs +++ b/gstreamer/src/auto/element.rs @@ -105,7 +105,7 @@ pub trait ElementExt: 'static { #[doc(alias = "gst_element_get_base_time")] #[doc(alias = "get_base_time")] - fn base_time(&self) -> ClockTime; + fn base_time(&self) -> Option; #[doc(alias = "gst_element_get_bus")] #[doc(alias = "get_bus")] @@ -137,13 +137,13 @@ pub trait ElementExt: 'static { #[doc(alias = "gst_element_get_start_time")] #[doc(alias = "get_start_time")] - fn start_time(&self) -> ClockTime; + fn start_time(&self) -> Option; #[doc(alias = "gst_element_get_state")] #[doc(alias = "get_state")] fn state( &self, - timeout: ClockTime, + timeout: impl Into>, ) -> (Result, State, State); #[doc(alias = "gst_element_get_static_pad")] @@ -233,7 +233,7 @@ pub trait ElementExt: 'static { fn set_locked_state(&self, locked_state: bool) -> bool; #[doc(alias = "gst_element_set_start_time")] - fn set_start_time(&self, time: ClockTime); + fn set_start_time(&self, time: impl Into>); #[doc(alias = "gst_element_set_state")] fn set_state(&self, state: State) -> Result; @@ -390,7 +390,7 @@ impl> ElementExt for O { } } - fn base_time(&self) -> ClockTime { + fn base_time(&self) -> Option { unsafe { from_glib(ffi::gst_element_get_base_time( self.as_ref().to_glib_none().0, @@ -446,7 +446,7 @@ impl> ElementExt for O { unsafe { from_glib_none(ffi::gst_element_get_factory(self.as_ref().to_glib_none().0)) } } - fn start_time(&self) -> ClockTime { + fn start_time(&self) -> Option { unsafe { from_glib(ffi::gst_element_get_start_time( self.as_ref().to_glib_none().0, @@ -456,7 +456,7 @@ impl> ElementExt for O { fn state( &self, - timeout: ClockTime, + timeout: impl Into>, ) -> (Result, State, State) { unsafe { let mut state = mem::MaybeUninit::uninit(); @@ -465,7 +465,7 @@ impl> ElementExt for O { self.as_ref().to_glib_none().0, state.as_mut_ptr(), pending.as_mut_ptr(), - timeout.into_glib(), + timeout.into().into_glib(), )); let state = state.assume_init(); let pending = pending.assume_init(); @@ -687,9 +687,12 @@ impl> ElementExt for O { } } - fn set_start_time(&self, time: ClockTime) { + fn set_start_time(&self, time: impl Into>) { unsafe { - ffi::gst_element_set_start_time(self.as_ref().to_glib_none().0, time.into_glib()); + ffi::gst_element_set_start_time( + self.as_ref().to_glib_none().0, + time.into().into_glib(), + ); } } diff --git a/gstreamer/src/auto/functions.rs b/gstreamer/src/auto/functions.rs index 5e09f933e..00ddf2230 100644 --- a/gstreamer/src/auto/functions.rs +++ b/gstreamer/src/auto/functions.rs @@ -269,7 +269,7 @@ pub fn update_registry() -> Result<(), glib::error::BoolError> { #[doc(alias = "gst_util_get_timestamp")] pub fn util_get_timestamp() -> ClockTime { skip_assert_initialized!(); - unsafe { from_glib(ffi::gst_util_get_timestamp()) } + unsafe { try_from_glib(ffi::gst_util_get_timestamp()).expect("mandatory glib value is None") } } #[doc(alias = "gst_version")] diff --git a/gstreamer/src/auto/object.rs b/gstreamer/src/auto/object.rs index 6d47e6285..2bc27665a 100644 --- a/gstreamer/src/auto/object.rs +++ b/gstreamer/src/auto/object.rs @@ -74,7 +74,7 @@ pub trait GstObjectExt: 'static { #[doc(alias = "gst_object_get_control_rate")] #[doc(alias = "get_control_rate")] - fn control_rate(&self) -> ClockTime; + fn control_rate(&self) -> Option; #[doc(alias = "gst_object_get_name")] #[doc(alias = "get_name")] @@ -90,11 +90,15 @@ pub trait GstObjectExt: 'static { #[doc(alias = "gst_object_get_value")] #[doc(alias = "get_value")] - fn value(&self, property_name: &str, timestamp: ClockTime) -> Option; + fn value( + &self, + property_name: &str, + timestamp: impl Into>, + ) -> Option; //#[doc(alias = "gst_object_get_value_array")] //#[doc(alias = "get_value_array")] - //fn is_value_array(&self, property_name: &str, timestamp: ClockTime, interval: ClockTime, n_values: u32, values: /*Unimplemented*/Option) -> bool; + //fn is_value_array(&self, property_name: &str, timestamp: impl Into>, interval: impl Into>, n_values: u32, values: /*Unimplemented*/Option) -> bool; #[doc(alias = "gst_object_has_active_control_bindings")] fn has_active_control_bindings(&self) -> bool; @@ -118,13 +122,13 @@ pub trait GstObjectExt: 'static { fn set_control_bindings_disabled(&self, disabled: bool); #[doc(alias = "gst_object_set_control_rate")] - fn set_control_rate(&self, control_rate: ClockTime); + fn set_control_rate(&self, control_rate: impl Into>); #[doc(alias = "gst_object_set_parent")] fn set_parent>(&self, parent: &P) -> Result<(), glib::error::BoolError>; #[doc(alias = "gst_object_suggest_next_sync")] - fn suggest_next_sync(&self) -> ClockTime; + fn suggest_next_sync(&self) -> Option; #[doc(alias = "gst_object_sync_values")] fn sync_values(&self, timestamp: ClockTime) -> Result<(), glib::error::BoolError>; @@ -174,7 +178,7 @@ impl> GstObjectExt for O { } } - fn control_rate(&self) -> ClockTime { + fn control_rate(&self) -> Option { unsafe { from_glib(ffi::gst_object_get_control_rate( self.as_ref().to_glib_none().0, @@ -198,17 +202,21 @@ impl> GstObjectExt for O { } } - fn value(&self, property_name: &str, timestamp: ClockTime) -> Option { + fn value( + &self, + property_name: &str, + timestamp: impl Into>, + ) -> Option { unsafe { from_glib_full(ffi::gst_object_get_value( self.as_ref().to_glib_none().0, property_name.to_glib_none().0, - timestamp.into_glib(), + timestamp.into().into_glib(), )) } } - //fn is_value_array(&self, property_name: &str, timestamp: ClockTime, interval: ClockTime, n_values: u32, values: /*Unimplemented*/Option) -> bool { + //fn is_value_array(&self, property_name: &str, timestamp: impl Into>, interval: impl Into>, n_values: u32, values: /*Unimplemented*/Option) -> bool { // unsafe { TODO: call ffi:gst_object_get_value_array() } //} @@ -275,11 +283,11 @@ impl> GstObjectExt for O { } } - fn set_control_rate(&self, control_rate: ClockTime) { + fn set_control_rate(&self, control_rate: impl Into>) { unsafe { ffi::gst_object_set_control_rate( self.as_ref().to_glib_none().0, - control_rate.into_glib(), + control_rate.into().into_glib(), ); } } @@ -296,7 +304,7 @@ impl> GstObjectExt for O { } } - fn suggest_next_sync(&self) -> ClockTime { + fn suggest_next_sync(&self) -> Option { unsafe { from_glib(ffi::gst_object_suggest_next_sync( self.as_ref().to_glib_none().0, diff --git a/gstreamer/src/auto/pipeline.rs b/gstreamer/src/auto/pipeline.rs index caaebbd0e..4bde5a984 100644 --- a/gstreamer/src/auto/pipeline.rs +++ b/gstreamer/src/auto/pipeline.rs @@ -55,7 +55,7 @@ pub trait PipelineExt: 'static { #[doc(alias = "gst_pipeline_get_latency")] #[doc(alias = "get_latency")] - fn latency(&self) -> ClockTime; + fn latency(&self) -> Option; #[doc(alias = "gst_pipeline_get_pipeline_clock")] #[doc(alias = "get_pipeline_clock")] @@ -68,7 +68,7 @@ pub trait PipelineExt: 'static { fn set_delay(&self, delay: ClockTime); #[doc(alias = "gst_pipeline_set_latency")] - fn set_latency(&self, latency: ClockTime); + fn set_latency(&self, latency: impl Into>); #[doc(alias = "gst_pipeline_use_clock")] fn use_clock>(&self, clock: Option<&P>); @@ -103,10 +103,13 @@ impl> PipelineExt for O { } fn delay(&self) -> ClockTime { - unsafe { from_glib(ffi::gst_pipeline_get_delay(self.as_ref().to_glib_none().0)) } + unsafe { + try_from_glib(ffi::gst_pipeline_get_delay(self.as_ref().to_glib_none().0)) + .expect("mandatory glib value is None") + } } - fn latency(&self) -> ClockTime { + fn latency(&self) -> Option { unsafe { from_glib(ffi::gst_pipeline_get_latency( self.as_ref().to_glib_none().0, @@ -137,9 +140,12 @@ impl> PipelineExt for O { } } - fn set_latency(&self, latency: ClockTime) { + fn set_latency(&self, latency: impl Into>) { unsafe { - ffi::gst_pipeline_set_latency(self.as_ref().to_glib_none().0, latency.into_glib()); + ffi::gst_pipeline_set_latency( + self.as_ref().to_glib_none().0, + latency.into().into_glib(), + ); } }