mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-21 17:11:04 +00:00
validate: Action.structure is nullable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1586>
This commit is contained in:
parent
e42b3c6bbe
commit
b941e9c56a
1 changed files with 12 additions and 4 deletions
|
@ -12,19 +12,27 @@ gst::mini_object_wrapper!(Action, ActionRef, ffi::GstValidateAction, || {
|
|||
});
|
||||
|
||||
impl ActionRef {
|
||||
pub fn structure(&self) -> &gst::StructureRef {
|
||||
pub fn structure(&self) -> Option<&gst::StructureRef> {
|
||||
unsafe {
|
||||
let action = &self.0 as *const ffi::GstValidateAction;
|
||||
|
||||
gst::StructureRef::from_glib_borrow((*action).structure)
|
||||
if (*action).structure.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(gst::StructureRef::from_glib_borrow((*action).structure))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn structure_mut(&mut self) -> &mut gst::StructureRef {
|
||||
pub fn structure_mut(&mut self) -> Option<&mut gst::StructureRef> {
|
||||
unsafe {
|
||||
let action = &mut self.0 as *mut ffi::GstValidateAction;
|
||||
|
||||
gst::StructureRef::from_glib_borrow_mut((*action).structure)
|
||||
if (*action).structure.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(gst::StructureRef::from_glib_borrow_mut((*action).structure))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue