Commit 94d7df18 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

aout: propagate volume and mute to input manager (fix #6760)

Several of UI & control plugins follow the volume and mute status
through the playlist instead of the aout. This patch works around
that limitation.
parent fdb50775
...@@ -30,9 +30,11 @@ ...@@ -30,9 +30,11 @@
#include <limits.h> #include <limits.h>
#include <assert.h> #include <assert.h>
#include <math.h>
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_aout.h> #include <vlc_aout.h>
#include <vlc_aout_intf.h>
#include <vlc_modules.h> #include <vlc_modules.h>
#include "aout_internal.h" #include "aout_internal.h"
#include "libvlc.h" #include "libvlc.h"
...@@ -44,6 +46,25 @@ ...@@ -44,6 +46,25 @@
/* Local functions */ /* Local functions */
static void aout_Destructor( vlc_object_t * p_this ); static void aout_Destructor( vlc_object_t * p_this );
static int var_Copy (vlc_object_t *src, const char *name, vlc_value_t prev,
vlc_value_t value, void *data)
{
vlc_object_t *dst = data;
(void) src; (void) prev;
return var_Set (dst, name, value);
}
static int var_CopyVolume (vlc_object_t *src, const char *name,
vlc_value_t prev, vlc_value_t value, void *data)
{
vlc_object_t *dst = data;
long volume = lroundf (value.f_float * (float)AOUT_VOLUME_DEFAULT);
(void) src; (void) prev;
return var_SetInteger (dst, name, volume);
}
#undef aout_New #undef aout_New
/***************************************************************************** /*****************************************************************************
* aout_New: initialize aout structure * aout_New: initialize aout structure
...@@ -74,7 +95,9 @@ audio_output_t *aout_New( vlc_object_t * p_parent ) ...@@ -74,7 +95,9 @@ audio_output_t *aout_New( vlc_object_t * p_parent )
char *str; char *str;
var_Create (aout, "volume", VLC_VAR_FLOAT); var_Create (aout, "volume", VLC_VAR_FLOAT);
var_AddCallback (aout, "volume", var_CopyVolume, p_parent);
var_Create (aout, "mute", VLC_VAR_BOOL | VLC_VAR_DOINHERIT); var_Create (aout, "mute", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
var_AddCallback (aout, "mute", var_Copy, p_parent);
/* Visualizations */ /* Visualizations */
var_Create (aout, "visual", VLC_VAR_STRING | VLC_VAR_HASCHOICE); var_Create (aout, "visual", VLC_VAR_STRING | VLC_VAR_HASCHOICE);
...@@ -181,6 +204,9 @@ void aout_Destroy (audio_output_t *aout) ...@@ -181,6 +204,9 @@ void aout_Destroy (audio_output_t *aout)
if (owner->module != NULL) if (owner->module != NULL)
aout_Shutdown (aout); aout_Shutdown (aout);
var_DelCallback (aout, "mute", var_Copy, aout->p_parent);
var_DelCallback (aout, "volume", var_CopyVolume, aout->p_parent);
vlc_object_release (aout); vlc_object_release (aout);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment