[vlc-devel] [PATCH 1/3] aout: add current_sink_info struct

Thomas Guillem thomas at gllm.fr
Thu Jul 20 14:59:28 CEST 2017


This new struct can be filled from the start() function of aout modules.
It contains (for now) only one member: the headphones state.
---
 include/vlc_aout.h        | 7 +++++++
 src/audio_output/output.c | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/include/vlc_aout.h b/include/vlc_aout.h
index 3693c0e921..8e2fd19903 100644
--- a/include/vlc_aout.h
+++ b/include/vlc_aout.h
@@ -168,6 +168,13 @@ struct audio_output
       * \return 0 on success, non-zero on failure.
       * \warning A stream may or may not have been started when called.
       */
+
+    struct {
+        bool headphones; /**< Default to false, set it to true if the current
+                              sink is using headphones */
+    } current_sink_info;
+    /**< Current sink informations set by the module from the start() function */
+
     struct {
         void (*volume_report)(audio_output_t *, float);
         void (*mute_report)(audio_output_t *, bool);
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 9629c46a44..23c9aa6bfc 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -537,6 +537,8 @@ int aout_OutputNew (audio_output_t *aout, audio_sample_format_t *restrict fmt,
         aout_FormatPrepare (fmt);
     }
 
+    aout->current_sink_info.headphones = false;
+
     if (aout->start (aout, fmt))
     {
         msg_Err (aout, "module not functional");
-- 
2.11.0



More information about the vlc-devel mailing list