mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-29 19:40:31 +00:00
gstreamer: Add support for new tracer use-structure-params API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1610>
This commit is contained in:
parent
7f59caa9b2
commit
9e3a0fd52b
1 changed files with 29 additions and 1 deletions
|
@ -11,6 +11,13 @@ use crate::{
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
pub trait TracerImpl: GstObjectImpl + ObjectSubclass<Type: IsA<Tracer>> {
|
pub trait TracerImpl: GstObjectImpl + ObjectSubclass<Type: IsA<Tracer>> {
|
||||||
|
// rustdoc-stripper-ignore-next
|
||||||
|
/// Whether to use `gst::Structure` style "params" and automatically pass
|
||||||
|
/// them to the corresponding properties during instantiation.
|
||||||
|
///
|
||||||
|
/// Setting this to `true` requires GStreamer 1.26
|
||||||
|
const USE_STRUCTURE_PARAMS: bool = false;
|
||||||
|
|
||||||
fn bin_add_post(&self, ts: u64, bin: &Bin, element: &Element, success: bool) {}
|
fn bin_add_post(&self, ts: u64, bin: &Bin, element: &Element, success: bool) {}
|
||||||
fn bin_add_pre(&self, ts: u64, bin: &Bin, element: &Element) {}
|
fn bin_add_pre(&self, ts: u64, bin: &Bin, element: &Element) {}
|
||||||
fn bin_remove_post(&self, ts: u64, bin: &Bin, success: bool) {}
|
fn bin_remove_post(&self, ts: u64, bin: &Bin, success: bool) {}
|
||||||
|
@ -83,7 +90,28 @@ pub trait TracerImpl: GstObjectImpl + ObjectSubclass<Type: IsA<Tracer>> {
|
||||||
fn plugin_feature_loaded(&self, ts: u64, feature: &crate::PluginFeature) {}
|
fn plugin_feature_loaded(&self, ts: u64, feature: &crate::PluginFeature) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: TracerImpl> IsSubclassable<T> for Tracer {}
|
unsafe impl<T: TracerImpl> IsSubclassable<T> for Tracer {
|
||||||
|
fn class_init(class: &mut glib::Class<Self>) {
|
||||||
|
Self::parent_class_init::<T>(class);
|
||||||
|
|
||||||
|
#[cfg(feature = "v1_26")]
|
||||||
|
{
|
||||||
|
let class = class.as_mut();
|
||||||
|
unsafe {
|
||||||
|
ffi::gst_tracer_class_set_use_structure_params(
|
||||||
|
class,
|
||||||
|
T::USE_STRUCTURE_PARAMS.into_glib(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "v1_26"))]
|
||||||
|
{
|
||||||
|
if T::USE_STRUCTURE_PARAMS {
|
||||||
|
panic!("Can only use `USE_STRUCTURE_PARAMS` with GStreamer 1.26 and newer");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub trait TracerImplExt: TracerImpl {
|
pub trait TracerImplExt: TracerImpl {
|
||||||
// rustdoc-stripper-ignore-next
|
// rustdoc-stripper-ignore-next
|
||||||
|
|
Loading…
Reference in a new issue