| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
#include "test.h" |
|---|
| 25 |
|
|---|
| 26 |
static void test_media_list_player_pause_stop(const char** argv, int argc) |
|---|
| 27 |
{ |
|---|
| 28 |
libvlc_instance_t *vlc; |
|---|
| 29 |
libvlc_media_t *md; |
|---|
| 30 |
libvlc_media_list_t *ml; |
|---|
| 31 |
libvlc_media_list_player_t *mlp; |
|---|
| 32 |
|
|---|
| 33 |
const char * file = test_default_sample; |
|---|
| 34 |
|
|---|
| 35 |
log ("Testing play and pause of %s using the media list.\n", file); |
|---|
| 36 |
|
|---|
| 37 |
libvlc_exception_init (&ex); |
|---|
| 38 |
vlc = libvlc_new (argc, argv, &ex); |
|---|
| 39 |
catch (); |
|---|
| 40 |
|
|---|
| 41 |
md = libvlc_media_new (vlc, file, &ex); |
|---|
| 42 |
catch (); |
|---|
| 43 |
|
|---|
| 44 |
ml = libvlc_media_list_new (vlc, &ex); |
|---|
| 45 |
catch (); |
|---|
| 46 |
|
|---|
| 47 |
mlp = libvlc_media_list_player_new (vlc, &ex); |
|---|
| 48 |
|
|---|
| 49 |
libvlc_media_list_add_media( ml, md, &ex ); |
|---|
| 50 |
catch (); |
|---|
| 51 |
|
|---|
| 52 |
libvlc_media_list_player_set_media_list( mlp, ml, &ex ); |
|---|
| 53 |
|
|---|
| 54 |
libvlc_media_list_player_play_item( mlp, md, &ex ); |
|---|
| 55 |
catch (); |
|---|
| 56 |
|
|---|
| 57 |
libvlc_media_list_player_pause (mlp, &ex); |
|---|
| 58 |
catch(); |
|---|
| 59 |
|
|---|
| 60 |
libvlc_media_list_player_stop (mlp, &ex); |
|---|
| 61 |
catch (); |
|---|
| 62 |
|
|---|
| 63 |
libvlc_media_release (md); |
|---|
| 64 |
|
|---|
| 65 |
libvlc_media_list_player_release (mlp); |
|---|
| 66 |
catch (); |
|---|
| 67 |
|
|---|
| 68 |
libvlc_release (vlc); |
|---|
| 69 |
catch (); |
|---|
| 70 |
} |
|---|
| 71 |
|
|---|
| 72 |
static void test_media_list_player_play_item_at_index(const char** argv, int argc) |
|---|
| 73 |
{ |
|---|
| 74 |
libvlc_instance_t *vlc; |
|---|
| 75 |
libvlc_media_t *md; |
|---|
| 76 |
libvlc_media_list_t *ml; |
|---|
| 77 |
libvlc_media_list_player_t *mlp; |
|---|
| 78 |
|
|---|
| 79 |
const char * file = test_default_sample; |
|---|
| 80 |
|
|---|
| 81 |
log ("Testing play and pause of %s using the media list.\n", file); |
|---|
| 82 |
|
|---|
| 83 |
libvlc_exception_init (&ex); |
|---|
| 84 |
vlc = libvlc_new (argc, argv, &ex); |
|---|
| 85 |
catch (); |
|---|
| 86 |
|
|---|
| 87 |
md = libvlc_media_new (vlc, file, &ex); |
|---|
| 88 |
catch (); |
|---|
| 89 |
|
|---|
| 90 |
ml = libvlc_media_list_new (vlc, &ex); |
|---|
| 91 |
catch (); |
|---|
| 92 |
|
|---|
| 93 |
mlp = libvlc_media_list_player_new (vlc, &ex); |
|---|
| 94 |
|
|---|
| 95 |
libvlc_media_list_add_media( ml, md, &ex ); |
|---|
| 96 |
catch (); |
|---|
| 97 |
|
|---|
| 98 |
libvlc_media_list_player_set_media_list( mlp, ml, &ex ); |
|---|
| 99 |
|
|---|
| 100 |
libvlc_media_list_player_play_item_at_index( mlp, 0, &ex ); |
|---|
| 101 |
catch (); |
|---|
| 102 |
|
|---|
| 103 |
libvlc_media_list_player_stop (mlp, &ex); |
|---|
| 104 |
catch (); |
|---|
| 105 |
|
|---|
| 106 |
libvlc_media_release (md); |
|---|
| 107 |
catch (); |
|---|
| 108 |
|
|---|
| 109 |
libvlc_media_list_player_release (mlp); |
|---|
| 110 |
catch (); |
|---|
| 111 |
|
|---|
| 112 |
libvlc_release (vlc); |
|---|
| 113 |
catch (); |
|---|
| 114 |
} |
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 |
int main (void) |
|---|
| 118 |
{ |
|---|
| 119 |
test_init(); |
|---|
| 120 |
|
|---|
| 121 |
test_media_list_player_pause_stop (test_defaults_args, test_defaults_nargs); |
|---|
| 122 |
test_media_list_player_play_item_at_index (test_defaults_args, test_defaults_nargs); |
|---|
| 123 |
return 0; |
|---|
| 124 |
} |
|---|