Shuffle and unshuffle

When a playlist is created, it is unshuffled, which means that playing its contents in a renderer would play the items in the playlist in the same order they were inserted.

It is also possible to shuffle the elements in the playlist using mafw_playlist_shuffle, changing the default playing order.

The method mafw_playlist_get_starting_index can be called to obtain the index and object identifier of the first item of the playlist according to the playing order. The methods mafw_playlist_get_next and mafw_playlist_get_prev can be used to move to the next and previous elements respectively.

Because playlists are played in renderers, the only way to obtain information on which item of a playlist is being played is to obtain it from a renderer object to which the playlist has been assigned. The "media-changed" signal is emitted when the selected item in the playlist assigned to a particular renderer changes. The signal handler for the "media-changed" signal looks like this:

static void
media_changed_cb(MafwRenderer *renderer,
		 gint index,
		 gchar *object_id,
		 gpointer user_data)
    /* Handle media changed in renderer */

The application developer can also query the currently selected entry in the playlist assigned to a renderer using the method mafw_renderer_get_status (see the Mafw API reference for details).