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  = gstreamer-Gst.html
27  * outPack = gstreamer
28  * outFile = gstreamer
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = GStreamer
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.ErrorG
47  * 	- glib.GException
48  * 	- glib.Str
49  * 	- glib.OptionGroup
50  * structWrap:
51  * 	- GOptionGroup* -> OptionGroup
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56 
57 module gstreamer.gstreamer;
58 
59 public  import gstreamerc.gstreamertypes;
60 
61 private import gstreamerc.gstreamer;
62 private import glib.ConstructionException;
63 private import gobject.ObjectG;
64 
65 
66 private import glib.ErrorG;
67 private import glib.GException;
68 private import glib.Str;
69 private import glib.OptionGroup;
70 
71 
72 
73 
74 /**
75  * Description
76  * GStreamer is a framework for constructing graphs of various filters
77  * (termed elements here) that will handle streaming media. Any discreet
78  * (packetizable) media type is supported, with provisions for automatically
79  * determining source type. Formatting/framing information is provided with
80  * a powerful negotiation framework. Plugins are heavily used to provide for
81  * all elements, allowing one to construct plugins outside of the GST
82  * library, even released binary-only if license require (please don't).
83  * GStreamer borrows heavily from both the OGI media pipeline and
84  * Microsoft's DirectShow, hopefully taking the best of both and leaving the
85  * cruft behind. Its interface is slowly getting stable.
86  * The GStreamer library should be initialized with
87  * gst_init() before it can be used. You should pass pointers to the main argc
88  * and argv variables so that GStreamer can process its own command line
89  * options, as shown in the following example.
90  * $(DDOC_COMMENT example)
91  * It's allowed to pass two NULL pointers to gst_init() in case you don't want
92  * to pass the command line args to GStreamer.
93  * You can also use GOption to initialize your own parameters as shown in
94  * the next code fragment:
95  * $(DDOC_COMMENT example)
96  * Use gst_version() to query the library version at runtime or use the
97  * GST_VERSION_* macros to find the version at compile time. Optionally
98  * gst_version_string() returns a printable string.
99  * The gst_deinit() call is used to clean up all internal resources used
100  * by GStreamer. It is mostly used in unit tests
101  * to check for leaks.
102  * Last reviewed on 2006-08-11 (0.10.10)
103  */
104 public class GStreamer
105 {
106 	
107 	/**
108 	 */
109 	
110 	/**
111 	 * Initializes the GStreamer library, setting up internal path lists,
112 	 * registering built-in elements, and loading standard plugins.
113 	 * This function should be called before calling any other GLib functions. If
114 	 * this is not an option, your program must initialise the GLib thread system
115 	 * using g_thread_init() before any other GLib functions are called.
116 	 * Note
117 	 * This function will terminate your program if it was unable to initialize
118 	 * GStreamer for some reason. If you want your program to fall back,
119 	 * use gst_init_check() instead.
120 	 * WARNING: This function does not work in the same way as corresponding
121 	 * functions in other glib-style libraries, such as gtk_init(). In
122 	 * particular, unknown command line options cause this function to
123 	 * abort program execution.
124 	 * Params:
125 	 * argv = pointer to application's argv
126 	 */
127 	public static void init(ref string[] argv)
128 	{
129 		// void gst_init (int *argc,  char **argv[]);
130 		char** outargv = Str.toStringzArray(argv);
131 		int argc = cast(int) argv.length;
132 		
133 		gst_init(&argc, &outargv);
134 		
135 		argv = null;
136 		foreach ( cstr; outargv[0 .. argc] )
137 		{
138 			argv ~= Str.toString(cstr);
139 		}
140 	}
141 	
142 	/**
143 	 * Initializes the GStreamer library, setting up internal path lists,
144 	 * registering built-in elements, and loading standard plugins.
145 	 * This function will return FALSE if GStreamer could not be initialized
146 	 * for some reason. If you want your program to fail fatally,
147 	 * use gst_init() instead.
148 	 * This function should be called before calling any other GLib functions. If
149 	 * this is not an option, your program must initialise the GLib thread system
150 	 * using g_thread_init() before any other GLib functions are called.
151 	 * Params:
152 	 * argv = pointer to application's argv
153 	 * Returns: TRUE if GStreamer could be initialized.
154 	 * Throws: GException on failure.
155 	 */
156 	public static int initCheck(ref string[] argv)
157 	{
158 		// gboolean gst_init_check (int *argc,  char **argv[],  GError **err);
159 		char** outargv = Str.toStringzArray(argv);
160 		int argc = cast(int) argv.length;
161 		GError* err = null;
162 		
163 		auto p = gst_init_check(&argc, &outargv, &err);
164 		
165 		if (err !is null)
166 		{
167 			throw new GException( new ErrorG(err) );
168 		}
169 		
170 		argv = null;
171 		foreach ( cstr; outargv[0 .. argc] )
172 		{
173 			argv ~= Str.toString(cstr);
174 		}
175 		return p;
176 	}
177 	
178 	/**
179 	 * Returns a GOptionGroup with GStreamer's argument specifications. The
180 	 * group is set up to use standard GOption callbacks, so when using this
181 	 * group in combination with GOption parsing methods, all argument parsing
182 	 * and initialization is automated.
183 	 * This function is useful if you want to integrate GStreamer with other
184 	 * libraries that use GOption (see g_option_context_add_group() ).
185 	 * If you use this function, you should make sure you initialise the GLib
186 	 * threading system as one of the very first things in your program
187 	 * (see the example at the beginning of this section).
188 	 * Returns: a pointer to GStreamer's option group.
189 	 */
190 	public static OptionGroup initGetOptionGroup()
191 	{
192 		// GOptionGroup* gst_init_get_option_group (void);
193 		auto p = gst_init_get_option_group();
194 		
195 		if(p is null)
196 		{
197 			return null;
198 		}
199 		
200 		return ObjectG.getDObject!(OptionGroup)(cast(GOptionGroup*) p);
201 	}
202 	
203 	/**
204 	 * Clean up any resources created by GStreamer in gst_init().
205 	 * It is normally not needed to call this function in a normal application
206 	 * as the resources will automatically be freed when the program terminates.
207 	 * This function is therefore mostly used by testsuites and other memory
208 	 * profiling tools.
209 	 * After this call GStreamer (including this method) should not be used anymore.
210 	 */
211 	public static void deinit()
212 	{
213 		// void gst_deinit (void);
214 		gst_deinit();
215 	}
216 	
217 	/**
218 	 * Gets the version number of the GStreamer library.
219 	 * Params:
220 	 * major = pointer to a guint to store the major version number
221 	 * minor = pointer to a guint to store the minor version number
222 	 * micro = pointer to a guint to store the micro version number
223 	 * nano = pointer to a guint to store the nano version number
224 	 */
225 	public static void versio(ref uint major, ref uint minor, ref uint micro, ref uint nano)
226 	{
227 		// void gst_version (guint *major,  guint *minor,  guint *micro,  guint *nano);
228 		gst_version(&major, &minor, &micro, &nano);
229 	}
230 	
231 	/**
232 	 * This function returns a string that is useful for describing this version
233 	 * of GStreamer to the outside world: user agent strings, logging, ...
234 	 * Returns: a newly allocated string describing this version of GStreamer.
235 	 */
236 	public static string versionString()
237 	{
238 		// gchar* gst_version_string (void);
239 		return Str.toString(gst_version_string());
240 	}
241 	
242 	/**
243 	 * Some functions in the GStreamer core might install a custom SIGSEGV handler
244 	 * to better catch and report errors to the application. Currently this feature
245 	 * is enabled by default when loading plugins.
246 	 * Applications might want to disable this behaviour with the
247 	 * gst_segtrap_set_enabled() function. This is typically done if the application
248 	 * wants to install its own handler without GStreamer interfering.
249 	 * Returns: TRUE if GStreamer is allowed to install a custom SIGSEGV handler. Since 0.10.10
250 	 */
251 	public static int segtrapIsEnabled()
252 	{
253 		// gboolean gst_segtrap_is_enabled (void);
254 		return gst_segtrap_is_enabled();
255 	}
256 	
257 	/**
258 	 * Applications might want to disable/enable the SIGSEGV handling of
259 	 * the GStreamer core. See gst_segtrap_is_enabled() for more information.
260 	 * Params:
261 	 * enabled = whether a custom SIGSEGV handler should be installed.
262 	 * Since 0.10.10
263 	 */
264 	public static void segtrapSetEnabled(int enabled)
265 	{
266 		// void gst_segtrap_set_enabled (gboolean enabled);
267 		gst_segtrap_set_enabled(enabled);
268 	}
269 	
270 	/**
271 	 * By default GStreamer will perform a fork() when scanning and rebuilding the
272 	 * registry file.
273 	 * Applications might want to disable this behaviour with the
274 	 * gst_registry_fork_set_enabled() function.
275 	 * Returns: TRUE if GStreamer will use fork() when rebuilding the registry. On platforms without fork(), this function will always return FALSE. Since 0.10.10
276 	 */
277 	public static int registryForkIsEnabled()
278 	{
279 		// gboolean gst_registry_fork_is_enabled (void);
280 		return gst_registry_fork_is_enabled();
281 	}
282 	
283 	/**
284 	 * Applications might want to disable/enable the usage of fork() when rebuilding
285 	 * the registry. See gst_registry_fork_is_enabled() for more information.
286 	 * On platforms without fork(), this function will have no effect on the return
287 	 * value of gst_registry_fork_is_enabled().
288 	 * Params:
289 	 * enabled = whether rebuilding the registry may fork
290 	 * Since 0.10.10
291 	 */
292 	public static void registryForkSetEnabled(int enabled)
293 	{
294 		// void gst_registry_fork_set_enabled (gboolean enabled);
295 		gst_registry_fork_set_enabled(enabled);
296 	}
297 	
298 	/**
299 	 * Forces GStreamer to re-scan its plugin paths and update the default
300 	 * plugin registry.
301 	 * Applications will almost never need to call this function, it is only
302 	 * useful if the application knows new plugins have been installed (or old
303 	 * ones removed) since the start of the application (or, to be precise, the
304 	 * first call to gst_init()) and the application wants to make use of any
305 	 * newly-installed plugins without restarting the application.
306 	 * Applications should assume that the registry update is neither atomic nor
307 	 * thread-safe and should therefore not have any dynamic pipelines running
308 	 * (including the playbin and decodebin elements) and should also not create
309 	 * any elements or access the GStreamer registry while the update is in
310 	 * progress.
311 	 * Note that this function may block for a significant amount of time.
312 	 * Returns: TRUE if the registry has been updated successfully (does not imply that there were changes), otherwise FALSE. Since 0.10.12
313 	 */
314 	public static int updateRegistry()
315 	{
316 		// gboolean gst_update_registry (void);
317 		return gst_update_registry();
318 	}
319 }