vlc | branch: master | Felix Paul Kühne <fe...@feepk.net> | Sun Jun 16 13:10:15 2019 +0200| [f5824de9ec61c0dedebe6e714f8de8ac55f32592] | committer: Felix Paul Kühne
macosx/main: move activePlayback property to player controller as it does not belong in the main singleton > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f5824de9ec61c0dedebe6e714f8de8ac55f32592 --- modules/gui/macosx/library/VLCLibraryWindow.m | 3 ++- modules/gui/macosx/main/VLCMain.h | 1 - modules/gui/macosx/main/VLCMain.m | 17 +---------------- modules/gui/macosx/playlist/VLCPlayerController.h | 5 +++++ .../macosx/windows/video/VLCVideoOutputProvider.m | 6 +++--- .../gui/macosx/windows/video/VLCVideoWindowCommon.m | 21 +++++++++++---------- 6 files changed, 22 insertions(+), 31 deletions(-) diff --git a/modules/gui/macosx/library/VLCLibraryWindow.m b/modules/gui/macosx/library/VLCLibraryWindow.m index f714ed9eb4..f19475b84b 100644 --- a/modules/gui/macosx/library/VLCLibraryWindow.m +++ b/modules/gui/macosx/library/VLCLibraryWindow.m @@ -27,6 +27,7 @@ #import "extensions/NSView+VLCAdditions.h" #import "main/VLCMain.h" +#import "playlist/VLCPlayerController.h" #import "playlist/VLCPlaylistController.h" #import "playlist/VLCPlaylistDataSource.h" #import "playlist/VLCPlaylistSortingMenuController.h" @@ -623,7 +624,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, id currentWindow = [NSApp keyWindow]; if ([currentWindow respondsToSelector:@selector(hasActiveVideo)] && [currentWindow hasActiveVideo]) { if ([currentWindow respondsToSelector:@selector(fullscreen)] && [currentWindow fullscreen] && ![[currentWindow videoView] isHidden]) { - if ([[VLCMain sharedInstance] activeVideoPlayback]) { + if ([_playlistController.playerController activeVideoPlayback]) { [_fspanel fadeIn]; } } diff --git a/modules/gui/macosx/main/VLCMain.h b/modules/gui/macosx/main/VLCMain.h index 77dbc82054..b03d0767f4 100644 --- a/modules/gui/macosx/main/VLCMain.h +++ b/modules/gui/macosx/main/VLCMain.h @@ -67,7 +67,6 @@ extern NSString *VLCConfigurationChangedNotification; + (VLCMain *)sharedInstance; -@property (readwrite) BOOL activeVideoPlayback; @property (readonly) BOOL isTerminating; @property (readonly) VLCAudioEffectsWindowController *audioEffectsPanel; diff --git a/modules/gui/macosx/main/VLCMain.m b/modules/gui/macosx/main/VLCMain.m index 93917c8cdb..cdd90699f4 100644 --- a/modules/gui/macosx/main/VLCMain.m +++ b/modules/gui/macosx/main/VLCMain.m @@ -346,7 +346,7 @@ static VLCMain *sharedInstance = nil; /* don't be enthusiastic about an update if we currently play a video */ - (BOOL)updaterMayCheckForUpdates:(SUUpdater *)bundle { - if ([self activeVideoPlayback]) + if ([_playlistController.playerController activeVideoPlayback]) return NO; return YES; @@ -408,16 +408,6 @@ static VLCMain *sharedInstance = nil; return YES; } -- (void)setActiveVideoPlayback:(BOOL)b_value -{ - assert([NSThread isMainThread]); - - b_active_videoplayback = b_value; - if ([self libraryWindow]) { -// [[self libraryWindow] toggleVideoPlaybackAppearance]; - } -} - #pragma mark - #pragma mark Other objects getters @@ -523,9 +513,4 @@ static VLCMain *sharedInstance = nil; return _resume_dialog; } -- (BOOL)activeVideoPlayback -{ - return b_active_videoplayback; -} - @end diff --git a/modules/gui/macosx/playlist/VLCPlayerController.h b/modules/gui/macosx/playlist/VLCPlayerController.h index 1909beac13..7ae1c11254 100644 --- a/modules/gui/macosx/playlist/VLCPlayerController.h +++ b/modules/gui/macosx/playlist/VLCPlayerController.h @@ -771,6 +771,11 @@ extern const CGFloat VLCVolumeDefault; @property (readwrite, nonatomic) BOOL fullscreen; /** + * indicates whether we currently have an active video playback session + */ +@property (readwrite) BOOL activeVideoPlayback; + +/** * helper function to inverse the current fullscreen state */ - (void)toggleFullscreen; diff --git a/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m b/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m index 378dce3f2d..928928c58f 100644 --- a/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m +++ b/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m @@ -355,7 +355,7 @@ int WindowOpen(vout_window_t *p_wnd) [newVideoWindow setHasActiveVideo: YES]; [_voutWindows setObject:newVideoWindow forKey:[NSValue valueWithPointer:p_wnd]]; - [mainInstance setActiveVideoPlayback: YES]; + [_playerController setActiveVideoPlayback: YES]; [[mainInstance libraryWindow] setNonembedded:!b_mainWindowHasVideo]; // TODO: find a cleaner way for "start in fullscreen" @@ -418,7 +418,7 @@ int WindowOpen(vout_window_t *p_wnd) [_voutWindows removeObjectForKey:key]; if ([_voutWindows count] == 0) { - [mainInstance setActiveVideoPlayback:NO]; + [_playerController setActiveVideoPlayback:NO]; _statusLevelWindowCounter = 0; } @@ -507,7 +507,7 @@ int WindowOpen(vout_window_t *p_wnd) assert(o_current_window); if (b_fullscreen) { - if (_playerController.playerState != VLC_PLAYER_STATE_STOPPED && [[VLCMain sharedInstance] activeVideoPlayback]) { + if (_playerController.playerState != VLC_PLAYER_STATE_STOPPED && [_playerController activeVideoPlayback]) { // activate app, as method can also be triggered from outside the app (prevents nasty window layout) [NSApp activateIgnoringOtherApps:YES]; [o_current_window enterFullscreenWithAnimation:b_animation]; diff --git a/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m b/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m index 00975761e4..cd362fd3a9 100644 --- a/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m +++ b/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m @@ -61,6 +61,7 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController"; BOOL b_video_view_was_hidden; NSRect frameBeforeLionFullscreen; + VLCPlayerController *_playerController; } - (void)customZoom:(id)sender; @@ -86,6 +87,8 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController"; o_temp_view = [[NSView alloc] init]; [o_temp_view setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable]; + + _playerController = [[[VLCMain sharedInstance] playlistController] playerController]; } return self; @@ -125,7 +128,7 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController"; { VLCPlaylistController *playlistController = [[VLCMain sharedInstance] playlistController]; input_item_t *mediaItem = [playlistController currentlyPlayingInputItem]; - if (mediaItem == NULL || playlistController.playerController.playerState == VLC_PLAYER_STATE_STOPPED) { + if (mediaItem == NULL || _playerController.playerState == VLC_PLAYER_STATE_STOPPED) { [self setTitle:_NS("VLC media player")]; self.representedURL = nil; return; @@ -390,7 +393,7 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController"; - (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize { - if (![[VLCMain sharedInstance] activeVideoPlayback] || self.nativeVideoSize.width == 0. || self.nativeVideoSize.height == 0. || window != self) + if (![_playerController activeVideoPlayback] || self.nativeVideoSize.width == 0. || self.nativeVideoSize.height == 0. || window != self) return proposedFrameSize; // needed when entering lion fullscreen mode @@ -400,7 +403,7 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController"; if ([_videoView isHidden]) return proposedFrameSize; - if ([[[[VLCMain sharedInstance] playlistController] playerController] aspectRatioIsLocked]) { + if ([_playerController aspectRatioIsLocked]) { NSRect videoWindowFrame = [self frame]; NSRect viewRect = [_videoView convertRect:[_videoView bounds] toView: nil]; NSRect contentRect = [self contentRectForFrameRect:videoWindowFrame]; @@ -504,7 +507,7 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController"; - (void)windowWillEnterFullScreen:(NSNotification *)notification { - _windowShouldExitFullscreenWhenFinished = [[VLCMain sharedInstance] activeVideoPlayback]; + _windowShouldExitFullscreenWhenFinished = [_playerController activeVideoPlayback]; NSInteger i_currLevel = [self level]; // self.fullscreen and _inFullscreenTransition must not be true yet @@ -514,13 +517,12 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController"; _inFullscreenTransition = YES; - VLCPlayerController *playerController = [[[VLCMain sharedInstance] playlistController] playerController]; - playerController.fullscreen = YES; + _playerController.fullscreen = YES; frameBeforeLionFullscreen = [self frame]; if ([self hasActiveVideo]) { - vout_thread_t *p_vout = [playerController videoOutputThreadForKeyWindow]; + vout_thread_t *p_vout = [_playerController videoOutputThreadForKeyWindow]; if (p_vout) { var_SetBool(p_vout, "fullscreen", true); vout_Release(p_vout); @@ -566,10 +568,9 @@ NSString *VLCWindowShouldShowController = @"VLCWindowShouldShowController"; [self setFullscreen: NO]; if ([self hasActiveVideo]) { - VLCPlayerController *playerController = [[[VLCMain sharedInstance] playlistController] playerController]; - playerController.fullscreen = NO; + _playerController.fullscreen = NO; - vout_thread_t *p_vout = [playerController videoOutputThreadForKeyWindow]; + vout_thread_t *p_vout = [_playerController videoOutputThreadForKeyWindow]; if (p_vout) { var_SetBool(p_vout, "fullscreen", false); vout_Release(p_vout); _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits