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