Implement ToOwned for Message/Event/QueryRef

This commit is contained in:
Sebastian Dröge 2017-12-01 11:32:04 +02:00
parent 6f09e5c791
commit bc991708e5
3 changed files with 33 additions and 0 deletions

View file

@ -307,6 +307,17 @@ impl glib::types::StaticType for EventRef {
}
}
impl ToOwned for EventRef {
type Owned = GstRc<EventRef>;
fn to_owned(&self) -> GstRc<EventRef> {
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>),

View file

@ -342,6 +342,17 @@ impl glib::types::StaticType for MessageRef {
}
}
impl ToOwned for MessageRef {
type Owned = GstRc<MessageRef>;
fn to_owned(&self) -> GstRc<MessageRef> {
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>),

View file

@ -182,6 +182,17 @@ impl glib::types::StaticType for QueryRef {
}
}
impl ToOwned for QueryRef {
type Owned = GstRc<QueryRef>;
fn to_owned(&self) -> GstRc<QueryRef> {
unsafe {
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
as *mut _)
}
}
}
pub enum QueryView<T> {
Position(Position<T>),
Duration(Duration<T>),