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 f1f278271e
commit bc8da095c3

View file

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