mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-28 20:41:31 +00:00
Event/Message::get_structure() can return None
This commit is contained in:
parent
affc53a515
commit
aa275d5ddb
2 changed files with 12 additions and 4 deletions
|
@ -101,10 +101,14 @@ impl EventRef {
|
|||
}
|
||||
|
||||
|
||||
pub fn get_structure(&self) -> &StructureRef {
|
||||
pub fn get_structure(&self) -> Option<&StructureRef> {
|
||||
unsafe {
|
||||
let structure = ffi::gst_event_get_structure(self.as_mut_ptr());
|
||||
StructureRef::from_glib_borrow(structure)
|
||||
if structure.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(StructureRef::from_glib_borrow(structure))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,10 +45,14 @@ impl MessageRef {
|
|||
unsafe { ffi::gst_message_get_seqnum(self.as_mut_ptr()) }
|
||||
}
|
||||
|
||||
pub fn get_structure(&self) -> &StructureRef {
|
||||
pub fn get_structure(&self) -> Option<&StructureRef> {
|
||||
unsafe {
|
||||
let structure = ffi::gst_message_get_structure(self.as_mut_ptr());
|
||||
StructureRef::from_glib_borrow(structure)
|
||||
if structure.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(StructureRef::from_glib_borrow(structure))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue