regen: use TryFromGlib::Option for ClockTime

This commit is contained in:
François Laignel 2021-04-05 12:48:30 +02:00
parent 532af96ef9
commit 03e8e6d22f
33 changed files with 326 additions and 221 deletions

View file

@ -127,11 +127,14 @@ impl AppSink {
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
#[doc(alias = "gst_app_sink_try_pull_preroll")] #[doc(alias = "gst_app_sink_try_pull_preroll")]
pub fn try_pull_preroll(&self, timeout: gst::ClockTime) -> Option<gst::Sample> { pub fn try_pull_preroll(
&self,
timeout: impl Into<Option<gst::ClockTime>>,
) -> Option<gst::Sample> {
unsafe { unsafe {
from_glib_full(ffi::gst_app_sink_try_pull_preroll( from_glib_full(ffi::gst_app_sink_try_pull_preroll(
self.to_glib_none().0, 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(any(feature = "v1_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
#[doc(alias = "gst_app_sink_try_pull_sample")] #[doc(alias = "gst_app_sink_try_pull_sample")]
pub fn try_pull_sample(&self, timeout: gst::ClockTime) -> Option<gst::Sample> { pub fn try_pull_sample(
&self,
timeout: impl Into<Option<gst::ClockTime>>,
) -> Option<gst::Sample> {
unsafe { unsafe {
from_glib_full(ffi::gst_app_sink_try_pull_sample( from_glib_full(ffi::gst_app_sink_try_pull_sample(
self.to_glib_none().0, self.to_glib_none().0,
timeout.into_glib(), timeout.into().into_glib(),
)) ))
} }
} }

View file

@ -55,7 +55,7 @@ impl AppSrc {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_app_src_get_current_level_time")] #[doc(alias = "gst_app_src_get_current_level_time")]
#[doc(alias = "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<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_app_src_get_current_level_time( from_glib(ffi::gst_app_src_get_current_level_time(
self.to_glib_none().0, self.to_glib_none().0,
@ -67,7 +67,7 @@ impl AppSrc {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
#[doc(alias = "gst_app_src_get_duration")] #[doc(alias = "gst_app_src_get_duration")]
#[doc(alias = "get_duration")] #[doc(alias = "get_duration")]
pub fn duration(&self) -> gst::ClockTime { pub fn duration(&self) -> Option<gst::ClockTime> {
unsafe { from_glib(ffi::gst_app_src_get_duration(self.to_glib_none().0)) } 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")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_app_src_get_max_time")] #[doc(alias = "gst_app_src_get_max_time")]
#[doc(alias = "get_max_time")] #[doc(alias = "get_max_time")]
pub fn max_time(&self) -> gst::ClockTime { pub fn max_time(&self) -> Option<gst::ClockTime> {
unsafe { from_glib(ffi::gst_app_src_get_max_time(self.to_glib_none().0)) } 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(any(feature = "v1_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
#[doc(alias = "gst_app_src_set_duration")] #[doc(alias = "gst_app_src_set_duration")]
pub fn set_duration(&self, duration: gst::ClockTime) { pub fn set_duration(&self, duration: impl Into<Option<gst::ClockTime>>) {
unsafe { 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(any(feature = "v1_20", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_app_src_set_max_time")] #[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<Option<gst::ClockTime>>) {
unsafe { 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());
} }
} }

View file

@ -58,7 +58,7 @@ pub trait AudioBaseSinkExt: 'static {
fn set_alignment_threshold(&self, alignment_threshold: gst::ClockTime); fn set_alignment_threshold(&self, alignment_threshold: gst::ClockTime);
//#[doc(alias = "gst_audio_base_sink_set_custom_slaving_callback")] //#[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<Fundamental: Pointer>); //fn set_custom_slaving_callback(&self, callback: /*Unimplemented*/Fn(&AudioBaseSink, impl Into<Option<gst::ClockTime>>, impl Into<Option<gst::ClockTime>>, gst::ClockTimeDiff, /*Ignored*/AudioBaseSinkDiscontReason), user_data: /*Unimplemented*/Option<Fundamental: Pointer>);
#[doc(alias = "gst_audio_base_sink_set_discont_wait")] #[doc(alias = "gst_audio_base_sink_set_discont_wait")]
fn set_discont_wait(&self, discont_wait: gst::ClockTime); fn set_discont_wait(&self, discont_wait: gst::ClockTime);
@ -146,17 +146,19 @@ impl<O: IsA<AudioBaseSink>> AudioBaseSinkExt for O {
fn alignment_threshold(&self) -> gst::ClockTime { fn alignment_threshold(&self) -> gst::ClockTime {
unsafe { 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, self.as_ref().to_glib_none().0,
)) ))
.expect("mandatory glib value is None")
} }
} }
fn discont_wait(&self) -> gst::ClockTime { fn discont_wait(&self) -> gst::ClockTime {
unsafe { 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, self.as_ref().to_glib_none().0,
)) ))
.expect("mandatory glib value is None")
} }
} }
@ -191,7 +193,7 @@ impl<O: IsA<AudioBaseSink>> 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<Fundamental: Pointer>) { //fn set_custom_slaving_callback(&self, callback: /*Unimplemented*/Fn(&AudioBaseSink, impl Into<Option<gst::ClockTime>>, impl Into<Option<gst::ClockTime>>, gst::ClockTimeDiff, /*Ignored*/AudioBaseSinkDiscontReason), user_data: /*Unimplemented*/Option<Fundamental: Pointer>) {
// unsafe { TODO: call ffi:gst_audio_base_sink_set_custom_slaving_callback() } // unsafe { TODO: call ffi:gst_audio_base_sink_set_custom_slaving_callback() }
//} //}

View file

@ -49,7 +49,7 @@ pub trait AudioDecoderExt: 'static {
#[doc(alias = "gst_audio_decoder_get_latency")] #[doc(alias = "gst_audio_decoder_get_latency")]
#[doc(alias = "get_latency")] #[doc(alias = "get_latency")]
fn latency(&self) -> (gst::ClockTime, gst::ClockTime); fn latency(&self) -> (gst::ClockTime, Option<gst::ClockTime>);
#[doc(alias = "gst_audio_decoder_get_max_errors")] #[doc(alias = "gst_audio_decoder_get_max_errors")]
#[doc(alias = "get_max_errors")] #[doc(alias = "get_max_errors")]
@ -97,7 +97,7 @@ pub trait AudioDecoderExt: 'static {
fn set_estimate_rate(&self, enabled: bool); fn set_estimate_rate(&self, enabled: bool);
#[doc(alias = "gst_audio_decoder_set_latency")] #[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<Option<gst::ClockTime>>);
#[doc(alias = "gst_audio_decoder_set_max_errors")] #[doc(alias = "gst_audio_decoder_set_max_errors")]
fn set_max_errors(&self, num: i32); fn set_max_errors(&self, num: i32);
@ -179,7 +179,7 @@ impl<O: IsA<AudioDecoder>> AudioDecoderExt for O {
unsafe { ffi::gst_audio_decoder_get_estimate_rate(self.as_ref().to_glib_none().0) } 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<gst::ClockTime>) {
unsafe { unsafe {
let mut min = mem::MaybeUninit::uninit(); let mut min = mem::MaybeUninit::uninit();
let mut max = mem::MaybeUninit::uninit(); let mut max = mem::MaybeUninit::uninit();
@ -190,7 +190,10 @@ impl<O: IsA<AudioDecoder>> AudioDecoderExt for O {
); );
let min = min.assume_init(); let min = min.assume_init();
let max = max.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<O: IsA<AudioDecoder>> AudioDecoderExt for O {
fn min_latency(&self) -> gst::ClockTime { fn min_latency(&self) -> gst::ClockTime {
unsafe { 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, self.as_ref().to_glib_none().0,
)) ))
.expect("mandatory glib value is None")
} }
} }
@ -243,9 +247,10 @@ impl<O: IsA<AudioDecoder>> AudioDecoderExt for O {
fn tolerance(&self) -> gst::ClockTime { fn tolerance(&self) -> gst::ClockTime {
unsafe { 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, self.as_ref().to_glib_none().0,
)) ))
.expect("mandatory glib value is None")
} }
} }
@ -298,12 +303,12 @@ impl<O: IsA<AudioDecoder>> AudioDecoderExt for O {
} }
} }
fn set_latency(&self, min: gst::ClockTime, max: gst::ClockTime) { fn set_latency(&self, min: gst::ClockTime, max: impl Into<Option<gst::ClockTime>>) {
unsafe { unsafe {
ffi::gst_audio_decoder_set_latency( ffi::gst_audio_decoder_set_latency(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
min.into_glib(), min.into_glib(),
max.into_glib(), max.into().into_glib(),
); );
} }
} }

View file

@ -10,6 +10,7 @@ use glib::signal::connect_raw;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::translate::*; use glib::translate::*;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute; use std::mem::transmute;
glib::wrapper! { glib::wrapper! {
@ -58,6 +59,10 @@ pub trait AudioEncoderExt: 'static {
#[doc(alias = "get_hard_resync")] #[doc(alias = "get_hard_resync")]
fn is_hard_resync(&self) -> bool; fn is_hard_resync(&self) -> bool;
#[doc(alias = "gst_audio_encoder_get_latency")]
#[doc(alias = "get_latency")]
fn latency(&self) -> (gst::ClockTime, Option<gst::ClockTime>);
#[doc(alias = "gst_audio_encoder_get_lookahead")] #[doc(alias = "gst_audio_encoder_get_lookahead")]
#[doc(alias = "get_lookahead")] #[doc(alias = "get_lookahead")]
fn lookahead(&self) -> i32; fn lookahead(&self) -> i32;
@ -107,7 +112,7 @@ pub trait AudioEncoderExt: 'static {
fn set_headers(&self, headers: &[&gst::Buffer]); fn set_headers(&self, headers: &[&gst::Buffer]);
#[doc(alias = "gst_audio_encoder_set_latency")] #[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<Option<gst::ClockTime>>);
#[doc(alias = "gst_audio_encoder_set_lookahead")] #[doc(alias = "gst_audio_encoder_set_lookahead")]
fn set_lookahead(&self, num: i32); fn set_lookahead(&self, num: i32);
@ -201,6 +206,24 @@ impl<O: IsA<AudioEncoder>> AudioEncoderExt for O {
} }
} }
fn latency(&self) -> (gst::ClockTime, Option<gst::ClockTime>) {
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 { fn lookahead(&self) -> i32 {
unsafe { ffi::gst_audio_encoder_get_lookahead(self.as_ref().to_glib_none().0) } unsafe { ffi::gst_audio_encoder_get_lookahead(self.as_ref().to_glib_none().0) }
} }
@ -223,9 +246,10 @@ impl<O: IsA<AudioEncoder>> AudioEncoderExt for O {
fn tolerance(&self) -> gst::ClockTime { fn tolerance(&self) -> gst::ClockTime {
unsafe { 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, self.as_ref().to_glib_none().0,
)) ))
.expect("mandatory glib value is None")
} }
} }
@ -314,12 +338,12 @@ impl<O: IsA<AudioEncoder>> AudioEncoderExt for O {
} }
} }
fn set_latency(&self, min: gst::ClockTime, max: gst::ClockTime) { fn set_latency(&self, min: gst::ClockTime, max: impl Into<Option<gst::ClockTime>>) {
unsafe { unsafe {
ffi::gst_audio_encoder_set_latency( ffi::gst_audio_encoder_set_latency(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
min.into_glib(), min.into_glib(),
max.into_glib(), max.into().into_glib(),
); );
} }
} }

View file

@ -37,9 +37,10 @@ impl AudioStreamAlign {
#[doc(alias = "get_alignment_threshold")] #[doc(alias = "get_alignment_threshold")]
pub fn alignment_threshold(&self) -> gst::ClockTime { pub fn alignment_threshold(&self) -> gst::ClockTime {
unsafe { 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, self.to_glib_none().0,
)) ))
.expect("mandatory glib value is None")
} }
} }
@ -47,9 +48,10 @@ impl AudioStreamAlign {
#[doc(alias = "get_discont_wait")] #[doc(alias = "get_discont_wait")]
pub fn discont_wait(&self) -> gst::ClockTime { pub fn discont_wait(&self) -> gst::ClockTime {
unsafe { 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, 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 = "gst_audio_stream_align_get_timestamp_at_discont")]
#[doc(alias = "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<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_audio_stream_align_get_timestamp_at_discont( from_glib(ffi::gst_audio_stream_align_get_timestamp_at_discont(
self.to_glib_none().0, self.to_glib_none().0,

View file

@ -50,7 +50,7 @@ impl Adapter {
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
#[doc(alias = "gst_adapter_dts_at_discont")] #[doc(alias = "gst_adapter_dts_at_discont")]
pub fn dts_at_discont(&self) -> gst::ClockTime { pub fn dts_at_discont(&self) -> Option<gst::ClockTime> {
unsafe { from_glib(ffi::gst_adapter_dts_at_discont(self.to_glib_none().0)) } 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")] #[doc(alias = "gst_adapter_prev_dts")]
pub fn prev_dts(&self) -> (gst::ClockTime, u64) { pub fn prev_dts(&self) -> (Option<gst::ClockTime>, u64) {
unsafe { unsafe {
let mut distance = mem::MaybeUninit::uninit(); let mut distance = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_adapter_prev_dts( let ret = from_glib(ffi::gst_adapter_prev_dts(
@ -75,7 +75,7 @@ impl Adapter {
} }
#[doc(alias = "gst_adapter_prev_dts_at_offset")] #[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<gst::ClockTime>, u64) {
unsafe { unsafe {
let mut distance = mem::MaybeUninit::uninit(); let mut distance = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_adapter_prev_dts_at_offset( let ret = from_glib(ffi::gst_adapter_prev_dts_at_offset(
@ -101,7 +101,7 @@ impl Adapter {
} }
#[doc(alias = "gst_adapter_prev_pts")] #[doc(alias = "gst_adapter_prev_pts")]
pub fn prev_pts(&self) -> (gst::ClockTime, u64) { pub fn prev_pts(&self) -> (Option<gst::ClockTime>, u64) {
unsafe { unsafe {
let mut distance = mem::MaybeUninit::uninit(); let mut distance = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_adapter_prev_pts( let ret = from_glib(ffi::gst_adapter_prev_pts(
@ -114,7 +114,7 @@ impl Adapter {
} }
#[doc(alias = "gst_adapter_prev_pts_at_offset")] #[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<gst::ClockTime>, u64) {
unsafe { unsafe {
let mut distance = mem::MaybeUninit::uninit(); let mut distance = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_adapter_prev_pts_at_offset( 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(any(feature = "v1_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
#[doc(alias = "gst_adapter_pts_at_discont")] #[doc(alias = "gst_adapter_pts_at_discont")]
pub fn pts_at_discont(&self) -> gst::ClockTime { pub fn pts_at_discont(&self) -> Option<gst::ClockTime> {
unsafe { from_glib(ffi::gst_adapter_pts_at_discont(self.to_glib_none().0)) } unsafe { from_glib(ffi::gst_adapter_pts_at_discont(self.to_glib_none().0)) }
} }
} }

View file

@ -40,7 +40,7 @@ pub trait AggregatorExt: 'static {
#[doc(alias = "gst_aggregator_get_latency")] #[doc(alias = "gst_aggregator_get_latency")]
#[doc(alias = "get_latency")] #[doc(alias = "get_latency")]
fn latency(&self) -> gst::ClockTime; fn latency(&self) -> Option<gst::ClockTime>;
#[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
@ -53,7 +53,11 @@ pub trait AggregatorExt: 'static {
fn peek_next_sample<P: IsA<AggregatorPad>>(&self, pad: &P) -> Option<gst::Sample>; fn peek_next_sample<P: IsA<AggregatorPad>>(&self, pad: &P) -> Option<gst::Sample>;
#[doc(alias = "gst_aggregator_set_latency")] #[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<Option<gst::ClockTime>>,
);
#[doc(alias = "gst_aggregator_set_src_caps")] #[doc(alias = "gst_aggregator_set_src_caps")]
fn set_src_caps(&self, caps: &gst::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(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
#[doc(alias = "gst_aggregator_simple_get_next_time")] #[doc(alias = "gst_aggregator_simple_get_next_time")]
fn simple_get_next_time(&self) -> gst::ClockTime; fn simple_get_next_time(&self) -> Option<gst::ClockTime>;
#[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
@ -127,7 +131,7 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
} }
} }
fn latency(&self) -> gst::ClockTime { fn latency(&self) -> Option<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_aggregator_get_latency( from_glib(ffi::gst_aggregator_get_latency(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -156,12 +160,16 @@ impl<O: IsA<Aggregator>> 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<Option<gst::ClockTime>>,
) {
unsafe { unsafe {
ffi::gst_aggregator_set_latency( ffi::gst_aggregator_set_latency(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
min_latency.into_glib(), min_latency.into_glib(),
max_latency.into_glib(), max_latency.into().into_glib(),
); );
} }
} }
@ -174,7 +182,7 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
#[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
fn simple_get_next_time(&self) -> gst::ClockTime { fn simple_get_next_time(&self) -> Option<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_aggregator_simple_get_next_time( from_glib(ffi::gst_aggregator_simple_get_next_time(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,

View file

@ -49,7 +49,11 @@ pub trait BaseParseExt: 'static {
fn set_infer_ts(&self, infer_ts: bool); fn set_infer_ts(&self, infer_ts: bool);
#[doc(alias = "gst_base_parse_set_latency")] #[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<Option<gst::ClockTime>>,
);
#[doc(alias = "gst_base_parse_set_min_frame_size")] #[doc(alias = "gst_base_parse_set_min_frame_size")]
fn set_min_frame_size(&self, min_size: u32); fn set_min_frame_size(&self, min_size: u32);
@ -131,12 +135,16 @@ impl<O: IsA<BaseParse>> 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<Option<gst::ClockTime>>,
) {
unsafe { unsafe {
ffi::gst_base_parse_set_latency( ffi::gst_base_parse_set_latency(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
min_latency.into_glib(), min_latency.into_glib(),
max_latency.into_glib(), max_latency.into().into_glib(),
); );
} }
} }

View file

@ -120,7 +120,7 @@ pub trait BaseSinkExt: 'static {
#[doc(alias = "gst_base_sink_wait")] #[doc(alias = "gst_base_sink_wait")]
fn wait( fn wait(
&self, &self,
time: gst::ClockTime, time: impl Into<Option<gst::ClockTime>>,
) -> (Result<gst::FlowSuccess, gst::FlowError>, gst::ClockTimeDiff); ) -> (Result<gst::FlowSuccess, gst::FlowError>, gst::ClockTimeDiff);
#[doc(alias = "gst_base_sink_wait_clock")] #[doc(alias = "gst_base_sink_wait_clock")]
@ -251,9 +251,10 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
fn latency(&self) -> gst::ClockTime { fn latency(&self) -> gst::ClockTime {
unsafe { 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, self.as_ref().to_glib_none().0,
)) ))
.expect("mandatory glib value is None")
} }
} }
@ -269,17 +270,19 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
fn processing_deadline(&self) -> gst::ClockTime { fn processing_deadline(&self) -> gst::ClockTime {
unsafe { 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, self.as_ref().to_glib_none().0,
)) ))
.expect("mandatory glib value is None")
} }
} }
fn render_delay(&self) -> gst::ClockTime { fn render_delay(&self) -> gst::ClockTime {
unsafe { 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, self.as_ref().to_glib_none().0,
)) ))
.expect("mandatory glib value is None")
} }
} }
@ -367,13 +370,13 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
fn wait( fn wait(
&self, &self,
time: gst::ClockTime, time: impl Into<Option<gst::ClockTime>>,
) -> (Result<gst::FlowSuccess, gst::FlowError>, gst::ClockTimeDiff) { ) -> (Result<gst::FlowSuccess, gst::FlowError>, gst::ClockTimeDiff) {
unsafe { unsafe {
let mut jitter = mem::MaybeUninit::uninit(); let mut jitter = mem::MaybeUninit::uninit();
let ret = try_from_glib(ffi::gst_base_sink_wait( let ret = try_from_glib(ffi::gst_base_sink_wait(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
time.into_glib(), time.into().into_glib(),
jitter.as_mut_ptr(), jitter.as_mut_ptr(),
)); ));
let jitter = jitter.assume_init(); let jitter = jitter.assume_init();

View file

@ -57,9 +57,10 @@ impl TestClock {
#[doc(alias = "get_next_entry_time")] #[doc(alias = "get_next_entry_time")]
pub fn next_entry_time(&self) -> gst::ClockTime { pub fn next_entry_time(&self) -> gst::ClockTime {
unsafe { 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, 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")] //#[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<gst::ClockTime> {
// unsafe { TODO: call ffi:gst_test_clock_id_list_get_latest_time() } // unsafe { TODO: call ffi:gst_test_clock_id_list_get_latest_time() }
//} //}

View file

@ -28,7 +28,7 @@ pub const NONE_TIMED_VALUE_CONTROL_SOURCE: Option<&TimedValueControlSource> = No
pub trait TimedValueControlSourceExt: 'static { pub trait TimedValueControlSourceExt: 'static {
//#[doc(alias = "gst_timed_value_control_source_find_control_point_iter")] //#[doc(alias = "gst_timed_value_control_source_find_control_point_iter")]
//fn find_control_point_iter(&self, timestamp: gst::ClockTime) -> /*Ignored*/Option<glib::SequenceIter>; //fn find_control_point_iter(&self, timestamp: impl Into<Option<gst::ClockTime>>) -> /*Ignored*/Option<glib::SequenceIter>;
//#[doc(alias = "gst_timed_value_control_source_get_all")] //#[doc(alias = "gst_timed_value_control_source_get_all")]
//#[doc(alias = "get_all")] //#[doc(alias = "get_all")]
@ -70,7 +70,7 @@ pub trait TimedValueControlSourceExt: 'static {
} }
impl<O: IsA<TimedValueControlSource>> TimedValueControlSourceExt for O { impl<O: IsA<TimedValueControlSource>> TimedValueControlSourceExt for O {
//fn find_control_point_iter(&self, timestamp: gst::ClockTime) -> /*Ignored*/Option<glib::SequenceIter> { //fn find_control_point_iter(&self, timestamp: impl Into<Option<gst::ClockTime>>) -> /*Ignored*/Option<glib::SequenceIter> {
// unsafe { TODO: call ffi:gst_timed_value_control_source_find_control_point_iter() } // unsafe { TODO: call ffi:gst_timed_value_control_source_find_control_point_iter() }
//} //}

View file

@ -84,8 +84,8 @@ pub trait ClipExt: 'static {
fn internal_time_from_timeline_time<P: IsA<TrackElement>>( fn internal_time_from_timeline_time<P: IsA<TrackElement>>(
&self, &self,
child: &P, child: &P,
timeline_time: gst::ClockTime, timeline_time: impl Into<Option<gst::ClockTime>>,
) -> Result<gst::ClockTime, glib::Error>; ) -> Result<Option<gst::ClockTime>, glib::Error>;
#[doc(alias = "ges_clip_get_layer")] #[doc(alias = "ges_clip_get_layer")]
#[doc(alias = "get_layer")] #[doc(alias = "get_layer")]
@ -102,8 +102,8 @@ pub trait ClipExt: 'static {
fn timeline_time_from_internal_time<P: IsA<TrackElement>>( fn timeline_time_from_internal_time<P: IsA<TrackElement>>(
&self, &self,
child: &P, child: &P,
internal_time: gst::ClockTime, internal_time: impl Into<Option<gst::ClockTime>>,
) -> Result<gst::ClockTime, glib::Error>; ) -> Result<Option<gst::ClockTime>, glib::Error>;
#[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
@ -112,7 +112,7 @@ pub trait ClipExt: 'static {
fn timeline_time_from_source_frame( fn timeline_time_from_source_frame(
&self, &self,
frame_number: FrameNumber, frame_number: FrameNumber,
) -> Result<gst::ClockTime, glib::Error>; ) -> Result<Option<gst::ClockTime>, glib::Error>;
#[doc(alias = "ges_clip_get_top_effect_index")] #[doc(alias = "ges_clip_get_top_effect_index")]
#[doc(alias = "get_top_effect_index")] #[doc(alias = "get_top_effect_index")]
@ -276,9 +276,10 @@ impl<O: IsA<Clip>> ClipExt for O {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
fn duration_limit(&self) -> gst::ClockTime { fn duration_limit(&self) -> gst::ClockTime {
unsafe { 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, self.as_ref().to_glib_none().0,
)) ))
.expect("mandatory glib value is None")
} }
} }
@ -287,14 +288,14 @@ impl<O: IsA<Clip>> ClipExt for O {
fn internal_time_from_timeline_time<P: IsA<TrackElement>>( fn internal_time_from_timeline_time<P: IsA<TrackElement>>(
&self, &self,
child: &P, child: &P,
timeline_time: gst::ClockTime, timeline_time: impl Into<Option<gst::ClockTime>>,
) -> Result<gst::ClockTime, glib::Error> { ) -> Result<Option<gst::ClockTime>, glib::Error> {
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let ret = ffi::ges_clip_get_internal_time_from_timeline_time( let ret = ffi::ges_clip_get_internal_time_from_timeline_time(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
child.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0,
timeline_time.into_glib(), timeline_time.into().into_glib(),
&mut error, &mut error,
); );
if error.is_null() { if error.is_null() {
@ -322,14 +323,14 @@ impl<O: IsA<Clip>> ClipExt for O {
fn timeline_time_from_internal_time<P: IsA<TrackElement>>( fn timeline_time_from_internal_time<P: IsA<TrackElement>>(
&self, &self,
child: &P, child: &P,
internal_time: gst::ClockTime, internal_time: impl Into<Option<gst::ClockTime>>,
) -> Result<gst::ClockTime, glib::Error> { ) -> Result<Option<gst::ClockTime>, glib::Error> {
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let ret = ffi::ges_clip_get_timeline_time_from_internal_time( let ret = ffi::ges_clip_get_timeline_time_from_internal_time(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
child.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0,
internal_time.into_glib(), internal_time.into().into_glib(),
&mut error, &mut error,
); );
if error.is_null() { if error.is_null() {
@ -345,7 +346,7 @@ impl<O: IsA<Clip>> ClipExt for O {
fn timeline_time_from_source_frame( fn timeline_time_from_source_frame(
&self, &self,
frame_number: FrameNumber, frame_number: FrameNumber,
) -> Result<gst::ClockTime, glib::Error> { ) -> Result<Option<gst::ClockTime>, glib::Error> {
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let ret = ffi::ges_clip_get_timeline_time_from_source_frame( let ret = ffi::ges_clip_get_timeline_time_from_source_frame(

View file

@ -52,9 +52,9 @@ pub trait LayerExt: 'static {
fn add_asset<P: IsA<Asset>>( fn add_asset<P: IsA<Asset>>(
&self, &self,
asset: &P, asset: &P,
start: gst::ClockTime, start: impl Into<Option<gst::ClockTime>>,
inpoint: gst::ClockTime, inpoint: impl Into<Option<gst::ClockTime>>,
duration: gst::ClockTime, duration: impl Into<Option<gst::ClockTime>>,
track_types: TrackType, track_types: TrackType,
) -> Result<Clip, glib::BoolError>; ) -> Result<Clip, glib::BoolError>;
@ -64,9 +64,9 @@ pub trait LayerExt: 'static {
fn add_asset_full<P: IsA<Asset>>( fn add_asset_full<P: IsA<Asset>>(
&self, &self,
asset: &P, asset: &P,
start: gst::ClockTime, start: impl Into<Option<gst::ClockTime>>,
inpoint: gst::ClockTime, inpoint: impl Into<Option<gst::ClockTime>>,
duration: gst::ClockTime, duration: impl Into<Option<gst::ClockTime>>,
track_types: TrackType, track_types: TrackType,
) -> Result<Clip, glib::Error>; ) -> Result<Clip, glib::Error>;
@ -94,7 +94,11 @@ pub trait LayerExt: 'static {
#[doc(alias = "ges_layer_get_clips_in_interval")] #[doc(alias = "ges_layer_get_clips_in_interval")]
#[doc(alias = "get_clips_in_interval")] #[doc(alias = "get_clips_in_interval")]
fn clips_in_interval(&self, start: gst::ClockTime, end: gst::ClockTime) -> Vec<Clip>; fn clips_in_interval(
&self,
start: impl Into<Option<gst::ClockTime>>,
end: impl Into<Option<gst::ClockTime>>,
) -> Vec<Clip>;
#[doc(alias = "ges_layer_get_duration")] #[doc(alias = "ges_layer_get_duration")]
#[doc(alias = "get_duration")] #[doc(alias = "get_duration")]
@ -152,18 +156,18 @@ impl<O: IsA<Layer>> LayerExt for O {
fn add_asset<P: IsA<Asset>>( fn add_asset<P: IsA<Asset>>(
&self, &self,
asset: &P, asset: &P,
start: gst::ClockTime, start: impl Into<Option<gst::ClockTime>>,
inpoint: gst::ClockTime, inpoint: impl Into<Option<gst::ClockTime>>,
duration: gst::ClockTime, duration: impl Into<Option<gst::ClockTime>>,
track_types: TrackType, track_types: TrackType,
) -> Result<Clip, glib::BoolError> { ) -> Result<Clip, glib::BoolError> {
unsafe { unsafe {
Option::<_>::from_glib_none(ffi::ges_layer_add_asset( Option::<_>::from_glib_none(ffi::ges_layer_add_asset(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
asset.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0,
start.into_glib(), start.into().into_glib(),
inpoint.into_glib(), inpoint.into().into_glib(),
duration.into_glib(), duration.into().into_glib(),
track_types.into_glib(), track_types.into_glib(),
)) ))
.ok_or_else(|| glib::bool_error!("Failed to add asset")) .ok_or_else(|| glib::bool_error!("Failed to add asset"))
@ -175,9 +179,9 @@ impl<O: IsA<Layer>> LayerExt for O {
fn add_asset_full<P: IsA<Asset>>( fn add_asset_full<P: IsA<Asset>>(
&self, &self,
asset: &P, asset: &P,
start: gst::ClockTime, start: impl Into<Option<gst::ClockTime>>,
inpoint: gst::ClockTime, inpoint: impl Into<Option<gst::ClockTime>>,
duration: gst::ClockTime, duration: impl Into<Option<gst::ClockTime>>,
track_types: TrackType, track_types: TrackType,
) -> Result<Clip, glib::Error> { ) -> Result<Clip, glib::Error> {
unsafe { unsafe {
@ -185,9 +189,9 @@ impl<O: IsA<Layer>> LayerExt for O {
let ret = ffi::ges_layer_add_asset_full( let ret = ffi::ges_layer_add_asset_full(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
asset.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0,
start.into_glib(), start.into().into_glib(),
inpoint.into_glib(), inpoint.into().into_glib(),
duration.into_glib(), duration.into().into_glib(),
track_types.into_glib(), track_types.into_glib(),
&mut error, &mut error,
); );
@ -256,18 +260,25 @@ impl<O: IsA<Layer>> LayerExt for O {
} }
} }
fn clips_in_interval(&self, start: gst::ClockTime, end: gst::ClockTime) -> Vec<Clip> { fn clips_in_interval(
&self,
start: impl Into<Option<gst::ClockTime>>,
end: impl Into<Option<gst::ClockTime>>,
) -> Vec<Clip> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_layer_get_clips_in_interval( FromGlibPtrContainer::from_glib_full(ffi::ges_layer_get_clips_in_interval(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
start.into_glib(), start.into().into_glib(),
end.into_glib(), end.into().into_glib(),
)) ))
} }
} }
fn duration(&self) -> gst::ClockTime { 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 { fn priority(&self) -> u32 {

View file

@ -110,7 +110,7 @@ pub trait TimelineExt: 'static {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
#[doc(alias = "ges_timeline_get_frame_time")] #[doc(alias = "ges_timeline_get_frame_time")]
#[doc(alias = "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<gst::ClockTime>;
#[doc(alias = "ges_timeline_get_groups")] #[doc(alias = "ges_timeline_get_groups")]
#[doc(alias = "get_groups")] #[doc(alias = "get_groups")]
@ -130,7 +130,7 @@ pub trait TimelineExt: 'static {
#[doc(alias = "ges_timeline_get_snapping_distance")] #[doc(alias = "ges_timeline_get_snapping_distance")]
#[doc(alias = "get_snapping_distance")] #[doc(alias = "get_snapping_distance")]
fn snapping_distance(&self) -> gst::ClockTime; fn snapping_distance(&self) -> Option<gst::ClockTime>;
#[doc(alias = "ges_timeline_get_track_for_pad")] #[doc(alias = "ges_timeline_get_track_for_pad")]
#[doc(alias = "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); fn set_auto_transition(&self, auto_transition: bool);
#[doc(alias = "ges_timeline_set_snapping_distance")] #[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<Option<gst::ClockTime>>);
#[doc(alias = "commited")] #[doc(alias = "commited")]
fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
@ -292,9 +292,10 @@ impl<O: IsA<Timeline>> TimelineExt for O {
fn duration(&self) -> gst::ClockTime { fn duration(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::ges_timeline_get_duration( try_from_glib(ffi::ges_timeline_get_duration(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
)) ))
.expect("mandatory glib value is None")
} }
} }
@ -317,7 +318,7 @@ impl<O: IsA<Timeline>> TimelineExt for O {
#[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[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<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::ges_timeline_get_frame_time( from_glib(ffi::ges_timeline_get_frame_time(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -360,7 +361,7 @@ impl<O: IsA<Timeline>> TimelineExt for O {
} }
} }
fn snapping_distance(&self) -> gst::ClockTime { fn snapping_distance(&self) -> Option<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::ges_timeline_get_snapping_distance( from_glib(ffi::ges_timeline_get_snapping_distance(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -496,11 +497,11 @@ impl<O: IsA<Timeline>> TimelineExt for O {
} }
} }
fn set_snapping_distance(&self, snapping_distance: gst::ClockTime) { fn set_snapping_distance(&self, snapping_distance: impl Into<Option<gst::ClockTime>>) {
unsafe { unsafe {
ffi::ges_timeline_set_snapping_distance( ffi::ges_timeline_set_snapping_distance(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
snapping_distance.into_glib(), snapping_distance.into().into_glib(),
); );
} }
} }

View file

@ -94,7 +94,7 @@ pub trait TimelineElementExt: 'static {
#[doc(alias = "ges_timeline_element_get_inpoint")] #[doc(alias = "ges_timeline_element_get_inpoint")]
#[doc(alias = "get_inpoint")] #[doc(alias = "get_inpoint")]
fn inpoint(&self) -> gst::ClockTime; fn inpoint(&self) -> Option<gst::ClockTime>;
#[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] #[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 = "ges_timeline_element_get_max_duration")]
#[doc(alias = "get_max_duration")] #[doc(alias = "get_max_duration")]
fn max_duration(&self) -> gst::ClockTime; fn max_duration(&self) -> Option<gst::ClockTime>;
#[doc(alias = "ges_timeline_element_get_name")] #[doc(alias = "ges_timeline_element_get_name")]
#[doc(alias = "get_name")] #[doc(alias = "get_name")]
@ -126,7 +126,7 @@ pub trait TimelineElementExt: 'static {
#[doc(alias = "ges_timeline_element_get_start")] #[doc(alias = "ges_timeline_element_get_start")]
#[doc(alias = "get_start")] #[doc(alias = "get_start")]
fn start(&self) -> gst::ClockTime; fn start(&self) -> Option<gst::ClockTime>;
#[doc(alias = "ges_timeline_element_get_timeline")] #[doc(alias = "ges_timeline_element_get_timeline")]
#[doc(alias = "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); //fn set_child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported);
#[doc(alias = "ges_timeline_element_set_duration")] #[doc(alias = "ges_timeline_element_set_duration")]
fn set_duration(&self, duration: gst::ClockTime) -> bool; fn set_duration(&self, duration: impl Into<Option<gst::ClockTime>>) -> bool;
#[doc(alias = "ges_timeline_element_set_inpoint")] #[doc(alias = "ges_timeline_element_set_inpoint")]
fn set_inpoint(&self, inpoint: gst::ClockTime) -> bool; fn set_inpoint(&self, inpoint: gst::ClockTime) -> bool;
#[doc(alias = "ges_timeline_element_set_max_duration")] #[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<Option<gst::ClockTime>>) -> bool;
#[doc(alias = "ges_timeline_element_set_name")] #[doc(alias = "ges_timeline_element_set_name")]
fn set_name(&self, name: Option<&str>) -> Result<(), glib::error::BoolError>; 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; fn set_priority(&self, priority: u32) -> bool;
#[doc(alias = "ges_timeline_element_set_start")] #[doc(alias = "ges_timeline_element_set_start")]
fn set_start(&self, start: gst::ClockTime) -> bool; fn set_start(&self, start: impl Into<Option<gst::ClockTime>>) -> bool;
#[doc(alias = "ges_timeline_element_set_timeline")] #[doc(alias = "ges_timeline_element_set_timeline")]
fn set_timeline<P: IsA<Timeline>>(&self, timeline: &P) -> Result<(), glib::error::BoolError>; fn set_timeline<P: IsA<Timeline>>(&self, timeline: &P) -> Result<(), glib::error::BoolError>;
@ -364,13 +364,14 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
fn duration(&self) -> gst::ClockTime { fn duration(&self) -> gst::ClockTime {
unsafe { 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, self.as_ref().to_glib_none().0,
)) ))
.expect("mandatory glib value is None")
} }
} }
fn inpoint(&self) -> gst::ClockTime { fn inpoint(&self) -> Option<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_get_inpoint( from_glib(ffi::ges_timeline_element_get_inpoint(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -384,7 +385,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
unsafe { ffi::ges_timeline_element_get_layer_priority(self.as_ref().to_glib_none().0) } 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<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_get_max_duration( from_glib(ffi::ges_timeline_element_get_max_duration(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -433,7 +434,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
unsafe { ffi::ges_timeline_element_get_priority(self.as_ref().to_glib_none().0) } unsafe { ffi::ges_timeline_element_get_priority(self.as_ref().to_glib_none().0) }
} }
fn start(&self) -> gst::ClockTime { fn start(&self) -> Option<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_get_start( from_glib(ffi::ges_timeline_element_get_start(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -581,11 +582,11 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
// unsafe { TODO: call ffi:ges_timeline_element_set_child_property_valist() } // 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<Option<gst::ClockTime>>) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_set_duration( from_glib(ffi::ges_timeline_element_set_duration(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
duration.into_glib(), duration.into().into_glib(),
)) ))
} }
} }
@ -599,11 +600,11 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
} }
} }
fn set_max_duration(&self, maxduration: gst::ClockTime) -> bool { fn set_max_duration(&self, maxduration: impl Into<Option<gst::ClockTime>>) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_set_max_duration( from_glib(ffi::ges_timeline_element_set_max_duration(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
maxduration.into_glib(), maxduration.into().into_glib(),
)) ))
} }
} }
@ -644,11 +645,11 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
} }
} }
fn set_start(&self, start: gst::ClockTime) -> bool { fn set_start(&self, start: impl Into<Option<gst::ClockTime>>) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_set_start( from_glib(ffi::ges_timeline_element_set_start(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
start.into_glib(), start.into().into_glib(),
)) ))
} }
} }

View file

@ -60,7 +60,7 @@ pub const NONE_URI_CLIP_ASSET: Option<&UriClipAsset> = None;
pub trait UriClipAssetExt: 'static { pub trait UriClipAssetExt: 'static {
#[doc(alias = "ges_uri_clip_asset_get_duration")] #[doc(alias = "ges_uri_clip_asset_get_duration")]
#[doc(alias = "get_duration")] #[doc(alias = "get_duration")]
fn duration(&self) -> gst::ClockTime; fn duration(&self) -> Option<gst::ClockTime>;
#[doc(alias = "ges_uri_clip_asset_get_info")] #[doc(alias = "ges_uri_clip_asset_get_info")]
#[doc(alias = "get_info")] #[doc(alias = "get_info")]
@ -70,7 +70,7 @@ pub trait UriClipAssetExt: 'static {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
#[doc(alias = "ges_uri_clip_asset_get_max_duration")] #[doc(alias = "ges_uri_clip_asset_get_max_duration")]
#[doc(alias = "get_max_duration")] #[doc(alias = "get_max_duration")]
fn max_duration(&self) -> gst::ClockTime; fn max_duration(&self) -> Option<gst::ClockTime>;
#[doc(alias = "ges_uri_clip_asset_get_stream_assets")] #[doc(alias = "ges_uri_clip_asset_get_stream_assets")]
#[doc(alias = "get_stream_assets")] #[doc(alias = "get_stream_assets")]
@ -98,7 +98,7 @@ pub trait UriClipAssetExt: 'static {
} }
impl<O: IsA<UriClipAsset>> UriClipAssetExt for O { impl<O: IsA<UriClipAsset>> UriClipAssetExt for O {
fn duration(&self) -> gst::ClockTime { fn duration(&self) -> Option<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::ges_uri_clip_asset_get_duration( from_glib(ffi::ges_uri_clip_asset_get_duration(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -116,7 +116,7 @@ impl<O: IsA<UriClipAsset>> UriClipAssetExt for O {
#[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
fn max_duration(&self) -> gst::ClockTime { fn max_duration(&self) -> Option<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::ges_uri_clip_asset_get_max_duration( from_glib(ffi::ges_uri_clip_asset_get_max_duration(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,

View file

@ -45,7 +45,7 @@ impl DiscovererInfo {
#[doc(alias = "gst_discoverer_info_get_duration")] #[doc(alias = "gst_discoverer_info_get_duration")]
#[doc(alias = "get_duration")] #[doc(alias = "get_duration")]
pub fn duration(&self) -> gst::ClockTime { pub fn duration(&self) -> Option<gst::ClockTime> {
unsafe { from_glib(ffi::gst_discoverer_info_get_duration(self.to_glib_none().0)) } unsafe { from_glib(ffi::gst_discoverer_info_get_duration(self.to_glib_none().0)) }
} }

View file

@ -85,7 +85,7 @@ impl Player {
#[doc(alias = "gst_player_get_duration")] #[doc(alias = "gst_player_get_duration")]
#[doc(alias = "get_duration")] #[doc(alias = "get_duration")]
pub fn duration(&self) -> gst::ClockTime { pub fn duration(&self) -> Option<gst::ClockTime> {
unsafe { from_glib(ffi::gst_player_get_duration(self.to_glib_none().0)) } 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 = "gst_player_get_position")]
#[doc(alias = "get_position")] #[doc(alias = "get_position")]
pub fn position(&self) -> gst::ClockTime { pub fn position(&self) -> Option<gst::ClockTime> {
unsafe { from_glib(ffi::gst_player_get_position(self.to_glib_none().0)) } unsafe { from_glib(ffi::gst_player_get_position(self.to_glib_none().0)) }
} }

View file

@ -41,7 +41,7 @@ impl PlayerMediaInfo {
#[doc(alias = "gst_player_media_info_get_duration")] #[doc(alias = "gst_player_media_info_get_duration")]
#[doc(alias = "get_duration")] #[doc(alias = "get_duration")]
pub fn duration(&self) -> gst::ClockTime { pub fn duration(&self) -> Option<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_player_media_info_get_duration( from_glib(ffi::gst_player_media_info_get_duration(
self.to_glib_none().0, self.to_glib_none().0,

View file

@ -71,7 +71,7 @@ pub trait RTSPMediaExt: 'static {
#[doc(alias = "gst_rtsp_media_get_base_time")] #[doc(alias = "gst_rtsp_media_get_base_time")]
#[doc(alias = "get_base_time")] #[doc(alias = "get_base_time")]
fn base_time(&self) -> gst::ClockTime; fn base_time(&self) -> Option<gst::ClockTime>;
#[doc(alias = "gst_rtsp_media_get_buffer_size")] #[doc(alias = "gst_rtsp_media_get_buffer_size")]
#[doc(alias = "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 = "gst_rtsp_media_get_retransmission_time")]
#[doc(alias = "get_retransmission_time")] #[doc(alias = "get_retransmission_time")]
fn retransmission_time(&self) -> gst::ClockTime; fn retransmission_time(&self) -> Option<gst::ClockTime>;
#[doc(alias = "gst_rtsp_media_get_status")] #[doc(alias = "gst_rtsp_media_get_status")]
#[doc(alias = "get_status")] #[doc(alias = "get_status")]
@ -222,7 +222,7 @@ pub trait RTSPMediaExt: 'static {
//#[cfg(any(feature = "v1_18", feature = "dox"))] //#[cfg(any(feature = "v1_18", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
//#[doc(alias = "gst_rtsp_media_seek_trickmode")] //#[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<Option<gst::ClockTime>>) -> bool;
//#[cfg(any(feature = "v1_14", feature = "dox"))] //#[cfg(any(feature = "v1_14", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
@ -288,7 +288,7 @@ pub trait RTSPMediaExt: 'static {
fn set_rate_control(&self, enabled: bool); fn set_rate_control(&self, enabled: bool);
#[doc(alias = "gst_rtsp_media_set_retransmission_time")] #[doc(alias = "gst_rtsp_media_set_retransmission_time")]
fn set_retransmission_time(&self, time: gst::ClockTime); fn set_retransmission_time(&self, time: impl Into<Option<gst::ClockTime>>);
#[doc(alias = "gst_rtsp_media_set_reusable")] #[doc(alias = "gst_rtsp_media_set_reusable")]
fn set_reusable(&self, reusable: bool); fn set_reusable(&self, reusable: bool);
@ -504,7 +504,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
} }
} }
fn base_time(&self) -> gst::ClockTime { fn base_time(&self) -> Option<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_get_base_time( from_glib(ffi::gst_rtsp_media_get_base_time(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -635,7 +635,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
} }
} }
fn retransmission_time(&self) -> gst::ClockTime { fn retransmission_time(&self) -> Option<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_get_retransmission_time( from_glib(ffi::gst_rtsp_media_get_retransmission_time(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -793,7 +793,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
//#[cfg(any(feature = "v1_18", feature = "dox"))] //#[cfg(any(feature = "v1_18", feature = "dox"))]
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] //#[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<Option<gst::ClockTime>>) -> bool {
// unsafe { TODO: call ffi:gst_rtsp_media_seek_trickmode() } // unsafe { TODO: call ffi:gst_rtsp_media_seek_trickmode() }
//} //}
@ -940,11 +940,11 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
} }
} }
fn set_retransmission_time(&self, time: gst::ClockTime) { fn set_retransmission_time(&self, time: impl Into<Option<gst::ClockTime>>) {
unsafe { unsafe {
ffi::gst_rtsp_media_set_retransmission_time( ffi::gst_rtsp_media_set_retransmission_time(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
time.into_glib(), time.into().into_glib(),
); );
} }
} }

View file

@ -120,7 +120,7 @@ pub trait RTSPMediaFactoryExt: 'static {
#[doc(alias = "gst_rtsp_media_factory_get_retransmission_time")] #[doc(alias = "gst_rtsp_media_factory_get_retransmission_time")]
#[doc(alias = "get_retransmission_time")] #[doc(alias = "get_retransmission_time")]
fn retransmission_time(&self) -> gst::ClockTime; fn retransmission_time(&self) -> Option<gst::ClockTime>;
#[doc(alias = "gst_rtsp_media_factory_get_suspend_mode")] #[doc(alias = "gst_rtsp_media_factory_get_suspend_mode")]
#[doc(alias = "get_suspend_mode")] #[doc(alias = "get_suspend_mode")]
@ -211,7 +211,7 @@ pub trait RTSPMediaFactoryExt: 'static {
fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode); fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode);
#[doc(alias = "gst_rtsp_media_factory_set_retransmission_time")] #[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<Option<gst::ClockTime>>);
#[doc(alias = "gst_rtsp_media_factory_set_shared")] #[doc(alias = "gst_rtsp_media_factory_set_shared")]
fn set_shared(&self, shared: bool); fn set_shared(&self, shared: bool);
@ -463,7 +463,7 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
} }
} }
fn retransmission_time(&self) -> gst::ClockTime { fn retransmission_time(&self) -> Option<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_factory_get_retransmission_time( from_glib(ffi::gst_rtsp_media_factory_get_retransmission_time(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -680,11 +680,11 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
} }
} }
fn set_retransmission_time(&self, time: gst::ClockTime) { fn set_retransmission_time(&self, time: impl Into<Option<gst::ClockTime>>) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_retransmission_time( ffi::gst_rtsp_media_factory_set_retransmission_time(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
time.into_glib(), time.into().into_glib(),
); );
} }
} }

View file

@ -42,7 +42,7 @@ pub trait RTSPSessionMediaExt: 'static {
#[doc(alias = "gst_rtsp_session_media_get_base_time")] #[doc(alias = "gst_rtsp_session_media_get_base_time")]
#[doc(alias = "get_base_time")] #[doc(alias = "get_base_time")]
fn base_time(&self) -> gst::ClockTime; fn base_time(&self) -> Option<gst::ClockTime>;
#[doc(alias = "gst_rtsp_session_media_get_media")] #[doc(alias = "gst_rtsp_session_media_get_media")]
#[doc(alias = "get_media")] #[doc(alias = "get_media")]
@ -84,7 +84,7 @@ impl<O: IsA<RTSPSessionMedia>> RTSPSessionMediaExt for O {
// unsafe { TODO: call ffi:gst_rtsp_session_media_alloc_channels() } // unsafe { TODO: call ffi:gst_rtsp_session_media_alloc_channels() }
//} //}
fn base_time(&self) -> gst::ClockTime { fn base_time(&self) -> Option<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_session_media_get_base_time( from_glib(ffi::gst_rtsp_session_media_get_base_time(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,

View file

@ -165,7 +165,7 @@ pub trait RTSPStreamExt: 'static {
#[doc(alias = "gst_rtsp_stream_get_retransmission_time")] #[doc(alias = "gst_rtsp_stream_get_retransmission_time")]
#[doc(alias = "get_retransmission_time")] #[doc(alias = "get_retransmission_time")]
fn retransmission_time(&self) -> gst::ClockTime; fn retransmission_time(&self) -> Option<gst::ClockTime>;
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] #[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 = "gst_rtsp_stream_get_rtpinfo")]
#[doc(alias = "get_rtpinfo")] #[doc(alias = "get_rtpinfo")]
fn rtpinfo(&self) -> Option<(u32, u32, u32, gst::ClockTime)>; fn rtpinfo(&self) -> Option<(u32, u32, u32, Option<gst::ClockTime>)>;
#[doc(alias = "gst_rtsp_stream_get_rtpsession")] #[doc(alias = "gst_rtsp_stream_get_rtpsession")]
#[doc(alias = "get_rtpsession")] #[doc(alias = "get_rtpsession")]
@ -384,7 +384,7 @@ pub trait RTSPStreamExt: 'static {
fn set_retransmission_pt(&self, rtx_pt: u32); fn set_retransmission_pt(&self, rtx_pt: u32);
#[doc(alias = "gst_rtsp_stream_set_retransmission_time")] #[doc(alias = "gst_rtsp_stream_set_retransmission_time")]
fn set_retransmission_time(&self, time: gst::ClockTime); fn set_retransmission_time(&self, time: impl Into<Option<gst::ClockTime>>);
#[doc(alias = "gst_rtsp_stream_set_seqnum_offset")] #[doc(alias = "gst_rtsp_stream_set_seqnum_offset")]
fn set_seqnum_offset(&self, seqnum: u16); fn set_seqnum_offset(&self, seqnum: u16);
@ -649,7 +649,7 @@ impl<O: IsA<RTSPStream>> RTSPStreamExt for O {
unsafe { ffi::gst_rtsp_stream_get_retransmission_pt(self.as_ref().to_glib_none().0) } 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<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_get_retransmission_time( from_glib(ffi::gst_rtsp_stream_get_retransmission_time(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -695,7 +695,7 @@ impl<O: IsA<RTSPStream>> RTSPStreamExt for O {
} }
} }
fn rtpinfo(&self) -> Option<(u32, u32, u32, gst::ClockTime)> { fn rtpinfo(&self) -> Option<(u32, u32, u32, Option<gst::ClockTime>)> {
unsafe { unsafe {
let mut rtptime = mem::MaybeUninit::uninit(); let mut rtptime = mem::MaybeUninit::uninit();
let mut seq = mem::MaybeUninit::uninit(); let mut seq = mem::MaybeUninit::uninit();
@ -1148,11 +1148,11 @@ impl<O: IsA<RTSPStream>> RTSPStreamExt for O {
} }
} }
fn set_retransmission_time(&self, time: gst::ClockTime) { fn set_retransmission_time(&self, time: impl Into<Option<gst::ClockTime>>) {
unsafe { unsafe {
ffi::gst_rtsp_stream_set_retransmission_time( ffi::gst_rtsp_stream_set_retransmission_time(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
time.into_glib(), time.into().into_glib(),
); );
} }
} }

View file

@ -29,7 +29,7 @@ pub const NONE_RTSP_STREAM_TRANSPORT: Option<&RTSPStreamTransport> = None;
pub trait RTSPStreamTransportExt: 'static { pub trait RTSPStreamTransportExt: 'static {
#[doc(alias = "gst_rtsp_stream_transport_get_rtpinfo")] #[doc(alias = "gst_rtsp_stream_transport_get_rtpinfo")]
#[doc(alias = "get_rtpinfo")] #[doc(alias = "get_rtpinfo")]
fn rtpinfo(&self, start_time: gst::ClockTime) -> Option<glib::GString>; fn rtpinfo(&self, start_time: impl Into<Option<gst::ClockTime>>) -> Option<glib::GString>;
#[doc(alias = "gst_rtsp_stream_transport_get_stream")] #[doc(alias = "gst_rtsp_stream_transport_get_stream")]
#[doc(alias = "get_stream")] #[doc(alias = "get_stream")]
@ -110,11 +110,11 @@ pub trait RTSPStreamTransportExt: 'static {
} }
impl<O: IsA<RTSPStreamTransport>> RTSPStreamTransportExt for O { impl<O: IsA<RTSPStreamTransport>> RTSPStreamTransportExt for O {
fn rtpinfo(&self, start_time: gst::ClockTime) -> Option<glib::GString> { fn rtpinfo(&self, start_time: impl Into<Option<gst::ClockTime>>) -> Option<glib::GString> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_transport_get_rtpinfo( from_glib_full(ffi::gst_rtsp_stream_transport_get_rtpinfo(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
start_time.into_glib(), start_time.into().into_glib(),
)) ))
} }
} }

View file

@ -44,7 +44,7 @@ pub trait VideoEncoderExt: 'static {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_video_encoder_get_min_force_key_unit_interval")] #[doc(alias = "gst_video_encoder_get_min_force_key_unit_interval")]
#[doc(alias = "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<gst::ClockTime>;
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] #[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(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_video_encoder_set_min_force_key_unit_interval")] #[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<Option<gst::ClockTime>>);
#[doc(alias = "gst_video_encoder_set_min_pts")] #[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<Option<gst::ClockTime>>);
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
@ -113,7 +113,7 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExt for O {
#[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[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<gst::ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_video_encoder_get_min_force_key_unit_interval( from_glib(ffi::gst_video_encoder_get_min_force_key_unit_interval(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -162,18 +162,21 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExt for O {
#[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[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<Option<gst::ClockTime>>) {
unsafe { unsafe {
ffi::gst_video_encoder_set_min_force_key_unit_interval( ffi::gst_video_encoder_set_min_force_key_unit_interval(
self.as_ref().to_glib_none().0, 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<Option<gst::ClockTime>>) {
unsafe { 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(),
);
} }
} }

View file

@ -118,11 +118,11 @@ impl Bus {
//} //}
#[doc(alias = "gst_bus_timed_pop")] #[doc(alias = "gst_bus_timed_pop")]
pub fn timed_pop(&self, timeout: ClockTime) -> Option<Message> { pub fn timed_pop(&self, timeout: impl Into<Option<ClockTime>>) -> Option<Message> {
unsafe { unsafe {
from_glib_full(ffi::gst_bus_timed_pop( from_glib_full(ffi::gst_bus_timed_pop(
self.to_glib_none().0, self.to_glib_none().0,
timeout.into_glib(), timeout.into().into_glib(),
)) ))
} }
} }

View file

@ -39,7 +39,7 @@ impl Clock {
//} //}
//#[doc(alias = "gst_clock_id_get_time")] //#[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<ClockTime> {
// unsafe { TODO: call ffi:gst_clock_id_get_time() } // unsafe { TODO: call ffi:gst_clock_id_get_time() }
//} //}
@ -71,7 +71,7 @@ impl Clock {
//} //}
//#[doc(alias = "gst_clock_id_wait_async")] //#[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<Fundamental: Pointer>) -> Result<ClockSuccess, ClockError> { //pub fn id_wait_async(id: /*Unimplemented*/ClockID, func: /*Unimplemented*/Fn(&Clock, impl Into<Option<ClockTime>>, /*Unimplemented*/ClockID) -> bool, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> Result<ClockSuccess, ClockError> {
// unsafe { TODO: call ffi:gst_clock_id_wait_async() } // unsafe { TODO: call ffi:gst_clock_id_wait_async() }
//} //}
} }
@ -93,7 +93,7 @@ pub trait ClockExt: 'static {
) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)>; ) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)>;
#[doc(alias = "gst_clock_adjust_unlocked")] #[doc(alias = "gst_clock_adjust_unlocked")]
fn adjust_unlocked(&self, internal: ClockTime) -> ClockTime; fn adjust_unlocked(&self, internal: ClockTime) -> Option<ClockTime>;
#[doc(alias = "gst_clock_get_calibration")] #[doc(alias = "gst_clock_get_calibration")]
#[doc(alias = "get_calibration")] #[doc(alias = "get_calibration")]
@ -113,11 +113,11 @@ pub trait ClockExt: 'static {
#[doc(alias = "gst_clock_get_time")] #[doc(alias = "gst_clock_get_time")]
#[doc(alias = "get_time")] #[doc(alias = "get_time")]
fn time(&self) -> ClockTime; fn time(&self) -> Option<ClockTime>;
#[doc(alias = "gst_clock_get_timeout")] #[doc(alias = "gst_clock_get_timeout")]
#[doc(alias = "get_timeout")] #[doc(alias = "get_timeout")]
fn timeout(&self) -> ClockTime; fn timeout(&self) -> Option<ClockTime>;
#[doc(alias = "gst_clock_is_synced")] #[doc(alias = "gst_clock_is_synced")]
fn is_synced(&self) -> bool; fn is_synced(&self) -> bool;
@ -141,13 +141,16 @@ pub trait ClockExt: 'static {
fn set_synced(&self, synced: bool); fn set_synced(&self, synced: bool);
#[doc(alias = "gst_clock_set_timeout")] #[doc(alias = "gst_clock_set_timeout")]
fn set_timeout(&self, timeout: ClockTime); fn set_timeout(&self, timeout: impl Into<Option<ClockTime>>);
#[doc(alias = "gst_clock_unadjust_unlocked")] #[doc(alias = "gst_clock_unadjust_unlocked")]
fn unadjust_unlocked(&self, external: ClockTime) -> ClockTime; fn unadjust_unlocked(&self, external: ClockTime) -> Option<ClockTime>;
#[doc(alias = "gst_clock_wait_for_sync")] #[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<Option<ClockTime>>,
) -> Result<(), glib::error::BoolError>;
#[doc(alias = "window-size")] #[doc(alias = "window-size")]
fn window_size(&self) -> i32; fn window_size(&self) -> i32;
@ -229,10 +232,10 @@ impl<O: IsA<Clock>> ClockExt for O {
if ret { if ret {
Some(( Some((
r_squared, r_squared,
from_glib(internal), try_from_glib(internal).expect("mandatory glib value is None"),
from_glib(external), try_from_glib(external).expect("mandatory glib value is None"),
from_glib(rate_num), try_from_glib(rate_num).expect("mandatory glib value is None"),
from_glib(rate_denom), try_from_glib(rate_denom).expect("mandatory glib value is None"),
)) ))
} else { } else {
None None
@ -240,7 +243,7 @@ impl<O: IsA<Clock>> ClockExt for O {
} }
} }
fn adjust_unlocked(&self, internal: ClockTime) -> ClockTime { fn adjust_unlocked(&self, internal: ClockTime) -> Option<ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_clock_adjust_unlocked( from_glib(ffi::gst_clock_adjust_unlocked(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -267,19 +270,20 @@ impl<O: IsA<Clock>> ClockExt for O {
let rate_num = rate_num.assume_init(); let rate_num = rate_num.assume_init();
let rate_denom = rate_denom.assume_init(); let rate_denom = rate_denom.assume_init();
( (
from_glib(internal), try_from_glib(internal).expect("mandatory glib value is None"),
from_glib(external), try_from_glib(external).expect("mandatory glib value is None"),
from_glib(rate_num), try_from_glib(rate_num).expect("mandatory glib value is None"),
from_glib(rate_denom), try_from_glib(rate_denom).expect("mandatory glib value is None"),
) )
} }
} }
fn internal_time(&self) -> ClockTime { fn internal_time(&self) -> ClockTime {
unsafe { 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, self.as_ref().to_glib_none().0,
)) ))
.expect("mandatory glib value is None")
} }
} }
@ -289,17 +293,18 @@ impl<O: IsA<Clock>> ClockExt for O {
fn resolution(&self) -> ClockTime { fn resolution(&self) -> ClockTime {
unsafe { unsafe {
from_glib(ffi::gst_clock_get_resolution( try_from_glib(ffi::gst_clock_get_resolution(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
)) ))
.expect("mandatory glib value is None")
} }
} }
fn time(&self) -> ClockTime { fn time(&self) -> Option<ClockTime> {
unsafe { from_glib(ffi::gst_clock_get_time(self.as_ref().to_glib_none().0)) } unsafe { from_glib(ffi::gst_clock_get_time(self.as_ref().to_glib_none().0)) }
} }
fn timeout(&self) -> ClockTime { fn timeout(&self) -> Option<ClockTime> {
unsafe { from_glib(ffi::gst_clock_get_timeout(self.as_ref().to_glib_none().0)) } unsafe { from_glib(ffi::gst_clock_get_timeout(self.as_ref().to_glib_none().0)) }
} }
@ -339,10 +344,11 @@ impl<O: IsA<Clock>> ClockExt for O {
fn set_resolution(&self, resolution: ClockTime) -> ClockTime { fn set_resolution(&self, resolution: ClockTime) -> ClockTime {
unsafe { unsafe {
from_glib(ffi::gst_clock_set_resolution( try_from_glib(ffi::gst_clock_set_resolution(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
resolution.into_glib(), resolution.into_glib(),
)) ))
.expect("mandatory glib value is None")
} }
} }
@ -352,13 +358,13 @@ impl<O: IsA<Clock>> ClockExt for O {
} }
} }
fn set_timeout(&self, timeout: ClockTime) { fn set_timeout(&self, timeout: impl Into<Option<ClockTime>>) {
unsafe { 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<ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_clock_unadjust_unlocked( from_glib(ffi::gst_clock_unadjust_unlocked(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -367,10 +373,16 @@ impl<O: IsA<Clock>> ClockExt for O {
} }
} }
fn wait_for_sync(&self, timeout: ClockTime) -> Result<(), glib::error::BoolError> { fn wait_for_sync(
&self,
timeout: impl Into<Option<ClockTime>>,
) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib::result_from_gboolean!( 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" "Timed out waiting for sync"
) )
} }

View file

@ -30,7 +30,7 @@ pub trait ControlBindingExt: 'static {
//#[doc(alias = "gst_control_binding_get_value_array")] //#[doc(alias = "gst_control_binding_get_value_array")]
//#[doc(alias = "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<Option<ClockTime>>, interval: impl Into<Option<ClockTime>>, values: /*Unimplemented*/&[&Fundamental: Pointer]) -> bool;
#[doc(alias = "gst_control_binding_is_disabled")] #[doc(alias = "gst_control_binding_is_disabled")]
fn is_disabled(&self) -> bool; fn is_disabled(&self) -> bool;
@ -43,7 +43,7 @@ pub trait ControlBindingExt: 'static {
&self, &self,
object: &P, object: &P,
timestamp: ClockTime, timestamp: ClockTime,
last_sync: ClockTime, last_sync: impl Into<Option<ClockTime>>,
) -> bool; ) -> bool;
fn object(&self) -> Option<Object>; fn object(&self) -> Option<Object>;
@ -59,7 +59,7 @@ impl<O: IsA<ControlBinding>> 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<Option<ClockTime>>, interval: impl Into<Option<ClockTime>>, values: /*Unimplemented*/&[&Fundamental: Pointer]) -> bool {
// unsafe { TODO: call ffi:gst_control_binding_get_value_array() } // unsafe { TODO: call ffi:gst_control_binding_get_value_array() }
//} //}
@ -84,14 +84,14 @@ impl<O: IsA<ControlBinding>> ControlBindingExt for O {
&self, &self,
object: &P, object: &P,
timestamp: ClockTime, timestamp: ClockTime,
last_sync: ClockTime, last_sync: impl Into<Option<ClockTime>>,
) -> bool { ) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_control_binding_sync_values( from_glib(ffi::gst_control_binding_sync_values(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
object.as_ref().to_glib_none().0, object.as_ref().to_glib_none().0,
timestamp.into_glib(), timestamp.into_glib(),
last_sync.into_glib(), last_sync.into().into_glib(),
)) ))
} }
} }

View file

@ -105,7 +105,7 @@ pub trait ElementExt: 'static {
#[doc(alias = "gst_element_get_base_time")] #[doc(alias = "gst_element_get_base_time")]
#[doc(alias = "get_base_time")] #[doc(alias = "get_base_time")]
fn base_time(&self) -> ClockTime; fn base_time(&self) -> Option<ClockTime>;
#[doc(alias = "gst_element_get_bus")] #[doc(alias = "gst_element_get_bus")]
#[doc(alias = "get_bus")] #[doc(alias = "get_bus")]
@ -137,13 +137,13 @@ pub trait ElementExt: 'static {
#[doc(alias = "gst_element_get_start_time")] #[doc(alias = "gst_element_get_start_time")]
#[doc(alias = "get_start_time")] #[doc(alias = "get_start_time")]
fn start_time(&self) -> ClockTime; fn start_time(&self) -> Option<ClockTime>;
#[doc(alias = "gst_element_get_state")] #[doc(alias = "gst_element_get_state")]
#[doc(alias = "get_state")] #[doc(alias = "get_state")]
fn state( fn state(
&self, &self,
timeout: ClockTime, timeout: impl Into<Option<ClockTime>>,
) -> (Result<StateChangeSuccess, StateChangeError>, State, State); ) -> (Result<StateChangeSuccess, StateChangeError>, State, State);
#[doc(alias = "gst_element_get_static_pad")] #[doc(alias = "gst_element_get_static_pad")]
@ -233,7 +233,7 @@ pub trait ElementExt: 'static {
fn set_locked_state(&self, locked_state: bool) -> bool; fn set_locked_state(&self, locked_state: bool) -> bool;
#[doc(alias = "gst_element_set_start_time")] #[doc(alias = "gst_element_set_start_time")]
fn set_start_time(&self, time: ClockTime); fn set_start_time(&self, time: impl Into<Option<ClockTime>>);
#[doc(alias = "gst_element_set_state")] #[doc(alias = "gst_element_set_state")]
fn set_state(&self, state: State) -> Result<StateChangeSuccess, StateChangeError>; fn set_state(&self, state: State) -> Result<StateChangeSuccess, StateChangeError>;
@ -390,7 +390,7 @@ impl<O: IsA<Element>> ElementExt for O {
} }
} }
fn base_time(&self) -> ClockTime { fn base_time(&self) -> Option<ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_element_get_base_time( from_glib(ffi::gst_element_get_base_time(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -446,7 +446,7 @@ impl<O: IsA<Element>> ElementExt for O {
unsafe { from_glib_none(ffi::gst_element_get_factory(self.as_ref().to_glib_none().0)) } 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<ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_element_get_start_time( from_glib(ffi::gst_element_get_start_time(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -456,7 +456,7 @@ impl<O: IsA<Element>> ElementExt for O {
fn state( fn state(
&self, &self,
timeout: ClockTime, timeout: impl Into<Option<ClockTime>>,
) -> (Result<StateChangeSuccess, StateChangeError>, State, State) { ) -> (Result<StateChangeSuccess, StateChangeError>, State, State) {
unsafe { unsafe {
let mut state = mem::MaybeUninit::uninit(); let mut state = mem::MaybeUninit::uninit();
@ -465,7 +465,7 @@ impl<O: IsA<Element>> ElementExt for O {
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
state.as_mut_ptr(), state.as_mut_ptr(),
pending.as_mut_ptr(), pending.as_mut_ptr(),
timeout.into_glib(), timeout.into().into_glib(),
)); ));
let state = state.assume_init(); let state = state.assume_init();
let pending = pending.assume_init(); let pending = pending.assume_init();
@ -687,9 +687,12 @@ impl<O: IsA<Element>> ElementExt for O {
} }
} }
fn set_start_time(&self, time: ClockTime) { fn set_start_time(&self, time: impl Into<Option<ClockTime>>) {
unsafe { 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(),
);
} }
} }

View file

@ -269,7 +269,7 @@ pub fn update_registry() -> Result<(), glib::error::BoolError> {
#[doc(alias = "gst_util_get_timestamp")] #[doc(alias = "gst_util_get_timestamp")]
pub fn util_get_timestamp() -> ClockTime { pub fn util_get_timestamp() -> ClockTime {
skip_assert_initialized!(); 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")] #[doc(alias = "gst_version")]

View file

@ -74,7 +74,7 @@ pub trait GstObjectExt: 'static {
#[doc(alias = "gst_object_get_control_rate")] #[doc(alias = "gst_object_get_control_rate")]
#[doc(alias = "get_control_rate")] #[doc(alias = "get_control_rate")]
fn control_rate(&self) -> ClockTime; fn control_rate(&self) -> Option<ClockTime>;
#[doc(alias = "gst_object_get_name")] #[doc(alias = "gst_object_get_name")]
#[doc(alias = "get_name")] #[doc(alias = "get_name")]
@ -90,11 +90,15 @@ pub trait GstObjectExt: 'static {
#[doc(alias = "gst_object_get_value")] #[doc(alias = "gst_object_get_value")]
#[doc(alias = "get_value")] #[doc(alias = "get_value")]
fn value(&self, property_name: &str, timestamp: ClockTime) -> Option<glib::Value>; fn value(
&self,
property_name: &str,
timestamp: impl Into<Option<ClockTime>>,
) -> Option<glib::Value>;
//#[doc(alias = "gst_object_get_value_array")] //#[doc(alias = "gst_object_get_value_array")]
//#[doc(alias = "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<Fundamental: Pointer>) -> bool; //fn is_value_array(&self, property_name: &str, timestamp: impl Into<Option<ClockTime>>, interval: impl Into<Option<ClockTime>>, n_values: u32, values: /*Unimplemented*/Option<Fundamental: Pointer>) -> bool;
#[doc(alias = "gst_object_has_active_control_bindings")] #[doc(alias = "gst_object_has_active_control_bindings")]
fn has_active_control_bindings(&self) -> bool; fn has_active_control_bindings(&self) -> bool;
@ -118,13 +122,13 @@ pub trait GstObjectExt: 'static {
fn set_control_bindings_disabled(&self, disabled: bool); fn set_control_bindings_disabled(&self, disabled: bool);
#[doc(alias = "gst_object_set_control_rate")] #[doc(alias = "gst_object_set_control_rate")]
fn set_control_rate(&self, control_rate: ClockTime); fn set_control_rate(&self, control_rate: impl Into<Option<ClockTime>>);
#[doc(alias = "gst_object_set_parent")] #[doc(alias = "gst_object_set_parent")]
fn set_parent<P: IsA<Object>>(&self, parent: &P) -> Result<(), glib::error::BoolError>; fn set_parent<P: IsA<Object>>(&self, parent: &P) -> Result<(), glib::error::BoolError>;
#[doc(alias = "gst_object_suggest_next_sync")] #[doc(alias = "gst_object_suggest_next_sync")]
fn suggest_next_sync(&self) -> ClockTime; fn suggest_next_sync(&self) -> Option<ClockTime>;
#[doc(alias = "gst_object_sync_values")] #[doc(alias = "gst_object_sync_values")]
fn sync_values(&self, timestamp: ClockTime) -> Result<(), glib::error::BoolError>; fn sync_values(&self, timestamp: ClockTime) -> Result<(), glib::error::BoolError>;
@ -174,7 +178,7 @@ impl<O: IsA<Object>> GstObjectExt for O {
} }
} }
fn control_rate(&self) -> ClockTime { fn control_rate(&self) -> Option<ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_object_get_control_rate( from_glib(ffi::gst_object_get_control_rate(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -198,17 +202,21 @@ impl<O: IsA<Object>> GstObjectExt for O {
} }
} }
fn value(&self, property_name: &str, timestamp: ClockTime) -> Option<glib::Value> { fn value(
&self,
property_name: &str,
timestamp: impl Into<Option<ClockTime>>,
) -> Option<glib::Value> {
unsafe { unsafe {
from_glib_full(ffi::gst_object_get_value( from_glib_full(ffi::gst_object_get_value(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
property_name.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<Fundamental: Pointer>) -> bool { //fn is_value_array(&self, property_name: &str, timestamp: impl Into<Option<ClockTime>>, interval: impl Into<Option<ClockTime>>, n_values: u32, values: /*Unimplemented*/Option<Fundamental: Pointer>) -> bool {
// unsafe { TODO: call ffi:gst_object_get_value_array() } // unsafe { TODO: call ffi:gst_object_get_value_array() }
//} //}
@ -275,11 +283,11 @@ impl<O: IsA<Object>> GstObjectExt for O {
} }
} }
fn set_control_rate(&self, control_rate: ClockTime) { fn set_control_rate(&self, control_rate: impl Into<Option<ClockTime>>) {
unsafe { unsafe {
ffi::gst_object_set_control_rate( ffi::gst_object_set_control_rate(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
control_rate.into_glib(), control_rate.into().into_glib(),
); );
} }
} }
@ -296,7 +304,7 @@ impl<O: IsA<Object>> GstObjectExt for O {
} }
} }
fn suggest_next_sync(&self) -> ClockTime { fn suggest_next_sync(&self) -> Option<ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_object_suggest_next_sync( from_glib(ffi::gst_object_suggest_next_sync(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,

View file

@ -55,7 +55,7 @@ pub trait PipelineExt: 'static {
#[doc(alias = "gst_pipeline_get_latency")] #[doc(alias = "gst_pipeline_get_latency")]
#[doc(alias = "get_latency")] #[doc(alias = "get_latency")]
fn latency(&self) -> ClockTime; fn latency(&self) -> Option<ClockTime>;
#[doc(alias = "gst_pipeline_get_pipeline_clock")] #[doc(alias = "gst_pipeline_get_pipeline_clock")]
#[doc(alias = "get_pipeline_clock")] #[doc(alias = "get_pipeline_clock")]
@ -68,7 +68,7 @@ pub trait PipelineExt: 'static {
fn set_delay(&self, delay: ClockTime); fn set_delay(&self, delay: ClockTime);
#[doc(alias = "gst_pipeline_set_latency")] #[doc(alias = "gst_pipeline_set_latency")]
fn set_latency(&self, latency: ClockTime); fn set_latency(&self, latency: impl Into<Option<ClockTime>>);
#[doc(alias = "gst_pipeline_use_clock")] #[doc(alias = "gst_pipeline_use_clock")]
fn use_clock<P: IsA<Clock>>(&self, clock: Option<&P>); fn use_clock<P: IsA<Clock>>(&self, clock: Option<&P>);
@ -103,10 +103,13 @@ impl<O: IsA<Pipeline>> PipelineExt for O {
} }
fn delay(&self) -> ClockTime { 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<ClockTime> {
unsafe { unsafe {
from_glib(ffi::gst_pipeline_get_latency( from_glib(ffi::gst_pipeline_get_latency(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -137,9 +140,12 @@ impl<O: IsA<Pipeline>> PipelineExt for O {
} }
} }
fn set_latency(&self, latency: ClockTime) { fn set_latency(&self, latency: impl Into<Option<ClockTime>>) {
unsafe { 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(),
);
} }
} }