mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-29 04:51:09 +00:00
gstreamer: Move various MetaAPI
methods to an extension trait
These don't make sense to implement any different than the default. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1284>
This commit is contained in:
parent
af57f6f17b
commit
12bed29738
2 changed files with 19 additions and 2 deletions
|
@ -104,7 +104,8 @@ pub mod meta;
|
|||
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
|
||||
pub use crate::meta::MetaSeqnum;
|
||||
pub use crate::meta::{
|
||||
Meta, MetaAPI, MetaRef, MetaRefMut, ParentBufferMeta, ProtectionMeta, ReferenceTimestampMeta,
|
||||
Meta, MetaAPI, MetaAPIExt, MetaRef, MetaRefMut, ParentBufferMeta, ProtectionMeta,
|
||||
ReferenceTimestampMeta,
|
||||
};
|
||||
pub mod buffer;
|
||||
pub use crate::buffer::{
|
||||
|
@ -322,7 +323,7 @@ pub mod prelude {
|
|||
gobject::GObjectExtManualGst,
|
||||
memory::MemoryType,
|
||||
message::MessageErrorDomain,
|
||||
meta::MetaAPI,
|
||||
meta::{MetaAPI, MetaAPIExt},
|
||||
miniobject::IsMiniObject,
|
||||
object::GstObjectExtManual,
|
||||
pad::PadExtManual,
|
||||
|
|
|
@ -14,7 +14,23 @@ pub unsafe trait MetaAPI: Sync + Send + Sized {
|
|||
|
||||
#[doc(alias = "get_meta_api")]
|
||||
fn meta_api() -> glib::Type;
|
||||
}
|
||||
|
||||
pub trait MetaAPIExt: MetaAPI {
|
||||
#[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(
|
||||
|
|
Loading…
Reference in a new issue