From b73b4428badd7f15fe58b3a20faddd6265735bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 12 Jul 2021 14:22:09 +0300 Subject: [PATCH] gstreamer/segment: Return a segment reference instead of the value itself from the getter --- gstreamer/src/sample.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gstreamer/src/sample.rs b/gstreamer/src/sample.rs index 5925940cf..d4540ea01 100644 --- a/gstreamer/src/sample.rs +++ b/gstreamer/src/sample.rs @@ -162,8 +162,15 @@ impl SampleRef { #[doc(alias = "get_segment")] #[doc(alias = "gst_sample_get_segment")] - pub fn segment(&self) -> Option { - unsafe { from_glib_none(ffi::gst_sample_get_segment(self.as_mut_ptr())) } + pub fn segment(&self) -> Option<&Segment> { + unsafe { + let ptr = ffi::gst_sample_get_segment(self.as_mut_ptr()); + if ptr.is_null() { + None + } else { + Some(&*(ptr as *const crate::Segment)) + } + } } #[doc(alias = "get_info")]