[vlc-devel] [PATCH v2 4/7] player: split vlc_player_InvalidateNextMedia

Thomas Guillem thomas at gllm.fr
Wed Mar 20 18:09:11 CET 2019


---
 src/input/player.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/input/player.c b/src/input/player.c
index 22284418e4..c2ecdb532a 100644
--- a/src/input/player.c
+++ b/src/input/player.c
@@ -2056,6 +2056,18 @@ vlc_player_RemoveListener(vlc_player_t *player,
     free(id);
 }
 
+static void
+vlc_player_ReleaseNextMedia(vlc_player_t *player)
+{
+    vlc_player_assert_locked(player);
+    if (player->next_media)
+    {
+        input_item_Release(player->next_media);
+        player->next_media = NULL;
+    }
+    player->next_media_requested = false;
+}
+
 int
 vlc_player_SetCurrentMedia(vlc_player_t *player, input_item_t *media)
 {
@@ -2063,7 +2075,7 @@ vlc_player_SetCurrentMedia(vlc_player_t *player, input_item_t *media)
 
     vlc_player_CancelWaitError(player);
 
-    vlc_player_InvalidateNextMedia(player);
+    vlc_player_ReleaseNextMedia(player);
 
     if (media)
     {
@@ -2154,13 +2166,7 @@ vlc_player_GetAssociatedSubsFPS(vlc_player_t *player)
 void
 vlc_player_InvalidateNextMedia(vlc_player_t *player)
 {
-    vlc_player_assert_locked(player);
-    if (player->next_media)
-    {
-        input_item_Release(player->next_media);
-        player->next_media = NULL;
-    }
-    player->next_media_requested = false;
+    vlc_player_ReleaseNextMedia(player);
 
 }
 
@@ -2219,7 +2225,7 @@ vlc_player_Stop(vlc_player_t *player)
 
     vlc_player_CancelWaitError(player);
 
-    vlc_player_InvalidateNextMedia(player);
+    vlc_player_ReleaseNextMedia(player);
 
     if (!input || !player->started)
         return;
@@ -2228,6 +2234,7 @@ vlc_player_Stop(vlc_player_t *player)
     vlc_player_destructor_AddInput(player, input);
     player->input = NULL;
 
+    vlc_player_SetGaplessEnabled(player, false);
 }
 
 void
-- 
2.20.1



More information about the vlc-devel mailing list