forked from mirrors/gstreamer-rs
gstreamer: Simplify MetaAPIExt
trait implementation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1337>
This commit is contained in:
parent
6f52f3e4fa
commit
8027269c7b
1 changed files with 5 additions and 13 deletions
|
@ -17,20 +17,8 @@ pub unsafe trait MetaAPI: Sync + Send + Sized {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait MetaAPIExt: MetaAPI {
|
pub trait MetaAPIExt: MetaAPI {
|
||||||
|
#[inline]
|
||||||
#[doc(alias = "gst_meta_api_type_has_tag")]
|
#[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 {
|
fn has_tag(&self, tag: glib::Quark) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib(ffi::gst_meta_api_type_has_tag(
|
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] {
|
fn tags(&self) -> &[glib::GStringPtr] {
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::StrV::from_glib_borrow(ffi::gst_meta_api_type_get_tags(
|
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(feature = "v1_16")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
|
||||||
#[derive(Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq)]
|
||||||
|
|
Loading…
Reference in a new issue