diff --git a/gstreamer/src/meta.rs b/gstreamer/src/meta.rs index e99e7c451..dfd57324a 100644 --- a/gstreamer/src/meta.rs +++ b/gstreamer/src/meta.rs @@ -220,6 +220,11 @@ impl<'a, T> MetaRef<'a, T> { } } + #[inline] + pub fn upcast_ref(&self) -> &MetaRef<'a, Meta> { + unsafe { &*(self as *const MetaRef<'a, T> as *const MetaRef<'a, Meta>) } + } + #[inline] pub fn as_ptr(&self) -> *const T::GstType where @@ -296,6 +301,16 @@ impl<'a, T, U> MetaRefMut<'a, T, U> { } } + #[inline] + pub fn upcast_ref(&self) -> &MetaRef<'a, Meta> { + unsafe { &*(self as *const MetaRefMut<'a, T, U> as *const MetaRef<'a, Meta>) } + } + + #[inline] + pub fn upcast_mut(&mut self) -> &MetaRefMut<'a, Meta, U> { + unsafe { &mut *(self as *mut MetaRefMut<'a, T, U> as *mut MetaRefMut<'a, Meta, U>) } + } + #[inline] pub fn as_ptr(&self) -> *const T::GstType where