[vlc-commits] macosx: improve handling of playlist view state in case of multiple vouts
David Fuhrmann
git at videolan.org
Tue Mar 4 18:16:35 CET 2014
vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Mon Mar 3 22:22:09 2014 +0100| [58d4ebc3f4d45a4e0bbf99adb1535d76195d8e8b] | committer: David Fuhrmann
macosx: improve handling of playlist view state in case of multiple vouts
close #10761
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=58d4ebc3f4d45a4e0bbf99adb1535d76195d8e8b
---
modules/gui/macosx/MainWindow.m | 5 ++--
modules/gui/macosx/VLCVoutWindowController.m | 32 +++++++++++++++++++-------
modules/gui/macosx/intf.m | 11 ++++-----
3 files changed, 30 insertions(+), 18 deletions(-)
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index f0030b1..8788f8c 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -783,8 +783,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
// only resize back to minimum view of this is still desired final state
float f_threshold_height = f_min_video_height + [o_controls_bar height];
- if(frameBeforePlayback.size.height > f_threshold_height || b_minimized_view)
+ if(frameBeforePlayback.size.height > f_threshold_height || b_minimized_view) {
[[self animator] setFrame:frameBeforePlayback display:YES];
+ }
}
frameBeforePlayback = NSMakeRect(0, 0, 0, 0);
@@ -810,8 +811,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_fspanel setNonActive: nil];
}
}
-
- [self changePlaylistState: psVideoStartedOrStoppedEvent];
}
#pragma mark -
diff --git a/modules/gui/macosx/VLCVoutWindowController.m b/modules/gui/macosx/VLCVoutWindowController.m
index 5be5048..67b67b1 100644
--- a/modules/gui/macosx/VLCVoutWindowController.m
+++ b/modules/gui/macosx/VLCVoutWindowController.m
@@ -68,7 +68,8 @@
VLCVideoWindowCommon *o_new_video_window;
// should be called before any window resizing occurs
- [[VLCMainWindow sharedInstance] videoplayWillBeStarted];
+ if (!b_multiple_vout_windows)
+ [[VLCMainWindow sharedInstance] videoplayWillBeStarted];
if (b_multiple_vout_windows && b_video_wallpaper)
b_video_wallpaper = false;
@@ -126,7 +127,6 @@
[o_new_video_window setContentMinSize: NSMakeSize(f_min_video_height, f_min_video_height)];
}
- [[VLCMainWindow sharedInstance] setNonembedded:YES];
b_nonembedded = YES;
} else {
if ((var_InheritBool(VLCIntf, "embedded-video") && !b_mainwindow_has_video)) {
@@ -221,13 +221,18 @@
[o_new_video_window setAlphaValue: config_GetFloat(VLCIntf, "macosx-opaqueness")];
- if (!b_multiple_vout_windows)
- [[VLCMainWindow sharedInstance] setNonembedded:b_nonembedded];
+
[o_vout_view setVoutThread:(vout_thread_t *)p_wnd->p_parent];
[o_new_video_window setHasActiveVideo: YES];
[o_vout_dict setObject:[o_new_video_window autorelease] forKey:[NSValue valueWithPointer:p_wnd]];
+ [[VLCMainWindow sharedInstance] setNonembedded:!b_mainwindow_has_video];
+
+ // beware of order, setActiveVideoPlayback:, setHasActiveVideo: and setNonembedded: must be called before
+ if ([o_new_video_window class] == [VLCMainWindow class])
+ [[VLCMainWindow sharedInstance] changePlaylistState: psVideoStartedOrStoppedEvent];
+
if (b_nonembedded) {
// event occurs before window is created, so call again
[[VLCMain sharedInstance] playlistUpdated];
@@ -244,9 +249,6 @@
return;
}
- if ([o_window class] == [VLCMainWindow class])
- b_mainwindow_has_video = NO;
-
if ([o_window fullscreen] && ![[VLCMainWindow sharedInstance] nativeFullscreenMode])
[o_window leaveFullscreen];
@@ -255,17 +257,31 @@
// set active video to no BEFORE closing the window to avoid stopping playback
// due to NSWindowWillCloseNotification
[o_window setHasActiveVideo: NO];
+
if ([o_window class] != [VLCMainWindow class]) {
[o_window close];
[o_window orderOut:self]; // for dark interface
}
+ [o_window retain];
[o_vout_dict removeObjectForKey:o_key];
-
if ([o_vout_dict count] == 0) {
[[VLCMain sharedInstance] setActiveVideoPlayback:NO];
i_statusLevelWindowCounter = 0;
}
+
+ if ([o_window class] == [VLCMainWindow class]) {
+ b_mainwindow_has_video = NO;
+
+ // video in main window might get stopped while another vout is open
+ if ([o_vout_dict count] > 0)
+ [[VLCMainWindow sharedInstance] setNonembedded:YES];
+
+ // beware of order, setActiveVideoPlayback:, setHasActiveVideo: and setNonembedded: must be called before
+ [[VLCMainWindow sharedInstance] changePlaylistState: psVideoStartedOrStoppedEvent];
+ }
+
+ [o_window release];
}
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 636a707..f5b804d 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -135,6 +135,8 @@ int WindowOpen(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
return VLC_EGENERIC;
}
+ [[VLCMain sharedInstance] setActiveVideoPlayback: YES];
+
SEL sel = @selector(setupVoutForWindow:withProposedVideoViewPosition:);
NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[o_vout_controller methodSignatureForSelector:sel]];
[inv setTarget:o_vout_controller];
@@ -148,19 +150,14 @@ int WindowOpen(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
VLCVoutView *videoView = nil;
[inv getReturnValue:&videoView];
- if (!videoView) {
- msg_Err(p_wnd, "got no video view from the interface");
- [o_vout_provider_lock unlock];
- [o_pool release];
- return VLC_EGENERIC;
- }
+ // this method is not supposed to fail
+ assert(videoView != nil);
msg_Dbg(VLCIntf, "returning videoview with proposed position x=%i, y=%i, width=%i, height=%i", cfg->x, cfg->y, cfg->width, cfg->height);
p_wnd->handle.nsobject = videoView;
[o_vout_provider_lock unlock];
- [[VLCMain sharedInstance] setActiveVideoPlayback: YES];
p_wnd->control = WindowControl;
[o_pool release];
More information about the vlc-commits
mailing list