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