From 5d2f36fac3f331916fa158afb2fe3a49d079c63c Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Mon, 16 May 2022 00:45:34 +0200 Subject: [PATCH] gstreamer: implement FromGlibPtrBorrow trait for gst::Structure needed for callbacks that pass GstStructure by reference for example: the PlaySignalAdapter error and warning signals needed by https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1036 --- gstreamer/src/structure.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index e2063cee5..4914ebf24 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -281,6 +281,18 @@ impl FromGlibPtrFull<*mut ffi::GstStructure> for Structure { } } +impl FromGlibPtrBorrow<*const ffi::GstStructure> for Structure { + unsafe fn from_glib_borrow(ptr: *const ffi::GstStructure) -> Borrowed { + Borrowed::new(from_glib_full(ptr)) + } +} + +impl FromGlibPtrBorrow<*mut ffi::GstStructure> for Structure { + unsafe fn from_glib_borrow(ptr: *mut ffi::GstStructure) -> Borrowed { + Borrowed::new(from_glib_full(ptr)) + } +} + impl glib::value::ValueType for Structure { type Type = Self; }