]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/controls.m
ALL:
[vlc] / modules / gui / macosx / controls.m
index 6e91dc426e3e9431b57323ac176ad7f5a6fdad00..113dca602ff10fa839fb00c2376f5cc28f7298c4 100644 (file)
@@ -2,7 +2,7 @@
  * controls.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: controls.m,v 1.24 2003/02/09 01:13:43 massiot Exp $
+ * $Id: controls.m,v 1.28 2003/02/12 14:22:23 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -53,6 +53,9 @@
 - (IBAction)next:(id)sender;
 - (IBAction)loop:(id)sender;
 
+- (IBAction)forward:(id)sender;
+- (IBAction)backward:(id)sender;
+
 - (IBAction)volumeUp:(id)sender;
 - (IBAction)volumeDown:(id)sender;
 - (IBAction)mute:(id)sender;
     vlc_object_release( p_playlist );
 }
 
-- (IBAction)volumeUp:(id)sender
+- (IBAction)forward:(id)sender
 {
     intf_thread_t * p_intf = [NSApp getIntf];
+    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                                       FIND_ANYWHERE );
+    if( p_playlist == NULL || p_playlist->p_input == NULL )
+    {
+        if ( p_playlist != NULL ) vlc_object_release( p_playlist );
+        return;
+    }
 
-    aout_VolumeUp( p_intf, 1, NULL );
+    input_Seek( p_playlist->p_input, 5, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR );
+    vlc_object_release( p_playlist );
+}
+
+- (IBAction)backward:(id)sender
+{
+    intf_thread_t * p_intf = [NSApp getIntf];
+    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                                       FIND_ANYWHERE );
+    if( p_playlist == NULL || p_playlist->p_input == NULL )
+    {
+        if ( p_playlist != NULL ) vlc_object_release( p_playlist );
+        return;
+    }
+
+    input_Seek( p_playlist->p_input, -5, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR );
+    vlc_object_release( p_playlist );
+}
+
+- (IBAction)volumeUp:(id)sender
+{
+    intf_thread_t * p_intf = [NSApp getIntf];
 
     if( p_intf->p_sys->b_mute )
     {
         [self mute: nil];
     }
 
+    aout_VolumeUp( p_intf, 1, NULL );
+
     [self updateVolumeSlider];
 }
 
 {
     intf_thread_t * p_intf = [NSApp getIntf];
 
-    aout_VolumeDown( p_intf, 1, NULL );
-
     if( p_intf->p_sys->b_mute )
     {
         [self mute: nil];
     }
+    
+    aout_VolumeDown( p_intf, 1, NULL );
 
     [self updateVolumeSlider];
 }
 
 - (IBAction)deinterlace:(id)sender
 {
-
+    intf_thread_t * p_intf = [NSApp getIntf];
+    BOOL bEnable = [sender state] == NSOffState;
+    
+    if( bEnable )
+    {
+        config_PutPsz( p_intf, "filter", "deinterlace" );
+       config_PutPsz( p_intf, "deinterlace-mode",
+                    [[sender title] lossyCString] );
+    }
+    else
+    {
+        config_PutPsz( p_intf, "filter", NULL );
+    }
 }
 
 - (IBAction)toggleProgram:(id)sender
 
         [o_mi setState: i_state];
     }
+    else if( [[o_mi title] isEqualToString: _NS("Step Forward")] ||
+             [[o_mi title] isEqualToString: _NS("Step Backward")] )
+    {
+        if( p_playlist != NULL && p_input != NULL )
+        {
+            vlc_mutex_lock( &p_input->stream.stream_lock );
+            bEnabled = p_input->stream.b_seekable;
+            vlc_mutex_unlock( &p_input->stream.stream_lock );
+        }
+        else
+        {
+            bEnabled = FALSE;
+        }
+    }
     else if( [[o_mi title] isEqualToString: _NS("Mute")] ) 
     {
         [o_mi setState: p_intf->p_sys->b_mute ? NSOnState : NSOffState];
     }
     else if( o_menu != nil && 
              [[o_menu title] isEqualToString: _NS("Deinterlace")] )
-    { 
+    {
+        char * psz_filter = config_GetPsz( p_intf, "filter" );
+        
+        if( psz_filter != NULL )
+        {
+            free( psz_filter );
+            
+            psz_filter = config_GetPsz( p_intf, "deinterlace-mode" );
+        }
 
-    } 
+        if( psz_filter != NULL )
+        {
+            if( strcmp( psz_filter, [[o_mi title] lossyCString] ) == 0 )
+            {
+                [o_mi setState: NSOnState];
+            }
+            else
+            {
+                [o_mi setState: NSOffState];
+            }
+
+            free( psz_filter );
+        }
+        else
+        {
+            [o_mi setState: NSOffState];
+        }
+    }
 
     if( p_playlist != NULL )
     {