mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-29 21:11:14 +00:00
gstreamer/segment: Return a segment reference instead of the value itself from the getter
This commit is contained in:
parent
eb5df0ae26
commit
b73b4428ba
1 changed files with 9 additions and 2 deletions
|
@ -162,8 +162,15 @@ impl SampleRef {
|
||||||
|
|
||||||
#[doc(alias = "get_segment")]
|
#[doc(alias = "get_segment")]
|
||||||
#[doc(alias = "gst_sample_get_segment")]
|
#[doc(alias = "gst_sample_get_segment")]
|
||||||
pub fn segment(&self) -> Option<Segment> {
|
pub fn segment(&self) -> Option<&Segment> {
|
||||||
unsafe { from_glib_none(ffi::gst_sample_get_segment(self.as_mut_ptr())) }
|
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")]
|
#[doc(alias = "get_info")]
|
||||||
|
|
Loading…
Reference in a new issue