Commit 0aebd656 authored by Dylan's avatar Dylan Committed by Jean-Baptiste Kempf

Add Hotkey to cycle through audio devices

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 83a70bc8
...@@ -334,5 +334,6 @@ static inline int StringToKey( char *psz_key ) ...@@ -334,5 +334,6 @@ static inline int StringToKey( char *psz_key )
#define ACTIONID_ZOOM_HALF 93 #define ACTIONID_ZOOM_HALF 93
#define ACTIONID_ZOOM_ORIGINAL 94 #define ACTIONID_ZOOM_ORIGINAL 94
#define ACTIONID_ZOOM_DOUBLE 95 #define ACTIONID_ZOOM_DOUBLE 95
/* Cycle Through Audio Devices */
#define ACTIONID_AUDIODEVICE_CYCLE 96
#endif #endif
...@@ -504,6 +504,54 @@ static void Run( intf_thread_t *p_intf ) ...@@ -504,6 +504,54 @@ static void Run( intf_thread_t *p_intf )
_("Audio track: %s"), _("Audio track: %s"),
list2.p_list->p_values[i].psz_string ); list2.p_list->p_values[i].psz_string );
} }
else if( i_action == ACTIONID_AUDIODEVICE_CYCLE && p_vout)
{
vlc_value_t val, list, list2;
int i_count, i;
aout_instance_t *p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE );
var_Get( p_aout, "audio-device", &val );
var_Change( p_aout, "audio-device", VLC_VAR_GETCHOICES,&list, &list2 );
i_count = list.p_list->i_count;
if( i_count <= 1 )
{
continue;
}
for( i = 1; i < i_count; i )
{
if( val.i_int == list.p_list->p_values[i].i_int )
{
break;
}
}
if( i == i_count )
{
msg_Warn( p_aout,
"invalid current audio device, selecting 0" );
var_Set( p_aout, "audio-device",
list.p_list->p_values[1] );
i = 1;
}
else if( i == i_count -1 )
{
var_Set( p_aout, "audio-device",
list.p_list->p_values[0] );
i = 0;
}
else
{
var_Set( p_aout, "audio-device",
list.p_list->p_values[i1] );
i;
}
vout_OSDMessage( VLC_OBJECT(p_input),
DEFAULT_CHAN,
_("Audio Device: %s"),
list2.p_list->p_values[i].psz_string );
}
else if( i_action == ACTIONID_SUBTITLE_TRACK ) else if( i_action == ACTIONID_SUBTITLE_TRACK )
{ {
vlc_value_t val, list, list2; vlc_value_t val, list, list2;
......
...@@ -1356,6 +1356,8 @@ static const char *ppsz_pltree_descriptions[] = { N_("Default"), N_("Always"), N ...@@ -1356,6 +1356,8 @@ static const char *ppsz_pltree_descriptions[] = { N_("Default"), N_("Always"), N
#define MENU_SELECT_KEY_LONGTEXT N_( \ #define MENU_SELECT_KEY_LONGTEXT N_( \
"Selecting current widget performs the associated action.") "Selecting current widget performs the associated action.")
#define AUDI_DEVICE_CYCLE_KEY_TEXT N_("Cycle through audio devices")
#define AUDI_DEVICE_CYCLE_KEY_LONGTEXT N_("Cycle through available audio devices")
const char vlc_usage[] = N_( const char vlc_usage[] = N_(
"Usage: %s [options] [stream] ..." "Usage: %s [options] [stream] ..."
"\nYou can specify multiple streams on the commandline. They will be enqueued in the playlist." "\nYou can specify multiple streams on the commandline. They will be enqueued in the playlist."
...@@ -2192,6 +2194,7 @@ vlc_module_begin(); ...@@ -2192,6 +2194,7 @@ vlc_module_begin();
# define KEY_MENU_UP KEY_MODIFIER_ALT|KEY_MODIFIER_SHIFT|KEY_UP # define KEY_MENU_UP KEY_MODIFIER_ALT|KEY_MODIFIER_SHIFT|KEY_UP
# define KEY_MENU_DOWN KEY_MODIFIER_ALT|KEY_MODIFIER_SHIFT|KEY_DOWN # define KEY_MENU_DOWN KEY_MODIFIER_ALT|KEY_MODIFIER_SHIFT|KEY_DOWN
# define KEY_MENU_SELECT KEY_MODIFIER_ALT|KEY_MODIFIER_SHIFT|KEY_ENTER # define KEY_MENU_SELECT KEY_MODIFIER_ALT|KEY_MODIFIER_SHIFT|KEY_ENTER
# define KEY_AUDIODEVICE_CYCLE KEY_MODIFIER_ALT|'a'
#endif #endif
add_key( "key-toggle-fullscreen", KEY_TOGGLE_FULLSCREEN, NULL, TOGGLE_FULLSCREEN_KEY_TEXT, add_key( "key-toggle-fullscreen", KEY_TOGGLE_FULLSCREEN, NULL, TOGGLE_FULLSCREEN_KEY_TEXT,
...@@ -2272,6 +2275,8 @@ vlc_module_begin(); ...@@ -2272,6 +2275,8 @@ vlc_module_begin();
AUDIODELAY_DOWN_KEY_TEXT, AUDIODELAY_DOWN_KEY_LONGTEXT, VLC_TRUE ); AUDIODELAY_DOWN_KEY_TEXT, AUDIODELAY_DOWN_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-audio-track", KEY_AUDIO_TRACK, NULL, AUDIO_TRACK_KEY_TEXT, add_key( "key-audio-track", KEY_AUDIO_TRACK, NULL, AUDIO_TRACK_KEY_TEXT,
AUDIO_TRACK_KEY_LONGTEXT, VLC_FALSE ); AUDIO_TRACK_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-audiodevice-cycle", KEY_STOP, NULL, AUDI_DEVICE_CYCLE_KEY_TEXT,
AUDI_DEVICE_CYCLE_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-subtitle-track", KEY_SUBTITLE_TRACK, NULL, add_key( "key-subtitle-track", KEY_SUBTITLE_TRACK, NULL,
SUBTITLE_TRACK_KEY_TEXT, SUBTITLE_TRACK_KEY_LONGTEXT, VLC_FALSE ); SUBTITLE_TRACK_KEY_TEXT, SUBTITLE_TRACK_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-aspect-ratio", KEY_ASPECT_RATIO, NULL, add_key( "key-aspect-ratio", KEY_ASPECT_RATIO, NULL,
...@@ -2605,6 +2610,7 @@ const struct hotkey libvlc_hotkeys[] = ...@@ -2605,6 +2610,7 @@ const struct hotkey libvlc_hotkeys[] =
{ "key-menu-up", ACTIONID_MENU_UP, 0, 0, 0, 0 }, { "key-menu-up", ACTIONID_MENU_UP, 0, 0, 0, 0 },
{ "key-menu-down", ACTIONID_MENU_DOWN, 0, 0, 0, 0 }, { "key-menu-down", ACTIONID_MENU_DOWN, 0, 0, 0, 0 },
{ "key-menu-select", ACTIONID_MENU_SELECT, 0, 0, 0, 0 }, { "key-menu-select", ACTIONID_MENU_SELECT, 0, 0, 0, 0 },
{ "key-audiodevice-cycle", ACTIONID_AUDIODEVICE_CYCLE, 0, 0, 0, 0 },
{ NULL, 0, 0, 0, 0, 0 } { NULL, 0, 0, 0, 0, 0 }
}; };
......
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