Allow None caps for appsrc/appsink

Thanks to Guillaume Desmottes for noticing
This commit is contained in:
Sebastian Dröge 2017-11-17 16:53:37 +02:00
parent e6d72527c4
commit c9636bca2e
3 changed files with 20 additions and 4 deletions

View file

@ -55,6 +55,12 @@ trait = false
# Action signal
ignore = true
[[object.function]]
name = "set_caps"
[[object.function.parameter]]
name = "caps"
nullable = true
[[object]]
name = "GstApp.AppSrc"
status = "generate"
@ -80,6 +86,12 @@ trait = false
# Action signal
ignore = true
[[object.function]]
name = "set_caps"
[[object.function.parameter]]
name = "caps"
nullable = true
[[object]]
name = "Gst.Structure"
status = "manual"

View file

@ -97,9 +97,11 @@ impl AppSink {
// unsafe { TODO: call ffi::gst_app_sink_set_callbacks() }
//}
pub fn set_caps(&self, caps: &gst::Caps) {
pub fn set_caps<'a, P: Into<Option<&'a gst::Caps>>>(&self, caps: P) {
let caps = caps.into();
let caps = caps.to_glib_none();
unsafe {
ffi::gst_app_sink_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
ffi::gst_app_sink_set_caps(self.to_glib_none().0, caps.0);
}
}

View file

@ -101,9 +101,11 @@ impl AppSrc {
// unsafe { TODO: call ffi::gst_app_src_set_callbacks() }
//}
pub fn set_caps(&self, caps: &gst::Caps) {
pub fn set_caps<'a, P: Into<Option<&'a gst::Caps>>>(&self, caps: P) {
let caps = caps.into();
let caps = caps.to_glib_none();
unsafe {
ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.0);
}
}