X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fmacosx%2Fintf.m;h=b26ba28291f6694db5347988ffe0593742b87f89;hb=f940d5e23990350d4ff36ca58898bbad32894aa1;hp=64576f5484efc57bb4e2953f7be97a63290f0441;hpb=e5d609fd73f61ab47a2d5acf926c101a2c296fa1;p=vlc diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index 64576f5484..b26ba28291 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -57,6 +57,7 @@ #import "eyetv.h" #import "simple_prefs.h" #import "CoreInteraction.h" +#import "TrackSynchronization.h" #import /* for crashlog send mechanism */ #import /* we're the update delegate */ @@ -91,6 +92,8 @@ static int VolumeUpdated( vlc_object_t *, const char *, *****************************************************************************/ int OpenIntf ( vlc_object_t *p_this ) { + NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init]; + [VLCApplication sharedApplication]; intf_thread_t *p_intf = (intf_thread_t*) p_this; p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); @@ -104,6 +107,7 @@ int OpenIntf ( vlc_object_t *p_this ) p_intf->pf_run = Run; p_intf->b_should_run_on_first_thread = true; + [o_pool release]; return VLC_SUCCESS; } @@ -141,8 +145,7 @@ int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg ) return VLC_EGENERIC; } - [[VLCMainWindow sharedInstance] setVideoplayEnabled:YES]; - [[VLCMainWindow sharedInstance] togglePlaylist:nil]; + [[VLCMain sharedInstance] setActiveVideoPlayback: YES]; p_wnd->control = WindowControl; p_wnd->sys = (vout_window_sys_t *)VLCIntf; [o_pool release]; @@ -166,7 +169,7 @@ static int WindowControl( vout_window_t *p_wnd, int i_query, va_list args ) void WindowClose( vout_window_t *p_wnd ) { NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init]; - [[VLCMainWindow sharedInstance] setVideoplayEnabled:NO]; + [[VLCMain sharedInstance] setActiveVideoPlayback:NO]; NSLog( @"Window Close" ); // tell the interface to get rid of the video, TODO [o_pool release]; @@ -191,11 +194,10 @@ static void Run( intf_thread_t *p_intf ) pthread_sigmask( SIG_UNBLOCK, &set, NULL ); NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; + [VLCApplication sharedApplication]; o_appLock = [[NSLock alloc] init]; - [VLCApplication sharedApplication]; - [[VLCMain sharedInstance] setIntf: p_intf]; [NSBundle loadNibNamed: @"MainMenu" owner: NSApp]; @@ -231,6 +233,7 @@ static void MsgCallback( msg_cb_data_t *data, const msg_item_t *item ) static int InputEvent( vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t new_val, void *param ) { + NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init]; switch (new_val.i_int) { case INPUT_EVENT_STATE: [[VLCMain sharedInstance] playbackStatusUpdated]; @@ -243,7 +246,6 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var, break; case INPUT_EVENT_TITLE: case INPUT_EVENT_CHAPTER: - [[VLCMain sharedInstance] updateTitle]; break; case INPUT_EVENT_CACHE: [[VLCMain sharedInstance] updateMainWindow]; @@ -262,6 +264,7 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var, break; case INPUT_EVENT_ITEM_META: case INPUT_EVENT_ITEM_INFO: + [[VLCMain sharedInstance] updateName]; [[VLCMain sharedInstance] updateInfoandMetaPanel]; break; case INPUT_EVENT_BOOKMARK: @@ -276,11 +279,13 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var, break; case INPUT_EVENT_ITEM_NAME: - [[VLCMain sharedInstance] updateTitle]; + [[VLCMain sharedInstance] updateName]; + [[VLCMain sharedInstance] playlistUpdated]; break; case INPUT_EVENT_AUDIO_DELAY: case INPUT_EVENT_SUBTITLE_DELAY: + [[VLCMain sharedInstance] updateDelays]; break; case INPUT_EVENT_DEAD: @@ -296,38 +301,47 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var, break; } + [o_pool release]; return VLC_SUCCESS; } static int PLItemChanged( vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t new_val, void *param ) { + NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(PlaylistItemChanged) withObject:nil waitUntilDone:NO]; + [o_pool release]; return VLC_SUCCESS; } static int PlaylistUpdated( vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t new_val, void *param ) { + NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(playlistUpdated) withObject:nil waitUntilDone:NO]; + [o_pool release]; return VLC_SUCCESS; } static int PlaybackModeUpdated( vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t new_val, void *param ) { + NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; [[VLCMain sharedInstance] playbackModeUpdated]; + [o_pool release]; return VLC_SUCCESS; } static int VolumeUpdated( vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t new_val, void *param ) { + NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; [[VLCMain sharedInstance] updateVolume]; + [o_pool release]; return VLC_SUCCESS; } @@ -442,12 +456,12 @@ vout_thread_t *getVout(void) return p_vout; } -aout_instance_t *getAout(void) +audio_output_t *getAout(void) { input_thread_t *p_input = getInput(); if (!p_input) return NULL; - aout_instance_t *p_aout = input_GetAout(p_input); + audio_output_t *p_aout = input_GetAout(p_input); vlc_object_release(p_input); return p_aout; } @@ -498,6 +512,7 @@ static VLCMain *_o_sharedMainInstance = nil; o_mainmenu = [[VLCMainMenu alloc] init]; o_coreinteraction = [[VLCCoreInteraction alloc] init]; o_eyetv = [[VLCEyeTVController alloc] init]; + o_mainwindow = [[VLCMainWindow alloc] init]; /* announce our launch to a potential eyetv plugin */ [[NSDistributedNotificationCenter defaultCenter] postNotificationName: @"VLCOSXGUIInit" @@ -519,8 +534,13 @@ static VLCMain *_o_sharedMainInstance = nil; { playlist_t *p_playlist; vlc_value_t val; + if( !p_intf ) return; var_Create( p_intf, "intf-change", VLC_VAR_BOOL ); + /* Check if we already did this once. Opening the other nibs calls it too, + because VLCMain is the owner */ + if( nib_main_loaded ) return; + [o_msgs_panel setExcludedFromWindowsMenu: YES]; [o_msgs_panel setDelegate: self]; @@ -688,6 +708,7 @@ static VLCMain *_o_sharedMainInstance = nil; [o_embedded_list release]; [o_coredialogs release]; [o_eyetv release]; + [o_mainwindow release]; /* unsubscribe from libvlc's debug messages */ msg_Unsubscribe( p_intf->p_sys->p_sub ); @@ -1231,9 +1252,14 @@ unsigned int CocoaKeyToVLC( unichar i_key ) [o_mainwindow updateWindow]; } -- (void)updateTitle +- (void)updateDelays +{ + [[VLCTrackSynchronization sharedInstance] performSelectorOnMainThread: @selector(updateValues) withObject: nil waitUntilDone:NO]; +} + +- (void)updateName { - [o_mainwindow updateTitle]; + [o_mainwindow updateName]; } - (void)updatePlaybackPosition @@ -1442,10 +1468,16 @@ unsigned int CocoaKeyToVLC( unichar i_key ) return o_remote; } -- (IBAction)showController:(id)sender +- (void)setActiveVideoPlayback:(BOOL)b_value { - //FIXME: why is this function here?! - [o_mainwindow makeKeyAndOrderFront:sender]; + b_active_videoplayback = b_value; + [o_mainwindow setVideoplayEnabled]; + [o_mainwindow togglePlaylist:nil]; +} + +- (BOOL)activeVideoPlayback +{ + return b_active_videoplayback; } #pragma mark - @@ -1738,11 +1770,6 @@ unsigned int CocoaKeyToVLC( unichar i_key ) #pragma mark - #pragma mark Playlist toggling -- (IBAction)togglePlaylist:(id)sender -{ - NSLog( @"needs to be re-implemented" ); -} - - (void)updateTogglePlaylistState { [[self playlist] outlineViewSelectionDidChange: NULL];