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
This commit is contained in:
Philippe Renon 2022-05-16 00:45:34 +02:00
parent 268e351dde
commit 5d2f36fac3

View file

@ -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<Self> {
Borrowed::new(from_glib_full(ptr))
}
}
impl FromGlibPtrBorrow<*mut ffi::GstStructure> for Structure {
unsafe fn from_glib_borrow(ptr: *mut ffi::GstStructure) -> Borrowed<Self> {
Borrowed::new(from_glib_full(ptr))
}
}
impl glib::value::ValueType for Structure {
type Type = Self;
}