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