gstreamer/auto/
plugin_feature.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{ffi, Object, Plugin};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    /// This is a base class for anything that can be added to a [`Plugin`][crate::Plugin].
11    ///
12    /// This is an Abstract Base Class, you cannot instantiate it.
13    ///
14    /// # Implements
15    ///
16    /// [`PluginFeatureExt`][trait@crate::prelude::PluginFeatureExt], [`GstObjectExt`][trait@crate::prelude::GstObjectExt], [`trait@glib::ObjectExt`], [`PluginFeatureExtManual`][trait@crate::prelude::PluginFeatureExtManual]
17    #[doc(alias = "GstPluginFeature")]
18    pub struct PluginFeature(Object<ffi::GstPluginFeature, ffi::GstPluginFeatureClass>) @extends Object;
19
20    match fn {
21        type_ => || ffi::gst_plugin_feature_get_type(),
22    }
23}
24
25impl PluginFeature {
26    pub const NONE: Option<&'static PluginFeature> = None;
27}
28
29unsafe impl Send for PluginFeature {}
30unsafe impl Sync for PluginFeature {}
31
32mod sealed {
33    pub trait Sealed {}
34    impl<T: super::IsA<super::PluginFeature>> Sealed for T {}
35}
36
37/// Trait containing all [`struct@PluginFeature`] methods.
38///
39/// # Implementors
40///
41/// [`DeviceProviderFactory`][struct@crate::DeviceProviderFactory], [`ElementFactory`][struct@crate::ElementFactory], [`PluginFeature`][struct@crate::PluginFeature], [`TracerFactory`][struct@crate::TracerFactory], [`TypeFindFactory`][struct@crate::TypeFindFactory]
42pub trait PluginFeatureExt: IsA<PluginFeature> + sealed::Sealed + 'static {
43    /// Checks whether the given plugin feature is at least the required version.
44    ///
45    /// Note: Since version 1.24 this function no longer returns [`true`] if the
46    /// version is a git development version (e.g. 1.23.0.1) and the check is
47    /// for the "next" micro version, that is it will no longer return [`true`] for
48    /// e.g. 1.23.0.1 if the check is for 1.23.1. It is still possible to parse
49    /// the nano version from the string and do this check that way if needed.
50    /// ## `min_major`
51    /// minimum required major version
52    /// ## `min_minor`
53    /// minimum required minor version
54    /// ## `min_micro`
55    /// minimum required micro version
56    ///
57    /// # Returns
58    ///
59    /// [`true`] if the plugin feature has at least
60    ///  the required version, otherwise [`false`].
61    #[doc(alias = "gst_plugin_feature_check_version")]
62    fn check_version(&self, min_major: u32, min_minor: u32, min_micro: u32) -> bool {
63        unsafe {
64            from_glib(ffi::gst_plugin_feature_check_version(
65                self.as_ref().to_glib_none().0,
66                min_major,
67                min_minor,
68                min_micro,
69            ))
70        }
71    }
72
73    /// Get the plugin that provides this feature.
74    ///
75    /// # Returns
76    ///
77    /// the plugin that provides this
78    ///  feature, or [`None`]. Unref with `gst_object_unref()` when no
79    ///  longer needed.
80    #[doc(alias = "gst_plugin_feature_get_plugin")]
81    #[doc(alias = "get_plugin")]
82    fn plugin(&self) -> Option<Plugin> {
83        unsafe {
84            from_glib_full(ffi::gst_plugin_feature_get_plugin(
85                self.as_ref().to_glib_none().0,
86            ))
87        }
88    }
89
90    /// Get the name of the plugin that provides this feature.
91    ///
92    /// # Returns
93    ///
94    /// the name of the plugin that provides this
95    ///  feature, or [`None`] if the feature is not associated with a
96    ///  plugin.
97    #[doc(alias = "gst_plugin_feature_get_plugin_name")]
98    #[doc(alias = "get_plugin_name")]
99    fn plugin_name(&self) -> Option<glib::GString> {
100        unsafe {
101            from_glib_none(ffi::gst_plugin_feature_get_plugin_name(
102                self.as_ref().to_glib_none().0,
103            ))
104        }
105    }
106}
107
108impl<O: IsA<PluginFeature>> PluginFeatureExt for O {}