forked from mirrors/gstreamer-rs
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")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
|
||||||
pub use crate::meta::MetaSeqnum;
|
pub use crate::meta::MetaSeqnum;
|
||||||
pub use crate::meta::{
|
pub use crate::meta::{
|
||||||
Meta, MetaAPI, MetaRef, MetaRefMut, ParentBufferMeta, ProtectionMeta, ReferenceTimestampMeta,
|
Meta, MetaAPI, MetaAPIExt, MetaRef, MetaRefMut, ParentBufferMeta, ProtectionMeta,
|
||||||
|
ReferenceTimestampMeta,
|
||||||
};
|
};
|
||||||
pub mod buffer;
|
pub mod buffer;
|
||||||
pub use crate::buffer::{
|
pub use crate::buffer::{
|
||||||
|
@ -322,7 +323,7 @@ pub mod prelude {
|
||||||
gobject::GObjectExtManualGst,
|
gobject::GObjectExtManualGst,
|
||||||
memory::MemoryType,
|
memory::MemoryType,
|
||||||
message::MessageErrorDomain,
|
message::MessageErrorDomain,
|
||||||
meta::MetaAPI,
|
meta::{MetaAPI, MetaAPIExt},
|
||||||
miniobject::IsMiniObject,
|
miniobject::IsMiniObject,
|
||||||
object::GstObjectExtManual,
|
object::GstObjectExtManual,
|
||||||
pad::PadExtManual,
|
pad::PadExtManual,
|
||||||
|
|
|
@ -14,7 +14,23 @@ pub unsafe trait MetaAPI: Sync + Send + Sized {
|
||||||
|
|
||||||
#[doc(alias = "get_meta_api")]
|
#[doc(alias = "get_meta_api")]
|
||||||
fn meta_api() -> glib::Type;
|
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 {
|
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(
|
||||||
|
|
Loading…
Reference in a new issue