forked from mirrors/gstreamer-rs
gstreamer: meta: Allow to register custom meta without transform function
This commit is contained in:
parent
4f2d974aa6
commit
69ea30dbda
1 changed files with 20 additions and 1 deletions
|
@ -4,6 +4,10 @@ use std::fmt;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::ops;
|
use std::ops;
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
use std::ptr;
|
||||||
|
|
||||||
use crate::Buffer;
|
use crate::Buffer;
|
||||||
use crate::BufferRef;
|
use crate::BufferRef;
|
||||||
use crate::Caps;
|
use crate::Caps;
|
||||||
|
@ -533,13 +537,28 @@ unsafe impl Sync for CustomMeta {}
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
impl CustomMeta {
|
impl CustomMeta {
|
||||||
#[doc(alias = "gst_meta_register_custom")]
|
#[doc(alias = "gst_meta_register_custom")]
|
||||||
pub fn register<
|
pub fn register(name: &str, tags: &[&str]) {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
|
unsafe {
|
||||||
|
ffi::gst_meta_register_custom(
|
||||||
|
name.to_glib_none().0,
|
||||||
|
tags.to_glib_none().0,
|
||||||
|
None,
|
||||||
|
ptr::null_mut(),
|
||||||
|
None,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "gst_meta_register_custom")]
|
||||||
|
pub fn register_with_transform<
|
||||||
F: Fn(&mut BufferRef, &CustomMeta, &BufferRef, glib::Quark) -> bool + Send + Sync + 'static,
|
F: Fn(&mut BufferRef, &CustomMeta, &BufferRef, glib::Quark) -> bool + Send + Sync + 'static,
|
||||||
>(
|
>(
|
||||||
name: &str,
|
name: &str,
|
||||||
tags: &[&str],
|
tags: &[&str],
|
||||||
transform_func: F,
|
transform_func: F,
|
||||||
) {
|
) {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
unsafe extern "C" fn transform_func_trampoline<
|
unsafe extern "C" fn transform_func_trampoline<
|
||||||
F: Fn(&mut BufferRef, &CustomMeta, &BufferRef, glib::Quark) -> bool
|
F: Fn(&mut BufferRef, &CustomMeta, &BufferRef, glib::Quark) -> bool
|
||||||
+ Send
|
+ Send
|
||||||
|
|
Loading…
Reference in a new issue