hadded keys to cycle audio track and subtitle track

parent acc84ebe
...@@ -407,6 +407,82 @@ static void Run( intf_thread_t *p_intf ) ...@@ -407,6 +407,82 @@ static void Run( intf_thread_t *p_intf )
var_Set( p_input, "time-offset", val ); var_Set( p_input, "time-offset", val );
DisplayPosition( p_intf, p_vout, p_input ); DisplayPosition( p_intf, p_vout, p_input );
} }
else if( i_action == ACTIONID_AUDIO_TRACK )
{
vlc_value_t val, list, list2;
int i_count, i;
var_Get( p_input, "audio-es", &val );
var_Change( p_input, "audio-es", VLC_VAR_GETCHOICES,
&list, &list2 );
i_count = list.p_list->i_count;
for( i = 0; i < i_count; i++ )
{
if( val.i_int == list.p_list->p_values[i].i_int )
{
break;
}
}
/* value of audio-es was not in choices list */
if( i == i_count )
{
msg_Warn( p_input,
"invalid current audio track, selecting 0" );
var_Set( p_input, "audio-es",
list.p_list->p_values[0] );
i = 0;
}
else if( i == i_count - 1 )
{
var_Set( p_input, "audio-es",
list.p_list->p_values[0] );
i = 0;
}
else
{
var_Set( p_input, "audio-es",
list.p_list->p_values[i+1] );
i++;
}
vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN,
_("Audio track: %s"),
list2.p_list->p_values[i].psz_string );
}
else if( i_action = ACTIONID_SUBTITLE_TRACK )
{
vlc_value_t val, list, list2;
int i_count, i;
var_Get( p_input, "spu-es", &val );
var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
&list, &list2 );
i_count = list.p_list->i_count;
for( i = 0; i < i_count; i++ )
{
if( val.i_int == list.p_list->p_values[i].i_int )
{
break;
}
}
/* value of audio-es was not in choices list */
if( i == i_count )
{
msg_Warn( p_input, "invalid current subtitle track, selecting 0" );
var_Set( p_input, "spu-es", list.p_list->p_values[0] );
i = 0;
}
else if( i == i_count - 1 )
{
var_Set( p_input, "spu-es", list.p_list->p_values[0] );
i = 0;
}
else
{
var_Set( p_input, "spu-es", list.p_list->p_values[i+1] );
i = i + 1;
}
vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN,
_("Subtitle track: %s"),
list2.p_list->p_values[i].psz_string );
}
else if( i_action == ACTIONID_NEXT ) else if( i_action == ACTIONID_NEXT )
{ {
p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
......
...@@ -722,6 +722,11 @@ static char *ppsz_align_descriptions[] = ...@@ -722,6 +722,11 @@ static char *ppsz_align_descriptions[] =
#define HISTORY_FORWARD_TEXT N_("Go forward in browsing history") #define HISTORY_FORWARD_TEXT N_("Go forward in browsing history")
#define HISTORY_FORWARD_LONGTEXT N_("Select the key to go forward (to the next media item) in the browsing history.") #define HISTORY_FORWARD_LONGTEXT N_("Select the key to go forward (to the next media item) in the browsing history.")
#define AUDIO_TRACK_KEY_TEXT N_("Cycle audio track")
#define AUDIO_TRACK_KEY_LONGTEXT N_("Cycle through the available audio tracks(languages)")
#define SUBTITLE_TRACK_KEY_TEXT N_("Cycle subtitle track")
#define SUBTITLE_TRACK_KEY_LONGTEXT N_("Cycle through the available subtitle tracks")
#define PLAYLIST_USAGE N_("\nPlaylist items:" \ #define PLAYLIST_USAGE N_("\nPlaylist items:" \
"\n *.mpg, *.vob plain MPEG-1/2 files" \ "\n *.mpg, *.vob plain MPEG-1/2 files" \
"\n [dvd://][device][@raw_device][@[title][,[chapter][,angle]]]" \ "\n [dvd://][device][@raw_device][@[title][,[chapter][,angle]]]" \
...@@ -1107,6 +1112,8 @@ vlc_module_begin(); ...@@ -1107,6 +1112,8 @@ vlc_module_begin();
add_key( "key-play-bookmark10", KEY_F10, NULL, PLAY_BOOKMARK10_KEY_TEXT, PLAY_BOOKMARK_KEY_LONGTEXT, VLC_TRUE ); add_key( "key-play-bookmark10", KEY_F10, NULL, PLAY_BOOKMARK10_KEY_TEXT, PLAY_BOOKMARK_KEY_LONGTEXT, VLC_TRUE );
add_key( "key-history-back", KEY_MODIFIER_CTRL|'[', NULL, HISTORY_BACK_TEXT, HISTORY_BACK_LONGTEXT, VLC_TRUE ); add_key( "key-history-back", KEY_MODIFIER_CTRL|'[', NULL, HISTORY_BACK_TEXT, HISTORY_BACK_LONGTEXT, VLC_TRUE );
add_key( "key-history-forward", KEY_MODIFIER_CTRL|']', NULL, HISTORY_FORWARD_TEXT, HISTORY_FORWARD_LONGTEXT, VLC_TRUE ); add_key( "key-history-forward", KEY_MODIFIER_CTRL|']', NULL, HISTORY_FORWARD_TEXT, HISTORY_FORWARD_LONGTEXT, VLC_TRUE );
add_key( "key-audio-track", 'l', NULL, AUDIO_TRACK_KEY_TEXT, AUDIO_TRACK_KEY_LONGTEXT, VLC_FALSE );
add_key( "key-subtitle-track", 's', NULL, SUBTITLE_TRACK_KEY_TEXT, SUBTITLE_TRACK_KEY_LONGTEXT, VLC_FALSE );
#endif #endif
/* Usage (mainly useful for cmd line stuff) */ /* Usage (mainly useful for cmd line stuff) */
...@@ -1197,5 +1204,7 @@ static struct hotkey p_hotkeys[] = ...@@ -1197,5 +1204,7 @@ static struct hotkey p_hotkeys[] =
{ "key-play-bookmark10", ACTIONID_PLAY_BOOKMARK10, 0}, { "key-play-bookmark10", ACTIONID_PLAY_BOOKMARK10, 0},
{ "key-history-back", ACTIONID_HISTORY_BACK, 0}, { "key-history-back", ACTIONID_HISTORY_BACK, 0},
{ "key-history-forward", ACTIONID_HISTORY_FORWARD, 0}, { "key-history-forward", ACTIONID_HISTORY_FORWARD, 0},
{ "key-audio-track", ACTIONID_AUDIO_TRACK, 0},
{ "key-subtitle-track", ACTIONID_SUBTITLE_TRACK, 0},
{ NULL, 0, 0 } { NULL, 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