]> git.sesse.net Git - vlc/commitdiff
* modules/gui/macosx/*:
authorDerk-Jan Hartman <hartman@videolan.org>
Sat, 20 Sep 2003 13:46:00 +0000 (13:46 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Sat, 20 Sep 2003 13:46:00 +0000 (13:46 +0000)
  - implemented the new input variables for control.
  - reevaltuated the locking mechanisms in the osx intf.
    a lot of this can now be removed, because of the new input structures,
    and the vout garbage collector of playlist.

modules/gui/macosx/controls.m
modules/gui/macosx/info.m
modules/gui/macosx/intf.h
modules/gui/macosx/intf.m
modules/gui/macosx/playlist.m
modules/gui/macosx/vout.m

index f8f46d3ef04f30c11ab30cfd2a4110d83c7a75de..7e55915b89221808a7790636a182b0a7b209f061 100644 (file)
@@ -2,7 +2,7 @@
  * controls.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: controls.m,v 1.47 2003/07/29 21:14:10 gbazin Exp $
+ * $Id: controls.m,v 1.48 2003/09/20 13:46:00 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
 - (IBAction)stop:(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 )
+    if( p_playlist != NULL )
     {
-        return;
+        playlist_Stop( p_playlist );
+        vlc_object_release( p_playlist );
     }
-
-    playlist_Stop( p_playlist );
-    vlc_object_release( p_playlist );
 }
 
 - (IBAction)faster:(id)sender
 {
     intf_thread_t * p_intf = [NSApp getIntf];
-
-    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+    input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
                                                        FIND_ANYWHERE );
-    if( p_playlist == NULL )
-    {
-        return;
-    }
-
-    vlc_mutex_lock( &p_playlist->object_lock );
-    if( p_playlist->p_input != NULL )
+    if( p_input != NULL )
     {
-        input_SetStatus( p_playlist->p_input, INPUT_STATUS_FASTER );
-    } 
-    vlc_mutex_unlock( &p_playlist->object_lock );
+        vlc_value_t val; val.b_bool = VLC_TRUE;
 
-    vlc_object_release( p_playlist );
+        var_Set( p_input, "rate-faster", val );
+        vlc_object_release( p_input );
+    }
 }
 
 - (IBAction)slower:(id)sender
 {
     intf_thread_t * p_intf = [NSApp getIntf];
-
-    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+    input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
                                                        FIND_ANYWHERE );
-    if( p_playlist == NULL )
+    if( p_input != NULL )
     {
-        return;
-    }
+        vlc_value_t val; val.b_bool = VLC_TRUE;
 
-    vlc_mutex_lock( &p_playlist->object_lock );
-    if( p_playlist->p_input != NULL )
-    {
-        input_SetStatus( p_playlist->p_input, INPUT_STATUS_SLOWER );
+        var_Set( p_input, "rate-slower", val );
+        vlc_object_release( p_input );
     }
-    vlc_mutex_unlock( &p_playlist->object_lock );
-
-    vlc_object_release( p_playlist );
 }
 
 - (IBAction)prev:(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,
+    input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
                                                        FIND_ANYWHERE );
-    if( p_playlist == NULL || p_playlist->p_input == NULL )
+    if( p_input != NULL )
     {
-        if ( p_playlist != NULL ) vlc_object_release( p_playlist );
-        return;
+        vlc_value_t time;
+        time.f_float = 5;
+        var_Set( p_input, "time-offset", time );
+        vlc_object_release( p_input );
     }
-
-    playlist_Play( p_playlist );
-    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,
+    input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
                                                        FIND_ANYWHERE );
-    if( p_playlist == NULL || p_playlist->p_input == NULL )
+    if( p_input != NULL )
     {
-        if ( p_playlist != NULL ) vlc_object_release( p_playlist );
-        return;
+        vlc_value_t time;
+        time.f_float = -5;
+        var_Set( p_input, "time-offset", time );
+        vlc_object_release( p_input );
     }
-
-    playlist_Play( p_playlist );
-    input_Seek( p_playlist->p_input, -5, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR );
-    vlc_object_release( p_playlist );
 }
 
 - (IBAction)volumeUp:(id)sender
index 4393b5b4de053716b03682c2853b2442b55dee2a..d3041758d8ad753562189670e9240a22ce668543 100644 (file)
@@ -2,7 +2,7 @@
  * info.m: MacOS X info panel
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: info.m,v 1.6 2003/05/25 17:27:13 massiot Exp $
+ * $Id: info.m,v 1.7 2003/09/20 13:46:00 hartman Exp $
  *
  * Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
  *
     o_selectedPane = [[o_selector selectedItem] title];
 
     intf_thread_t * p_intf = [NSApp getIntf]; 
-    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+    input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
                                                        FIND_ANYWHERE );
 
-    if( p_playlist == NULL )
+    if ( p_input == NULL )
     {
         return;
     }
 
-    vlc_mutex_lock( &p_playlist->object_lock );
-
-    if ( p_playlist->p_input == NULL )
-    {
-        vlc_mutex_unlock( &p_playlist->object_lock );
-        vlc_object_release( p_playlist );
-        return;
-    }
-
     [o_strings removeAllObjects];
     [o_selector removeAllItems];
 
-    vlc_mutex_lock( &p_playlist->p_input->stream.stream_lock );
-    input_info_category_t * p_category = p_playlist->p_input->stream.p_info;
+    vlc_mutex_lock( &p_input->stream.stream_lock );
+    input_info_category_t * p_category = p_input->stream.p_info;
 
     while( p_category )
     {
         p_category = p_category->p_next;
     }
 
-    vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
-    vlc_mutex_unlock( &p_playlist->object_lock );
-    vlc_object_release( p_playlist );
+    vlc_mutex_unlock( &p_input->stream.stream_lock );
+    vlc_object_release( p_input );
 
     int i_select = [o_selector indexOfItemWithTitle:o_selectedPane];
     if ( i_select < 0 )
     BOOL bEnabled = TRUE;
 
     intf_thread_t * p_intf = [NSApp getIntf];
-    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+    input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
                                                        FIND_ANYWHERE );
 
-    if( p_playlist != NULL )
-    {
-        vlc_mutex_lock( &p_playlist->object_lock );
-    }
-
     if( [[o_mi title] isEqualToString: _NS("Info")] )
     {
-        if( p_playlist == NULL || p_playlist->p_input == NULL )
+        if( p_input == NULL )
         {
             bEnabled = FALSE;
         }
-    }
-    
-    if( p_playlist != NULL )
-    {
-        vlc_mutex_unlock( &p_playlist->object_lock );
-        vlc_object_release( p_playlist );
+        else
+        {
+            vlc_object_release( p_input );
+        }
     }
 
     return( bEnabled );
index 2b4614ed9f8999f6f13b5f8d434e2aec22a383da..47bbc004afb1b18d1f7811854e5eb308c808605c 100644 (file)
@@ -2,7 +2,7 @@
  * intf.h: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: intf.h,v 1.43 2003/09/19 23:03:27 hartman Exp $
+ * $Id: intf.h,v 1.44 2003/09/20 13:46:00 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -225,8 +225,6 @@ struct intf_sys_t
 - (void)terminate;
 
 - (void)manage;
-- (void)manage:(playlist_t *)p_playlist;
-- (void)manageMode:(playlist_t *)p_playlist;
 - (void)manageIntf:(NSTimer *)o_timer;
 - (void)setupMenus;
 
index 62ce6a55d60693303f5cdca00485e433cf202ac0..bec07f92c5e66f7a9e50ae3a9a29df358f0f7955 100644 (file)
@@ -2,7 +2,7 @@
  * intf.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: intf.m,v 1.94 2003/09/19 23:03:27 hartman Exp $
+ * $Id: intf.m,v 1.95 2003/09/20 13:46:00 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -483,11 +483,38 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
         if( p_playlist != NULL )
         {
             var_AddCallback( p_playlist, "intf-change", PlaylistChanged, self );
-            vlc_mutex_lock( &p_playlist->object_lock );
-            
-            [self manage: p_playlist];
+#define p_input p_playlist->p_input
+        
+            if( p_input )
+            {
+                if( !p_input->b_die )
+                {
+                    vlc_value_t val;
+
+                    /* New input or stream map change */
+                    if( p_input->stream.b_changed )
+                    {
+                        msg_Dbg( p_intf, "stream has changed, refreshing interface" );
+                        p_intf->p_sys->b_playing = TRUE;
+                        p_intf->p_sys->b_current_title_update = 1;
+                        p_input->stream.b_changed = 0;
+                        p_intf->p_sys->b_intf_update = TRUE;
+                    }
+
+                    if( var_Get( (vlc_object_t *)p_input, "intf-change", &val )
+                        >= 0 && val.b_bool )
+                    {
+                        p_intf->p_sys->b_input_update = TRUE;
+                    }
+                }
+            }
+            else if( p_intf->p_sys->b_playing && !p_intf->b_die )
+            {
+                p_intf->p_sys->b_playing = FALSE;
+                p_intf->p_sys->b_intf_update = TRUE;
+            }
             
-            vlc_mutex_unlock( &p_playlist->object_lock );
+#undef p_input
             vlc_object_release( p_playlist );
         }
 
@@ -498,63 +525,9 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
     }
 
     [self terminate];
-
     [o_pool release];
 }
 
-- (void)manage:(playlist_t *)p_playlist
-{
-    intf_thread_t * p_intf = [NSApp getIntf];
-
-#define p_input p_playlist->p_input
-
-    if( p_input )
-    {
-        vlc_mutex_lock( &p_input->stream.stream_lock );
-
-        if( !p_input->b_die )
-        {
-            /* New input or stream map change */
-            if( p_input->stream.b_changed )
-            {
-                p_intf->p_sys->b_playing = TRUE;
-                [self manageMode: p_playlist];
-            }
-
-            vlc_value_t val;
-
-            if( var_Get( (vlc_object_t *)p_input, "intf-change", &val )
-                >= 0 && val.b_bool )
-            {
-                p_intf->p_sys->b_input_update = TRUE;
-            }
-        }
-        vlc_mutex_unlock( &p_input->stream.stream_lock );
-    }
-    else if( p_intf->p_sys->b_playing && !p_intf->b_die )
-    {
-        p_intf->p_sys->b_playing = FALSE;
-        [self manageMode: p_playlist];
-    }
-
-#undef p_input
-}
-
-- (void)manageMode:(playlist_t *)p_playlist
-{
-    intf_thread_t * p_intf = [NSApp getIntf];
-
-    if( p_playlist->p_input != NULL )
-    {
-        p_intf->p_sys->b_current_title_update = 1;
-        p_playlist->p_input->stream.b_changed = 0;
-        
-        msg_Dbg( p_intf, "stream has changed, refreshing interface" );
-    }
-
-    p_intf->p_sys->b_intf_update = VLC_TRUE;
-}
-
 - (void)manageIntf:(NSTimer *)o_timer
 {
     intf_thread_t * p_intf = [NSApp getIntf];
@@ -614,6 +587,7 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
         vlc_bool_t b_control = VLC_FALSE;
         vlc_bool_t b_seekable = VLC_FALSE;
         vlc_bool_t b_chapters = VLC_FALSE;
+        vlc_value_t val;
 
         b_plmul = p_playlist->i_size > 1;
 
@@ -629,12 +603,12 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
 
             /* chapters & titles */
             b_chapters = p_input->stream.i_area_nb > 1; 
+            vlc_mutex_unlock( &p_input->stream.stream_lock );
 
             /* play status */
-            p_intf->p_sys->b_play_status = 
-                p_input->stream.control.i_status != PAUSE_S;
-            
-            vlc_mutex_unlock( &p_input->stream.stream_lock );
+            var_Get( p_input, "state", &val );
+            p_intf->p_sys->b_play_status = val.i_int != PAUSE_S;
         }
         else
         {
@@ -659,16 +633,16 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
 
         p_intf->p_sys->b_intf_update = VLC_FALSE;
     }
-    
-#define p_area p_input->stream.p_selected_area
 
     if( p_intf->p_sys->b_playing && p_input != NULL )
     {
-        vlc_bool_t b_field_update = TRUE;
-        vlc_mutex_lock( &p_input->stream.stream_lock );
-        
+        vlc_value_t time, val;
+        NSString * o_time;
+        mtime_t i_seconds;
+        var_Get( p_input, "state", &val );
+
         if( !p_input->b_die && ( p_intf->p_sys->b_play_status !=
-            ( p_input->stream.control.i_status != PAUSE_S ) ) ) 
+            ( val.i_int != PAUSE_S ) ) ) 
         {
             p_intf->p_sys->b_play_status =
                 !p_intf->p_sys->b_play_status;
@@ -678,58 +652,31 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
 
         if( p_input->stream.b_seekable )
         {
-            if( f_slider == f_slider_old )
-            {
-                float f_updated = ( 10000. * p_area->i_tell ) /
-                                           p_area->i_size;
+            vlc_value_t pos;
+            float f_updated;
+            
+            var_Get( p_input, "position", &pos );
+            f_updated = 10000. * pos.f_float;
 
-                if( f_slider != f_updated )
-                {
-                    [o_timeslider setFloatValue: f_updated];
-                }
-            }
-            else
+            if( f_slider != f_updated )
             {
-                off_t i_seek = ( f_slider * p_area->i_size ) / 10000;
-
-                /* release the lock to be able to seek */
-                vlc_mutex_unlock( &p_input->stream.stream_lock );
-                vlc_mutex_unlock( &p_playlist->object_lock );
-                playlist_Play( p_playlist );
-                input_Seek( p_input, i_seek, INPUT_SEEK_SET );
-                vlc_mutex_lock( &p_playlist->object_lock );
-                vlc_mutex_lock( &p_input->stream.stream_lock );
-
-                /* update the old value */
-                f_slider_old = f_slider; 
-
-                b_field_update = VLC_FALSE;
+                [o_timeslider setFloatValue: f_updated];
             }
         }
-
-        if( b_field_update )
-        {
-            NSString * o_time;
-            char psz_time[ OFFSETTOTIME_MAX_SIZE ];
-
-            input_OffsetToTime( p_input, psz_time, p_area->i_tell );
-
-            o_time = [NSString stringWithUTF8String: psz_time];
-            [o_timefield setStringValue: o_time];
-        }
-        vlc_mutex_unlock( &p_input->stream.stream_lock );
+            
+        var_Get( p_input, "time", &time );
+        i_seconds = time.i_time / 1000000;
+        
+        o_time = [NSString stringWithFormat: @"%d:%02d:%02d",
+                        (int) (i_seconds / (60 * 60)),
+                        (int) (i_seconds / 60 % 60),
+                        (int) (i_seconds % 60)];
+        [o_timefield setStringValue: o_time];
 
         /* disable screen saver */
         UpdateSystemActivity( UsrActivity );
     }
 
-#undef p_area
-
-    if( p_input != NULL )
-    {
-        vlc_mutex_unlock( &p_input->stream.stream_lock );
-    }
-
 #undef p_input
 
     vlc_mutex_unlock( &p_playlist->object_lock );
@@ -928,15 +875,14 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
 
 - (IBAction)timesliderUpdate:(id)sender
 {
+    intf_thread_t * p_intf;
+    input_thread_t * p_input;
     float f_updated;
 
     switch( [[NSApp currentEvent] type] )
     {
         case NSLeftMouseUp:
         case NSLeftMouseDown:
-            f_slider = [sender floatValue];
-            return;
-
         case NSLeftMouseDragged:
             f_updated = [sender floatValue];
             break;
@@ -945,43 +891,42 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
             return;
     }
 
-    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 )
-    {
-        return;
-    }
-
-    vlc_mutex_lock( &p_playlist->object_lock );
+    p_intf = [NSApp getIntf];
+    p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
+                                            FIND_ANYWHERE );
 
-    if( p_playlist->p_input != NULL )
+    if( p_input != NULL )
     {
-        off_t i_tell;
+        vlc_value_t time;
+        mtime_t i_seconds;
         NSString * o_time;
-        char psz_time[ OFFSETTOTIME_MAX_SIZE ];
-
-#define p_area p_playlist->p_input->stream.p_selected_area
-        vlc_mutex_lock( &p_playlist->p_input->stream.stream_lock );
-        i_tell = f_updated / 10000. * p_area->i_size;
-        input_OffsetToTime( p_playlist->p_input, psz_time, i_tell );
-        vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
-#undef p_area
 
-        o_time = [NSString stringWithUTF8String: psz_time];
-        [o_timefield setStringValue: o_time]; 
+        if( p_input->stream.b_seekable )
+        {
+                vlc_value_t pos;
+                pos.f_float = f_updated / 10000.;
+                if( f_slider != f_updated )
+                {
+                    var_Set( p_input, "position", pos );
+                    [o_timeslider setFloatValue: f_updated];
+                }
+        }
+            
+        var_Get( p_input, "time", &time );
+        i_seconds = time.i_time / 1000000;
+        
+        o_time = [NSString stringWithFormat: @"%d:%02d:%02d",
+                        (int) (i_seconds / (60 * 60)),
+                        (int) (i_seconds / 60 % 60),
+                        (int) (i_seconds % 60)];
+        [o_timefield setStringValue: o_time];
+        vlc_object_release( p_input );
     }
-
-    vlc_mutex_unlock( &p_playlist->object_lock );
-    vlc_object_release( p_playlist );
 }
 
 - (void)terminate
 {
     NSEvent * o_event;
-    vout_thread_t * p_vout;
     playlist_t * p_playlist;
     intf_thread_t * p_intf = [NSApp getIntf];
 
@@ -997,18 +942,6 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
         playlist_Destroy( p_playlist );
     }
 
-    /*
-     * Free video outputs
-     */
-    msg_Dbg( p_intf, "removing all video outputs" );
-    while( (p_vout = vlc_object_find( p_intf->p_vlc, 
-                                      VLC_OBJECT_VOUT, FIND_CHILD )) )
-    {
-        vlc_object_detach( p_vout );
-        vlc_object_release( p_vout );
-        vout_Destroy( p_vout );
-    }
-
     if( o_img_pause != nil )
     {
         [o_img_pause release];
index 67d2dd4f947bdb8f2383b74672f135b7c26bf6d0..8189af332ae8059ae9f3a8120743a30a41431f9d 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: playlist.m,v 1.31 2003/09/19 23:03:27 hartman Exp $
+ * $Id: playlist.m,v 1.32 2003/09/20 13:46:00 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Derk-Jan Hartman <thedj@users.sourceforge.net>
@@ -32,6 +32,7 @@
 
 #include "intf.h"
 #include "playlist.h"
+#include "controls.h"
 
 int MacVersion102 = -1;
 
@@ -80,12 +81,7 @@ int MacVersion102 = -1;
     switch( key )
     {
         case ' ':
-            vlc_mutex_lock( &p_playlist->object_lock );
-            if( p_playlist->p_input != NULL )
-            {
-                input_SetStatus( p_playlist->p_input, INPUT_STATUS_PAUSE );
-            }
-            vlc_mutex_unlock( &p_playlist->object_lock );
+            [(VLCControls *)[[NSApp delegate] getControls] play: nil];
             break;
 
         case NSDeleteCharacter:
@@ -231,14 +227,11 @@ int MacVersion102 = -1;
     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                        FIND_ANYWHERE );
 
-    if( p_playlist == NULL )
+    if( p_playlist != NULL )
     {
-        return;
+        playlist_Goto( p_playlist, [o_table_view selectedRow] );
+        vlc_object_release( p_playlist );
     }
-
-    playlist_Goto( p_playlist, [o_table_view selectedRow] );
-
-    vlc_object_release( p_playlist );
 }
 
 - (IBAction)deleteItems:(id)sender
@@ -257,7 +250,7 @@ int MacVersion102 = -1;
     }
     
     o_to_delete = [NSMutableArray arrayWithArray:[[o_table_view selectedRowEnumerator] allObjects]];
-    c = [o_to_delete count];
+    c = (int)[o_to_delete count];
     
     for( i = 0; i < c; i++ ) {
         o_number = [o_to_delete lastObject];
index 10167fd59be495cf7881f438d8b905a619600d96..2ef183fe3c6f2dd3b5b9bcaf5ee8e12ff7d7ea65 100644 (file)
@@ -3,7 +3,7 @@
  * vout.m: MacOS X video output plugin
  *****************************************************************************
  * Copyright (C) 2001-2003 VideoLAN
- * $Id: vout.m,v 1.55 2003/08/25 14:51:47 garf Exp $
+ * $Id: vout.m,v 1.56 2003/09/20 13:46:00 hartman Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Florian G. Pflug <fgp@phlo.org>
@@ -427,20 +427,15 @@ static int vout_Manage( vout_thread_t *p_vout )
         else if ( !p_vout->p_sys->b_mouse_pointer_visible )
         {
             vlc_bool_t b_playing = NO;
-            playlist_t * p_playlist = vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST,
+            input_thread_t * p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT,
                                                                     FIND_ANYWHERE );
 
-            if ( p_playlist != nil )
+            if ( p_input != NULL )
             {
-                vlc_mutex_lock( &p_playlist->object_lock );
-                if( p_playlist->p_input != NULL )
-                {
-                    vlc_mutex_lock( &p_playlist->p_input->stream.stream_lock );
-                    b_playing = p_playlist->p_input->stream.control.i_status != PAUSE_S;
-                    vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
-                }
-                vlc_mutex_unlock( &p_playlist->object_lock );
-                vlc_object_release( p_playlist );
+                vlc_value_t state;
+                var_Get( p_input, "state", &state );
+                b_playing = state.i_int != PAUSE_S;
+                vlc_object_release( p_input );
             }
             if ( !b_playing )
             {
@@ -985,6 +980,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
 
 - (void)keyDown:(NSEvent *)o_event
 {
+    playlist_t * p_playlist;
     unichar key = 0;
     vlc_value_t val;
 
@@ -1011,7 +1007,13 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
             break;
 
         case ' ':
-            input_SetStatus( p_vout, INPUT_STATUS_PAUSE );
+            p_playlist = vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST,
+                                                    FIND_ANYWHERE );
+            if ( p_playlist != NULL )
+            {
+                playlist_Pause( p_playlist );
+                vlc_object_release( p_playlist);
+            }
             break;
 
         case (unichar)0xf700: /* arrow up */