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