[vlc-commits] [Git][videolan/vlc][master] 2 commits: input: update capabilities on end and error
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat Sep 17 08:41:56 UTC 2022
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
388cb0b6 by Marvin Scholz at 2022-09-17T07:25:44+00:00
input: update capabilities on end and error
When the input is stopped or an error occurred, the capabilities
should reflect that, so that on_capabilities_changed is invoked
as expected.
Fix #27047
- - - - -
2639fe0a by Marvin Scholz at 2022-09-17T07:25:44+00:00
test/player: check on_capabilities_changed on stop and error
- - - - -
3 changed files:
- include/vlc_player.h
- src/input/input.c
- test/src/player/player.c
Changes:
=====================================
include/vlc_player.h
=====================================
@@ -2817,7 +2817,8 @@ struct vlc_player_cbs
/**
* Called when the media capabilities has changed
*
- * Always called when the media is opening. Can be called during playback.
+ * Always called when the media is opening or stopping.
+ * Can be called during playback.
*
* @param player locked player instance
* @param old_caps old player capabilities
=====================================
src/input/input.c
=====================================
@@ -3229,6 +3229,8 @@ static void input_ChangeState( input_thread_t *p_input, int i_state,
input_priv(p_input)->i_state = i_state;
if( i_state == ERROR_S )
input_item_SetErrorWhenReading( input_priv(p_input)->p_item, true );
+ if (i_state == END_S || i_state == ERROR_S)
+ input_SendEventCapabilities( p_input, 0 );
input_SendEventState( p_input, i_state, state_date );
}
=====================================
test/src/player/player.c
=====================================
@@ -1004,6 +1004,16 @@ test_end_poststop_medias(struct ctx *ctx)
assert(vlc_player_GetCurrentMedia(player) == NULL);
}
+static void
+test_end_poststop_capabilities(struct ctx *ctx)
+{
+ vlc_player_t *player = ctx->player;
+ vec_on_capabilities_changed *vec = &ctx->report.on_capabilities_changed;
+ int new_caps = VEC_LAST(vec).new_caps;
+ assert(vlc_player_CanSeek(player) == !!(new_caps & VLC_PLAYER_CAP_SEEK));
+ assert(vlc_player_CanPause(player) == !!(new_caps & VLC_PLAYER_CAP_PAUSE));
+}
+
static void
test_prestop(struct ctx *ctx)
{
@@ -1035,6 +1045,7 @@ test_end(struct ctx *ctx)
test_end_poststop_titles(ctx);
test_end_poststop_vouts(ctx);
}
+ test_end_poststop_capabilities(ctx);
test_end_poststop_medias(ctx);
player_set_rate(ctx, 1.0f);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8e00bdaa574f60448c645f7070b2dd4080043e06...2639fe0af8d283dfdf2b30f6e2529ddeb96246f2
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8e00bdaa574f60448c645f7070b2dd4080043e06...2639fe0af8d283dfdf2b30f6e2529ddeb96246f2
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list