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
32/// Trait containing all [`struct@PluginFeature`] methods.
33///
34/// # Implementors
35///
36/// [`DeviceProviderFactory`][struct@crate::DeviceProviderFactory], [`ElementFactory`][struct@crate::ElementFactory], [`PluginFeature`][struct@crate::PluginFeature], [`TracerFactory`][struct@crate::TracerFactory], [`TypeFindFactory`][struct@crate::TypeFindFactory]
37pub trait PluginFeatureExt: IsA<PluginFeature> + 'static {
38    /// Checks whether the given plugin feature is at least the required version.
39    ///
40    /// Note: Since version 1.24 this function no longer returns [`true`] if the
41    /// version is a git development version (e.g. 1.23.0.1) and the check is
42    /// for the "next" micro version, that is it will no longer return [`true`] for
43    /// e.g. 1.23.0.1 if the check is for 1.23.1. It is still possible to parse
44    /// the nano version from the string and do this check that way if needed.
45    /// ## `min_major`
46    /// minimum required major version
47    /// ## `min_minor`
48    /// minimum required minor version
49    /// ## `min_micro`
50    /// minimum required micro version
51    ///
52    /// # Returns
53    ///
54    /// [`true`] if the plugin feature has at least
55    ///  the required version, otherwise [`false`].
56    #[doc(alias = "gst_plugin_feature_check_version")]
57    fn check_version(&self, min_major: u32, min_minor: u32, min_micro: u32) -> bool {
58        unsafe {
59            from_glib(ffi::gst_plugin_feature_check_version(
60                self.as_ref().to_glib_none().0,
61                min_major,
62                min_minor,
63                min_micro,
64            ))
65        }
66    }
67
68    /// Get the plugin that provides this feature.
69    ///
70    /// # Returns
71    ///
72    /// the plugin that provides this
73    ///  feature, or [`None`]. Unref with `gst_object_unref()` when no
74    ///  longer needed.
75    #[doc(alias = "gst_plugin_feature_get_plugin")]
76    #[doc(alias = "get_plugin")]
77    fn plugin(&self) -> Option<Plugin> {
78        unsafe {
79            from_glib_full(ffi::gst_plugin_feature_get_plugin(
80                self.as_ref().to_glib_none().0,
81            ))
82        }
83    }
84
85    /// Get the name of the plugin that provides this feature.
86    ///
87    /// # Returns
88    ///
89    /// the name of the plugin that provides this
90    ///  feature, or [`None`] if the feature is not associated with a
91    ///  plugin.
92    #[doc(alias = "gst_plugin_feature_get_plugin_name")]
93    #[doc(alias = "get_plugin_name")]
94    fn plugin_name(&self) -> Option<glib::GString> {
95        unsafe {
96            from_glib_none(ffi::gst_plugin_feature_get_plugin_name(
97                self.as_ref().to_glib_none().0,
98            ))
99        }
100    }
101}
102
103impl<O: IsA<PluginFeature>> PluginFeatureExt for O {}