[vlc-devel] [PATCH v2 7/9] player: indicate if stop() is stopping

Romain Vimont rom1v at videolabs.io
Wed May 15 11:53:15 CEST 2019


From: Thomas Guillem <thomas at gllm.fr>

---
 include/vlc_player.h | 4 +++-
 src/input/player.c   | 6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/vlc_player.h b/include/vlc_player.h
index 054c4abae3..a7ad520bed 100644
--- a/include/vlc_player.h
+++ b/include/vlc_player.h
@@ -1206,8 +1206,10 @@ vlc_player_Start(vlc_player_t *player);
  * STOPPED state event to know when the stop is finished.
  *
  * @param player locked player instance
+ * @return false if already stopped, true if the player is stopping
+ * asynchronously
  */
-VLC_API void
+VLC_API bool
 vlc_player_Stop(vlc_player_t *player);
 
 /**
diff --git a/src/input/player.c b/src/input/player.c
index e81c717f36..6796b07e07 100644
--- a/src/input/player.c
+++ b/src/input/player.c
@@ -2217,7 +2217,7 @@ vlc_player_Start(vlc_player_t *player)
     return ret;
 }
 
-void
+bool
 vlc_player_Stop(vlc_player_t *player)
 {
     struct vlc_player_input *input = vlc_player_get_input_locked(player);
@@ -2227,12 +2227,12 @@ vlc_player_Stop(vlc_player_t *player)
     vlc_player_InvalidateNextMedia(player);
 
     if (!input || !player->started)
-        return;
+        return false;
     player->started = false;
 
     vlc_player_destructor_AddInput(player, input);
     player->input = NULL;
-
+    return true;
 }
 
 void
-- 
2.20.1



More information about the vlc-devel mailing list