Element::set_bus() allows None for the bus parameter

This commit is contained in:
Sebastian Dröge 2017-12-20 18:10:50 +02:00
parent 241bb823d5
commit 6d7acd200d
2 changed files with 9 additions and 4 deletions

View file

@ -14151,7 +14151,10 @@ MT safe.</doc>
<doc xml:space="preserve">a #GstElement to set the bus of.</doc> <doc xml:space="preserve">a #GstElement to set the bus of.</doc>
<type name="Element" c:type="GstElement*"/> <type name="Element" c:type="GstElement*"/>
</instance-parameter> </instance-parameter>
<parameter name="bus" transfer-ownership="none"> <parameter name="bus"
transfer-ownership="none"
nullable="1"
allow-none="1">
<doc xml:space="preserve">the #GstBus to set.</doc> <doc xml:space="preserve">the #GstBus to set.</doc>
<type name="Bus" c:type="GstBus*"/> <type name="Bus" c:type="GstBus*"/>
</parameter> </parameter>

View file

@ -144,7 +144,7 @@ pub trait ElementExt {
fn set_base_time(&self, time: ClockTime); fn set_base_time(&self, time: ClockTime);
fn set_bus(&self, bus: &Bus); 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<P: IsA<Clock>>(&self, clock: &P) -> Result<(), glib::error::BoolError>;
@ -413,9 +413,11 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
} }
} }
fn set_bus(&self, bus: &Bus) { fn set_bus<'a, P: Into<Option<&'a Bus>>>(&self, bus: P) {
let bus = bus.into();
let bus = bus.to_glib_none();
unsafe { unsafe {
ffi::gst_element_set_bus(self.to_glib_none().0, bus.to_glib_none().0); ffi::gst_element_set_bus(self.to_glib_none().0, bus.0);
} }
} }