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