[vlc-devel] [PATCH 4/5] player: add vlc_player_aout_Reset

Thomas Guillem thomas at gllm.fr
Wed Jul 22 15:51:10 CEST 2020


---
 include/vlc_player.h | 11 +++++++++++
 src/libvlccore.sym   |  1 +
 src/player/aout.c    | 11 +++++++++++
 src/player/player.h  |  3 +++
 4 files changed, 26 insertions(+)

diff --git a/include/vlc_player.h b/include/vlc_player.h
index 763aae564d8..ac5991982df 100644
--- a/include/vlc_player.h
+++ b/include/vlc_player.h
@@ -2210,6 +2210,17 @@ struct vlc_player_aout_cbs
 VLC_API audio_output_t *
 vlc_player_aout_Hold(vlc_player_t *player);
 
+/**
+ * Reset the main audio output
+ *
+ * @warning The main aout can only by reset if it is not currently used by any
+ * decoders (before any play).
+ *
+ * @param player player instance
+ */
+VLC_API void
+vlc_player_aout_Reset(vlc_player_t *player);
+
 /**
  * Add a listener callback for audio output events
  *
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 7361b29e6f5..d7d93aa549f 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -779,6 +779,7 @@ vlc_player_aout_AddListener
 vlc_player_aout_EnableFilter
 vlc_player_aout_GetVolume
 vlc_player_aout_Hold
+vlc_player_aout_Reset
 vlc_player_aout_IncrementVolume
 vlc_player_aout_IsMuted
 vlc_player_aout_Mute
diff --git a/src/player/aout.c b/src/player/aout.c
index 840d0e01fec..8674cc65359 100644
--- a/src/player/aout.c
+++ b/src/player/aout.c
@@ -237,3 +237,14 @@ vlc_player_aout_Deinit(vlc_player_t *player)
 {
     vlc_player_aout_DelCallbacks(player);
 }
+
+void
+vlc_player_aout_Reset(vlc_player_t *player)
+{
+    vlc_player_aout_Deinit(player);
+
+    input_resource_ResetAout(player->resource);
+
+    vlc_player_aout_Init(player);
+}
+
diff --git a/src/player/player.h b/src/player/player.h
index 87b9e430330..3728a7ef993 100644
--- a/src/player/player.h
+++ b/src/player/player.h
@@ -473,6 +473,9 @@ vlc_player_aout_Init(vlc_player_t *player);
 void
 vlc_player_aout_Deinit(vlc_player_t *player);
 
+void
+vlc_player_aout_Reset(vlc_player_t *player);
+
 /*
  * player_osd.c
  */
-- 
2.27.0



More information about the vlc-devel mailing list