Commit 96dfe793 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

osd: update volume reporting (untested)

parent eae1c91d
...@@ -29,11 +29,13 @@ ...@@ -29,11 +29,13 @@
# include "config.h" # include "config.h"
#endif #endif
#include <math.h>
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_keys.h> #include <vlc_keys.h>
#include <vlc_osd.h> #include <vlc_osd.h>
#include <vlc_image.h> #include <vlc_image.h>
#include <vlc_modules.h> #include <vlc_modules.h>
#include <vlc_aout_intf.h>
#include "libvlc.h" #include "libvlc.h"
...@@ -45,7 +47,6 @@ ...@@ -45,7 +47,6 @@
static void osd_UpdateState( osd_menu_state_t *, int, int, int, int, picture_t * ); static void osd_UpdateState( osd_menu_state_t *, int, int, int, int, picture_t * );
static inline osd_state_t *osd_VolumeStateChange( osd_state_t *, int ); static inline osd_state_t *osd_VolumeStateChange( osd_state_t *, int );
static int osd_VolumeStep( vlc_object_t *, int, int );
static bool osd_ParserLoad( osd_menu_t *, const char * ); static bool osd_ParserLoad( osd_menu_t *, const char * );
static void osd_ParserUnload( osd_menu_t * ); static void osd_ParserUnload( osd_menu_t * );
...@@ -139,8 +140,6 @@ osd_menu_t *osd_MenuCreate( vlc_object_t *p_this, const char *psz_file ) ...@@ -139,8 +140,6 @@ osd_menu_t *osd_MenuCreate( vlc_object_t *p_this, const char *psz_file )
{ {
osd_menu_t *p_osd = NULL; osd_menu_t *p_osd = NULL;
vlc_value_t val; vlc_value_t val;
int i_volume = 0;
int i_steps = 0;
/* to be sure to avoid multiple creation */ /* to be sure to avoid multiple creation */
vlc_mutex_lock( &osd_mutex ); vlc_mutex_lock( &osd_mutex );
...@@ -172,10 +171,15 @@ osd_menu_t *osd_MenuCreate( vlc_object_t *p_this, const char *psz_file ) ...@@ -172,10 +171,15 @@ osd_menu_t *osd_MenuCreate( vlc_object_t *p_this, const char *psz_file )
if( p_osd->p_state->p_volume ) if( p_osd->p_state->p_volume )
{ {
/* Update the volume state images to match the current volume */ /* Update the volume state images to match the current volume */
i_volume = config_GetInt( p_this, "volume" ); float vol = aout_VolumeGet( p_this );
i_steps = osd_VolumeStep( p_this, i_volume, p_osd->p_state->p_volume->i_ranges ); if( vol >= 0.f )
p_osd->p_state->p_volume->p_current_state = osd_VolumeStateChange( {
p_osd->p_state->p_volume->p_states, i_steps ); vol *= (float)AOUT_VOLUME_DEFAULT;
vol /= var_InheritInteger( p_this, "volume-step" );
p_osd->p_state->p_volume->p_current_state =
osd_VolumeStateChange( p_osd->p_state->p_volume->p_states,
lroundf(vol) );
}
} }
/* Initialize OSD state */ /* Initialize OSD state */
osd_UpdateState( p_osd->p_state, p_osd->i_x, p_osd->i_y, osd_UpdateState( p_osd->p_state, p_osd->i_x, p_osd->i_y,
...@@ -564,15 +568,6 @@ void osd_MenuDown( vlc_object_t *p_this ) ...@@ -564,15 +568,6 @@ void osd_MenuDown( vlc_object_t *p_this )
vlc_mutex_unlock( &osd_mutex ); vlc_mutex_unlock( &osd_mutex );
} }
static int osd_VolumeStep( vlc_object_t *p_this, int i_volume, int i_steps )
{
int i_volume_step = 0;
(void)i_steps;
i_volume_step = config_GetInt( p_this->p_libvlc, "volume-step" );
return (i_volume/i_volume_step);
}
#undef osd_ButtonFind #undef osd_ButtonFind
osd_button_t *osd_ButtonFind( vlc_object_t *p_this, int i_x, int i_y, osd_button_t *osd_ButtonFind( vlc_object_t *p_this, int i_x, int i_y,
int i_window_height, int i_window_width, int i_window_height, int i_window_width,
......
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