video: Don't return glib::Borrowed from VideoFrameRef::from_glib_borrow_mut()

For it to be usable we need a mutable reference, which Borrowed does not
provide. This should be handled via Pin at a later time, see
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/324
This commit is contained in:
Sebastian Dröge 2021-05-09 19:15:47 +03:00
parent 65fd79f973
commit 255c0ff95e

View file

@ -643,18 +643,18 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
} }
impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
pub unsafe fn from_glib_borrow_mut(frame: *mut ffi::GstVideoFrame) -> Borrowed<Self> { pub unsafe fn from_glib_borrow_mut(frame: *mut ffi::GstVideoFrame) -> Self {
assert!(!frame.is_null()); assert!(!frame.is_null());
let frame = ptr::read(frame); let frame = ptr::read(frame);
let info = crate::VideoInfo(ptr::read(&frame.info)); let info = crate::VideoInfo(ptr::read(&frame.info));
let buffer = gst::BufferRef::from_mut_ptr(frame.buffer); let buffer = gst::BufferRef::from_mut_ptr(frame.buffer);
Borrowed::new(Self { Self {
frame, frame,
buffer: Some(buffer), buffer: Some(buffer),
info, info,
unmap: false, unmap: false,
}) }
} }
pub unsafe fn from_glib_full_mut(frame: ffi::GstVideoFrame) -> Self { pub unsafe fn from_glib_full_mut(frame: ffi::GstVideoFrame) -> Self {