video/video_frame: Allow getting an owned buffer from readable video frames

In all other variations this is not possible as it would allow to
circumvent the mini object writability rules.
This commit is contained in:
Sebastian Dröge 2020-08-11 13:35:39 +03:00
parent dfe87cf5c9
commit febb0dfd16

View file

@ -10,7 +10,7 @@ use gst_sys;
use gst_video_sys; use gst_video_sys;
use glib; use glib;
use glib::translate::{from_glib, Borrowed, ToGlibPtr}; use glib::translate::{from_glib, from_glib_none, Borrowed, ToGlibPtr};
use gst; use gst;
use std::fmt; use std::fmt;
@ -283,6 +283,10 @@ impl VideoFrame<Readable> {
} }
} }
} }
pub fn buffer_owned(&self) -> gst::Buffer {
unsafe { from_glib_none(self.frame.buffer) }
}
} }
impl VideoFrame<Writable> { impl VideoFrame<Writable> {