mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 09:31:06 +00:00
Add VideoFrameRef::copy_to_ref() and ::copy_plane_to_ref()
These take a VideoFrameRef instead of a VideoFrame as destination. Next time we break API, the existing ::copy() and ::copy_plane() functions should be modified.
This commit is contained in:
parent
7a779fe940
commit
1294c28058
1 changed files with 28 additions and 0 deletions
|
@ -423,6 +423,34 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn copy_to_ref(&self, dest: &mut VideoFrameRef<&mut gst::BufferRef>) -> Result<(), glib::BoolError> {
|
||||
unsafe {
|
||||
let res: bool = from_glib(ffi::gst_video_frame_copy(&mut dest.0, &self.0));
|
||||
if res {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::BoolError("Failed to copy video frame"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn copy_plane_to_ref(
|
||||
&self,
|
||||
dest: &mut VideoFrameRef<&mut gst::BufferRef>,
|
||||
plane: u32,
|
||||
) -> Result<(), glib::BoolError> {
|
||||
skip_assert_initialized!();
|
||||
|
||||
unsafe {
|
||||
let res: bool = from_glib(ffi::gst_video_frame_copy_plane(&mut dest.0, &self.0, plane));
|
||||
if res {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(glib::BoolError("Failed to copy video frame plane"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn format(&self) -> ::VideoFormat {
|
||||
self.info().format()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue