[vlc-commits] aout: simplify volume and mute variables life cycle

Rémi Denis-Courmont git at videolan.org
Tue May 22 19:17:25 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue May 22 20:03:49 2012 +0300| [6a40ca7199612f16d6bd1d9131dbcd43d7179e78] | committer: Rémi Denis-Courmont

aout: simplify volume and mute variables life cycle

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

 src/audio_output/common.c |    2 ++
 src/audio_output/output.c |   12 ++++--------
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/audio_output/common.c b/src/audio_output/common.c
index 0fe1088..d0baa2a 100644
--- a/src/audio_output/common.c
+++ b/src/audio_output/common.c
@@ -75,6 +75,8 @@ audio_output_t *aout_New( vlc_object_t * p_parent )
     vlc_value_t val, text;
     char *str;
 
+    var_Create (aout, "volume", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+    var_Create (aout, "mute", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
     var_Create (aout, "intf-change", VLC_VAR_VOID);
 
     /* Visualizations */
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 28a9c32..ef8a80c 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -286,8 +286,6 @@ void aout_VolumeNoneInit (audio_output_t *aout)
      * other thread knows of this audio output instance.
     aout_assert_locked (aout); */
     aout->pf_volume_set = aout_VolumeNoneSet;
-    var_Destroy (aout, "volume");
-    var_Destroy (aout, "mute");
 }
 
 /**
@@ -322,8 +320,8 @@ static int aout_VolumeSoftSet (audio_output_t *aout, float volume, bool mute)
  */
 void aout_VolumeSoftInit (audio_output_t *aout)
 {
-    audio_volume_t volume = var_InheritInteger (aout, "volume");
-    bool mute = var_InheritBool (aout, "mute");
+    audio_volume_t volume = var_GetInteger (aout, "volume");
+    bool mute = var_GetBool (aout, "mute");
 
     aout_assert_locked (aout);
     aout->pf_volume_set = aout_VolumeSoftSet;
@@ -341,14 +339,12 @@ void aout_VolumeHardInit (audio_output_t *aout, aout_volume_cb setter,
 {
     aout_assert_locked (aout);
     aout->pf_volume_set = setter;
-    var_Create (aout, "volume", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT);
-    var_Create (aout, "mute", VLC_VAR_BOOL|VLC_VAR_DOINHERIT);
 
     if (restore)
     {
-        float vol = var_InheritInteger (aout, "volume")
+        float vol = var_GetInteger (aout, "volume")
                   / (float)AOUT_VOLUME_DEFAULT;
-        setter (aout, vol, var_InheritBool (aout, "mute"));
+        setter (aout, vol, var_GetBool (aout, "mute"));
     }
 }
 



More information about the vlc-commits mailing list