From ccf6c1a6324575595cf06bde23b0e7b377a3e352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 16 Dec 2017 18:39:33 +0200 Subject: [PATCH] Owner of structure-change and stream-status messages is mandatory --- gstreamer/src/message.rs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index 0c96bbc9a..3824b62eb 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -723,7 +723,7 @@ impl<'a> NewClock<'a> { pub struct StructureChange<'a>(&'a MessageRef); impl<'a> StructureChange<'a> { - pub fn get(&self) -> (::StructureChangeType, Option<::Element>, bool) { + pub fn get(&self) -> (::StructureChangeType, ::Element, bool) { unsafe { let mut type_ = mem::uninitialized(); let mut owner = ptr::null_mut(); @@ -743,7 +743,7 @@ impl<'a> StructureChange<'a> { pub struct StreamStatus<'a>(&'a MessageRef); impl<'a> StreamStatus<'a> { - pub fn get(&self) -> (::StreamStatusType, Option<::Element>) { + pub fn get(&self) -> (::StreamStatusType, ::Element) { unsafe { let mut type_ = mem::uninitialized(); let mut owner = ptr::null_mut(); @@ -989,19 +989,13 @@ impl<'a> StreamStart<'a> { pub struct NeedContext<'a>(&'a MessageRef); impl<'a> NeedContext<'a> { - pub fn get_context_type(&self) -> Option<&str> { + pub fn get_context_type(&self) -> &str { unsafe { let mut context_type = ptr::null(); - if from_glib(ffi::gst_message_parse_context_type( - self.0.as_mut_ptr(), - &mut context_type, - )) && !context_type.is_null() - { - Some(CStr::from_ptr(context_type).to_str().unwrap()) - } else { - None - } + ffi::gst_message_parse_context_type(self.0.as_mut_ptr(), &mut context_type); + + CStr::from_ptr(context_type).to_str().unwrap() } } }