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-GstParse.html
27  * outPack = gstreamer
28  * outFile = Parse
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = Parse
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_parse_
41  * omit structs:
42  * omit prefixes:
43  * 	- gst_parse_context_
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- glib.ErrorG
49  * 	- glib.GException
50  * 	- gstreamer.Element
51  * 	- gstreamer.ParseContext
52  * structWrap:
53  * 	- GstElement* -> Element
54  * 	- GstParseContext* -> ParseContext
55  * module aliases:
56  * local aliases:
57  * overrides:
58  */
59 
60 module gstreamer.Parse;
61 
62 public  import gstreamerc.gstreamertypes;
63 
64 private import gstreamerc.gstreamer;
65 private import glib.ConstructionException;
66 private import gobject.ObjectG;
67 
68 private import glib.Str;
69 private import glib.ErrorG;
70 private import glib.GException;
71 private import gstreamer.Element;
72 private import gstreamer.ParseContext;
73 
74 
75 
76 /**
77  * These function allow to create a pipeline based on the syntax used in the
78  * gst-launch utility (see man-page for syntax documentation).
79  *
80  * Please note that these functions take several measures to create
81  * somewhat dynamic pipelines. Due to that such pipelines are not always
82  * reusable (set the state to NULL and back to PLAYING).
83  */
84 public class Parse
85 {
86 	
87 	/**
88 	 */
89 	
90 	/**
91 	 * Get the error quark used by the parsing subsystem.
92 	 * Returns: the quark of the parse errors.
93 	 */
94 	public static GQuark errorQuark()
95 	{
96 		// GQuark gst_parse_error_quark (void);
97 		return gst_parse_error_quark();
98 	}
99 	
100 	/**
101 	 * Create a new pipeline based on command line syntax.
102 	 * Please note that you might get a return value that is not NULL even though
103 	 * the error is set. In this case there was a recoverable parsing error and you
104 	 * can try to play the pipeline.
105 	 * Params:
106 	 * pipelineDescription = the command line describing the pipeline
107 	 * Returns: a new element on success, NULL on failure. If more than one toplevel element is specified by the pipeline_description, all elements are put into a GstPipeline, which than is returned. [transfer floating]
108 	 * Throws: GException on failure.
109 	 */
110 	public static Element launch(string pipelineDescription)
111 	{
112 		// GstElement * gst_parse_launch (const gchar *pipeline_description,  GError **error);
113 		GError* err = null;
114 		
115 		auto p = gst_parse_launch(Str.toStringz(pipelineDescription), &err);
116 		
117 		if (err !is null)
118 		{
119 			throw new GException( new ErrorG(err) );
120 		}
121 		
122 		
123 		if(p is null)
124 		{
125 			return null;
126 		}
127 		
128 		return ObjectG.getDObject!(Element)(cast(GstElement*) p);
129 	}
130 	
131 	/**
132 	 * Create a new pipeline based on command line syntax.
133 	 * Please note that you might get a return value that is not NULL even though
134 	 * the error is set. In this case there was a recoverable parsing error and you
135 	 * can try to play the pipeline.
136 	 * Params:
137 	 * pipelineDescription = the command line describing the pipeline
138 	 * context = a parse context allocated with
139 	 * gst_parse_context_new(), or NULL. [allow-none]
140 	 * flags = parsing options, or GST_PARSE_FLAG_NONE
141 	 * Returns: a new element on success, NULL on failure. If more than one toplevel element is specified by the pipeline_description, all elements are put into a GstPipeline, which then is returned. [transfer full]
142 	 * Throws: GException on failure.
143 	 */
144 	public static Element launchFull(string pipelineDescription, ParseContext context, GstParseFlags flags)
145 	{
146 		// GstElement * gst_parse_launch_full (const gchar *pipeline_description,  GstParseContext *context,  GstParseFlags flags,  GError **error);
147 		GError* err = null;
148 		
149 		auto p = gst_parse_launch_full(Str.toStringz(pipelineDescription), (context is null) ? null : context.getParseContextStruct(), flags, &err);
150 		
151 		if (err !is null)
152 		{
153 			throw new GException( new ErrorG(err) );
154 		}
155 		
156 		
157 		if(p is null)
158 		{
159 			return null;
160 		}
161 		
162 		return ObjectG.getDObject!(Element)(cast(GstElement*) p);
163 	}
164 	
165 	/**
166 	 * Create a new element based on command line syntax.
167 	 * error will contain an error message if an erroneuos pipeline is specified.
168 	 * An error does not mean that the pipeline could not be constructed.
169 	 * Params:
170 	 * argv = null-terminated array of arguments. [in][array zero-terminated=1]
171 	 * Returns: a new element on success and NULL on failure. [transfer full]
172 	 * Throws: GException on failure.
173 	 */
174 	public static Element launchv(string[] argv)
175 	{
176 		// GstElement * gst_parse_launchv (const gchar **argv,  GError **error);
177 		GError* err = null;
178 		
179 		auto p = gst_parse_launchv(Str.toStringzArray(argv), &err);
180 		
181 		if (err !is null)
182 		{
183 			throw new GException( new ErrorG(err) );
184 		}
185 		
186 		
187 		if(p is null)
188 		{
189 			return null;
190 		}
191 		
192 		return ObjectG.getDObject!(Element)(cast(GstElement*) p);
193 	}
194 	
195 	/**
196 	 * Create a new element based on command line syntax.
197 	 * error will contain an error message if an erroneous pipeline is specified.
198 	 * An error does not mean that the pipeline could not be constructed.
199 	 * Params:
200 	 * argv = null-terminated array of arguments. [in][array zero-terminated=1]
201 	 * context = a parse context allocated with
202 	 * gst_parse_context_new(), or NULL. [allow-none]
203 	 * flags = parsing options, or GST_PARSE_FLAG_NONE
204 	 * Returns: a new element on success; on failure, either NULL or a partially-constructed bin or element will be returned and error will be set (unless you passed GST_PARSE_FLAG_FATAL_ERRORS in flags, then NULL will always be returned on failure). [transfer full]
205 	 * Throws: GException on failure.
206 	 */
207 	public static Element launchvFull(string[] argv, ParseContext context, GstParseFlags flags)
208 	{
209 		// GstElement * gst_parse_launchv_full (const gchar **argv,  GstParseContext *context,  GstParseFlags flags,  GError **error);
210 		GError* err = null;
211 		
212 		auto p = gst_parse_launchv_full(Str.toStringzArray(argv), (context is null) ? null : context.getParseContextStruct(), flags, &err);
213 		
214 		if (err !is null)
215 		{
216 			throw new GException( new ErrorG(err) );
217 		}
218 		
219 		
220 		if(p is null)
221 		{
222 			return null;
223 		}
224 		
225 		return ObjectG.getDObject!(Element)(cast(GstElement*) p);
226 	}
227 	
228 	/**
229 	 * This is a convenience wrapper around gst_parse_launch() to create a
230 	 * GstBin from a gst-launch-style pipeline description. See
231 	 * gst_parse_launch() and the gst-launch man page for details about the
232 	 * syntax. Ghost pads on the bin for unlinked source or sink pads
233 	 * within the bin can automatically be created (but only a maximum of
234 	 * one ghost pad for each direction will be created; if you expect
235 	 * multiple unlinked source pads or multiple unlinked sink pads
236 	 * and want them all ghosted, you will have to create the ghost pads
237 	 * yourself).
238 	 * Params:
239 	 * binDescription = command line describing the bin
240 	 * ghostUnlinkedPads = whether to automatically create ghost pads
241 	 * for unlinked source or sink pads within the bin
242 	 * Returns: a newly-created bin, or NULL if an error occurred. [transfer floating][type Gst.Bin]
243 	 * Throws: GException on failure.
244 	 */
245 	public static Element binFromDescription(string binDescription, int ghostUnlinkedPads)
246 	{
247 		// GstElement * gst_parse_bin_from_description (const gchar *bin_description,  gboolean ghost_unlinked_pads,  GError **err);
248 		GError* err = null;
249 		
250 		auto p = gst_parse_bin_from_description(Str.toStringz(binDescription), ghostUnlinkedPads, &err);
251 		
252 		if (err !is null)
253 		{
254 			throw new GException( new ErrorG(err) );
255 		}
256 		
257 		
258 		if(p is null)
259 		{
260 			return null;
261 		}
262 		
263 		return ObjectG.getDObject!(Element)(cast(GstElement*) p);
264 	}
265 	
266 	/**
267 	 * This is a convenience wrapper around gst_parse_launch() to create a
268 	 * GstBin from a gst-launch-style pipeline description. See
269 	 * gst_parse_launch() and the gst-launch man page for details about the
270 	 * syntax. Ghost pads on the bin for unlinked source or sink pads
271 	 * within the bin can automatically be created (but only a maximum of
272 	 * one ghost pad for each direction will be created; if you expect
273 	 * multiple unlinked source pads or multiple unlinked sink pads
274 	 * and want them all ghosted, you will have to create the ghost pads
275 	 * yourself).
276 	 * Params:
277 	 * binDescription = command line describing the bin
278 	 * ghostUnlinkedPads = whether to automatically create ghost pads
279 	 * for unlinked source or sink pads within the bin
280 	 * context = a parse context allocated with
281 	 * gst_parse_context_new(), or NULL. [transfer none][allow-none]
282 	 * flags = parsing options, or GST_PARSE_FLAG_NONE
283 	 * Returns: a newly-created element, which is guaranteed to be a bin unless GST_FLAG_NO_SINGLE_ELEMENT_BINS was passed, or NULL if an error occurred. [transfer full][type Gst.Element]
284 	 * Throws: GException on failure.
285 	 */
286 	public static Element binFromDescriptionFull(string binDescription, int ghostUnlinkedPads, ParseContext context, GstParseFlags flags)
287 	{
288 		// GstElement * gst_parse_bin_from_description_full (const gchar *bin_description,  gboolean ghost_unlinked_pads,  GstParseContext *context,  GstParseFlags flags,  GError **err);
289 		GError* err = null;
290 		
291 		auto p = gst_parse_bin_from_description_full(Str.toStringz(binDescription), ghostUnlinkedPads, (context is null) ? null : context.getParseContextStruct(), flags, &err);
292 		
293 		if (err !is null)
294 		{
295 			throw new GException( new ErrorG(err) );
296 		}
297 		
298 		
299 		if(p is null)
300 		{
301 			return null;
302 		}
303 		
304 		return ObjectG.getDObject!(Element)(cast(GstElement*) p);
305 	}
306 }