[vlc-commits] player: stop: return a status

Thomas Guillem git at videolan.org
Thu Nov 7 14:13:16 CET 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Nov  7 11:36:20 2019 +0100| [44a43c295804b00782e4edb7f397a825c849003f] | committer: Thomas Guillem

player: stop: return a status

In order to notify the user if he should wait for the stopped event.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=44a43c295804b00782e4edb7f397a825c849003f
---

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

diff --git a/include/vlc_player.h b/include/vlc_player.h
index db19966080..3e382db248 100644
--- a/include/vlc_player.h
+++ b/include/vlc_player.h
@@ -443,12 +443,14 @@ vlc_player_Start(vlc_player_t *player);
 /**
  * Stop the playback of the current media
  *
- * @note This function is asynchronous. Users should wait on
- * STOPPED state event to know when the stop is finished.
+ * @note This function is asynchronous. In case of success, the user should wait
+ * for the STOPPED state event to know when the stop is finished.
  *
  * @param player locked player instance
+ * @return VLC_SUCCESS if the player is being stopped, VLC_EGENERIC otherwise
+ * (no-op)
  */
-VLC_API void
+VLC_API int
 vlc_player_Stop(vlc_player_t *player);
 
 /**
diff --git a/src/player/player.c b/src/player/player.c
index 22dad216cc..d624f7e345 100644
--- a/src/player/player.c
+++ b/src/player/player.c
@@ -1148,7 +1148,7 @@ vlc_player_Start(vlc_player_t *player)
     return ret;
 }
 
-void
+int
 vlc_player_Stop(vlc_player_t *player)
 {
     struct vlc_player_input *input = vlc_player_get_input_locked(player);
@@ -1158,12 +1158,12 @@ vlc_player_Stop(vlc_player_t *player)
     vlc_player_InvalidateNextMedia(player);
 
     if (!input || !player->started)
-        return;
+        return VLC_EGENERIC;
     player->started = false;
 
     vlc_player_destructor_AddInput(player, input);
     player->input = NULL;
-
+    return VLC_SUCCESS;
 }
 
 void



More information about the vlc-commits mailing list