Element::set_clock() allows None for the clock parameter

This commit is contained in:
Sebastian Dröge 2017-12-20 18:13:06 +02:00
parent 6d7acd200d
commit 210119d9aa
2 changed files with 9 additions and 4 deletions

View file

@ -14177,7 +14177,10 @@ MT safe.</doc>
<doc xml:space="preserve">a #GstElement to set the clock for.</doc>
<type name="Element" c:type="GstElement*"/>
</instance-parameter>
<parameter name="clock" transfer-ownership="none">
<parameter name="clock"
transfer-ownership="none"
nullable="1"
allow-none="1">
<doc xml:space="preserve">the #GstClock to set for the element.</doc>
<type name="Clock" c:type="GstClock*"/>
</parameter>

View file

@ -146,7 +146,7 @@ pub trait ElementExt {
fn set_bus<'a, P: Into<Option<&'a Bus>>>(&self, bus: P);
fn set_clock<P: IsA<Clock>>(&self, clock: &P) -> Result<(), glib::error::BoolError>;
fn set_clock<'a, P: IsA<Clock> + 'a, Q: Into<Option<&'a P>>>(&self, clock: Q) -> Result<(), glib::error::BoolError>;
fn set_context(&self, context: &Context);
@ -421,9 +421,11 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
}
}
fn set_clock<P: IsA<Clock>>(&self, clock: &P) -> Result<(), glib::error::BoolError> {
fn set_clock<'a, P: IsA<Clock> + 'a, Q: Into<Option<&'a P>>>(&self, clock: Q) -> Result<(), glib::error::BoolError> {
let clock = clock.into();
let clock = clock.to_glib_none();
unsafe {
glib::error::BoolError::from_glib(ffi::gst_element_set_clock(self.to_glib_none().0, clock.to_glib_none().0), "Failed to set clock")
glib::error::BoolError::from_glib(ffi::gst_element_set_clock(self.to_glib_none().0, clock.0), "Failed to set clock")
}
}