Add functions to get the FFI pointer behind a VideoFrame/VideoFrameRef

This commit is contained in:
Sebastian Dröge 2018-09-28 17:35:48 +03:00
parent e37be09eeb
commit 513914c735

View file

@ -223,6 +223,10 @@ impl VideoFrame<Readable> {
let info = self.2.clone();
VideoFrameRef(vframe, Some(self.buffer()), info, true)
}
pub fn as_ptr(&self) -> *const ffi::GstVideoFrame {
&self.0
}
}
impl VideoFrame<Writable> {
@ -319,11 +323,19 @@ impl VideoFrame<Writable> {
let info = self.2.clone();
VideoFrameRef(vframe, Some(self.buffer_mut()), info, true)
}
pub fn as_mut_ptr(&mut self) -> *mut ffi::GstVideoFrame {
&mut self.0
}
}
pub struct VideoFrameRef<T>(ffi::GstVideoFrame, Option<T>, ::VideoInfo, bool);
impl<'a> VideoFrameRef<&'a gst::BufferRef> {
pub fn as_ptr(&self) -> *const ffi::GstVideoFrame {
&self.0
}
pub fn from_buffer_ref_readable<'b>(
buffer: &'a gst::BufferRef,
info: &'b ::VideoInfo,
@ -589,6 +601,10 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
))
}
}
pub fn as_mut_ptr(&mut self) -> *mut ffi::GstVideoFrame {
&mut self.0
}
}
impl<'a> ops::Deref for VideoFrameRef<&'a mut gst::BufferRef> {