1 // Take a look at the license at the top of the repository in the LICENSE file. 2 3 use crate::Plugin; 4 use crate::PluginFlags; 5 use crate::Structure; 6 use crate::StructureRef; 7 8 use glib::prelude::*; 9 use glib::translate::*; 10 11 impl Plugin { 12 #[doc(alias = "get_cache_data")] 13 #[doc(alias = "gst_plugin_get_cache_data")] cache_data(&self) -> Option<&StructureRef>14 pub fn cache_data(&self) -> Option<&StructureRef> { 15 unsafe { 16 let cache_data = ffi::gst_plugin_get_cache_data(self.to_glib_none().0); 17 if cache_data.is_null() { 18 None 19 } else { 20 Some(StructureRef::from_glib_borrow(cache_data)) 21 } 22 } 23 } 24 25 #[doc(alias = "gst_plugin_set_cache_data")] set_cache_data(&self, cache_data: Structure)26 pub fn set_cache_data(&self, cache_data: Structure) { 27 unsafe { 28 ffi::gst_plugin_set_cache_data(self.to_glib_none().0, cache_data.into_ptr()); 29 } 30 } 31 } 32 33 pub trait GstPluginExtManual: 'static { 34 #[doc(alias = "get_plugin_flags")] plugin_flags(&self) -> PluginFlags35 fn plugin_flags(&self) -> PluginFlags; 36 37 #[doc(alias = "get_plugin_name")] plugin_name(&self) -> glib::GString38 fn plugin_name(&self) -> glib::GString; 39 } 40 41 impl<O: IsA<crate::Plugin>> GstPluginExtManual for O { plugin_flags(&self) -> PluginFlags42 fn plugin_flags(&self) -> PluginFlags { 43 unsafe { 44 let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; 45 let _guard = crate::utils::MutexGuard::lock(&(*ptr).lock); 46 from_glib((*ptr).flags) 47 } 48 } 49 plugin_name(&self) -> glib::GString50 fn plugin_name(&self) -> glib::GString { 51 unsafe { from_glib_none(ffi::gst_plugin_get_name(self.as_ref().to_glib_none().0)) } 52 } 53 } 54