forked from mirrors/gstreamer-rs
Event/Message::get_structure() can return None
This commit is contained in:
parent
7342a0fb98
commit
1576ff6c32
2 changed files with 12 additions and 4 deletions
|
@ -100,10 +100,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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,10 +43,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