[vlc-devel] [PATCH 4/4] test: player: add selection variable override test
Francois Cartegnie
fcvlcdev at free.fr
Tue Jul 7 13:43:24 CEST 2020
---
test/src/player/player.c | 68 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/test/src/player/player.c b/test/src/player/player.c
index 4d405dbb6d..9897b0faaa 100644
--- a/test/src/player/player.c
+++ b/test/src/player/player.c
@@ -2071,6 +2071,8 @@ enum ctx_flags
{
DISABLE_VIDEO_OUTPUT = 1 << 0,
DISABLE_AUDIO_OUTPUT = 1 << 1,
+ DISABLE_VIDEO = 1 << 2,
+ DISABLE_AUDIO = 1 << 3,
};
static void
@@ -2087,6 +2089,8 @@ ctx_init(struct ctx *ctx, enum ctx_flags flags)
"--dec-dev=none",
(flags & DISABLE_VIDEO_OUTPUT) ? "--vout=none" : "--vout=dummy",
(flags & DISABLE_AUDIO_OUTPUT) ? "--aout=none" : "--aout=dummy",
+ (flags & DISABLE_VIDEO) ? "--no-video" : "--video",
+ (flags & DISABLE_AUDIO) ? "--no-audio" : "--audio",
};
libvlc_instance_t *vlc = libvlc_new(ARRAY_SIZE(argv), argv);
assert(vlc);
@@ -2729,6 +2733,65 @@ test_teletext(struct ctx *ctx)
#endif
}
+static void
+test_es_selection_override(struct ctx *ctx)
+{
+ test_log("test_es_selection_override\n");
+
+ vlc_player_t *player = ctx->player;
+
+ struct media_params params = DEFAULT_MEDIA_PARAMS(VLC_TICK_FROM_SEC(2));
+ params.track_count[VIDEO_ES] = 1;
+ params.track_count[AUDIO_ES] = 1;
+ params.track_count[SPU_ES] = 0;
+
+ player_set_next_mock_media(ctx, "media1", ¶ms);
+
+ player_start(ctx);
+
+ /* Wait that all tracks are added */
+ {
+ vec_on_track_list_changed *vec = &ctx->report.on_track_list_changed;
+ while (vec_on_track_list_get_action_count(vec, VLC_PLAYER_LIST_ADDED)
+ != 2)
+ vlc_player_CondWait(player, &ctx->wait);
+ }
+
+ /* Wait that all tracks are selected */
+ {
+ vec_on_track_selection_changed *vec =
+ &ctx->report.on_track_selection_changed;
+ while (vec->size < 1)
+ vlc_player_CondWait(player, &ctx->wait);
+ }
+
+ assert(vlc_player_GetTrackCount(player, VIDEO_ES) == 1);
+ assert(vlc_player_GetTrackCount(player, AUDIO_ES) == 1);
+ const struct vlc_player_track *track = vlc_player_GetTrackAt(player, AUDIO_ES, 0);
+ assert(track);
+ assert(track->selected);
+ track = vlc_player_GetTrackAt(player, VIDEO_ES, 0);
+ assert(track);
+ assert(!track->selected);
+
+ /* Select video track */
+ vlc_player_SelectTrack(player, track, VLC_PLAYER_SELECT_EXCLUSIVE);
+ {
+ vec_on_track_selection_changed *vec =
+ &ctx->report.on_track_selection_changed;
+ while (vec->size < 2)
+ vlc_player_CondWait(player, &ctx->wait);
+ }
+ track = vlc_player_GetTrackAt(player, VIDEO_ES, 0);
+ assert(track);
+ assert(track->selected);
+
+ wait_state(ctx, VLC_PLAYER_STATE_STOPPED);
+ assert_normal_state(ctx);
+
+ test_end(ctx);
+}
+
int
main(void)
{
@@ -2764,6 +2827,11 @@ main(void)
test_delete_while_playback(VLC_OBJECT(ctx.vlc->p_libvlc_int), true);
test_delete_while_playback(VLC_OBJECT(ctx.vlc->p_libvlc_int), false);
+ ctx_destroy(&ctx);
+ /* Test with --no-video */
+ ctx_init(&ctx, DISABLE_VIDEO);
+ test_es_selection_override(&ctx);
+
ctx_destroy(&ctx);
return 0;
}
--
2.25.4
More information about the vlc-devel
mailing list