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: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gst_parse_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * - gst_parse_error_quark 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - glib.Quark 49 * - glib.ErrorG 50 * - glib.GException 51 * - gstreamer.Element 52 * structWrap: 53 * - GError* -> ErrorG 54 * - GQuark -> Quark 55 * - GstElement* -> Element 56 * module aliases: 57 * local aliases: 58 * overrides: 59 */ 60 61 module gstreamer.Parse; 62 63 public import gstreamerc.gstreamertypes; 64 65 private import gstreamerc.gstreamer; 66 private import glib.ConstructionException; 67 private import gobject.ObjectG; 68 69 70 private import glib.Str; 71 private import glib.Quark; 72 private import glib.ErrorG; 73 private import glib.GException; 74 private import gstreamer.Element; 75 76 77 78 79 /** 80 * Description 81 * These function allow to create a pipeline based on the syntax used in the 82 * gst-launch utillity. 83 */ 84 public class Parse 85 { 86 87 /** 88 * Get the error quark used by the parsing subsystem. 89 * Returns: 90 * the quark of the parse errors. 91 */ 92 public static Quark errorQuark() 93 { 94 // GQuark gst_parse_error_quark (void); 95 return new Quark( cast(uint*)gst_parse_error_quark() ); 96 } 97 98 /** 99 */ 100 101 /** 102 * Create a new pipeline based on command line syntax. 103 * Please note that you might get a return value that is not NULL even though 104 * the error is set. In this case there was a recoverable parsing error and you 105 * can try to play the pipeline. 106 * Params: 107 * pipelineDescription = the command line describing the pipeline 108 * 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. 109 * Throws: GException on failure. 110 */ 111 public static Element launch(string pipelineDescription) 112 { 113 // GstElement* gst_parse_launch (const gchar *pipeline_description, GError **error); 114 GError* err = null; 115 116 auto p = gst_parse_launch(Str.toStringz(pipelineDescription), &err); 117 118 if (err !is null) 119 { 120 throw new GException( new ErrorG(err) ); 121 } 122 123 124 if(p is null) 125 { 126 return null; 127 } 128 129 return ObjectG.getDObject!(Element)(cast(GstElement*) p); 130 } 131 132 /** 133 * Create a new element based on command line syntax. 134 * error will contain an error message if an erroneuos pipeline is specified. 135 * An error does not mean that the pipeline could not be constructed. 136 * Params: 137 * argv = null-terminated array of arguments 138 * Returns: a new element on success and NULL on failure. 139 * Throws: GException on failure. 140 */ 141 public static Element launchv(char** argv) 142 { 143 // GstElement* gst_parse_launchv (const gchar **argv, GError **error); 144 GError* err = null; 145 146 auto p = gst_parse_launchv(argv, &err); 147 148 if (err !is null) 149 { 150 throw new GException( new ErrorG(err) ); 151 } 152 153 154 if(p is null) 155 { 156 return null; 157 } 158 159 return ObjectG.getDObject!(Element)(cast(GstElement*) p); 160 } 161 162 /** 163 * This is a convenience wrapper around gst_parse_launch() to create a 164 * GstBin from a gst-launch-style pipeline description. See 165 * gst_parse_launch() and the gst-launch man page for details about the 166 * syntax. Ghost pads on the bin for unconnected source or sink pads 167 * within the bin can automatically be created (but only a maximum of 168 * one ghost pad for each direction will be created; if you expect 169 * multiple unconnected source pads or multiple unconnected sink pads 170 * and want them all ghosted, you will have to create the ghost pads 171 * yourself). 172 * Params: 173 * binDescription = command line describing the bin 174 * ghostUnconnectedPads = whether to automatically create ghost pads 175 * for unconnected source or sink pads within 176 * the bin 177 * Returns: a newly-created bin, or NULL if an error occurred. Since 0.10.3 178 * Throws: GException on failure. 179 */ 180 public static Element binFromDescription(string binDescription, int ghostUnconnectedPads) 181 { 182 // GstElement* gst_parse_bin_from_description (const gchar *bin_description, gboolean ghost_unconnected_pads, GError **err); 183 GError* err = null; 184 185 auto p = gst_parse_bin_from_description(Str.toStringz(binDescription), ghostUnconnectedPads, &err); 186 187 if (err !is null) 188 { 189 throw new GException( new ErrorG(err) ); 190 } 191 192 193 if(p is null) 194 { 195 return null; 196 } 197 198 return ObjectG.getDObject!(Element)(cast(GstElement*) p); 199 } 200 }