public void init (ref string[]? argv)

Initializes the GStreamer library, setting up internal path lists, registering built-in elements, and loading standard plugins.

Unless the plugin registry is disabled at compile time, the registry will be loaded. By default this will also check if the registry cache needs to be updated and rescan all plugins if needed. See update_registry for details and section Running GStreamer Applications for how to disable automatic registry updates.

> This function will terminate your program if it was unable to initialize > GStreamer for some reason. If you want your program to fall back, > use init_check instead.

WARNING: This function does not work in the same way as corresponding functions in other glib-style libraries, such as gtk_init\(\). In particular, unknown command line options cause this function to abort program execution.

Example: Hello World:

// See
// for a detailed description

public static int main (string[] args) {
// Initialize GStreamer:
Gst.init (ref args);

// Build the pipeline:
Gst.Element pipeline;
try {
pipeline = Gst.parse_launch ("playbin uri=");
} catch (Error e) {
stderr.printf ("Error: %s\n", e.message);
return 0;

// Start playing:
pipeline.set_state (Gst.State.PLAYING);

// Wait until error or EOS:
Gst.Bus bus = pipeline.get_bus ();
bus.timed_pop_filtered (Gst.CLOCK_TIME_NONE, Gst.MessageType.ERROR | Gst.MessageType.EOS);

// Free resources:
pipeline.set_state (Gst.State.NULL);

return 0;

valac --pkg gstreamer-1.0 hello-world.vala



pointer to application's argv


pointer to application's argc

Namespace: Gst
Package: gstreamer-1.0