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