From febb0dfd16083010e42fc8c6089f390fb84ee488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 11 Aug 2020 13:35:39 +0300 Subject: [PATCH] video/video_frame: Allow getting an owned buffer from readable video frames In all other variations this is not possible as it would allow to circumvent the mini object writability rules. --- gstreamer-video/src/video_frame.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gstreamer-video/src/video_frame.rs b/gstreamer-video/src/video_frame.rs index f2ff4e369..16ad9ae69 100644 --- a/gstreamer-video/src/video_frame.rs +++ b/gstreamer-video/src/video_frame.rs @@ -10,7 +10,7 @@ use gst_sys; use gst_video_sys; use glib; -use glib::translate::{from_glib, Borrowed, ToGlibPtr}; +use glib::translate::{from_glib, from_glib_none, Borrowed, ToGlibPtr}; use gst; use std::fmt; @@ -283,6 +283,10 @@ impl VideoFrame { } } } + + pub fn buffer_owned(&self) -> gst::Buffer { + unsafe { from_glib_none(self.frame.buffer) } + } } impl VideoFrame {