]> git.sesse.net Git - vlc/blobdiff - modules/control/hotkeys.c
macosx: fix typo preventing post-processing (refs #11613)
[vlc] / modules / control / hotkeys.c
index 8589f3f7849043e2600259d2fddec7a9a2b2b032..7a5db8cb2f2a5f4fb3a62bb38020744a8024ac20 100644 (file)
@@ -172,22 +172,37 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
 
         /* Playlist actions (including audio) */
         case ACTIONID_LOOP:
+        {
             /* Toggle Normal -> Loop -> Repeat -> Normal ... */
+            const char *mode;
             if( var_GetBool( p_playlist, "repeat" ) )
+            {
                 var_SetBool( p_playlist, "repeat", false );
+                mode = N_("Off");
+            }
             else
             if( var_GetBool( p_playlist, "loop" ) )
             { /* FIXME: this is not atomic, we should use a real tristate */
                 var_SetBool( p_playlist, "loop", false );
                 var_SetBool( p_playlist, "repeat", true );
+                mode = N_("One");
             }
             else
+            {
                 var_SetBool( p_playlist, "loop", true );
+                mode = N_("All");
+            }
+            DisplayMessage( p_vout, _("Loop: %s"), vlc_gettext(mode) );
             break;
+        }
 
         case ACTIONID_RANDOM:
-            var_ToggleBool( p_playlist, "random" );
+        {
+            const bool state = var_ToggleBool( p_playlist, "random" );
+            DisplayMessage( p_vout, _("Random: %s"),
+                            vlc_gettext( state ? N_("On") : N_("Off") ) );
             break;
+        }
 
         case ACTIONID_NEXT:
             DisplayMessage( p_vout, _("Next") );
@@ -271,18 +286,24 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
             break;
         }
         case ACTIONID_VOL_MUTE:
-            if( playlist_MuteToggle( p_playlist ) == 0 )
+        {
+            int mute = playlist_MuteGet( p_playlist );
+            if( mute < 0 )
+                break;
+            mute = !mute;
+            if( playlist_MuteSet( p_playlist, mute ) )
+                break;
+
+            float vol = playlist_VolumeGet( p_playlist );
+            if( mute || vol == 0.f )
             {
-                float vol = playlist_VolumeGet( p_playlist );
-                if( playlist_MuteGet( p_playlist ) > 0 || vol == 0.f )
-                {
-                    ClearChannels( p_intf, p_vout );
-                    DisplayIcon( p_vout, OSD_MUTE_ICON );
-                }
-                else
-                    DisplayVolume( p_intf, p_vout, vol );
+                ClearChannels( p_intf, p_vout );
+                DisplayIcon( p_vout, OSD_MUTE_ICON );
             }
+            else
+                DisplayVolume( p_intf, p_vout, vol );
             break;
+        }
 
         case ACTIONID_AUDIODEVICE_CYCLE:
         {
@@ -348,10 +369,10 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
 
         /* Playlist + video output actions */
         case ACTIONID_WALLPAPER:
-        {   /* FIXME: this is invalid if not using DirectX output!!! */
-            vlc_object_t *obj = p_vout ? VLC_OBJECT(p_vout)
-                                       : VLC_OBJECT(p_playlist);
-            var_ToggleBool( obj, "video-wallpaper" );
+        {
+            bool wp = var_ToggleBool( p_playlist, "video-wallpaper" );
+            if( p_vout )
+                var_SetBool( p_vout, "video-wallpaper", wp );
             break;
         }
 
@@ -570,12 +591,63 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                     i = 0;
                 else
                     i++;
-                var_Set( p_input, "spu-es", list.p_list->p_values[i] );
+                var_SetInteger( p_input, "spu-es", list.p_list->p_values[i].i_int );
+                var_SetInteger( p_input, "spu-choice", list.p_list->p_values[i].i_int );
                 DisplayMessage( p_vout, _("Subtitle track: %s"),
                                 list2.p_list->p_values[i].psz_string );
                 var_FreeList( &list, &list2 );
             }
             break;
+        case ACTIONID_SUBTITLE_TOGGLE:
+            if( p_input )
+            {
+                vlc_value_t list, list2;
+                int i_count, i_sel_index, i_sel_id, i_old_id, i_new_index;
+                i_old_id = var_GetInteger( p_input, "spu-es" );
+                i_sel_id = var_GetInteger( p_input, "spu-choice" );
+
+                var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
+                            &list, &list2 );
+                i_count = list.p_list->i_count;
+                if( i_count <= 1 )
+                {
+                    DisplayMessage( p_vout, _("Subtitle track: %s"),
+                                    _("N/A") );
+                    var_FreeList( &list, &list2 );
+                    break;
+                }
+                for( i_sel_index = 0; i_sel_index < i_count; i_sel_index++ )
+                {
+                    if( i_sel_id == list.p_list->p_values[i_sel_index].i_int )
+                    {
+                        break;
+                    }
+                }
+                /* if there is nothing to toggle choose the first track */
+                if( !i_sel_index ) {
+                    i_sel_index = 1;
+                    i_sel_id = list.p_list->p_values[1].i_int;
+                    var_SetInteger( p_input, "spu-choice", i_sel_id );
+                }
+
+                i_new_index = 0;
+                if( i_old_id != i_sel_id )
+                {
+                    if( i_sel_index >= i_count )
+                    {
+                        var_SetInteger( p_input, "spu-choice", list.p_list->p_values[0].i_int );
+                    }
+                    else
+                    {
+                        i_new_index = i_sel_index;
+                    }
+                }
+                var_SetInteger( p_input, "spu-es", list.p_list->p_values[i_new_index].i_int );
+                DisplayMessage( p_vout, _("Subtitle track: %s"),
+                                list2.p_list->p_values[i_new_index].psz_string );
+                var_FreeList( &list, &list2 );
+            }
+            break;
         case ACTIONID_PROGRAM_SID_NEXT:
         case ACTIONID_PROGRAM_SID_PREV:
             if( p_input )
@@ -712,9 +784,13 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
 
         case ACTIONID_TOGGLE_FULLSCREEN:
         {
-            bool fs = var_ToggleBool( p_playlist, "fullscreen" );
             if( p_vout )
-                var_SetBool( p_vout, "fullscreen", fs );
+            {
+                bool fs = var_ToggleBool( p_vout, "fullscreen" );
+                var_SetBool( p_playlist, "fullscreen", fs );
+            }
+            else
+                var_ToggleBool( p_playlist, "fullscreen" );
             break;
         }
 
@@ -924,7 +1000,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
 
                     char *psz_mode = var_GetString( p_vout, "deinterlace-mode" );
                     vlc_value_t vlist, tlist;
-                    if( psz_mode && !var_Change( p_vout, "deinterlace-mode", VLC_VAR_GETCHOICES, &vlist, &tlist ) >= 0 )
+                    if( psz_mode && !var_Change( p_vout, "deinterlace-mode", VLC_VAR_GETCHOICES, &vlist, &tlist ) )
                     {
                         const char *psz_text = NULL;
                         for( int i = 0; i < vlist.p_list->i_count; i++ )
@@ -949,7 +1025,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
             {
                 char *psz_mode = var_GetString( p_vout, "deinterlace-mode" );
                 vlc_value_t vlist, tlist;
-                if( psz_mode && !var_Change( p_vout, "deinterlace-mode", VLC_VAR_GETCHOICES, &vlist, &tlist ) >= 0 )
+                if( psz_mode && !var_Change( p_vout, "deinterlace-mode", VLC_VAR_GETCHOICES, &vlist, &tlist ))
                 {
                     const char *psz_text = NULL;
                     int i;