set_state


Description:

public virtual StateChangeReturn set_state (State state)

Sets the state of the element.

This function will try to set the requested state by going through all the intermediary states and calling the class's state change function for each.

This function can return ASYNC, in which case the element will perform the remainder of the state change asynchronously in another thread. An application can use get_state to wait for the completion of the state change or it can wait for a ASYNC_DONE or STATE_CHANGED on the bus.

State changes to READY or NULL never return ASYNC.

Example: Hello World:

// See http://docs.gstreamer.com/x/NwAF
// 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=http://docs.gstreamer.com/media/sintel_trailer-480p.webm");
} 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

Parameters:

this

a Element to change state of.

state

the element's new State.

Returns: