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