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-Gst.html 27 * outPack = gstreamer 28 * outFile = gstreamer 29 * strct = 30 * realStrct= 31 * ctorStrct= 32 * clss = GStreamer 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gst_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.ErrorG 47 * - glib.GException 48 * - glib.Str 49 * - glib.OptionGroup 50 * structWrap: 51 * - GOptionGroup* -> OptionGroup 52 * module aliases: 53 * local aliases: 54 * overrides: 55 */ 56 57 module gstreamer.gstreamer; 58 59 public import gstreamerc.gstreamertypes; 60 61 private import gstreamerc.gstreamer; 62 private import glib.ConstructionException; 63 private import gobject.ObjectG; 64 65 private import glib.ErrorG; 66 private import glib.GException; 67 private import glib.Str; 68 private import glib.OptionGroup; 69 70 71 72 /** 73 * GStreamer is a framework for constructing graphs of various filters 74 * (termed elements here) that will handle streaming media. Any discreet 75 * (packetizable) media type is supported, with provisions for automatically 76 * determining source type. Formatting/framing information is provided with 77 * a powerful negotiation framework. Plugins are heavily used to provide for 78 * all elements, allowing one to construct plugins outside of the GST 79 * library, even released binary-only if license require (please don't). 80 * GStreamer covers a wide range of use cases including: playback, recording, 81 * editing, serving streams, voice over ip and video calls. 82 * 83 * The GStreamer library should be initialized with 84 * gst_init() before it can be used. You should pass pointers to the main argc 85 * and argv variables so that GStreamer can process its own command line 86 * options, as shown in the following example. 87 * 88 * $(DDOC_COMMENT example) 89 * 90 * It's allowed to pass two NULL pointers to gst_init() in case you don't want 91 * to pass the command line args to GStreamer. 92 * 93 * You can also use GOption to initialize your own parameters as shown in 94 * the next code fragment: 95 * 96 * $(DDOC_COMMENT example) 97 * 98 * Use gst_version() to query the library version at runtime or use the 99 * GST_VERSION_* macros to find the version at compile time. Optionally 100 * gst_version_string() returns a printable string. 101 * 102 * The gst_deinit() call is used to clean up all internal resources used 103 * by GStreamer. It is mostly used in unit tests 104 * to check for leaks. 105 * 106 * Last reviewed on 2006-08-11 (0.10.10) 107 */ 108 public class GStreamer 109 { 110 111 /** 112 */ 113 114 /** 115 * Initializes the GStreamer library, setting up internal path lists, 116 * registering built-in elements, and loading standard plugins. 117 * Unless the plugin registry is disabled at compile time, the registry will be 118 * loaded. By default this will also check if the registry cache needs to be 119 * updated and rescan all plugins if needed. See gst_update_registry() for 120 * details and section 121 * Running GStreamer Applications 122 * for how to disable automatic registry updates. 123 * Note 124 * This function will terminate your program if it was unable to initialize 125 * GStreamer for some reason. If you want your program to fall back, 126 * use gst_init_check() instead. 127 * WARNING: This function does not work in the same way as corresponding 128 * functions in other glib-style libraries, such as gtk_init(). In 129 * particular, unknown command line options cause this function to 130 * abort program execution. 131 * Params: 132 * argv = pointer to application's argv. [inout][array length=argc][allow-none] 133 */ 134 public static void init(ref string[] argv) 135 { 136 // void gst_init (int *argc, char **argv[]); 137 char** outargv = Str.toStringzArray(argv); 138 int argc = cast(int) argv.length; 139 140 gst_init(&argc, &outargv); 141 142 argv = null; 143 foreach ( cstr; outargv[0 .. argc] ) 144 { 145 argv ~= Str.toString(cstr); 146 } 147 } 148 149 /** 150 * Initializes the GStreamer library, setting up internal path lists, 151 * registering built-in elements, and loading standard plugins. 152 * This function will return FALSE if GStreamer could not be initialized 153 * for some reason. If you want your program to fail fatally, 154 * use gst_init() instead. 155 * Params: 156 * argv = pointer to application's argv. [inout][array length=argc][allow-none] 157 * Returns: TRUE if GStreamer could be initialized. 158 * Throws: GException on failure. 159 */ 160 public static int initCheck(ref string[] argv) 161 { 162 // gboolean gst_init_check (int *argc, char **argv[], GError **err); 163 char** outargv = Str.toStringzArray(argv); 164 int argc = cast(int) argv.length; 165 GError* err = null; 166 167 auto p = gst_init_check(&argc, &outargv, &err); 168 169 if (err !is null) 170 { 171 throw new GException( new ErrorG(err) ); 172 } 173 174 argv = null; 175 foreach ( cstr; outargv[0 .. argc] ) 176 { 177 argv ~= Str.toString(cstr); 178 } 179 return p; 180 } 181 182 /** 183 * Returns a GOptionGroup with GStreamer's argument specifications. The 184 * group is set up to use standard GOption callbacks, so when using this 185 * group in combination with GOption parsing methods, all argument parsing 186 * and initialization is automated. 187 * This function is useful if you want to integrate GStreamer with other 188 * libraries that use GOption (see g_option_context_add_group() ). 189 * If you use this function, you should make sure you initialise the GLib 190 * threading system as one of the very first things in your program 191 * (see the example at the beginning of this section). 192 * Returns: a pointer to GStreamer's option group. [transfer full] 193 */ 194 public static OptionGroup initGetOptionGroup() 195 { 196 // GOptionGroup * gst_init_get_option_group (void); 197 auto p = gst_init_get_option_group(); 198 199 if(p is null) 200 { 201 return null; 202 } 203 204 return ObjectG.getDObject!(OptionGroup)(cast(GOptionGroup*) p); 205 } 206 207 /** 208 * Use this function to check if GStreamer has been initialized with gst_init() 209 * or gst_init_check(). 210 * Returns: TRUE if initialization has been done, FALSE otherwise. 211 */ 212 public static int isInitialized() 213 { 214 // gboolean gst_is_initialized (void); 215 return gst_is_initialized(); 216 } 217 218 /** 219 * Clean up any resources created by GStreamer in gst_init(). 220 * It is normally not needed to call this function in a normal application 221 * as the resources will automatically be freed when the program terminates. 222 * This function is therefore mostly used by testsuites and other memory 223 * profiling tools. 224 * After this call GStreamer (including this method) should not be used anymore. 225 */ 226 public static void deinit() 227 { 228 // void gst_deinit (void); 229 gst_deinit(); 230 } 231 232 /** 233 * Gets the version number of the GStreamer library. 234 * Params: 235 * major = pointer to a guint to store the major version number. [out] 236 * minor = pointer to a guint to store the minor version number. [out] 237 * micro = pointer to a guint to store the micro version number. [out] 238 * nano = pointer to a guint to store the nano version number. [out] 239 */ 240 public static void versio(ref uint major, ref uint minor, ref uint micro, ref uint nano) 241 { 242 // void gst_version (guint *major, guint *minor, guint *micro, guint *nano); 243 gst_version(&major, &minor, µ, &nano); 244 } 245 246 /** 247 * This function returns a string that is useful for describing this version 248 * of GStreamer to the outside world: user agent strings, logging, ... 249 * Returns: a newly allocated string describing this version of GStreamer. [transfer full] 250 */ 251 public static string versionString() 252 { 253 // gchar * gst_version_string (void); 254 return Str.toString(gst_version_string()); 255 } 256 257 /** 258 * Some functions in the GStreamer core might install a custom SIGSEGV handler 259 * to better catch and report errors to the application. Currently this feature 260 * is enabled by default when loading plugins. 261 * Applications might want to disable this behaviour with the 262 * gst_segtrap_set_enabled() function. This is typically done if the application 263 * wants to install its own handler without GStreamer interfering. 264 * Returns: TRUE if GStreamer is allowed to install a custom SIGSEGV handler. 265 */ 266 public static int segtrapIsEnabled() 267 { 268 // gboolean gst_segtrap_is_enabled (void); 269 return gst_segtrap_is_enabled(); 270 } 271 272 /** 273 * Applications might want to disable/enable the SIGSEGV handling of 274 * the GStreamer core. See gst_segtrap_is_enabled() for more information. 275 * Params: 276 * enabled = whether a custom SIGSEGV handler should be installed. 277 */ 278 public static void segtrapSetEnabled(int enabled) 279 { 280 // void gst_segtrap_set_enabled (gboolean enabled); 281 gst_segtrap_set_enabled(enabled); 282 } 283 284 /** 285 * By default GStreamer will perform scanning and rebuilding of the 286 * registry file using a helper child process. 287 * Applications might want to disable this behaviour with the 288 * gst_registry_fork_set_enabled() function, in which case new plugins 289 * are scanned (and loaded) into the application process. 290 * Returns: TRUE if GStreamer will use the child helper process when rebuilding the registry. 291 */ 292 public static int registryForkIsEnabled() 293 { 294 // gboolean gst_registry_fork_is_enabled (void); 295 return gst_registry_fork_is_enabled(); 296 } 297 298 /** 299 * Applications might want to disable/enable spawning of a child helper process 300 * when rebuilding the registry. See gst_registry_fork_is_enabled() for more 301 * information. 302 * Params: 303 * enabled = whether rebuilding the registry can use a temporary child helper process. 304 */ 305 public static void registryForkSetEnabled(int enabled) 306 { 307 // void gst_registry_fork_set_enabled (gboolean enabled); 308 gst_registry_fork_set_enabled(enabled); 309 } 310 311 /** 312 * Forces GStreamer to re-scan its plugin paths and update the default 313 * plugin registry. 314 * Applications will almost never need to call this function, it is only 315 * useful if the application knows new plugins have been installed (or old 316 * ones removed) since the start of the application (or, to be precise, the 317 * first call to gst_init()) and the application wants to make use of any 318 * newly-installed plugins without restarting the application. 319 * Applications should assume that the registry update is neither atomic nor 320 * thread-safe and should therefore not have any dynamic pipelines running 321 * (including the playbin and decodebin elements) and should also not create 322 * any elements or access the GStreamer registry while the update is in 323 * progress. 324 * Note that this function may block for a significant amount of time. 325 * Returns: TRUE if the registry has been updated successfully (does not imply that there were changes), otherwise FALSE. 326 */ 327 public static int updateRegistry() 328 { 329 // gboolean gst_update_registry (void); 330 return gst_update_registry(); 331 } 332 }