1 /*****************************************************************************
2 * hotkeys.c: Hotkey handling for vlc
3 *****************************************************************************
4 * Copyright (C) 2004 VideoLAN
7 * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
27 #include <stdlib.h> /* malloc(), free() */
31 #include <vlc/input.h>
38 #define BUFFER_SIZE 10
40 #define CHANNELS_NUMBER 4
41 #define VOLUME_TEXT_CHAN p_intf->p_sys->p_channels[ 0 ]
42 #define VOLUME_WIDGET_CHAN p_intf->p_sys->p_channels[ 1 ]
43 #define POSITION_TEXT_CHAN p_intf->p_sys->p_channels[ 2 ]
44 #define POSITION_WIDGET_CHAN p_intf->p_sys->p_channels[ 3 ]
45 /*****************************************************************************
46 * intf_sys_t: description and status of FB interface
47 *****************************************************************************/
50 vlc_mutex_t change_lock; /* mutex to keep the callback
51 * and the main loop from
52 * stepping on each others
54 int p_keys[ BUFFER_SIZE ]; /* buffer that contains
56 int i_size; /* number of events in buffer */
57 int p_channels[ CHANNELS_NUMBER ]; /* contains registered
59 input_thread_t * p_input; /* pointer to input */
60 vout_thread_t * p_vout; /* pointer to vout object */
63 /*****************************************************************************
65 *****************************************************************************/
66 static int Open ( vlc_object_t * );
67 static void Close ( vlc_object_t * );
68 static void Run ( intf_thread_t * );
69 static int GetKey ( intf_thread_t *);
70 static int KeyEvent( vlc_object_t *, char const *,
71 vlc_value_t, vlc_value_t, void * );
72 static int ActionKeyCB( vlc_object_t *, char const *,
73 vlc_value_t, vlc_value_t, void * );
74 static void PlayBookmark( intf_thread_t *, int );
75 static void SetBookmark ( intf_thread_t *, int );
76 static void DisplayPosition( intf_thread_t *, vout_thread_t *, input_thread_t * );
77 static void DisplayVolume ( intf_thread_t *, vout_thread_t *, audio_volume_t );
78 static void ClearChannels ( intf_thread_t *, vout_thread_t * );
80 /*****************************************************************************
82 *****************************************************************************/
83 #define BOOKMARK1_TEXT N_("Playlist bookmark 1")
84 #define BOOKMARK2_TEXT N_("Playlist bookmark 2")
85 #define BOOKMARK3_TEXT N_("Playlist bookmark 3")
86 #define BOOKMARK4_TEXT N_("Playlist bookmark 4")
87 #define BOOKMARK5_TEXT N_("Playlist bookmark 5")
88 #define BOOKMARK6_TEXT N_("Playlist bookmark 6")
89 #define BOOKMARK7_TEXT N_("Playlist bookmark 7")
90 #define BOOKMARK8_TEXT N_("Playlist bookmark 8")
91 #define BOOKMARK9_TEXT N_("Playlist bookmark 9")
92 #define BOOKMARK10_TEXT N_("Playlist bookmark 10")
93 #define BOOKMARK_LONGTEXT N_( \
94 "This option allows you to define playlist bookmarks.")
97 set_description( _("Hotkeys management interface") );
98 add_string( "bookmark1", NULL, NULL,
99 BOOKMARK1_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
100 add_string( "bookmark2", NULL, NULL,
101 BOOKMARK2_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
102 add_string( "bookmark3", NULL, NULL,
103 BOOKMARK3_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
104 add_string( "bookmark4", NULL, NULL,
105 BOOKMARK4_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
106 add_string( "bookmark5", NULL, NULL,
107 BOOKMARK5_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
108 add_string( "bookmark6", NULL, NULL,
109 BOOKMARK6_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
110 add_string( "bookmark7", NULL, NULL,
111 BOOKMARK7_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
112 add_string( "bookmark8", NULL, NULL,
113 BOOKMARK8_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
114 add_string( "bookmark9", NULL, NULL,
115 BOOKMARK9_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
116 add_string( "bookmark10", NULL, NULL,
117 BOOKMARK10_TEXT, BOOKMARK_LONGTEXT, VLC_FALSE );
119 set_capability( "interface", 0 );
120 set_callbacks( Open, Close );
123 /*****************************************************************************
124 * Open: initialize interface
125 *****************************************************************************/
126 static int Open( vlc_object_t *p_this )
128 intf_thread_t *p_intf = (intf_thread_t *)p_this;
130 /* Allocate instance and initialize some members */
131 p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
132 if( p_intf->p_sys == NULL )
134 msg_Err( p_intf, "out of memory" );
137 vlc_mutex_init( p_intf, &p_intf->p_sys->change_lock );
138 p_intf->p_sys->i_size = 0;
139 p_intf->pf_run = Run;
141 p_intf->p_sys->p_input = NULL;
142 p_intf->p_sys->p_vout = NULL;
144 var_AddCallback( p_intf->p_vlc, "key-pressed", KeyEvent, p_intf );
148 /*****************************************************************************
149 * Close: destroy interface
150 *****************************************************************************/
151 static void Close( vlc_object_t *p_this )
153 intf_thread_t *p_intf = (intf_thread_t *)p_this;
155 if( p_intf->p_sys->p_input )
157 vlc_object_release( p_intf->p_sys->p_input );
159 if( p_intf->p_sys->p_vout )
161 vlc_object_release( p_intf->p_sys->p_vout );
163 /* Destroy structure */
164 free( p_intf->p_sys );
167 /*****************************************************************************
169 *****************************************************************************/
170 static void Run( intf_thread_t *p_intf )
172 playlist_t *p_playlist;
173 input_thread_t *p_input;
174 vout_thread_t *p_vout = NULL;
175 vout_thread_t *p_last_vout;
176 struct hotkey *p_hotkeys = p_intf->p_vlc->p_hotkeys;
180 /* Initialize hotkey structure */
181 for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
183 var_Create( p_intf->p_vlc, p_hotkeys[i].psz_action,
184 VLC_VAR_HOTKEY | VLC_VAR_DOINHERIT );
186 var_AddCallback( p_intf->p_vlc, p_hotkeys[i].psz_action,
188 var_Get( p_intf->p_vlc, p_hotkeys[i].psz_action, &val );
189 var_Set( p_intf->p_vlc, p_hotkeys[i].psz_action, val );
192 while( !p_intf->b_die )
197 msleep( INTF_IDLE_SLEEP );
199 /* Update the input */
200 if( p_intf->p_sys->p_input == NULL )
202 p_intf->p_sys->p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
205 else if( p_intf->p_sys->p_input->b_dead )
207 vlc_object_release( p_intf->p_sys->p_input );
208 p_intf->p_sys->p_input = NULL;
210 p_input = p_intf->p_sys->p_input;
212 /* Update the vout */
213 p_last_vout = p_intf->p_sys->p_vout;
216 p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
217 p_intf->p_sys->p_vout = p_vout;
219 else if( p_vout->b_die )
221 vlc_object_release( p_vout );
223 p_intf->p_sys->p_vout = NULL;
226 /* Register OSD channels */
227 if( p_vout && p_vout != p_last_vout )
229 for( i = 0; i < CHANNELS_NUMBER; i++ )
231 spu_Control( p_vout->p_spu, SPU_CHANNEL_REGISTER,
232 &p_intf->p_sys->p_channels[ i ] );
236 /* Find action triggered by hotkey */
238 i_key = GetKey( p_intf );
239 for( i = 0; i_key != -1 && p_hotkeys[i].psz_action != NULL; i++ )
241 if( p_hotkeys[i].i_key == i_key )
243 i_action = p_hotkeys[i].i_action;
249 /* No key pressed, sleep a bit more */
250 msleep( INTF_IDLE_SLEEP );
254 if( i_action == ACTIONID_QUIT )
256 p_intf->p_vlc->b_die = VLC_TRUE;
257 ClearChannels( p_intf, p_vout );
258 vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Quit" ) );
261 else if( i_action == ACTIONID_VOL_UP )
263 audio_volume_t i_newvol;
264 aout_VolumeUp( p_intf, 1, &i_newvol );
265 DisplayVolume( p_intf, p_vout, i_newvol );
267 else if( i_action == ACTIONID_VOL_DOWN )
269 audio_volume_t i_newvol;
270 aout_VolumeDown( p_intf, 1, &i_newvol );
271 DisplayVolume( p_intf, p_vout, i_newvol );
273 else if( i_action == ACTIONID_VOL_MUTE )
275 audio_volume_t i_newvol = -1;
276 aout_VolumeMute( p_intf, &i_newvol );
281 ClearChannels( p_intf, p_vout );
282 vout_OSDIcon( VLC_OBJECT( p_intf ), DEFAULT_CHAN,
287 DisplayVolume( p_intf, p_vout, i_newvol );
291 else if( i_action == ACTIONID_INTF_SHOW )
293 val.b_bool = VLC_TRUE;
294 p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
298 var_Set( p_playlist, "intf-show", val );
299 vlc_object_release( p_playlist );
302 else if( i_action == ACTIONID_SNAPSHOT )
304 if( p_vout ) vout_Control( p_vout, VOUT_SNAPSHOT );
306 else if( i_action == ACTIONID_SUBDELAY_DOWN )
308 int64_t i_delay = var_GetTime( p_input, "spu-delay" );
310 i_delay -= 50000; /* 50 ms */
312 var_SetTime( p_input, "spu-delay", i_delay );
313 ClearChannels( p_intf, p_vout );
314 vout_OSDMessage( p_intf, DEFAULT_CHAN, "Subtitle delay %i ms",
315 (int)(i_delay/1000) );
317 else if( i_action == ACTIONID_SUBDELAY_UP )
319 int64_t i_delay = var_GetTime( p_input, "spu-delay" );
321 i_delay += 50000; /* 50 ms */
323 var_SetTime( p_input, "spu-delay", i_delay );
324 ClearChannels( p_intf, p_vout );
325 vout_OSDMessage( p_intf, DEFAULT_CHAN, "Subtitle delay %i ms",
326 (int)(i_delay/1000) );
328 else if( i_action == ACTIONID_AUDIODELAY_DOWN )
330 int64_t i_delay = var_GetTime( p_input, "audio-delay" );
332 i_delay -= 50000; /* 50 ms */
334 var_SetTime( p_input, "audio-delay", i_delay );
335 ClearChannels( p_intf, p_vout );
336 vout_OSDMessage( p_intf, DEFAULT_CHAN, "Audio delay %i ms",
337 (int)(i_delay/1000) );
339 else if( i_action == ACTIONID_AUDIODELAY_UP )
341 int64_t i_delay = var_GetTime( p_input, "audio-delay" );
343 i_delay += 50000; /* 50 ms */
345 var_SetTime( p_input, "audio-delay", i_delay );
346 ClearChannels( p_intf, p_vout );
347 vout_OSDMessage( p_intf, DEFAULT_CHAN, "Audio delay %i ms",
348 (int)(i_delay/1000) );
350 else if( i_action == ACTIONID_FULLSCREEN )
354 var_Get( p_vout, "fullscreen", &val ); val.b_bool = !val.b_bool;
355 var_Set( p_vout, "fullscreen", val );
359 p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
363 var_Get( p_playlist, "fullscreen", &val ); val.b_bool = !val.b_bool;
364 var_Set( p_playlist, "fullscreen", val );
365 vlc_object_release( p_playlist );
369 else if( i_action == ACTIONID_PLAY )
371 p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
375 ClearChannels( p_intf, p_vout );
376 vout_OSDIcon( VLC_OBJECT( p_intf ), DEFAULT_CHAN,
378 playlist_Play( p_playlist );
379 vlc_object_release( p_playlist );
382 else if( i_action == ACTIONID_PLAY_PAUSE )
384 val.i_int = PLAYING_S;
387 var_Get( p_input, "state", &val );
389 if( p_input && val.i_int != PAUSE_S )
391 ClearChannels( p_intf, p_vout );
392 vout_OSDIcon( VLC_OBJECT( p_intf ), DEFAULT_CHAN,
395 var_Set( p_input, "state", val );
399 p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
403 ClearChannels( p_intf, p_vout );
404 vout_OSDIcon( VLC_OBJECT( p_intf ), DEFAULT_CHAN,
406 playlist_Play( p_playlist );
407 vlc_object_release( p_playlist );
414 * How to get a valid value ?
415 * That's not that easy with some special stream
417 vlc_bool_t b_seekable = VLC_TRUE;
419 if( i_action == ACTIONID_PAUSE )
421 ClearChannels( p_intf, p_vout );
422 vout_OSDIcon( VLC_OBJECT( p_intf ), DEFAULT_CHAN,
425 var_Set( p_input, "state", val );
427 else if( i_action == ACTIONID_JUMP_BACKWARD_10SEC && b_seekable )
429 val.i_time = -10000000;
430 var_Set( p_input, "time-offset", val );
431 DisplayPosition( p_intf, p_vout, p_input );
433 else if( i_action == ACTIONID_JUMP_FORWARD_10SEC && b_seekable )
435 val.i_time = 10000000;
436 var_Set( p_input, "time-offset", val );
437 DisplayPosition( p_intf, p_vout, p_input );
439 else if( i_action == ACTIONID_JUMP_BACKWARD_1MIN && b_seekable )
441 val.i_time = -60000000;
442 var_Set( p_input, "time-offset", val );
443 DisplayPosition( p_intf, p_vout, p_input );
445 else if( i_action == ACTIONID_JUMP_FORWARD_1MIN && b_seekable )
447 val.i_time = 60000000;
448 var_Set( p_input, "time-offset", val );
449 DisplayPosition( p_intf, p_vout, p_input );
451 else if( i_action == ACTIONID_JUMP_BACKWARD_5MIN && b_seekable )
453 val.i_time = -300000000;
454 var_Set( p_input, "time-offset", val );
455 DisplayPosition( p_intf, p_vout, p_input );
457 else if( i_action == ACTIONID_JUMP_FORWARD_5MIN && b_seekable )
459 val.i_time = 300000000;
460 var_Set( p_input, "time-offset", val );
461 DisplayPosition( p_intf, p_vout, p_input );
463 else if( i_action == ACTIONID_AUDIO_TRACK )
465 vlc_value_t val, list, list2;
467 var_Get( p_input, "audio-es", &val );
468 var_Change( p_input, "audio-es", VLC_VAR_GETCHOICES,
470 i_count = list.p_list->i_count;
475 for( i = 0; i < i_count; i++ )
477 if( val.i_int == list.p_list->p_values[i].i_int )
482 /* value of audio-es was not in choices list */
486 "invalid current audio track, selecting 0" );
487 var_Set( p_input, "audio-es",
488 list.p_list->p_values[0] );
491 else if( i == i_count - 1 )
493 var_Set( p_input, "audio-es",
494 list.p_list->p_values[1] );
499 var_Set( p_input, "audio-es",
500 list.p_list->p_values[i+1] );
503 vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN,
504 _("Audio track: %s"),
505 list2.p_list->p_values[i].psz_string );
507 else if( i_action == ACTIONID_SUBTITLE_TRACK )
509 vlc_value_t val, list, list2;
511 var_Get( p_input, "spu-es", &val );
513 var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
515 i_count = list.p_list->i_count;
518 vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN, _("Subtitle track: %s"), _("N/A") );
521 for( i = 0; i < i_count; i++ )
523 if( val.i_int == list.p_list->p_values[i].i_int )
528 /* value of spu-es was not in choices list */
531 msg_Warn( p_input, "invalid current subtitle track, selecting 0" );
532 var_Set( p_input, "spu-es", list.p_list->p_values[0] );
535 else if( i == i_count - 1 )
537 var_Set( p_input, "spu-es", list.p_list->p_values[0] );
542 var_Set( p_input, "spu-es", list.p_list->p_values[i+1] );
545 vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN,
546 _("Subtitle track: %s"),
547 list2.p_list->p_values[i].psz_string );
549 else if( i_action == ACTIONID_NEXT )
551 p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
555 vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN, _("Next") );
556 playlist_Next( p_playlist );
557 vlc_object_release( p_playlist );
560 else if( i_action == ACTIONID_PREV )
562 p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
566 vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN, _("Previous") );
567 playlist_Prev( p_playlist );
568 vlc_object_release( p_playlist );
571 else if( i_action == ACTIONID_STOP )
573 p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
577 playlist_Stop( p_playlist );
578 vlc_object_release( p_playlist );
581 else if( i_action == ACTIONID_FASTER )
583 vlc_value_t val; val.b_bool = VLC_TRUE;
584 var_Set( p_input, "rate-faster", val );
585 vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN, _("Faster") );
587 else if( i_action == ACTIONID_SLOWER )
589 vlc_value_t val; val.b_bool = VLC_TRUE;
590 var_Set( p_input, "rate-slower", val );
591 vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN, _("Slower") );
593 else if( i_action == ACTIONID_POSITION && b_seekable )
595 DisplayPosition( p_intf, p_vout, p_input );
597 else if( i_action >= ACTIONID_PLAY_BOOKMARK1 &&
598 i_action <= ACTIONID_PLAY_BOOKMARK10 )
600 PlayBookmark( p_intf, i_action - ACTIONID_PLAY_BOOKMARK1 + 1 );
602 else if( i_action >= ACTIONID_SET_BOOKMARK1 &&
603 i_action <= ACTIONID_SET_BOOKMARK10 )
605 SetBookmark( p_intf, i_action - ACTIONID_SET_BOOKMARK1 + 1 );
611 static int GetKey( intf_thread_t *p_intf)
613 vlc_mutex_lock( &p_intf->p_sys->change_lock );
614 if ( p_intf->p_sys->i_size == 0 )
616 vlc_mutex_unlock( &p_intf->p_sys->change_lock );
621 int i_return = p_intf->p_sys->p_keys[ 0 ];
623 p_intf->p_sys->i_size--;
624 for ( i = 0; i < BUFFER_SIZE - 1; i++)
626 p_intf->p_sys->p_keys[ i ] = p_intf->p_sys->p_keys[ i + 1 ];
628 vlc_mutex_unlock( &p_intf->p_sys->change_lock );
633 /*****************************************************************************
634 * KeyEvent: callback for keyboard events
635 *****************************************************************************/
636 static int KeyEvent( vlc_object_t *p_this, char const *psz_var,
637 vlc_value_t oldval, vlc_value_t newval, void *p_data )
639 intf_thread_t *p_intf = (intf_thread_t *)p_data;
640 vlc_mutex_lock( &p_intf->p_sys->change_lock );
641 if ( p_intf->p_sys->i_size == BUFFER_SIZE )
643 msg_Warn( p_intf, "event buffer full, dropping keypress" );
644 vlc_mutex_unlock( &p_intf->p_sys->change_lock );
649 p_intf->p_sys->p_keys[ p_intf->p_sys->i_size ] = newval.i_int;
650 p_intf->p_sys->i_size++;
652 vlc_mutex_unlock( &p_intf->p_sys->change_lock );
657 static int ActionKeyCB( vlc_object_t *p_this, char const *psz_var,
658 vlc_value_t oldval, vlc_value_t newval, void *p_data )
660 vlc_t *p_vlc = (vlc_t *)p_this;
661 struct hotkey *p_hotkeys = p_vlc->p_hotkeys;
664 for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
666 if( !strcmp( p_hotkeys[i].psz_action, psz_var ) )
668 p_hotkeys[i].i_key = newval.i_int;
675 static void PlayBookmark( intf_thread_t *p_intf, int i_num )
679 char psz_bookmark_name[11];
680 playlist_t *p_playlist =
681 vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
683 sprintf( psz_bookmark_name, "bookmark%i", i_num );
684 var_Create( p_intf, psz_bookmark_name, VLC_VAR_STRING|VLC_VAR_DOINHERIT );
685 var_Get( p_intf, psz_bookmark_name, &val );
689 char *psz_bookmark = strdup( val.psz_string );
690 for( i_position = 0; i_position < p_playlist->i_size; i_position++)
692 if( !strcmp( psz_bookmark,
693 p_playlist->pp_items[i_position]->input.psz_uri ) )
695 playlist_Goto( p_playlist, i_position );
699 vlc_object_release( p_playlist );
703 static void SetBookmark( intf_thread_t *p_intf, int i_num )
706 playlist_t *p_playlist =
707 vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
710 char psz_bookmark_name[11];
711 sprintf( psz_bookmark_name, "bookmark%i", i_num );
712 var_Create( p_intf, psz_bookmark_name,
713 VLC_VAR_STRING|VLC_VAR_DOINHERIT );
714 if( p_playlist->status.p_item )
716 val.psz_string = strdup( p_playlist->status.p_item->input.psz_uri );
717 var_Set( p_intf, psz_bookmark_name, val );
718 msg_Info( p_intf, "setting playlist bookmark %i to %s", i_num,
721 vlc_object_release( p_playlist );
725 static void DisplayPosition( intf_thread_t *p_intf, vout_thread_t *p_vout,
726 input_thread_t *p_input )
728 char psz_duration[MSTRTIME_MAX_SIZE];
729 char psz_time[MSTRTIME_MAX_SIZE];
730 vlc_value_t time, pos;
737 ClearChannels( p_intf, p_vout );
739 var_Get( p_input, "time", &time );
740 i_seconds = time.i_time / 1000000;
741 secstotimestr ( psz_time, i_seconds );
743 var_Get( p_input, "length", &time );
744 if( time.i_time > 0 )
746 secstotimestr( psz_duration, time.i_time / 1000000 );
747 vout_OSDMessage( p_input, POSITION_TEXT_CHAN, "%s / %s",
748 psz_time, psz_duration );
750 else if( i_seconds > 0 )
752 vout_OSDMessage( p_input, POSITION_TEXT_CHAN, psz_time );
755 if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
757 var_Get( p_input, "position", &pos );
758 vout_OSDSlider( VLC_OBJECT( p_input ), POSITION_WIDGET_CHAN,
759 pos.f_float * 100, OSD_HOR_SLIDER );
763 static void DisplayVolume( intf_thread_t *p_intf, vout_thread_t *p_vout,
764 audio_volume_t i_vol )
770 ClearChannels( p_intf, p_vout );
772 if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
774 vout_OSDSlider( VLC_OBJECT( p_vout ), VOLUME_WIDGET_CHAN,
775 i_vol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
779 vout_OSDMessage( p_vout, VOLUME_TEXT_CHAN, "Vol %d%%",
780 2*i_vol*100/AOUT_VOLUME_MAX );
784 static void ClearChannels( intf_thread_t *p_intf, vout_thread_t *p_vout )
790 spu_Control( p_vout->p_spu, SPU_CHANNEL_CLEAR, DEFAULT_CHAN );
791 for( i = 0; i < CHANNELS_NUMBER; i++ )
793 spu_Control( p_vout->p_spu, SPU_CHANNEL_CLEAR,
794 p_intf->p_sys->p_channels[ i ] );