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.PluginFeature; 26 27 private import glib.ListG; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gstreamer.ObjectGst; 31 private import gstreamer.Plugin; 32 private import gstreamerc.gstreamer; 33 public import gstreamerc.gstreamertypes; 34 35 36 /** 37 * This is a base class for anything that can be added to a #GstPlugin. 38 */ 39 public class PluginFeature : ObjectGst 40 { 41 /** the main Gtk struct */ 42 protected GstPluginFeature* gstPluginFeature; 43 44 /** Get the main Gtk struct */ 45 public GstPluginFeature* getPluginFeatureStruct(bool transferOwnership = false) 46 { 47 if (transferOwnership) 48 ownedRef = false; 49 return gstPluginFeature; 50 } 51 52 /** the main Gtk struct as a void* */ 53 protected override void* getStruct() 54 { 55 return cast(void*)gstPluginFeature; 56 } 57 58 protected override void setStruct(GObject* obj) 59 { 60 gstPluginFeature = cast(GstPluginFeature*)obj; 61 super.setStruct(obj); 62 } 63 64 /** 65 * Sets our main struct and passes it to the parent class. 66 */ 67 public this (GstPluginFeature* gstPluginFeature, bool ownedRef = false) 68 { 69 this.gstPluginFeature = gstPluginFeature; 70 super(cast(GstObject*)gstPluginFeature, ownedRef); 71 } 72 73 74 /** */ 75 public static GType getType() 76 { 77 return gst_plugin_feature_get_type(); 78 } 79 80 /** 81 * Copies the list of features. Caller should call @gst_plugin_feature_list_free 82 * when done with the list. 83 * 84 * Params: 85 * list = list 86 * of #GstPluginFeature 87 * 88 * Returns: a copy of @list, 89 * with each feature's reference count incremented. 90 */ 91 public static ListG listCopy(ListG list) 92 { 93 auto p = gst_plugin_feature_list_copy((list is null) ? null : list.getListGStruct()); 94 95 if(p is null) 96 { 97 return null; 98 } 99 100 return new ListG(cast(GList*) p, true); 101 } 102 103 /** 104 * Debug the plugin feature names in @list. 105 * 106 * Params: 107 * list = a #GList of 108 * plugin features 109 */ 110 public static void listDebug(ListG list) 111 { 112 gst_plugin_feature_list_debug((list is null) ? null : list.getListGStruct()); 113 } 114 115 /** 116 * Unrefs each member of @list, then frees the list. 117 * 118 * Params: 119 * list = list 120 * of #GstPluginFeature 121 */ 122 public static void listFree(ListG list) 123 { 124 gst_plugin_feature_list_free((list is null) ? null : list.getListGStruct()); 125 } 126 127 /** 128 * Compares the two given #GstPluginFeature instances. This function can be 129 * used as a #GCompareFunc when sorting by rank and then by name. 130 * 131 * Params: 132 * p1 = a #GstPluginFeature 133 * p2 = a #GstPluginFeature 134 * 135 * Returns: negative value if the rank of p1 > the rank of p2 or the ranks are 136 * equal but the name of p1 comes before the name of p2; zero if the rank 137 * and names are equal; positive value if the rank of p1 < the rank of p2 or the 138 * ranks are equal but the name of p2 comes before the name of p1 139 */ 140 public static int rankCompareFunc(void* p1, void* p2) 141 { 142 return gst_plugin_feature_rank_compare_func(p1, p2); 143 } 144 145 /** 146 * Checks whether the given plugin feature is at least 147 * the required version 148 * 149 * Params: 150 * minMajor = minimum required major version 151 * minMinor = minimum required minor version 152 * minMicro = minimum required micro version 153 * 154 * Returns: %TRUE if the plugin feature has at least 155 * the required version, otherwise %FALSE. 156 */ 157 public bool checkVersion(uint minMajor, uint minMinor, uint minMicro) 158 { 159 return gst_plugin_feature_check_version(gstPluginFeature, minMajor, minMinor, minMicro) != 0; 160 } 161 162 /** 163 * Get the plugin that provides this feature. 164 * 165 * Returns: the plugin that provides this 166 * feature, or %NULL. Unref with gst_object_unref() when no 167 * longer needed. 168 */ 169 public Plugin getPlugin() 170 { 171 auto p = gst_plugin_feature_get_plugin(gstPluginFeature); 172 173 if(p is null) 174 { 175 return null; 176 } 177 178 return ObjectG.getDObject!(Plugin)(cast(GstPlugin*) p, true); 179 } 180 181 /** 182 * Get the name of the plugin that provides this feature. 183 * 184 * Returns: the name of the plugin that provides this 185 * feature, or %NULL if the feature is not associated with a 186 * plugin. 187 * 188 * Since: 1.2 189 */ 190 public string getPluginName() 191 { 192 return Str.toString(gst_plugin_feature_get_plugin_name(gstPluginFeature)); 193 } 194 195 /** 196 * Gets the rank of a plugin feature. 197 * 198 * Returns: The rank of the feature 199 */ 200 public uint getRank() 201 { 202 return gst_plugin_feature_get_rank(gstPluginFeature); 203 } 204 205 /** 206 * Loads the plugin containing @feature if it's not already loaded. @feature is 207 * unaffected; use the return value instead. 208 * 209 * Normally this function is used like this: 210 * |[<!-- language="C" --> 211 * GstPluginFeature *loaded_feature; 212 * 213 * loaded_feature = gst_plugin_feature_load (feature); 214 * // presumably, we're no longer interested in the potentially-unloaded feature 215 * gst_object_unref (feature); 216 * feature = loaded_feature; 217 * ]| 218 * 219 * Returns: a reference to the loaded 220 * feature, or %NULL on error 221 */ 222 public PluginFeature load() 223 { 224 auto p = gst_plugin_feature_load(gstPluginFeature); 225 226 if(p is null) 227 { 228 return null; 229 } 230 231 return ObjectG.getDObject!(PluginFeature)(cast(GstPluginFeature*) p, true); 232 } 233 234 /** 235 * Specifies a rank for a plugin feature, so that autoplugging uses 236 * the most appropriate feature. 237 * 238 * Params: 239 * rank = rank value - higher number means more priority rank 240 */ 241 public void setRank(uint rank) 242 { 243 gst_plugin_feature_set_rank(gstPluginFeature, rank); 244 } 245 }