Add VideoFrame::from_glib_full() constructor

Thus it would be possible to instantiate gst_video::VideoFrame from
FFI's VideoFrame created outside of gstreamer_video's crate.

Fixes #152
This commit is contained in:
Víctor Manuel Jáquez Leal 2018-11-16 11:21:26 +01:00
parent 533e4af669
commit 284992d83a

View file

@ -157,6 +157,12 @@ impl<T> VideoFrame<T> {
))
}
}
pub unsafe fn from_glib_full(frame: ffi::GstVideoFrame) -> Self {
let info = ::VideoInfo(ptr::read(&frame.info));
let buffer = gst::Buffer::from_glib_none(frame.buffer);
VideoFrame(frame, Some(buffer), info, PhantomData)
}
}
impl<T> Drop for VideoFrame<T> {