[vlc-devel] commit: Updated hotkeys after deinterlace changes. (Laurent Aimar )

git version control git at videolan.org
Mon Oct 5 23:52:26 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Oct  5 23:30:26 2009 +0200| [2d273fc31f5ce12af32204abcbd8ccd43c826464] | committer: Laurent Aimar 

Updated hotkeys after deinterlace changes.

The deinterlace hotkey now turns of/off deinterlacing.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2d273fc31f5ce12af32204abcbd8ccd43c826464
---

 modules/control/hotkeys.c |   44 +++++++++++++++++++++++++-------------------
 1 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 1f536d3..d0f1e4d 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -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 )




More information about the vlc-devel mailing list