+static void test_media_list_player_playback_options (const char** argv, int argc)
+{
+ libvlc_instance_t *vlc;
+ libvlc_media_t *md;
+ libvlc_media_t *md2;
+ libvlc_media_t *md3;
+ libvlc_media_t *md4;
+ libvlc_media_t *md5;
+ libvlc_media_list_t *ml;
+ libvlc_media_list_t *ml2;
+ libvlc_media_list_t *ml3;
+ libvlc_media_list_t *ml4;
+ libvlc_media_list_t *ml5;
+ libvlc_media_list_t *ml6;
+ libvlc_media_list_player_t *mlp;
+
+ const char * file = test_default_sample;
+
+ log ("Testing media player playback options()\n");
+
+ libvlc_exception_init (&ex);
+ vlc = libvlc_new (argc, argv, &ex);
+ catch ();
+
+ /*
+ * Create the following media tree:
+ *
+ * ml1: 0 ---- 1 ---- 2
+ * / | \
+ * ml2&4: 0 -- 1 | 0 -- 1 -- 2
+ * |
+ * ml3: 0 -- 1 -- 2 -- 3 -- 4 -- 5 -- 6
+ * | |
+ * ml5&6: 0 0 -- 1
+ */
+
+ md = libvlc_media_new (vlc, file, &ex);
+ catch ();
+
+ md2 = libvlc_media_new (vlc, file, &ex);
+ catch ();
+
+ md3 = libvlc_media_new (vlc, file, &ex);
+ catch ();
+
+ md4 = libvlc_media_new (vlc, file, &ex);
+ catch ();
+
+ md5 = libvlc_media_new (vlc, file, &ex);
+ catch ();
+
+ ml = libvlc_media_list_new (vlc, &ex);
+ catch ();
+
+ ml2 = libvlc_media_list_new (vlc, &ex);
+ catch ();
+
+ ml3 = libvlc_media_list_new (vlc, &ex);
+ catch ();
+
+ ml4 = libvlc_media_list_new (vlc, &ex);
+ catch ();
+
+ ml5 = libvlc_media_list_new (vlc, &ex);
+ catch ();
+
+ ml6 = libvlc_media_list_new (vlc, &ex);
+ catch ();
+
+ media_list_add_file_path (vlc, ml2, file);
+ media_list_add_file_path (vlc, ml2, file);
+
+ media_list_add_file_path (vlc, ml3, file);
+ media_list_add_file_path (vlc, ml3, file);
+ libvlc_media_list_add_media (ml3, md4, &ex);
+ catch ();
+ media_list_add_file_path (vlc, ml3, file);
+ media_list_add_file_path (vlc, ml3, file);
+ media_list_add_file_path (vlc, ml3, file);
+ libvlc_media_list_add_media (ml3, md5, &ex);
+ catch ();
+
+ media_list_add_file_path (vlc, ml4, file);
+ media_list_add_file_path (vlc, ml4, file);
+ media_list_add_file_path (vlc, ml4, file);
+
+ media_list_add_file_path (vlc, ml5, file);
+
+ media_list_add_file_path (vlc, ml6, file);
+ media_list_add_file_path (vlc, ml6, file);
+
+ md->p_subitems = ml2;
+ md2->p_subitems = ml3;
+ md3->p_subitems = ml4;
+ md4->p_subitems = ml5;
+ md5->p_subitems = ml6;
+
+ libvlc_media_list_add_media (ml, md, &ex);
+ catch ();
+
+ libvlc_media_list_add_media (ml, md2, &ex);
+ catch ();
+
+ libvlc_media_list_add_media (ml, md3, &ex);
+ catch ();
+
+ mlp = libvlc_media_list_player_new (vlc, &ex);
+ catch ();
+
+ libvlc_media_list_player_set_media_list (mlp, ml, &ex);
+ catch ();
+
+ // Test default playback mode
+ libvlc_media_list_player_set_playback_mode(mlp, libvlc_playback_mode_default, &ex);
+ catch ();
+
+ libvlc_media_list_player_play_item (mlp, md, &ex);
+ catch ();
+
+ libvlc_media_release (md);
+ catch ();
+ libvlc_media_release (md2);
+ catch ();
+ libvlc_media_release (md3);
+ catch ();
+ libvlc_media_release (md4);
+ catch ();
+ libvlc_media_release (md5);
+ catch ();
+
+ msleep(500000);
+
+ libvlc_media_list_player_stop (mlp, &ex);
+ catch ();
+
+ // Test looping playback mode
+ log ("Testing media player playback option - Loop\n");
+ libvlc_media_list_player_set_playback_mode(mlp, libvlc_playback_mode_loop, &ex);
+ catch ();
+
+ libvlc_media_list_player_play_item (mlp, md, &ex);
+ catch ();
+
+ msleep(500000);
+
+ libvlc_media_list_player_stop (mlp, &ex);
+ catch ();
+
+ // Test repeat playback mode
+ log ("Testing media player playback option - Repeat\n");
+ libvlc_media_list_player_set_playback_mode(mlp, libvlc_playback_mode_repeat, &ex);
+ catch ();
+
+ libvlc_media_list_player_play_item (mlp, md, &ex);
+ catch ();
+
+ msleep(500000);
+
+ libvlc_media_list_player_release (mlp);
+ catch ();
+
+ libvlc_release (vlc);
+ catch ();
+}
+