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 6 use crate::Caps; 7 use crate::Element; 8 use crate::ElementFactoryListType; 9 use crate::Object; 10 use crate::PadDirection; 11 use crate::PluginFeature; 12 use crate::Rank; 13 use crate::StaticPadTemplate; 14 use crate::URIType; 15 use glib::translate::*; 16 17 glib::wrapper! { 18 #[doc(alias = "GstElementFactory")] 19 pub struct ElementFactory(Object<ffi::GstElementFactory, ffi::GstElementFactoryClass>) @extends PluginFeature, Object; 20 21 match fn { 22 type_ => || ffi::gst_element_factory_get_type(), 23 } 24 } 25 26 impl ElementFactory { 27 #[doc(alias = "gst_element_factory_can_sink_all_caps")] can_sink_all_caps(&self, caps: &Caps) -> bool28 pub fn can_sink_all_caps(&self, caps: &Caps) -> bool { 29 unsafe { 30 from_glib(ffi::gst_element_factory_can_sink_all_caps( 31 self.to_glib_none().0, 32 caps.to_glib_none().0, 33 )) 34 } 35 } 36 37 #[doc(alias = "gst_element_factory_can_sink_any_caps")] can_sink_any_caps(&self, caps: &Caps) -> bool38 pub fn can_sink_any_caps(&self, caps: &Caps) -> bool { 39 unsafe { 40 from_glib(ffi::gst_element_factory_can_sink_any_caps( 41 self.to_glib_none().0, 42 caps.to_glib_none().0, 43 )) 44 } 45 } 46 47 #[doc(alias = "gst_element_factory_can_src_all_caps")] can_src_all_caps(&self, caps: &Caps) -> bool48 pub fn can_src_all_caps(&self, caps: &Caps) -> bool { 49 unsafe { 50 from_glib(ffi::gst_element_factory_can_src_all_caps( 51 self.to_glib_none().0, 52 caps.to_glib_none().0, 53 )) 54 } 55 } 56 57 #[doc(alias = "gst_element_factory_can_src_any_caps")] can_src_any_caps(&self, caps: &Caps) -> bool58 pub fn can_src_any_caps(&self, caps: &Caps) -> bool { 59 unsafe { 60 from_glib(ffi::gst_element_factory_can_src_any_caps( 61 self.to_glib_none().0, 62 caps.to_glib_none().0, 63 )) 64 } 65 } 66 67 #[doc(alias = "gst_element_factory_create")] create(&self, name: Option<&str>) -> Result<Element, glib::BoolError>68 pub fn create(&self, name: Option<&str>) -> Result<Element, glib::BoolError> { 69 unsafe { 70 Option::<_>::from_glib_none(ffi::gst_element_factory_create( 71 self.to_glib_none().0, 72 name.to_glib_none().0, 73 )) 74 .ok_or_else(|| glib::bool_error!("Failed to create element from factory")) 75 } 76 } 77 78 #[doc(alias = "gst_element_factory_get_element_type")] 79 #[doc(alias = "get_element_type")] element_type(&self) -> glib::types::Type80 pub fn element_type(&self) -> glib::types::Type { 81 unsafe { 82 from_glib(ffi::gst_element_factory_get_element_type( 83 self.to_glib_none().0, 84 )) 85 } 86 } 87 88 #[doc(alias = "gst_element_factory_get_metadata")] 89 #[doc(alias = "get_metadata")] metadata(&self, key: &str) -> Option<glib::GString>90 pub fn metadata(&self, key: &str) -> Option<glib::GString> { 91 unsafe { 92 from_glib_none(ffi::gst_element_factory_get_metadata( 93 self.to_glib_none().0, 94 key.to_glib_none().0, 95 )) 96 } 97 } 98 99 #[doc(alias = "gst_element_factory_get_metadata_keys")] 100 #[doc(alias = "get_metadata_keys")] metadata_keys(&self) -> Vec<glib::GString>101 pub fn metadata_keys(&self) -> Vec<glib::GString> { 102 unsafe { 103 FromGlibPtrContainer::from_glib_full(ffi::gst_element_factory_get_metadata_keys( 104 self.to_glib_none().0, 105 )) 106 } 107 } 108 109 #[doc(alias = "gst_element_factory_get_num_pad_templates")] 110 #[doc(alias = "get_num_pad_templates")] num_pad_templates(&self) -> u32111 pub fn num_pad_templates(&self) -> u32 { 112 unsafe { ffi::gst_element_factory_get_num_pad_templates(self.to_glib_none().0) } 113 } 114 115 #[doc(alias = "gst_element_factory_get_static_pad_templates")] 116 #[doc(alias = "get_static_pad_templates")] static_pad_templates(&self) -> Vec<StaticPadTemplate>117 pub fn static_pad_templates(&self) -> Vec<StaticPadTemplate> { 118 unsafe { 119 FromGlibPtrContainer::from_glib_none(ffi::gst_element_factory_get_static_pad_templates( 120 self.to_glib_none().0, 121 )) 122 } 123 } 124 125 #[doc(alias = "gst_element_factory_get_uri_protocols")] 126 #[doc(alias = "get_uri_protocols")] uri_protocols(&self) -> Vec<glib::GString>127 pub fn uri_protocols(&self) -> Vec<glib::GString> { 128 unsafe { 129 FromGlibPtrContainer::from_glib_none(ffi::gst_element_factory_get_uri_protocols( 130 self.to_glib_none().0, 131 )) 132 } 133 } 134 135 #[doc(alias = "gst_element_factory_get_uri_type")] 136 #[doc(alias = "get_uri_type")] uri_type(&self) -> URIType137 pub fn uri_type(&self) -> URIType { 138 unsafe { from_glib(ffi::gst_element_factory_get_uri_type(self.to_glib_none().0)) } 139 } 140 141 #[doc(alias = "gst_element_factory_has_interface")] has_interface(&self, interfacename: &str) -> bool142 pub fn has_interface(&self, interfacename: &str) -> bool { 143 unsafe { 144 from_glib(ffi::gst_element_factory_has_interface( 145 self.to_glib_none().0, 146 interfacename.to_glib_none().0, 147 )) 148 } 149 } 150 151 #[doc(alias = "gst_element_factory_list_is_type")] list_is_type(&self, type_: ElementFactoryListType) -> bool152 pub fn list_is_type(&self, type_: ElementFactoryListType) -> bool { 153 unsafe { 154 from_glib(ffi::gst_element_factory_list_is_type( 155 self.to_glib_none().0, 156 type_.into_glib(), 157 )) 158 } 159 } 160 161 #[doc(alias = "gst_element_factory_find")] find(name: &str) -> Option<ElementFactory>162 pub fn find(name: &str) -> Option<ElementFactory> { 163 assert_initialized_main_thread!(); 164 unsafe { from_glib_full(ffi::gst_element_factory_find(name.to_glib_none().0)) } 165 } 166 167 #[doc(alias = "gst_element_factory_list_filter")] list_filter( list: &[ElementFactory], caps: &Caps, direction: PadDirection, subsetonly: bool, ) -> Vec<ElementFactory>168 pub fn list_filter( 169 list: &[ElementFactory], 170 caps: &Caps, 171 direction: PadDirection, 172 subsetonly: bool, 173 ) -> Vec<ElementFactory> { 174 assert_initialized_main_thread!(); 175 unsafe { 176 FromGlibPtrContainer::from_glib_full(ffi::gst_element_factory_list_filter( 177 list.to_glib_none().0, 178 caps.to_glib_none().0, 179 direction.into_glib(), 180 subsetonly.into_glib(), 181 )) 182 } 183 } 184 185 #[doc(alias = "gst_element_factory_list_get_elements")] list_get_elements(type_: ElementFactoryListType, minrank: Rank) -> Vec<ElementFactory>186 pub fn list_get_elements(type_: ElementFactoryListType, minrank: Rank) -> Vec<ElementFactory> { 187 assert_initialized_main_thread!(); 188 unsafe { 189 FromGlibPtrContainer::from_glib_full(ffi::gst_element_factory_list_get_elements( 190 type_.into_glib(), 191 minrank.into_glib(), 192 )) 193 } 194 } 195 196 #[doc(alias = "gst_element_factory_make")] make(factoryname: &str, name: Option<&str>) -> Result<Element, glib::BoolError>197 pub fn make(factoryname: &str, name: Option<&str>) -> Result<Element, glib::BoolError> { 198 assert_initialized_main_thread!(); 199 unsafe { 200 Option::<_>::from_glib_none(ffi::gst_element_factory_make( 201 factoryname.to_glib_none().0, 202 name.to_glib_none().0, 203 )) 204 .ok_or_else(|| glib::bool_error!("Failed to create element from factory name")) 205 } 206 } 207 } 208 209 unsafe impl Send for ElementFactory {} 210 unsafe impl Sync for ElementFactory {} 211