1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gstreamer.DeviceProviderFactory; 26 27 private import glib.ListG; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gstreamer.DeviceProvider; 31 private import gstreamer.PluginFeature; 32 private import gstreamerc.gstreamer; 33 public import gstreamerc.gstreamertypes; 34 35 36 /** 37 * #GstDeviceProviderFactory is used to create instances of device providers. A 38 * GstDeviceProviderfactory can be added to a #GstPlugin as it is also a 39 * #GstPluginFeature. 40 * 41 * Use the gst_device_provider_factory_find() and 42 * gst_device_provider_factory_get() functions to create device 43 * provider instances or use gst_device_provider_factory_get_by_name() as a 44 * convenient shortcut. 45 * 46 * Since: 1.4 47 */ 48 public class DeviceProviderFactory : PluginFeature 49 { 50 /** the main Gtk struct */ 51 protected GstDeviceProviderFactory* gstDeviceProviderFactory; 52 53 /** Get the main Gtk struct */ 54 public GstDeviceProviderFactory* getDeviceProviderFactoryStruct(bool transferOwnership = false) 55 { 56 if (transferOwnership) 57 ownedRef = false; 58 return gstDeviceProviderFactory; 59 } 60 61 /** the main Gtk struct as a void* */ 62 protected override void* getStruct() 63 { 64 return cast(void*)gstDeviceProviderFactory; 65 } 66 67 protected override void setStruct(GObject* obj) 68 { 69 gstDeviceProviderFactory = cast(GstDeviceProviderFactory*)obj; 70 super.setStruct(obj); 71 } 72 73 /** 74 * Sets our main struct and passes it to the parent class. 75 */ 76 public this (GstDeviceProviderFactory* gstDeviceProviderFactory, bool ownedRef = false) 77 { 78 this.gstDeviceProviderFactory = gstDeviceProviderFactory; 79 super(cast(GstPluginFeature*)gstDeviceProviderFactory, ownedRef); 80 } 81 82 83 /** */ 84 public static GType getType() 85 { 86 return gst_device_provider_factory_get_type(); 87 } 88 89 /** 90 * Search for an device provider factory of the given name. Refs the returned 91 * device provider factory; caller is responsible for unreffing. 92 * 93 * Params: 94 * name = name of factory to find 95 * 96 * Returns: #GstDeviceProviderFactory if 97 * found, %NULL otherwise 98 * 99 * Since: 1.4 100 */ 101 public static DeviceProviderFactory find(string name) 102 { 103 auto p = gst_device_provider_factory_find(Str.toStringz(name)); 104 105 if(p is null) 106 { 107 return null; 108 } 109 110 return ObjectG.getDObject!(DeviceProviderFactory)(cast(GstDeviceProviderFactory*) p, true); 111 } 112 113 /** 114 * Returns the device provider of the type defined by the given device 115 * provider factory. 116 * 117 * Params: 118 * factoryname = a named factory to instantiate 119 * 120 * Returns: a #GstDeviceProvider or %NULL 121 * if unable to create device provider 122 * 123 * Since: 1.4 124 */ 125 public static DeviceProvider getByName(string factoryname) 126 { 127 auto p = gst_device_provider_factory_get_by_name(Str.toStringz(factoryname)); 128 129 if(p is null) 130 { 131 return null; 132 } 133 134 return ObjectG.getDObject!(DeviceProvider)(cast(GstDeviceProvider*) p, true); 135 } 136 137 /** 138 * Get a list of factories with a rank greater or equal to @minrank. 139 * The list of factories is returned by decreasing rank. 140 * 141 * Params: 142 * minrank = Minimum rank 143 * 144 * Returns: a #GList of #GstDeviceProviderFactory device providers. Use 145 * gst_plugin_feature_list_free() after usage. 146 * 147 * Since: 1.4 148 */ 149 public static ListG listGetDeviceProviders(GstRank minrank) 150 { 151 auto p = gst_device_provider_factory_list_get_device_providers(minrank); 152 153 if(p is null) 154 { 155 return null; 156 } 157 158 return new ListG(cast(GList*) p, true); 159 } 160 161 /** 162 * Returns the device provider of the type defined by the given device 163 * providerfactory. 164 * 165 * Returns: the #GstDeviceProvider or %NULL 166 * if the device provider couldn't be created 167 * 168 * Since: 1.4 169 */ 170 public DeviceProvider get() 171 { 172 auto p = gst_device_provider_factory_get(gstDeviceProviderFactory); 173 174 if(p is null) 175 { 176 return null; 177 } 178 179 return ObjectG.getDObject!(DeviceProvider)(cast(GstDeviceProvider*) p, true); 180 } 181 182 /** 183 * Get the #GType for device providers managed by this factory. The type can 184 * only be retrieved if the device provider factory is loaded, which can be 185 * assured with gst_plugin_feature_load(). 186 * 187 * Returns: the #GType for device providers managed by this factory. 188 * 189 * Since: 1.4 190 */ 191 public GType getDeviceProviderType() 192 { 193 return gst_device_provider_factory_get_device_provider_type(gstDeviceProviderFactory); 194 } 195 196 /** 197 * Get the metadata on @factory with @key. 198 * 199 * Params: 200 * key = a key 201 * 202 * Returns: the metadata with @key on @factory or %NULL 203 * when there was no metadata with the given @key. 204 * 205 * Since: 1.4 206 */ 207 public string getMetadata(string key) 208 { 209 return Str.toString(gst_device_provider_factory_get_metadata(gstDeviceProviderFactory, Str.toStringz(key))); 210 } 211 212 /** 213 * Get the available keys for the metadata on @factory. 214 * 215 * Returns: a %NULL-terminated array of key strings, or %NULL when there is no 216 * metadata. Free with g_strfreev() when no longer needed. 217 * 218 * Since: 1.4 219 */ 220 public string[] getMetadataKeys() 221 { 222 auto retStr = gst_device_provider_factory_get_metadata_keys(gstDeviceProviderFactory); 223 224 scope(exit) Str.freeStringArray(retStr); 225 return Str.toStringArray(retStr); 226 } 227 228 /** 229 * Check if @factory matches all of the given @classes 230 * 231 * Params: 232 * classes = a "/" separate list of classes to match, only match 233 * if all classes are matched 234 * 235 * Returns: %TRUE if @factory matches or if @classes is %NULL. 236 * 237 * Since: 1.4 238 */ 239 public bool hasClasses(string classes) 240 { 241 return gst_device_provider_factory_has_classes(gstDeviceProviderFactory, Str.toStringz(classes)) != 0; 242 } 243 244 /** 245 * Check if @factory matches all of the given classes 246 * 247 * Params: 248 * classes = a %NULL terminated array 249 * of classes to match, only match if all classes are matched 250 * 251 * Returns: %TRUE if @factory matches. 252 * 253 * Since: 1.4 254 */ 255 public bool hasClassesv(string[] classes) 256 { 257 return gst_device_provider_factory_has_classesv(gstDeviceProviderFactory, Str.toStringzArray(classes)) != 0; 258 } 259 }