Commit 47d57d6d authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* modules/gui/macosx/*:

  - 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.
parent 92b1b630
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* controls.m: MacOS X interface plugin * controls.m: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * 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> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -74,58 +74,41 @@ ...@@ -74,58 +74,41 @@
- (IBAction)stop:(id)sender - (IBAction)stop:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = [NSApp getIntf];
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_playlist == NULL ) if( p_playlist != NULL )
{ {
return;
}
playlist_Stop( p_playlist ); playlist_Stop( p_playlist );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
}
} }
- (IBAction)faster:(id)sender - (IBAction)faster:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = [NSApp getIntf];
input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); 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 ); var_Set( p_input, "rate-faster", val );
if( p_playlist->p_input != NULL ) vlc_object_release( p_input );
{
input_SetStatus( p_playlist->p_input, INPUT_STATUS_FASTER );
} }
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
} }
- (IBAction)slower:(id)sender - (IBAction)slower:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = [NSApp getIntf];
input_thread_t * p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); 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 ); var_Set( p_input, "rate-slower", val );
if( p_playlist->p_input != NULL ) vlc_object_release( p_input );
{
input_SetStatus( p_playlist->p_input, INPUT_STATUS_SLOWER );
} }
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
} }
- (IBAction)prev:(id)sender - (IBAction)prev:(id)sender
...@@ -244,33 +227,29 @@ ...@@ -244,33 +227,29 @@
- (IBAction)forward:(id)sender - (IBAction)forward:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; 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 ); FIND_ANYWHERE );
if( p_playlist == NULL || p_playlist->p_input == NULL ) if( p_input != NULL )
{ {
if ( p_playlist != NULL ) vlc_object_release( p_playlist ); vlc_value_t time;
return; 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 - (IBAction)backward:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; 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 ); FIND_ANYWHERE );
if( p_playlist == NULL || p_playlist->p_input == NULL ) if( p_input != NULL )
{ {
if ( p_playlist != NULL ) vlc_object_release( p_playlist ); vlc_value_t time;
return; 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 - (IBAction)volumeUp:(id)sender
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* info.m: MacOS X info panel * info.m: MacOS X info panel
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
* *
...@@ -84,28 +84,19 @@ ...@@ -84,28 +84,19 @@
o_selectedPane = [[o_selector selectedItem] title]; o_selectedPane = [[o_selector selectedItem] title];
intf_thread_t * p_intf = [NSApp getIntf]; 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 ); FIND_ANYWHERE );
if( p_playlist == NULL ) if ( p_input == NULL )
{ {
return; 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_strings removeAllObjects];
[o_selector removeAllItems]; [o_selector removeAllItems];
vlc_mutex_lock( &p_playlist->p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
input_info_category_t * p_category = p_playlist->p_input->stream.p_info; input_info_category_t * p_category = p_input->stream.p_info;
while( p_category ) while( p_category )
{ {
...@@ -113,9 +104,8 @@ ...@@ -113,9 +104,8 @@
p_category = p_category->p_next; p_category = p_category->p_next;
} }
vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_object_release( p_input );
vlc_object_release( p_playlist );
int i_select = [o_selector indexOfItemWithTitle:o_selectedPane]; int i_select = [o_selector indexOfItemWithTitle:o_selectedPane];
if ( i_select < 0 ) if ( i_select < 0 )
...@@ -161,26 +151,19 @@ ...@@ -161,26 +151,19 @@
BOOL bEnabled = TRUE; BOOL bEnabled = TRUE;
intf_thread_t * p_intf = [NSApp getIntf]; 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 ); FIND_ANYWHERE );
if( p_playlist != NULL )
{
vlc_mutex_lock( &p_playlist->object_lock );
}
if( [[o_mi title] isEqualToString: _NS("Info")] ) if( [[o_mi title] isEqualToString: _NS("Info")] )
{ {
if( p_playlist == NULL || p_playlist->p_input == NULL ) if( p_input == NULL )
{ {
bEnabled = FALSE; bEnabled = FALSE;
} }
} else
if( p_playlist != NULL )
{ {
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_object_release( p_input );
vlc_object_release( p_playlist ); }
} }
return( bEnabled ); return( bEnabled );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf.h: MacOS X interface plugin * intf.h: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * 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> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -225,8 +225,6 @@ struct intf_sys_t ...@@ -225,8 +225,6 @@ struct intf_sys_t
- (void)terminate; - (void)terminate;
- (void)manage; - (void)manage;
- (void)manage:(playlist_t *)p_playlist;
- (void)manageMode:(playlist_t *)p_playlist;
- (void)manageIntf:(NSTimer *)o_timer; - (void)manageIntf:(NSTimer *)o_timer;
- (void)setupMenus; - (void)setupMenus;
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.m: MacOS X interface plugin * playlist.m: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * 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> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <thedj@users.sourceforge.net> * Derk-Jan Hartman <thedj@users.sourceforge.net>
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "intf.h" #include "intf.h"
#include "playlist.h" #include "playlist.h"
#include "controls.h"
int MacVersion102 = -1; int MacVersion102 = -1;
...@@ -80,12 +81,7 @@ int MacVersion102 = -1; ...@@ -80,12 +81,7 @@ int MacVersion102 = -1;
switch( key ) switch( key )
{ {
case ' ': case ' ':
vlc_mutex_lock( &p_playlist->object_lock ); [(VLCControls *)[[NSApp delegate] getControls] play: nil];
if( p_playlist->p_input != NULL )
{
input_SetStatus( p_playlist->p_input, INPUT_STATUS_PAUSE );
}
vlc_mutex_unlock( &p_playlist->object_lock );
break; break;
case NSDeleteCharacter: case NSDeleteCharacter:
...@@ -231,14 +227,11 @@ int MacVersion102 = -1; ...@@ -231,14 +227,11 @@ int MacVersion102 = -1;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_playlist == NULL ) if( p_playlist != NULL )
{ {
return;
}
playlist_Goto( p_playlist, [o_table_view selectedRow] ); playlist_Goto( p_playlist, [o_table_view selectedRow] );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
}
} }
- (IBAction)deleteItems:(id)sender - (IBAction)deleteItems:(id)sender
...@@ -257,7 +250,7 @@ int MacVersion102 = -1; ...@@ -257,7 +250,7 @@ int MacVersion102 = -1;
} }
o_to_delete = [NSMutableArray arrayWithArray:[[o_table_view selectedRowEnumerator] allObjects]]; 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++ ) { for( i = 0; i < c; i++ ) {
o_number = [o_to_delete lastObject]; o_number = [o_to_delete lastObject];
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* vout.m: MacOS X video output plugin * vout.m: MacOS X video output plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2003 VideoLAN * 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> * Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org> * Florian G. Pflug <fgp@phlo.org>
...@@ -427,20 +427,15 @@ static int vout_Manage( vout_thread_t *p_vout ) ...@@ -427,20 +427,15 @@ static int vout_Manage( vout_thread_t *p_vout )
else if ( !p_vout->p_sys->b_mouse_pointer_visible ) else if ( !p_vout->p_sys->b_mouse_pointer_visible )
{ {
vlc_bool_t b_playing = NO; 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 ); 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 ); vlc_value_t state;
b_playing = p_playlist->p_input->stream.control.i_status != PAUSE_S; var_Get( p_input, "state", &state );
vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock ); b_playing = state.i_int != PAUSE_S;
} vlc_object_release( p_input );
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
} }
if ( !b_playing ) if ( !b_playing )
{ {
...@@ -985,6 +980,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -985,6 +980,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
- (void)keyDown:(NSEvent *)o_event - (void)keyDown:(NSEvent *)o_event
{ {
playlist_t * p_playlist;
unichar key = 0; unichar key = 0;
vlc_value_t val; vlc_value_t val;
...@@ -1011,7 +1007,13 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1011,7 +1007,13 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
break; break;
case ' ': 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; break;
case (unichar)0xf700: /* arrow up */ case (unichar)0xf700: /* arrow up */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment