]> git.sesse.net Git - vlc/commitdiff
Updated hotkeys after deinterlace changes.
authorLaurent Aimar <fenrir@videolan.org>
Mon, 5 Oct 2009 21:30:26 +0000 (23:30 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 5 Oct 2009 21:34:01 +0000 (23:34 +0200)
The deinterlace hotkey now turns of/off deinterlacing.

modules/control/hotkeys.c

index 1f536d3c83c8a5cc0cb30ea78b7b4cc65cc43994..d0f1e4deb775412f2e9b1bf3107363b5a9b111b0 100644 (file)
@@ -594,31 +594,37 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
             }
             else if( i_action == ACTIONID_DEINTERLACE && p_vout )
             {
-                vlc_value_t val={0}, val_list, text_list;
-                var_Get( p_vout, "deinterlace-mode", &val );
-                if( var_Change( p_vout, "deinterlace-mode", VLC_VAR_GETLIST,
-                                &val_list, &text_list ) >= 0 )
+                int i_deinterlace = var_GetInteger( p_vout, "deinterlace" );
+                if( i_deinterlace != 0 )
                 {
-                    int i;
-                    for( i = 0; i < val_list.p_list->i_count; i++ )
+                    var_SetInteger( p_vout, "deinterlace", 0 );
+                    vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN,
+                                     "%s", _("Deinterlace off") );
+                }
+                else
+                {
+                    var_SetInteger( p_vout, "deinterlace", 1 );
+
+                    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( !strcmp( val_list.p_list->p_values[i].psz_string,
-                                     val.psz_string ) )
+                        const char *psz_text = NULL;
+                        for( int i = 0; i < vlist.p_list->i_count; i++ )
                         {
-                            i++;
-                            break;
+                            if( !strcmp( vlist.p_list->p_values[i].psz_string, psz_mode ) )
+                            {
+                                psz_text = tlist.p_list->p_values[i].psz_string;
+                                break;
+                            }
                         }
-                    }
-                    if( i == val_list.p_list->i_count ) i = 0;
-                    var_SetString( p_vout, "deinterlace-mode",
-                                   val_list.p_list->p_values[i].psz_string );
-                    vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN,
-                                     _("Deinterlace mode: %s"),
-                                     text_list.p_list->p_values[i].psz_string );
+                        vout_OSDMessage( VLC_OBJECT(p_input), DEFAULT_CHAN,
+                                         "%s (%s)", _("Deinterlace on"), psz_text ? psz_text : psz_mode );
 
-                    var_FreeList( &val_list, &text_list );
+                        var_FreeList( &vlist, &tlist );
+                    }
+                    free( psz_mode );
                 }
-                free( val.psz_string );
             }
             else if( ( i_action == ACTIONID_ZOOM ||
                        i_action == ACTIONID_UNZOOM ) && p_vout )