[vlc-commits] aout: add event to request pipeline reinitialization

Rémi Denis-Courmont git at videolan.org
Sun Dec 16 15:35:12 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Dec 16 16:34:49 2012 +0200| [e38ea904ade75270e69aa78cc711030a67961d08] | committer: Rémi Denis-Courmont

aout: add event to request pipeline reinitialization

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

 include/vlc_aout.h               |   10 ++++++++++
 src/audio_output/aout_internal.h |    6 +++++-
 src/audio_output/dec.c           |   22 +++-------------------
 src/audio_output/output.c        |    6 ++++++
 4 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/include/vlc_aout.h b/include/vlc_aout.h
index d6ea8be..ed459e2 100644
--- a/include/vlc_aout.h
+++ b/include/vlc_aout.h
@@ -205,6 +205,7 @@ struct audio_output
         void (*policy_report)(audio_output_t *, bool);
         void (*device_report)(audio_output_t *, const char *);
         int (*gain_request)(audio_output_t *, float);
+        void (*restart_request)(audio_output_t *, unsigned);
     } event;
 };
 
@@ -219,6 +220,10 @@ static const uint32_t pi_vlc_chan_order_wg4[] =
     AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0
 };
 
+#define AOUT_RESTART_FILTERS 1
+#define AOUT_RESTART_OUTPUT  2
+#define AOUT_RESTART_DECODER 4
+
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
@@ -324,6 +329,11 @@ static inline int aout_GainRequest(audio_output_t *aout, float gain)
     return aout->event.gain_request(aout, gain);
 }
 
+static inline void aout_RestartRequest(audio_output_t *aout, unsigned mode)
+{
+    aout->event.restart_request(aout, mode);
+}
+
 VLC_API int aout_ChannelsRestart( vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void * );
 
 /* */
diff --git a/src/audio_output/aout_internal.h b/src/audio_output/aout_internal.h
index f05cb84..bca1007 100644
--- a/src/audio_output/aout_internal.h
+++ b/src/audio_output/aout_internal.h
@@ -143,8 +143,12 @@ int aout_DecGetResetLost(audio_output_t *);
 void aout_DecChangePause(audio_output_t *, bool b_paused, mtime_t i_date);
 void aout_DecFlush(audio_output_t *);
 bool aout_DecIsEmpty(audio_output_t *);
+void aout_RequestRestart (audio_output_t *, unsigned);
 
-void aout_InputRequestRestart(audio_output_t *);
+static inline void aout_InputRequestRestart(audio_output_t *aout)
+{
+    aout_RequestRestart(aout, AOUT_RESTART_FILTERS);
+}
 
 /* Audio output locking */
 static inline void aout_lock( audio_output_t *p_aout )
diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index c840b7d..b6cbf5f 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -121,8 +121,6 @@ void aout_DecDelete (audio_output_t *aout)
     var_Destroy (aout, "stereo-mode");
 }
 
-#define AOUT_RESTART_OUTPUT 1
-#define AOUT_RESTART_INPUT  2
 static int aout_CheckReady (audio_output_t *aout)
 {
     aout_owner_t *owner = aout_owner (aout);
@@ -165,12 +163,10 @@ static int aout_CheckReady (audio_output_t *aout)
  * Marks the audio output for restart, to update any parameter of the output
  * plug-in (e.g. output device or channel mapping).
  */
-static void aout_RequestRestart (audio_output_t *aout)
+void aout_RequestRestart (audio_output_t *aout, unsigned mode)
 {
     aout_owner_t *owner = aout_owner (aout);
-
-    /* NOTE: restarting output requires restarting input. */
-    atomic_fetch_or (&owner->restart, AOUT_RESTART_OUTPUT);
+    atomic_fetch_or (&owner->restart, mode);
 }
 
 int aout_ChannelsRestart (vlc_object_t *obj, const char *varname,
@@ -185,22 +181,10 @@ int aout_ChannelsRestart (vlc_object_t *obj, const char *varname,
          * rebuilding the channel choices. */
         var_Destroy (aout, "stereo-mode");
     }
-    aout_RequestRestart (aout);
+    aout_RequestRestart (aout, AOUT_RESTART_OUTPUT);
     return 0;
 }
 
-/**
- * This function will safely mark aout input to be restarted as soon as
- * possible to take configuration changes into account
- */
-void aout_InputRequestRestart (audio_output_t *aout)
-{
-    aout_owner_t *owner = aout_owner (aout);
-
-    atomic_fetch_or (&owner->restart, AOUT_RESTART_INPUT);
-}
-
-
 /*
  * Buffer management
  */
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 2f0c99c..7c51cb3 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -103,6 +103,11 @@ static void aout_DeviceNotify (audio_output_t *aout, const char *id)
     free (tmp);
 }
 
+static void aout_RestartNotify (audio_output_t *aout, unsigned mode)
+{
+    aout_RequestRestart (aout, mode);
+}
+
 static int aout_GainNotify (audio_output_t *aout, float gain)
 {
     aout_owner_t *owner = aout_owner (aout);
@@ -146,6 +151,7 @@ audio_output_t *aout_New (vlc_object_t *parent)
     aout->event.device_report = aout_DeviceNotify;
     aout->event.policy_report = aout_PolicyNotify;
     aout->event.gain_request = aout_GainNotify;
+    aout->event.restart_request = aout_RestartNotify;
 
     /* Audio output module initialization */
     aout->start = NULL;



More information about the vlc-commits mailing list