forked from mirrors/gstreamer-rs
gstreamer: Simplify MetaAPIExt
trait implementation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1325>
This commit is contained in:
parent
62f58620b7
commit
5312131069
1 changed files with 5 additions and 13 deletions
|
@ -17,20 +17,8 @@ pub unsafe trait MetaAPI: Sync + Send + Sized {
|
|||
}
|
||||
|
||||
pub trait MetaAPIExt: MetaAPI {
|
||||
#[inline]
|
||||
#[doc(alias = "gst_meta_api_type_has_tag")]
|
||||
fn has_tag(&self, tag: glib::Quark) -> bool;
|
||||
|
||||
#[doc(alias = "gst_meta_api_type_get_tags")]
|
||||
fn tags(&self) -> &[glib::GStringPtr];
|
||||
|
||||
unsafe fn from_ptr(buffer: &BufferRef, ptr: *const Self::GstType) -> MetaRef<Self>;
|
||||
unsafe fn from_mut_ptr<T>(
|
||||
buffer: &mut BufferRef,
|
||||
ptr: *mut Self::GstType,
|
||||
) -> MetaRefMut<Self, T>;
|
||||
}
|
||||
|
||||
impl<A: MetaAPI> MetaAPIExt for A {
|
||||
fn has_tag(&self, tag: glib::Quark) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_meta_api_type_has_tag(
|
||||
|
@ -40,6 +28,8 @@ impl<A: MetaAPI> MetaAPIExt for A {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[doc(alias = "gst_meta_api_type_get_tags")]
|
||||
fn tags(&self) -> &[glib::GStringPtr] {
|
||||
unsafe {
|
||||
glib::StrV::from_glib_borrow(ffi::gst_meta_api_type_get_tags(
|
||||
|
@ -89,6 +79,8 @@ impl<A: MetaAPI> MetaAPIExt for A {
|
|||
}
|
||||
}
|
||||
|
||||
impl<A: MetaAPI> MetaAPIExt for A {}
|
||||
|
||||
#[cfg(feature = "v1_16")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
|
||||
#[derive(Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq)]
|
||||
|
|
Loading…
Reference in a new issue