mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 17:41:05 +00:00
tracer: Add support for the 1.20 "plugin-feature-loaded" hook
This commit is contained in:
parent
9e77ab3212
commit
c61d913ec6
1 changed files with 12 additions and 3 deletions
|
@ -58,6 +58,9 @@ pub trait TracerImpl: TracerImplExt + GstObjectImpl + Send + Sync {
|
|||
fn pad_query_pre(&self, ts: u64, pad: &Pad, query: &Query) {}
|
||||
fn pad_unlink_post(&self, ts: u64, src: &Pad, sink: &Pad, success: bool) {}
|
||||
fn pad_unlink_pre(&self, ts: u64, src: &Pad, sink: &Pad) {}
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
fn plugin_feature_loaded(&self, ts: u64, feature: &crate::PluginFeature) {}
|
||||
}
|
||||
|
||||
unsafe impl<T: TracerImpl> IsSubclassable<T> for Tracer {}
|
||||
|
@ -71,15 +74,15 @@ pub trait TracerImplExt: ObjectSubclass {
|
|||
}
|
||||
|
||||
macro_rules! define_tracer_hooks {
|
||||
($($name: ident($quark: literal) = |$this: ident, $ts: ident, $($cb_arg: ident: $cb_arg_ty: ty),*| $impl: block;)*) => {
|
||||
($($(#[$attr:meta])* $name: ident($quark: literal) = |$this: ident, $ts: ident, $($cb_arg: ident: $cb_arg_ty: ty),*| $impl: block;)*) => {
|
||||
pub enum TracerHook {
|
||||
$($name),*
|
||||
$($(#[$attr])* $name),*
|
||||
}
|
||||
impl<T: TracerImpl> TracerImplExt for T {
|
||||
fn register_hook(&self, hook: TracerHook) {
|
||||
use TracerHook::*;
|
||||
let (hook_type, callback) = match hook {
|
||||
$($name => {
|
||||
$($(#[$attr])* $name => {
|
||||
#[allow(non_snake_case)]
|
||||
unsafe extern "C" fn callback<T: TracerImpl>(
|
||||
$this: *mut ffi::GstTracer,
|
||||
|
@ -268,4 +271,10 @@ define_tracer_hooks! {
|
|||
let sink = Pad::from_glib_borrow(sink);
|
||||
this.pad_unlink_pre(ts, &src, &sink)
|
||||
};
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
PluginFeatureLoaded("plugin-feature-loaded") = |this, ts, feature: *mut ffi::GstPluginFeature| {
|
||||
let feature = crate::PluginFeature::from_glib_borrow(feature);
|
||||
this.plugin_feature_loaded(ts, &feature)
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue