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