mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-25 17:40:34 +00:00
meta: Add functions for working with meta API types directly
When working with allocation queries one only has the `glib::Type`. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1600>
This commit is contained in:
parent
486b5178e9
commit
11be6b0d2f
1 changed files with 28 additions and 9 deletions
|
@ -212,20 +212,13 @@ impl<'a, T> MetaRef<'a, T> {
|
|||
|
||||
#[inline]
|
||||
pub fn has_tag_by_quark(&self, tag: glib::Quark) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_meta_api_type_has_tag(
|
||||
self.api().into_glib(),
|
||||
tag.into_glib(),
|
||||
))
|
||||
}
|
||||
meta_api_type_has_tag_by_quark(self.api(), tag)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[doc(alias = "gst_meta_api_type_get_tags")]
|
||||
pub fn tags<'b>(&self) -> &'b [glib::GStringPtr] {
|
||||
unsafe {
|
||||
glib::StrV::from_glib_borrow(ffi::gst_meta_api_type_get_tags(self.api().into_glib()))
|
||||
}
|
||||
meta_api_type_get_tags(self.api())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -1116,6 +1109,32 @@ unsafe impl<'a> MetaTransform<'a> for MetaTransformCopy {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[doc(alias = "gst_meta_api_type_has_tag")]
|
||||
pub fn meta_api_type_has_tag<MT: MetaTag>(type_: glib::Type) -> bool {
|
||||
skip_assert_initialized!();
|
||||
meta_api_type_has_tag_by_quark(type_, MT::quark())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[doc(alias = "gst_meta_api_type_has_tag")]
|
||||
pub fn meta_api_type_has_tag_by_quark(type_: glib::Type, tag: glib::Quark) -> bool {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
from_glib(ffi::gst_meta_api_type_has_tag(
|
||||
type_.into_glib(),
|
||||
tag.into_glib(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[doc(alias = "gst_meta_api_type_get_tags")]
|
||||
pub fn meta_api_type_get_tags<'b>(type_: glib::Type) -> &'b [glib::GStringPtr] {
|
||||
skip_assert_initialized!();
|
||||
unsafe { glib::StrV::from_glib_borrow(ffi::gst_meta_api_type_get_tags(type_.into_glib())) }
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Reference in a new issue