Commit 7f8e2bc5 authored by Jon Lech Johansen's avatar Jon Lech Johansen

* ./modules/gui/macosx: Defeated some deadlocks.

                          World domination ... is at hand.
parent f3563dc1
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
toggleTitle = id; toggleTitle = id;
toggleVar = id; toggleVar = id;
volumeDown = id; volumeDown = id;
volumeSliderUpdate = id; volumeSliderUpdated = id;
volumeUp = id; volumeUp = id;
}; };
CLASS = VLCControls; CLASS = VLCControls;
LANGUAGE = ObjC; LANGUAGE = ObjC;
OUTLETS = {"o_main" = id; "o_mi_mute" = id; "o_open" = id; "o_volumeslider" = id; }; OUTLETS = {"o_main" = id; "o_open" = id; "o_volumeslider" = id; };
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{ {
...@@ -45,13 +45,13 @@ ...@@ -45,13 +45,13 @@
CLASS = VLCMain; CLASS = VLCMain;
LANGUAGE = ObjC; LANGUAGE = ObjC;
OUTLETS = { OUTLETS = {
"o_btn_fastforward" = id; "o_btn_faster" = id;
"o_btn_next" = id; "o_btn_next" = id;
"o_btn_play" = id; "o_btn_play" = id;
"o_btn_playlist" = id; "o_btn_playlist" = id;
"o_btn_prefs" = id; "o_btn_prefs" = id;
"o_btn_prev" = id; "o_btn_prev" = id;
"o_btn_slowmotion" = id; "o_btn_slower" = id;
"o_btn_stop" = id; "o_btn_stop" = id;
"o_controls" = id; "o_controls" = id;
"o_dmi_play" = id; "o_dmi_play" = id;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<key>IBEditorPositions</key> <key>IBEditorPositions</key>
<dict> <dict>
<key>29</key> <key>29</key>
<string>16 822 419 44 0 0 1280 1002 </string> <string>22 973 419 44 0 0 1600 1178 </string>
<key>303</key> <key>303</key>
<string>60 509 104 66 0 0 1280 1002 </string> <string>60 509 104 66 0 0 1280 1002 </string>
<key>909</key> <key>909</key>
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
</array> </array>
<key>IBOpenObjects</key> <key>IBOpenObjects</key>
<array> <array>
<integer>21</integer>
<integer>29</integer> <integer>29</integer>
<integer>21</integer>
</array> </array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>6G30</string> <string>6G30</string>
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf.h: MacOS X interface plugin * intf.h: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: intf.h,v 1.19 2003/01/29 11:34:11 jlj Exp $ * $Id: intf.h,v 1.20 2003/01/31 02:53:52 jlj 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>
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/intf.h> #include <vlc/intf.h>
#include <vlc/vout.h> #include <vlc/vout.h>
#include <vlc/aout.h>
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
...@@ -48,6 +49,8 @@ ...@@ -48,6 +49,8 @@
#define _NS(s) [NSApp localizedString: _(s)] #define _NS(s) [NSApp localizedString: _(s)]
int ExecuteOnMainThread( id target, SEL sel, void * p_arg );
/***************************************************************************** /*****************************************************************************
* intf_sys_t: description and status of the interface * intf_sys_t: description and status of the interface
*****************************************************************************/ *****************************************************************************/
...@@ -58,9 +61,12 @@ struct intf_sys_t ...@@ -58,9 +61,12 @@ struct intf_sys_t
/* special actions */ /* special actions */
vlc_bool_t b_playing; vlc_bool_t b_playing;
vlc_bool_t b_stopping;
vlc_bool_t b_mute; vlc_bool_t b_mute;
/* interface update */
vlc_bool_t b_intf_update;
vlc_bool_t b_play_status;
/* menus handlers */ /* menus handlers */
vlc_bool_t b_chapter_update; vlc_bool_t b_chapter_update;
vlc_bool_t b_program_update; vlc_bool_t b_program_update;
...@@ -70,9 +76,6 @@ struct intf_sys_t ...@@ -70,9 +76,6 @@ struct intf_sys_t
vlc_bool_t b_aout_update; vlc_bool_t b_aout_update;
vlc_bool_t b_vout_update; vlc_bool_t b_vout_update;
/* The input thread */
input_thread_t * p_input;
/* The messages window */ /* The messages window */
msg_subscription_t * p_sub; msg_subscription_t * p_sub;
...@@ -96,13 +99,16 @@ struct intf_sys_t ...@@ -96,13 +99,16 @@ struct intf_sys_t
IBOutlet id o_btn_playlist; /* btn playlist */ IBOutlet id o_btn_playlist; /* btn playlist */
IBOutlet id o_btn_prev; /* btn previous */ IBOutlet id o_btn_prev; /* btn previous */
IBOutlet id o_btn_slowmotion; /* btn slowmotion */ IBOutlet id o_btn_slower; /* btn slower */
IBOutlet id o_btn_play; /* btn play */ IBOutlet id o_btn_play; /* btn play */
IBOutlet id o_btn_stop; /* btn stop */ IBOutlet id o_btn_stop; /* btn stop */
IBOutlet id o_btn_fastforward; /* btn fastforward */ IBOutlet id o_btn_faster; /* btn faster */
IBOutlet id o_btn_next; /* btn next */ IBOutlet id o_btn_next; /* btn next */
IBOutlet id o_btn_prefs; /* btn prefs */ IBOutlet id o_btn_prefs; /* btn prefs */
NSImage * o_img_play; /* btn play img */
NSImage * o_img_pause; /* btn pause img */
IBOutlet id o_controls; /* VLCControls */ IBOutlet id o_controls; /* VLCControls */
IBOutlet id o_playlist; /* VLCPlaylist */ IBOutlet id o_playlist; /* VLCPlaylist */
...@@ -191,11 +197,18 @@ struct intf_sys_t ...@@ -191,11 +197,18 @@ struct intf_sys_t
- (void)terminate; - (void)terminate;
- (void)manage; - (void)manage;
- (void)manageMode; - (void)manage:(playlist_t *)p_playlist;
- (void)setControlItems; - (void)manageMode:(playlist_t *)p_playlist;
- (void)manageIntf:(NSTimer *)o_timer;
- (void)setupMenus;
- (void)setupLangMenu:(NSMenuItem *)o_mi - (void)updateMessageArray;
- (void)playStatusUpdated:(BOOL)b_pause;
- (void)setSubmenusEnabled:(BOOL)b_enabled;
- (void)manageVolumeSlider;
- (void)setupMenus:(input_thread_t *)p_input;
- (void)setupLangMenu:(input_thread_t *)p_input
mi:(NSMenuItem *)o_mi
es:(es_descriptor_t *)p_es es:(es_descriptor_t *)p_es
category:(int)i_cat category:(int)i_cat
selector:(SEL)pf_callback; selector:(SEL)pf_callback;
...@@ -210,7 +223,6 @@ struct intf_sys_t ...@@ -210,7 +223,6 @@ struct intf_sys_t
- (IBAction)viewPreferences:(id)sender; - (IBAction)viewPreferences:(id)sender;
- (IBAction)timesliderUpdate:(id)sender; - (IBAction)timesliderUpdate:(id)sender;
- (void)displayTime;
- (IBAction)closeError:(id)sender; - (IBAction)closeError:(id)sender;
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* open.m: MacOS X plugin for vlc * open.m: MacOS X plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: open.m,v 1.16 2003/01/26 14:53:08 hartman Exp $ * $Id: open.m,v 1.17 2003/01/31 02:53:52 jlj 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>
...@@ -37,17 +37,12 @@ ...@@ -37,17 +37,12 @@
#include <IOKit/storage/IOCDMedia.h> #include <IOKit/storage/IOCDMedia.h>
#include <IOKit/storage/IODVDMedia.h> #include <IOKit/storage/IODVDMedia.h>
#import <Cocoa/Cocoa.h> #include "intf.h"
#include "playlist.h"
#include <vlc/vlc.h> #include "open.h"
#include <vlc/intf.h>
#include "netutils.h" #include "netutils.h"
#import "intf.h"
#import "playlist.h"
#import "open.h"
/***************************************************************************** /*****************************************************************************
* GetEjectableMediaOfClass * GetEjectableMediaOfClass
*****************************************************************************/ *****************************************************************************/
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.m: MacOS X interface plugin * playlist.m: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: playlist.m,v 1.6 2003/01/29 11:34:11 jlj Exp $ * $Id: playlist.m,v 1.7 2003/01/31 02:53:52 jlj Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* *
...@@ -28,11 +28,6 @@ ...@@ -28,11 +28,6 @@
#include <sys/param.h> /* for MAXPATHLEN */ #include <sys/param.h> /* for MAXPATHLEN */
#include <string.h> #include <string.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <Cocoa/Cocoa.h>
#include "intf.h" #include "intf.h"
#include "playlist.h" #include "playlist.h"
...@@ -48,24 +43,41 @@ ...@@ -48,24 +43,41 @@
- (void)keyDown:(NSEvent *)o_event - (void)keyDown:(NSEvent *)o_event
{ {
intf_thread_t * p_intf = [NSApp getIntf];
unichar key = 0; unichar key = 0;
playlist_t * p_playlist;
intf_thread_t * p_intf = [NSApp getIntf];
if( [[o_event characters] length] ) if( [[o_event characters] length] )
{ {
key = [[o_event characters] characterAtIndex: 0]; key = [[o_event characters] characterAtIndex: 0];
} }
p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist != NULL )
{
vlc_mutex_lock( &p_playlist->object_lock );
}
switch( key ) switch( key )
{ {
case ' ': case ' ':
input_SetStatus( p_intf->p_sys->p_input , INPUT_STATUS_PAUSE ); if( p_playlist != NULL && p_playlist->p_input != NULL )
{
input_SetStatus( p_playlist->p_input, INPUT_STATUS_PAUSE );
}
break; break;
default: default:
[super keyDown: o_event]; [super keyDown: o_event];
break; break;
} }
if( p_playlist != NULL )
{
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
}
} }
@end @end
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* prefs.m: MacOS X plugin for vlc * prefs.m: MacOS X plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: prefs.m,v 1.9 2003/01/27 17:41:01 ipkiss Exp $ * $Id: prefs.m,v 1.10 2003/01/31 02:53:52 jlj Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* *
...@@ -28,13 +28,8 @@ ...@@ -28,13 +28,8 @@
#include <sys/param.h> /* for MAXPATHLEN */ #include <sys/param.h> /* for MAXPATHLEN */
#include <string.h> #include <string.h>
#import <Cocoa/Cocoa.h> #include "intf.h"
#include "prefs.h"
#include <vlc/vlc.h>
#include <vlc/intf.h>
#import "intf.h"
#import "prefs.h"
/***************************************************************************** /*****************************************************************************
* VLCPrefs implementation * VLCPrefs implementation
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout.h: MacOS X interface plugin * vout.h: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: vout.h,v 1.4 2003/01/05 01:55:07 massiot Exp $ * $Id: vout.h,v 1.5 2003/01/31 02:53:52 jlj 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>
...@@ -67,8 +67,6 @@ ...@@ -67,8 +67,6 @@
*****************************************************************************/ *****************************************************************************/
struct vout_sys_t struct vout_sys_t
{ {
NSConditionLock * o_lock;
NSRect s_rect; NSRect s_rect;
int b_pos_saved; int b_pos_saved;
VLCWindow * o_window; VLCWindow * o_window;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,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.20 2003/01/28 15:59:38 hartman Exp $ * $Id: vout.m,v 1.21 2003/01/31 02:53:52 jlj 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>
...@@ -31,12 +31,6 @@ ...@@ -31,12 +31,6 @@
#include <stdlib.h> /* free() */ #include <stdlib.h> /* free() */
#include <string.h> /* strerror() */ #include <string.h> /* strerror() */
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include <vlc/aout.h>
#include <vlc/intf.h>
#include <Cocoa/Cocoa.h>
#include <QuickTime/QuickTime.h> #include <QuickTime/QuickTime.h>
#include "intf.h" #include "intf.h"
...@@ -424,61 +418,14 @@ static int CoSendRequest( vout_thread_t *p_vout, SEL sel ) ...@@ -424,61 +418,14 @@ static int CoSendRequest( vout_thread_t *p_vout, SEL sel )
{ {
int i_ret = 0; int i_ret = 0;
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; VLCVout * o_vlv = [[VLCVout alloc] init];
VLCVout * o_vlv = [[[VLCVout alloc] init] autorelease];
if( [o_vlv respondsToSelector: @selector(performSelectorOnMainThread: if( ( i_ret = ExecuteOnMainThread( o_vlv, sel, (void *)p_vout ) ) )
withObject:waitUntilDone:)] )
{
[o_vlv performSelectorOnMainThread: sel
withObject: [NSValue valueWithPointer: p_vout]
waitUntilDone: YES];
}
else if( [NSApp respondsToSelector: @selector(getIntf)] )
{
NSArray * o_array;
NSValue * o_value;
NSPort * o_recv_port;
NSInvocation * o_inv;
NSPortMessage * o_msg;
intf_thread_t * p_intf;
NSMethodSignature * o_sig;
p_intf = (intf_thread_t *)[NSApp getIntf];
o_recv_port = [[NSPort port] retain];
o_value = [NSValue valueWithPointer: p_vout];
o_sig = [VLCVout instanceMethodSignatureForSelector: sel];
o_inv = [NSInvocation invocationWithMethodSignature: o_sig];
[o_inv setArgument: &o_value atIndex: 2];
[o_inv setTarget: o_vlv];
[o_inv setSelector: sel];
o_array = [NSArray arrayWithObject:
[NSData dataWithBytes: &o_inv length: sizeof(o_inv)]];
o_msg = [[NSPortMessage alloc]
initWithSendPort: p_intf->p_sys->o_sendport
receivePort: o_recv_port components: o_array];
p_vout->p_sys->o_lock =
[[NSConditionLock alloc] initWithCondition: 0];
[o_msg sendBeforeDate: [NSDate distantPast]];
[p_vout->p_sys->o_lock lockWhenCondition: 1];
[p_vout->p_sys->o_lock unlock];
[p_vout->p_sys->o_lock release];
p_vout->p_sys->o_lock = nil;
[o_msg release];
[o_recv_port release];
}
else
{ {
msg_Err( p_vout, "SendRequest: no way to communicate with mt" ); msg_Err( p_vout, "SendRequest: no way to communicate with mt" );
i_ret = 1;
} }
[o_pool release]; [o_vlv release];
return( i_ret ); return( i_ret );
} }
...@@ -842,7 +789,6 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -842,7 +789,6 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
playlist_Stop( p_playlist ); playlist_Stop( p_playlist );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
p_intf->p_sys->b_stopping = 1;
/* The window will be closed by the intf later. */ /* The window will be closed by the intf later. */
return NO; return NO;
......
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