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() 55 { 56 return gstDeviceProviderFactory; 57 } 58 59 /** the main Gtk struct as a void* */ 60 protected override void* getStruct() 61 { 62 return cast(void*)gstDeviceProviderFactory; 63 } 64 65 protected override void setStruct(GObject* obj) 66 { 67 gstDeviceProviderFactory = cast(GstDeviceProviderFactory*)obj; 68 super.setStruct(obj); 69 } 70 71 /** 72 * Sets our main struct and passes it to the parent class. 73 */ 74 public this (GstDeviceProviderFactory* gstDeviceProviderFactory, bool ownedRef = false) 75 { 76 this.gstDeviceProviderFactory = gstDeviceProviderFactory; 77 super(cast(GstPluginFeature*)gstDeviceProviderFactory, ownedRef); 78 } 79 80 81 /** */ 82 public static GType getType() 83 { 84 return gst_device_provider_factory_get_type(); 85 } 86 87 /** 88 * Search for an device provider factory of the given name. Refs the returned 89 * device provider factory; caller is responsible for unreffing. 90 * 91 * Params: 92 * name = name of factory to find 93 * 94 * Return: #GstDeviceProviderFactory if 95 * found, %NULL otherwise 96 * 97 * Since: 1.4 98 */ 99 public static DeviceProviderFactory find(string name) 100 { 101 auto p = gst_device_provider_factory_find(Str.toStringz(name)); 102 103 if(p is null) 104 { 105 return null; 106 } 107 108 return ObjectG.getDObject!(DeviceProviderFactory)(cast(GstDeviceProviderFactory*) p, true); 109 } 110 111 /** 112 * Returns the device provider of the type defined by the given device 113 * provider factory. 114 * 115 * Params: 116 * factoryname = a named factory to instantiate 117 * 118 * Return: a #GstDeviceProvider or %NULL 119 * if unable to create device provider 120 * 121 * Since: 1.4 122 */ 123 public static DeviceProvider getByName(string factoryname) 124 { 125 auto p = gst_device_provider_factory_get_by_name(Str.toStringz(factoryname)); 126 127 if(p is null) 128 { 129 return null; 130 } 131 132 return ObjectG.getDObject!(DeviceProvider)(cast(GstDeviceProvider*) p, true); 133 } 134 135 /** 136 * Get a list of factories with a rank greater or equal to @minrank. 137 * The list of factories is returned by decreasing rank. 138 * 139 * Params: 140 * minrank = Minimum rank 141 * 142 * Return: a #GList of #GstDeviceProviderFactory device providers. Use 143 * gst_plugin_feature_list_free() after usage. 144 * 145 * Since: 1.4 146 */ 147 public static ListG listGetDeviceProviders(GstRank minrank) 148 { 149 auto p = gst_device_provider_factory_list_get_device_providers(minrank); 150 151 if(p is null) 152 { 153 return null; 154 } 155 156 return new ListG(cast(GList*) p, true); 157 } 158 159 /** 160 * Returns the device provider of the type defined by the given device 161 * providerfactory. 162 * 163 * Return: the #GstDeviceProvider or %NULL 164 * if the device provider couldn't be created 165 * 166 * Since: 1.4 167 */ 168 public DeviceProvider get() 169 { 170 auto p = gst_device_provider_factory_get(gstDeviceProviderFactory); 171 172 if(p is null) 173 { 174 return null; 175 } 176 177 return ObjectG.getDObject!(DeviceProvider)(cast(GstDeviceProvider*) p, true); 178 } 179 180 /** 181 * Get the #GType for device providers managed by this factory. The type can 182 * only be retrieved if the device provider factory is loaded, which can be 183 * assured with gst_plugin_feature_load(). 184 * 185 * Return: the #GType for device providers managed by this factory. 186 * 187 * Since: 1.4 188 */ 189 public GType getDeviceProviderType() 190 { 191 return gst_device_provider_factory_get_device_provider_type(gstDeviceProviderFactory); 192 } 193 194 /** 195 * Get the metadata on @factory with @key. 196 * 197 * Params: 198 * key = a key 199 * 200 * Return: the metadata with @key on @factory or %NULL 201 * when there was no metadata with the given @key. 202 * 203 * Since: 1.4 204 */ 205 public string getMetadata(string key) 206 { 207 return Str.toString(gst_device_provider_factory_get_metadata(gstDeviceProviderFactory, Str.toStringz(key))); 208 } 209 210 /** 211 * Get the available keys for the metadata on @factory. 212 * 213 * Return: a %NULL-terminated array of key strings, or %NULL when there is no 214 * metadata. Free with g_strfreev() when no longer needed. 215 * 216 * Since: 1.4 217 */ 218 public string[] getMetadataKeys() 219 { 220 auto retStr = gst_device_provider_factory_get_metadata_keys(gstDeviceProviderFactory); 221 222 scope(exit) Str.freeStringArray(retStr); 223 return Str.toStringArray(retStr); 224 } 225 226 /** 227 * Check if @factory matches all of the given @classes 228 * 229 * Params: 230 * classes = a "/" separate list of classes to match, only match 231 * if all classes are matched 232 * 233 * Return: %TRUE if @factory matches or if @classes is %NULL. 234 * 235 * Since: 1.4 236 */ 237 public bool hasClasses(string classes) 238 { 239 return gst_device_provider_factory_has_classes(gstDeviceProviderFactory, Str.toStringz(classes)) != 0; 240 } 241 242 /** 243 * Check if @factory matches all of the given classes 244 * 245 * Params: 246 * classes = a %NULL terminated array 247 * of classes to match, only match if all classes are matched 248 * 249 * Return: %TRUE if @factory matches. 250 * 251 * Since: 1.4 252 */ 253 public bool hasClassesv(string[] classes) 254 { 255 return gst_device_provider_factory_has_classesv(gstDeviceProviderFactory, Str.toStringzArray(classes)) != 0; 256 } 257 }