1 /*****************************************************************************
\r
2 * osd.c - The OSD Menu core code.
\r
3 *****************************************************************************
\r
4 * Copyright (C) 2005 M2X
\r
5 * $Id: osd.c 9451 2004-12-01 01:07:08Z jpsaman $
\r
7 * Authors: Jean-Paul Saman <jpsaman #_at_# m2x dot nl>
\r
9 * This program is free software; you can redistribute it and/or modify
\r
10 * it under the terms of the GNU General Public License as published by
\r
11 * the Free Software Foundation; either version 2 of the License, or
\r
12 * (at your option) any later version.
\r
14 * This program is distributed in the hope that it will be useful,
\r
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 * GNU General Public License for more details.
\r
19 * You should have received a copy of the GNU General Public License
\r
20 * along with this program; if not, write to the Free Software
\r
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
\r
22 *****************************************************************************/
\r
24 /*****************************************************************************
\r
26 *****************************************************************************/
\r
30 #include <vlc/vlc.h>
\r
31 #include <vlc_keys.h>
\r
32 #include <vlc_osd.h>
\r
34 #undef OSD_MENU_DEBUG
\r
36 /*****************************************************************************
\r
38 *****************************************************************************/
\r
40 static void osd_UpdateState( osd_menu_state_t *, int, int, int, int, picture_t * );
\r
41 static inline osd_state_t *osd_VolumeStateChange( osd_state_t *, int );
\r
42 static int osd_VolumeStep( vlc_object_t *, int, int );
\r
43 static vlc_bool_t osd_isVisible( osd_menu_t *p_osd );
\r
45 static vlc_bool_t osd_isVisible( osd_menu_t *p_osd )
\r
49 var_Get( p_osd, "osd-menu-visible", &val );
\r
53 /*****************************************************************************
\r
55 *****************************************************************************/
\r
56 osd_menu_t *__osd_MenuCreate( vlc_object_t *p_this, const char *psz_file )
\r
58 osd_menu_t *p_osd = NULL;
\r
59 vlc_value_t lockval;
\r
63 /* to be sure to avoid multiple creation */
\r
64 var_Create( p_this->p_libvlc, "osd_mutex", VLC_VAR_MUTEX );
\r
65 var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
\r
66 vlc_mutex_lock( lockval.p_address );
\r
68 if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL )
\r
72 msg_Dbg( p_this, "creating osd menu object" );
\r
73 if( ( p_osd = vlc_object_create( p_this, VLC_OBJECT_OSDMENU ) ) == NULL )
\r
75 msg_Err( p_this, "out of memory" );
\r
76 vlc_mutex_unlock( lockval.p_address );
\r
80 /* Parse configuration file */
\r
81 if( osd_ConfigLoader( p_this, psz_file, &p_osd ) )
\r
84 /* Setup default button (first button) */
\r
85 p_osd->p_state->p_visible = p_osd->p_button;
\r
86 p_osd->p_state->p_visible->p_current_state =
\r
87 osd_StateChange( p_osd->p_state->p_visible->p_states, OSD_BUTTON_SELECT );
\r
88 p_osd->i_width = p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch;
\r
89 p_osd->i_height = p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_lines;
\r
91 /* Update the volume state images to match the current volume */
\r
92 i_volume = config_GetInt( p_this, "volume" );
\r
93 i_steps = osd_VolumeStep( p_this, i_volume, p_osd->p_state->p_volume->i_ranges );
\r
94 p_osd->p_state->p_volume->p_current_state = osd_VolumeStateChange( p_osd->p_state->p_volume->p_states, i_steps );
\r
96 /* Initialize OSD state */
\r
97 osd_UpdateState( p_osd->p_state, p_osd->i_x, p_osd->i_y,
\r
98 p_osd->i_width, p_osd->i_height, NULL );
\r
100 vlc_object_yield( p_osd );
\r
101 vlc_object_attach( p_osd, p_this->p_vlc );
\r
103 /* Signal when an update of OSD menu is needed */
\r
104 var_Create( p_osd, "osd-menu-update", VLC_VAR_BOOL );
\r
105 var_Create( p_osd, "osd-menu-visible", VLC_VAR_BOOL );
\r
107 val.b_bool = VLC_FALSE;
\r
108 var_Set( p_osd, "osd-menu-update", val );
\r
109 var_Set( p_osd, "osd-menu-visible", val );
\r
111 vlc_mutex_unlock( lockval.p_address );
\r
115 msg_Err( p_this, "creating osd menu object failed" );
\r
116 vlc_mutex_unlock( lockval.p_address );
\r
117 vlc_object_destroy( p_osd );
\r
121 void __osd_MenuDelete( vlc_object_t *p_this, osd_menu_t *p_osd )
\r
123 vlc_value_t lockval;
\r
125 if( !p_osd || !p_this ) return;
\r
127 var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
\r
128 vlc_mutex_lock( lockval.p_address );
\r
130 vlc_object_release( p_osd );
\r
131 if( p_osd->i_refcount > 0 )
\r
133 vlc_mutex_unlock( lockval.p_address );
\r
137 var_Destroy( p_osd, "osd-menu-visible" );
\r
138 var_Destroy( p_osd, "osd-menu-update" );
\r
140 osd_ConfigUnload( p_this, &p_osd );
\r
141 vlc_object_detach( p_osd );
\r
142 vlc_object_destroy( p_osd );
\r
145 vlc_mutex_unlock( lockval.p_address );
\r
148 osd_state_t *__osd_StateChange( osd_state_t *p_states, const int i_state )
\r
150 osd_state_t *p_current = p_states;
\r
151 osd_state_t *p_temp = NULL;
\r
154 for( i=0; p_current != NULL; i++ )
\r
156 if( p_current->i_state == i_state )
\r
158 p_temp = p_current->p_next;
\r
159 p_current = p_temp;
\r
164 /* The volume can be modified in another interface while the OSD Menu
\r
165 * has not been instantiated yet. This routines updates the "volume OSD menu item"
\r
166 * to reflect the current state of the GUI.
\r
168 static inline osd_state_t *osd_VolumeStateChange( osd_state_t *p_current, int i_steps )
\r
170 osd_state_t *p_temp = NULL;
\r
173 if( i_steps < 0 ) i_steps = 0;
\r
175 for( i=0; (i < i_steps) && (p_current != NULL); i++ )
\r
177 p_temp = p_current->p_next;
\r
178 if( !p_temp ) return p_current;
\r
179 p_current = p_temp;
\r
181 return (!p_temp) ? p_current : p_temp;
\r
184 /* Update the state of the OSD Menu */
\r
185 static void osd_UpdateState( osd_menu_state_t *p_state, int i_x, int i_y,
\r
186 int i_width, int i_height, picture_t *p_pic )
\r
188 p_state->i_x = i_x;
\r
189 p_state->i_y = i_y;
\r
190 p_state->i_width = i_width;
\r
191 p_state->i_height = i_height;
\r
192 p_state->p_pic = p_pic;
\r
195 void __osd_MenuShow( vlc_object_t *p_this )
\r
197 osd_menu_t *p_osd = NULL;
\r
198 osd_button_t *p_button = NULL;
\r
199 vlc_value_t lockval;
\r
201 if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL )
\r
203 msg_Err( p_this, "osd_MenuNext failed" );
\r
207 var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
\r
208 vlc_mutex_lock( lockval.p_address );
\r
210 #if defined(OSD_MENU_DEBUG)
\r
211 msg_Dbg( p_osd, "menu on" );
\r
213 p_button = p_osd->p_state->p_visible;
\r
216 if( !p_button->b_range )
\r
217 p_button->p_current_state = osd_StateChange( p_button->p_states, OSD_BUTTON_UNSELECT );
\r
218 p_osd->p_state->p_visible = p_osd->p_button;
\r
220 if( !p_osd->p_state->p_visible->b_range )
\r
221 p_osd->p_state->p_visible->p_current_state =
\r
222 osd_StateChange( p_osd->p_state->p_visible->p_states, OSD_BUTTON_SELECT );
\r
224 osd_UpdateState( p_osd->p_state,
\r
225 p_osd->p_state->p_visible->i_x, p_osd->p_state->p_visible->i_y,
\r
226 p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch,
\r
227 p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_lines,
\r
228 p_osd->p_state->p_visible->p_current_state->p_pic );
\r
229 osd_SetMenuUpdate( p_osd, VLC_TRUE );
\r
231 osd_SetMenuVisible( p_osd, VLC_TRUE );
\r
233 vlc_object_release( (vlc_object_t*) p_osd );
\r
234 vlc_mutex_unlock( lockval.p_address );
\r
237 void __osd_MenuHide( vlc_object_t *p_this )
\r
239 osd_menu_t *p_osd = NULL;
\r
240 vlc_value_t lockval;
\r
242 if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL )
\r
244 msg_Err( p_this, "osd_MenuNext failed" );
\r
248 var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
\r
249 vlc_mutex_lock( lockval.p_address );
\r
251 #if defined(OSD_MENU_DEBUG)
\r
252 msg_Dbg( p_osd, "menu off" );
\r
254 osd_UpdateState( p_osd->p_state,
\r
255 p_osd->p_state->i_x, p_osd->p_state->i_y,
\r
257 osd_SetMenuUpdate( p_osd, VLC_TRUE );
\r
259 vlc_object_release( (vlc_object_t*) p_osd );
\r
260 vlc_mutex_unlock( lockval.p_address );
\r
263 void __osd_MenuActivate( vlc_object_t *p_this )
\r
265 osd_menu_t *p_osd = NULL;
\r
266 osd_button_t *p_button = NULL;
\r
267 vlc_value_t lockval;
\r
269 if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL )
\r
271 msg_Err( p_this, "osd_MenuNext failed" );
\r
275 if( osd_isVisible( p_osd ) == VLC_FALSE )
\r
277 vlc_object_release( (vlc_object_t*) p_osd );
\r
281 var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
\r
282 vlc_mutex_lock( lockval.p_address );
\r
284 #if defined(OSD_MENU_DEBUG)
\r
285 msg_Dbg( p_osd, "select" );
\r
287 p_button = p_osd->p_state->p_visible;
\r
289 * Is there a menu item above or below? If so, then select it.
\r
291 if( p_button && p_button->p_up)
\r
293 vlc_object_release( (vlc_object_t*) p_osd );
\r
294 vlc_mutex_unlock( lockval.p_address );
\r
295 __osd_MenuUp( p_this ); /* "menu select" means go to menu item above. */
\r
298 if( p_button && p_button->p_down)
\r
300 vlc_object_release( (vlc_object_t*) p_osd );
\r
301 vlc_mutex_unlock( lockval.p_address );
\r
302 __osd_MenuDown( p_this ); /* "menu select" means go to menu item below. */
\r
306 if( p_button && !p_button->b_range )
\r
308 p_button->p_current_state = osd_StateChange( p_button->p_states, OSD_BUTTON_PRESSED );
\r
309 osd_UpdateState( p_osd->p_state,
\r
310 p_button->i_x, p_button->i_y,
\r
311 p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch,
\r
312 p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_lines,
\r
313 p_button->p_current_state->p_pic );
\r
314 osd_SetMenuUpdate( p_osd, VLC_TRUE );
\r
315 osd_SetMenuVisible( p_osd, VLC_TRUE );
\r
316 osd_SetKeyPressed( VLC_OBJECT(p_osd->p_vlc), config_GetInt( p_osd, p_button->psz_action ) );
\r
317 #if defined(OSD_MENU_DEBUG)
\r
318 msg_Dbg( p_osd, "select (%d, %s)", config_GetInt( p_osd, p_button->psz_action ), p_button->psz_action );
\r
321 vlc_object_release( (vlc_object_t*) p_osd );
\r
322 vlc_mutex_unlock( lockval.p_address );
\r
325 void __osd_MenuNext( vlc_object_t *p_this )
\r
327 osd_menu_t *p_osd = NULL;
\r
328 osd_button_t *p_button = NULL;
\r
329 vlc_value_t lockval;
\r
331 if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL )
\r
333 msg_Err( p_this, "osd_MenuNext failed" );
\r
337 if( osd_isVisible( p_osd ) == VLC_FALSE )
\r
339 vlc_object_release( (vlc_object_t*) p_osd );
\r
343 var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
\r
344 vlc_mutex_lock( lockval.p_address );
\r
346 p_button = p_osd->p_state->p_visible;
\r
349 if( !p_button->b_range )
\r
350 p_button->p_current_state = osd_StateChange( p_button->p_states, OSD_BUTTON_UNSELECT );
\r
351 if( p_button->p_next )
\r
352 p_osd->p_state->p_visible = p_button->p_next;
\r
354 p_osd->p_state->p_visible = p_osd->p_button;
\r
356 if( !p_osd->p_state->p_visible->b_range )
\r
357 p_osd->p_state->p_visible->p_current_state =
\r
358 osd_StateChange( p_osd->p_state->p_visible->p_states, OSD_BUTTON_SELECT );
\r
360 osd_UpdateState( p_osd->p_state,
\r
361 p_osd->p_state->p_visible->i_x, p_osd->p_state->p_visible->i_y,
\r
362 p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch,
\r
363 p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_lines,
\r
364 p_osd->p_state->p_visible->p_current_state->p_pic );
\r
365 osd_SetMenuUpdate( p_osd, VLC_TRUE );
\r
367 #if defined(OSD_MENU_DEBUG)
\r
368 msg_Dbg( p_osd, "direction right [button %s]", p_osd->p_state->p_visible->psz_action );
\r
371 vlc_object_release( (vlc_object_t*) p_osd );
\r
372 vlc_mutex_unlock( lockval.p_address );
\r
375 void __osd_MenuPrev( vlc_object_t *p_this )
\r
377 osd_menu_t *p_osd = NULL;
\r
378 osd_button_t *p_button = NULL;
\r
379 vlc_value_t lockval;
\r
381 if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL )
\r
383 msg_Err( p_this, "osd_MenuPrev failed" );
\r
387 if( osd_isVisible( p_osd ) == VLC_FALSE )
\r
389 vlc_object_release( (vlc_object_t*) p_osd );
\r
393 var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
\r
394 vlc_mutex_lock( lockval.p_address );
\r
396 p_button = p_osd->p_state->p_visible;
\r
399 if( !p_button->b_range )
\r
400 p_button->p_current_state = osd_StateChange( p_button->p_states, OSD_BUTTON_UNSELECT );
\r
401 if( p_button->p_prev )
\r
402 p_osd->p_state->p_visible = p_button->p_prev;
\r
404 p_osd->p_state->p_visible = p_osd->p_last_button;
\r
406 if( !p_osd->p_state->p_visible->b_range )
\r
407 p_osd->p_state->p_visible->p_current_state =
\r
408 osd_StateChange( p_osd->p_state->p_visible->p_states, OSD_BUTTON_SELECT );
\r
410 osd_UpdateState( p_osd->p_state,
\r
411 p_osd->p_state->p_visible->i_x, p_osd->p_state->p_visible->i_y,
\r
412 p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch,
\r
413 p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_lines,
\r
414 p_osd->p_state->p_visible->p_current_state->p_pic );
\r
415 osd_SetMenuUpdate( p_osd, VLC_TRUE );
\r
417 #if defined(OSD_MENU_DEBUG)
\r
418 msg_Dbg( p_osd, "direction left [button %s]", p_osd->p_state->p_visible->psz_action );
\r
421 vlc_object_release( (vlc_object_t*) p_osd );
\r
422 vlc_mutex_unlock( lockval.p_address );
\r
425 void __osd_MenuUp( vlc_object_t *p_this )
\r
427 osd_menu_t *p_osd = NULL;
\r
428 osd_button_t *p_button = NULL;
\r
429 vlc_value_t lockval;
\r
430 #if defined(OSD_MENU_DEBUG)
\r
434 if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL )
\r
436 msg_Err( p_this, "osd_MenuDown failed" );
\r
440 if( osd_isVisible( p_osd ) == VLC_FALSE )
\r
442 vlc_object_release( (vlc_object_t*) p_osd );
\r
446 var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
\r
447 vlc_mutex_lock( lockval.p_address );
\r
449 p_button = p_osd->p_state->p_visible;
\r
452 if( !p_button->b_range )
\r
454 p_button->p_current_state = osd_StateChange( p_button->p_states, OSD_BUTTON_SELECT );
\r
455 if( p_button->p_up )
\r
456 p_osd->p_state->p_visible = p_button->p_up;
\r
459 if( p_button->b_range && p_osd->p_state->p_visible->b_range )
\r
461 osd_state_t *p_temp = p_osd->p_state->p_visible->p_current_state;
\r
462 if( p_temp && p_temp->p_next )
\r
463 p_osd->p_state->p_visible->p_current_state = p_temp->p_next;
\r
465 else if( !p_osd->p_state->p_visible->b_range )
\r
467 p_osd->p_state->p_visible->p_current_state =
\r
468 osd_StateChange( p_osd->p_state->p_visible->p_states, OSD_BUTTON_SELECT );
\r
471 osd_UpdateState( p_osd->p_state,
\r
472 p_osd->p_state->p_visible->i_x, p_osd->p_state->p_visible->i_y,
\r
473 p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch,
\r
474 p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_lines,
\r
475 p_osd->p_state->p_visible->p_current_state->p_pic );
\r
476 osd_SetMenuUpdate( p_osd, VLC_TRUE );
\r
477 /* If this is a range style action with associated images of only one state,
\r
478 * then perform "menu select" on every menu navigation
\r
480 if( p_button->b_range )
\r
482 osd_SetKeyPressed( VLC_OBJECT(p_osd->p_vlc), config_GetInt(p_osd, p_button->psz_action) );
\r
483 #if defined(OSD_MENU_DEBUG)
\r
484 msg_Dbg( p_osd, "select (%d, %s)", val.i_int, p_button->psz_action );
\r
488 #if defined(OSD_MENU_DEBUG)
\r
489 msg_Dbg( p_osd, "direction up [button %s]", p_osd->p_state->p_visible->psz_action );
\r
492 vlc_object_release( (vlc_object_t*) p_osd );
\r
493 vlc_mutex_unlock( lockval.p_address );
\r
496 void __osd_MenuDown( vlc_object_t *p_this )
\r
498 osd_menu_t *p_osd = NULL;
\r
499 osd_button_t *p_button = NULL;
\r
500 vlc_value_t lockval;
\r
501 #if defined(OSD_MENU_DEBUG)
\r
505 if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL )
\r
507 msg_Err( p_this, "osd_MenuDown failed" );
\r
511 if( osd_isVisible( p_osd ) == VLC_FALSE )
\r
513 vlc_object_release( (vlc_object_t*) p_osd );
\r
517 var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
\r
518 vlc_mutex_lock( lockval.p_address );
\r
520 p_button = p_osd->p_state->p_visible;
\r
523 if( !p_button->b_range )
\r
525 p_button->p_current_state = osd_StateChange( p_button->p_states, OSD_BUTTON_SELECT );
\r
526 if( p_button->p_down )
\r
527 p_osd->p_state->p_visible = p_button->p_down;
\r
530 if( p_button->b_range && p_osd->p_state->p_visible->b_range )
\r
532 osd_state_t *p_temp = p_osd->p_state->p_visible->p_current_state;
\r
533 if( p_temp && p_temp->p_prev )
\r
534 p_osd->p_state->p_visible->p_current_state = p_temp->p_prev;
\r
536 else if( !p_osd->p_state->p_visible->b_range )
\r
538 p_osd->p_state->p_visible->p_current_state =
\r
539 osd_StateChange( p_osd->p_state->p_visible->p_states, OSD_BUTTON_SELECT );
\r
542 osd_UpdateState( p_osd->p_state,
\r
543 p_osd->p_state->p_visible->i_x, p_osd->p_state->p_visible->i_y,
\r
544 p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch,
\r
545 p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_lines,
\r
546 p_osd->p_state->p_visible->p_current_state->p_pic );
\r
547 osd_SetMenuUpdate( p_osd, VLC_TRUE );
\r
548 /* If this is a range style action with associated images of only one state,
\r
549 * then perform "menu select" on every menu navigation
\r
551 if( p_button->b_range )
\r
553 osd_SetKeyPressed( VLC_OBJECT(p_osd->p_vlc), config_GetInt(p_osd, p_button->psz_action_down) );
\r
554 #if defined(OSD_MENU_DEBUG)
\r
555 msg_Dbg( p_osd, "select (%d, %s)", val.i_int, p_button->psz_action_down );
\r
559 #if defined(OSD_MENU_DEBUG)
\r
560 msg_Dbg( p_osd, "direction down [button %s]", p_osd->p_state->p_visible->psz_action );
\r
563 vlc_object_release( (vlc_object_t*) p_osd );
\r
564 vlc_mutex_unlock( lockval.p_address );
\r
567 static int osd_VolumeStep( vlc_object_t *p_this, int i_volume, int i_steps )
\r
569 int i_volume_step = 0;
\r
571 i_volume_step = config_GetInt( p_this->p_vlc, "volume-step" );
\r
572 return (i_volume/i_volume_step);
\r
576 * Display current audio volume bitmap
\r
578 * The OSD Menu audio volume bar is updated to reflect the new audio volume. Call this function
\r
579 * when the audio volume is updated outside the OSD menu command "menu up", "menu down" or "menu select".
\r
581 void __osd_Volume( vlc_object_t *p_this )
\r
583 osd_menu_t *p_osd = NULL;
\r
584 osd_button_t *p_button = NULL;
\r
585 vlc_value_t lockval;
\r
589 if( ( p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ) ) == NULL )
\r
591 msg_Err( p_this, "OSD menu volume update failed" );
\r
595 var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
\r
596 vlc_mutex_lock( lockval.p_address );
\r
598 p_button = p_osd->p_state->p_volume;
\r
599 if( p_osd->p_state->p_volume )
\r
600 p_osd->p_state->p_visible = p_osd->p_state->p_volume;
\r
601 if( p_button && p_button->b_range )
\r
603 /* Update the volume state images to match the current volume */
\r
604 i_volume = config_GetInt( p_this, "volume" );
\r
605 i_steps = osd_VolumeStep( p_this, i_volume, p_button->i_ranges );
\r
606 p_button->p_current_state = osd_VolumeStateChange( p_button->p_states, i_steps );
\r
608 osd_UpdateState( p_osd->p_state,
\r
609 p_button->i_x, p_button->i_y,
\r
610 p_button->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch,
\r
611 p_button->p_current_state->p_pic->p[Y_PLANE].i_visible_lines,
\r
612 p_button->p_current_state->p_pic );
\r
613 osd_SetMenuUpdate( p_osd, VLC_TRUE );
\r
614 osd_SetMenuVisible( p_osd, VLC_TRUE );
\r
616 vlc_object_release( (vlc_object_t*) p_osd );
\r
617 vlc_mutex_unlock( lockval.p_address );
\r