gstreamer/
plugin.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::{prelude::*, translate::*};
4
5use crate::{ffi, prelude::*, Plugin, PluginFlags, StructureRef};
6
7impl Plugin {
8    #[doc(alias = "get_cache_data")]
9    #[doc(alias = "gst_plugin_get_cache_data")]
10    pub fn cache_data(&self) -> Option<&StructureRef> {
11        unsafe {
12            let cache_data = ffi::gst_plugin_get_cache_data(self.to_glib_none().0);
13            if cache_data.is_null() {
14                None
15            } else {
16                Some(StructureRef::from_glib_borrow(cache_data))
17            }
18        }
19    }
20
21    #[doc(alias = "get_plugin_flags")]
22    pub fn plugin_flags(&self) -> PluginFlags {
23        unsafe {
24            let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
25            let _guard = self.object_lock();
26            from_glib((*ptr).flags)
27        }
28    }
29}