mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-02-01 20:02:27 +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/1290>
This commit is contained in:
parent
d77f983b02
commit
0f2c850785
2 changed files with 13 additions and 2 deletions
|
@ -104,7 +104,8 @@ pub mod meta;
|
|||
#[cfg_attr(feature = "dox", 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::{
|
||||
|
@ -320,7 +321,7 @@ pub mod prelude {
|
|||
gobject::GObjectExtManualGst,
|
||||
memory::MemoryType,
|
||||
message::MessageErrorDomain,
|
||||
meta::MetaAPI,
|
||||
meta::{MetaAPI, MetaAPIExt},
|
||||
miniobject::IsMiniObject,
|
||||
object::GstObjectExtManual,
|
||||
pad::PadExtManual,
|
||||
|
|
|
@ -14,7 +14,17 @@ pub unsafe trait MetaAPI: Sync + Send + Sized {
|
|||
|
||||
#[doc(alias = "get_meta_api")]
|
||||
fn meta_api() -> glib::Type;
|
||||
}
|
||||
|
||||
pub trait MetaAPIExt: MetaAPI {
|
||||
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 {
|
||||
#[inline]
|
||||
unsafe fn from_ptr(buffer: &BufferRef, ptr: *const Self::GstType) -> MetaRef<Self> {
|
||||
debug_assert!(!ptr.is_null());
|
||||
|
|
Loading…
Reference in a new issue