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