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  * Conversion parameters:
26  * inFile  = GstPlugin.html
27  * outPack = gstreamer
28  * outFile = Plugin
29  * strct   = GstPlugin
30  * realStrct=
31  * ctorStrct=
32  * clss    = Plugin
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_plugin_
41  * 	- gst_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- glib.Module
49  * 	- glib.ErrorG
50  * 	- glib.GException
51  * 	- glib.ListG
52  * structWrap:
53  * 	- GList* -> ListG
54  * 	- GModule* -> Module
55  * 	- GstPlugin* -> Plugin
56  * module aliases:
57  * local aliases:
58  * overrides:
59  * 	- getName
60  */
61 
62 module gstreamer.Plugin;
63 
64 public  import gstreamerc.gstreamertypes;
65 
66 private import gstreamerc.gstreamer;
67 private import glib.ConstructionException;
68 private import gobject.ObjectG;
69 
70 
71 private import glib.Str;
72 private import glib.Module;
73 private import glib.ErrorG;
74 private import glib.GException;
75 private import glib.ListG;
76 
77 
78 
79 private import gstreamer.ObjectGst;
80 
81 /**
82  * Description
83  * GStreamer is extensible, so GstElement instances can be loaded at runtime.
84  * A plugin system can provide one or more of the basic
85  * GStreamer GstPluginFeature subclasses.
86  * A plugin should export a symbol plugin_desc that is a
87  * struct of type GstPluginDesc.
88  * the plugin loader will check the version of the core library the plugin was
89  * linked against and will create a new GstPlugin. It will then call the
90  * GstPluginInitFunc function that was provided in the plugin_desc.
91  * Once you have a handle to a GstPlugin (e.g. from the GstRegistryPool), you
92  * can add any object that subclasses GstPluginFeature.
93  * Use gst_plugin_find_feature() and gst_plugin_get_feature_list() to find
94  * features in a plugin.
95  * Usually plugins are always automaticlly loaded so you don't need to call
96  * gst_plugin_load() explicitly to bring it into memory. There are options to
97  * statically link plugins to an app or even use GStreamer without a plugin
98  * repository in which case gst_plugin_load() can be needed to bring the plugin
99  * into memory.
100  */
101 public class Plugin : ObjectGst
102 {
103 	
104 	/** the main Gtk struct */
105 	protected GstPlugin* gstPlugin;
106 	
107 	
108 	public GstPlugin* getPluginStruct()
109 	{
110 		return gstPlugin;
111 	}
112 	
113 	
114 	/** the main Gtk struct as a void* */
115 	protected override void* getStruct()
116 	{
117 		return cast(void*)gstPlugin;
118 	}
119 	
120 	/**
121 	 * Sets our main struct and passes it to the parent class
122 	 */
123 	public this (GstPlugin* gstPlugin)
124 	{
125 		super(cast(GstObject*)gstPlugin);
126 		this.gstPlugin = gstPlugin;
127 	}
128 	
129 	protected override void setStruct(GObject* obj)
130 	{
131 		super.setStruct(obj);
132 		gstPlugin = cast(GstPlugin*)obj;
133 	}
134 	
135 	/**
136 	 */
137 	
138 	/**
139 	 * Get the error quark.
140 	 * Returns: The error quark used in GError messages
141 	 */
142 	public static GQuark errorQuark()
143 	{
144 		// GQuark gst_plugin_error_quark (void);
145 		return gst_plugin_error_quark();
146 	}
147 	
148 	/**
149 	 * Get the short name of the plugin
150 	 * Returns: the name of the plugin
151 	 */
152 	public override string getName()
153 	{
154 		// const gchar* gst_plugin_get_name (GstPlugin *plugin);
155 		return Str.toString(gst_plugin_get_name(gstPlugin));
156 	}
157 	
158 	/**
159 	 * Get the long descriptive name of the plugin
160 	 * Returns: the long name of the plugin
161 	 */
162 	public string getDescription()
163 	{
164 		// const gchar* gst_plugin_get_description (GstPlugin *plugin);
165 		return Str.toString(gst_plugin_get_description(gstPlugin));
166 	}
167 	
168 	/**
169 	 * get the filename of the plugin
170 	 * Returns: the filename of the plugin
171 	 */
172 	public string getFilename()
173 	{
174 		// const gchar* gst_plugin_get_filename (GstPlugin *plugin);
175 		return Str.toString(gst_plugin_get_filename(gstPlugin));
176 	}
177 	
178 	/**
179 	 * get the license of the plugin
180 	 * Returns: the license of the plugin
181 	 */
182 	public string getLicense()
183 	{
184 		// const gchar* gst_plugin_get_license (GstPlugin *plugin);
185 		return Str.toString(gst_plugin_get_license(gstPlugin));
186 	}
187 	
188 	/**
189 	 * get the package the plugin belongs to.
190 	 * Returns: the package of the plugin
191 	 */
192 	public string getPackage()
193 	{
194 		// const gchar* gst_plugin_get_package (GstPlugin *plugin);
195 		return Str.toString(gst_plugin_get_package(gstPlugin));
196 	}
197 	
198 	/**
199 	 * get the URL where the plugin comes from
200 	 * Returns: the origin of the plugin
201 	 */
202 	public string getOrigin()
203 	{
204 		// const gchar* gst_plugin_get_origin (GstPlugin *plugin);
205 		return Str.toString(gst_plugin_get_origin(gstPlugin));
206 	}
207 	
208 	/**
209 	 * get the source module the plugin belongs to.
210 	 * Returns: the source of the plugin
211 	 */
212 	public string getSource()
213 	{
214 		// const gchar* gst_plugin_get_source (GstPlugin *plugin);
215 		return Str.toString(gst_plugin_get_source(gstPlugin));
216 	}
217 	
218 	/**
219 	 * get the version of the plugin
220 	 * Returns: the version of the plugin
221 	 */
222 	public string getVersion()
223 	{
224 		// const gchar* gst_plugin_get_version (GstPlugin *plugin);
225 		return Str.toString(gst_plugin_get_version(gstPlugin));
226 	}
227 	
228 	/**
229 	 * Gets the GModule of the plugin. If the plugin isn't loaded yet, NULL is
230 	 * returned.
231 	 * Returns: module belonging to the plugin or NULL if the plugin isn't loaded yet.
232 	 */
233 	public Module getModule()
234 	{
235 		// GModule* gst_plugin_get_module (GstPlugin *plugin);
236 		auto p = gst_plugin_get_module(gstPlugin);
237 		
238 		if(p is null)
239 		{
240 			return null;
241 		}
242 		
243 		return ObjectG.getDObject!(Module)(cast(GModule*) p);
244 	}
245 	
246 	/**
247 	 * queries if the plugin is loaded into memory
248 	 * Returns: TRUE is loaded, FALSE otherwise
249 	 */
250 	public int isLoaded()
251 	{
252 		// gboolean gst_plugin_is_loaded (GstPlugin *plugin);
253 		return gst_plugin_is_loaded(gstPlugin);
254 	}
255 	
256 	/**
257 	 * A standard filter that returns TRUE when the plugin is of the
258 	 * given name.
259 	 * Params:
260 	 * name = the name of the plugin
261 	 * Returns: TRUE if the plugin is of the given name.
262 	 */
263 	public int nameFilter(string name)
264 	{
265 		// gboolean gst_plugin_name_filter (GstPlugin *plugin,  const gchar *name);
266 		return gst_plugin_name_filter(gstPlugin, Str.toStringz(name));
267 	}
268 	
269 	/**
270 	 * Loads the given plugin and refs it. Caller needs to unref after use.
271 	 * Params:
272 	 * filename = the plugin filename to load
273 	 * Returns: a reference to the existing loaded GstPlugin, a reference to the newly-loaded GstPlugin, or NULL if an error occurred.
274 	 * Throws: GException on failure.
275 	 */
276 	public static Plugin loadFile(string filename)
277 	{
278 		// GstPlugin* gst_plugin_load_file (const gchar *filename,  GError **error);
279 		GError* err = null;
280 		
281 		auto p = gst_plugin_load_file(Str.toStringz(filename), &err);
282 		
283 		if (err !is null)
284 		{
285 			throw new GException( new ErrorG(err) );
286 		}
287 		
288 		
289 		if(p is null)
290 		{
291 			return null;
292 		}
293 		
294 		return ObjectG.getDObject!(Plugin)(cast(GstPlugin*) p);
295 	}
296 	
297 	/**
298 	 * Loads plugin. Note that the *return value* is the loaded plugin; plugin is
299 	 * Returns: A reference to a loaded plugin, or NULL on error.
300 	 */
301 	public Plugin load()
302 	{
303 		// GstPlugin* gst_plugin_load (GstPlugin *plugin);
304 		auto p = gst_plugin_load(gstPlugin);
305 		
306 		if(p is null)
307 		{
308 			return null;
309 		}
310 		
311 		return ObjectG.getDObject!(Plugin)(cast(GstPlugin*) p);
312 	}
313 	
314 	/**
315 	 * Load the named plugin. Refs the plugin.
316 	 * Params:
317 	 * name = name of plugin to load
318 	 * Returns: A reference to a loaded plugin, or NULL on error.
319 	 */
320 	public static Plugin loadByName(string name)
321 	{
322 		// GstPlugin* gst_plugin_load_by_name (const gchar *name);
323 		auto p = gst_plugin_load_by_name(Str.toStringz(name));
324 		
325 		if(p is null)
326 		{
327 			return null;
328 		}
329 		
330 		return ObjectG.getDObject!(Plugin)(cast(GstPlugin*) p);
331 	}
332 	
333 	/**
334 	 * Unrefs each member of list, then frees the list.
335 	 * Params:
336 	 * list = list of GstPlugin
337 	 */
338 	public static void listFree(ListG list)
339 	{
340 		// void gst_plugin_list_free (GList *list);
341 		gst_plugin_list_free((list is null) ? null : list.getListGStruct());
342 	}
343 }