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 /** */ 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 * Return: 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 * Return: a newly-created 102 * element, which is guaranteed to be a bin unless 103 * GST_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 * Return: 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 * Params: 144 * pipelineDescription = the command line describing the pipeline 145 * 146 * Return: a new element on success, %NULL on failure. If 147 * more than one toplevel element is specified by the @pipeline_description, 148 * all elements are put into a #GstPipeline, which than is returned. 149 * 150 * Throws: GException on failure. 151 */ 152 public static Element launch(string pipelineDescription) 153 { 154 GError* err = null; 155 156 auto p = gst_parse_launch(Str.toStringz(pipelineDescription), &err); 157 158 if (err !is null) 159 { 160 throw new GException( new ErrorG(err) ); 161 } 162 163 if(p is null) 164 { 165 return null; 166 } 167 168 return ObjectG.getDObject!(Element)(cast(GstElement*) p); 169 } 170 171 /** 172 * Create a new pipeline based on command line syntax. 173 * Please note that you might get a return value that is not %NULL even though 174 * the @error is set. In this case there was a recoverable parsing error and you 175 * can try to play the pipeline. 176 * 177 * Params: 178 * pipelineDescription = the command line describing the pipeline 179 * context = a parse context allocated with 180 * gst_parse_context_new(), or %NULL 181 * flags = parsing options, or #GST_PARSE_FLAG_NONE 182 * 183 * Return: a new element on success, %NULL on failure. If 184 * more than one toplevel element is specified by the @pipeline_description, 185 * all elements are put into a #GstPipeline, which then is returned (unless 186 * the GST_PARSE_FLAG_PLACE_IN_BIN flag is set, in which case they are put 187 * in a #GstBin instead). 188 * 189 * Throws: GException on failure. 190 */ 191 public static Element launchFull(string pipelineDescription, ParseContext context, GstParseFlags flags) 192 { 193 GError* err = null; 194 195 auto p = gst_parse_launch_full(Str.toStringz(pipelineDescription), (context is null) ? null : context.getParseContextStruct(), flags, &err); 196 197 if (err !is null) 198 { 199 throw new GException( new ErrorG(err) ); 200 } 201 202 if(p is null) 203 { 204 return null; 205 } 206 207 return ObjectG.getDObject!(Element)(cast(GstElement*) p); 208 } 209 210 /** 211 * Create a new element based on command line syntax. 212 * @error will contain an error message if an erroneous pipeline is specified. 213 * An error does not mean that the pipeline could not be constructed. 214 * 215 * Params: 216 * argv = null-terminated array of arguments 217 * 218 * Return: a new element on success and %NULL on failure. 219 * 220 * Throws: GException on failure. 221 */ 222 public static Element launchv(string[] argv) 223 { 224 GError* err = null; 225 226 auto p = gst_parse_launchv(Str.toStringzArray(argv), &err); 227 228 if (err !is null) 229 { 230 throw new GException( new ErrorG(err) ); 231 } 232 233 if(p is null) 234 { 235 return null; 236 } 237 238 return ObjectG.getDObject!(Element)(cast(GstElement*) p); 239 } 240 241 /** 242 * Create a new element based on command line syntax. 243 * @error will contain an error message if an erroneous pipeline is specified. 244 * An error does not mean that the pipeline could not be constructed. 245 * 246 * Params: 247 * argv = null-terminated array of arguments 248 * context = a parse context allocated with 249 * gst_parse_context_new(), or %NULL 250 * flags = parsing options, or #GST_PARSE_FLAG_NONE 251 * 252 * Return: a new element on success; on failure, either %NULL 253 * or a partially-constructed bin or element will be returned and @error will 254 * be set (unless you passed #GST_PARSE_FLAG_FATAL_ERRORS in @flags, then 255 * %NULL will always be returned on failure) 256 * 257 * Throws: GException on failure. 258 */ 259 public static Element launchvFull(string[] argv, ParseContext context, GstParseFlags flags) 260 { 261 GError* err = null; 262 263 auto p = gst_parse_launchv_full(Str.toStringzArray(argv), (context is null) ? null : context.getParseContextStruct(), flags, &err); 264 265 if (err !is null) 266 { 267 throw new GException( new ErrorG(err) ); 268 } 269 270 if(p is null) 271 { 272 return null; 273 } 274 275 return ObjectG.getDObject!(Element)(cast(GstElement*) p); 276 } 277 }