diff --git a/gstreamer/src/event.rs b/gstreamer/src/event.rs index 711f6e24f..947abce82 100644 --- a/gstreamer/src/event.rs +++ b/gstreamer/src/event.rs @@ -372,6 +372,17 @@ impl glib::types::StaticType for EventRef { } } +impl ToOwned for EventRef { + type Owned = GstRc; + + fn to_owned(&self) -> GstRc { + unsafe { + from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) + as *mut _) + } + } +} + pub enum EventView<'a> { FlushStart(FlushStart<'a>), FlushStop(FlushStop<'a>), diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index d673bd9f7..93e2f796a 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -346,6 +346,17 @@ impl glib::types::StaticType for MessageRef { } } +impl ToOwned for MessageRef { + type Owned = GstRc; + + fn to_owned(&self) -> GstRc { + unsafe { + from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) + as *mut _) + } + } +} + pub enum MessageView<'a> { Eos(Eos<'a>), Error(Error<'a>), diff --git a/gstreamer/src/query.rs b/gstreamer/src/query.rs index 748523898..260740f5f 100644 --- a/gstreamer/src/query.rs +++ b/gstreamer/src/query.rs @@ -182,6 +182,17 @@ impl glib::types::StaticType for QueryRef { } } +impl ToOwned for QueryRef { + type Owned = GstRc; + + fn to_owned(&self) -> GstRc { + unsafe { + from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) + as *mut _) + } + } +} + pub enum QueryView { Position(Position), Duration(Duration),