[vlc-commits] [Git][videolan/vlc][master] 12 commits: macosx: Set overlay view constraints on superview rather than voutContainingView in main video view
Marvin Scholz (@ePirat)
gitlab at videolan.org
Sat Nov 9 22:26:08 UTC 2024
Marvin Scholz pushed to branch master at VideoLAN / VLC
Commits:
1c8fbf6f by Claudio Cambra at 2024-11-09T21:56:38+00:00
macosx: Set overlay view constraints on superview rather than voutContainingView in main video view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
be0bba38 by Claudio Cambra at 2024-11-09T21:56:38+00:00
macosx: Apply voutContainingView as the PIP view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
a18dcda0 by Claudio Cambra at 2024-11-09T21:56:38+00:00
macosx: Switch out audio decorative view and voutview within voutContainingView
This removes the horrible hacky way we were doing it before, where we
were just placing the audio decorative view on top of the
voutcontaininview
As a benefit the audio decorative view will now appear correctly in the
PIP view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
22fea1ed by Claudio Cambra at 2024-11-09T21:56:38+00:00
macosx: Return library window to library view when enabling PIP in video view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
858081a6 by Claudio Cambra at 2024-11-09T21:56:38+00:00
macosx: Enable video playback appearance in library window when closing PIP
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
d2ade81c by Claudio Cambra at 2024-11-09T21:56:38+00:00
macosx: Match formatting of PIP sections in mainvideoviewcontroller with rest
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
549f71fc by Claudio Cambra at 2024-11-09T21:56:38+00:00
macosx: Add method to retrieve the video window for a given vout view in output provider
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
dee9c873 by Claudio Cambra at 2024-11-09T21:56:38+00:00
macosx: Use valid window reference for a vout view's intended parent window in main video view controller window restore handling
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
0420de17 by Claudio Cambra at 2024-11-09T21:56:38+00:00
macosx: Use valid window reference and bring up window before PIP close transition
Cannot use self.view.window as this is a null refernce; also is smoother
to present the user with the window the PIP view will merge into
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
743bfbcd by Claudio Cambra at 2024-11-09T21:56:38+00:00
macosx: Prepare window positioning before PIP transition closes
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
055b0935 by Claudio Cambra at 2024-11-09T21:56:38+00:00
macosx: Fix PIP close animation when playing music with artwork view
When video playback is not active we cannot use the voutview (and it's
window pointer) to get the VLCVideoWindowCommon instance associated with
it. Instead let's just hold a reference to the parent window and clear
this reference when PIP is done
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
e319abab by Claudio Cambra at 2024-11-09T21:56:38+00:00
macosx: Ensure audio decorative view has reasonable sizings and adapts to small PIP views
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
5 changed files:
- modules/gui/macosx/UI/VLCMainVideoView.xib
- modules/gui/macosx/UI/VLCMainVideoViewAudioMediaDecorativeView.xib
- modules/gui/macosx/windows/video/VLCMainVideoViewController.m
- modules/gui/macosx/windows/video/VLCVideoOutputProvider.h
- modules/gui/macosx/windows/video/VLCVideoOutputProvider.m
Changes:
=====================================
modules/gui/macosx/UI/VLCMainVideoView.xib
=====================================
@@ -495,17 +495,17 @@
</progressIndicator>
</subviews>
<constraints>
+ <constraint firstItem="D4V-Zd-qvB" firstAttribute="leading" secondItem="WRu-Ic-lQK" secondAttribute="leading" id="0vg-TG-O1c"/>
<constraint firstItem="MTR-ds-I8o" firstAttribute="top" secondItem="WRu-Ic-lQK" secondAttribute="top" id="2cq-kJ-XAR"/>
+ <constraint firstAttribute="bottom" secondItem="D4V-Zd-qvB" secondAttribute="bottom" id="D7Y-ck-iZE"/>
<constraint firstAttribute="trailing" secondItem="MTR-ds-I8o" secondAttribute="trailing" id="E2t-0S-hdB"/>
- <constraint firstItem="D4V-Zd-qvB" firstAttribute="leading" secondItem="MTR-ds-I8o" secondAttribute="leading" id="LJf-4H-NXB"/>
- <constraint firstItem="D4V-Zd-qvB" firstAttribute="top" secondItem="MTR-ds-I8o" secondAttribute="top" id="M6r-Gq-UVy"/>
<constraint firstItem="xOQ-YR-iAc" firstAttribute="top" secondItem="CvV-yX-Nbh" secondAttribute="bottom" constant="20" id="S0Y-3b-Ibd"/>
<constraint firstItem="MTR-ds-I8o" firstAttribute="leading" secondItem="WRu-Ic-lQK" secondAttribute="leading" id="TJ3-v0-eiw"/>
- <constraint firstItem="D4V-Zd-qvB" firstAttribute="bottom" secondItem="MTR-ds-I8o" secondAttribute="bottom" id="cC2-Et-2M0"/>
+ <constraint firstAttribute="trailing" secondItem="D4V-Zd-qvB" secondAttribute="trailing" id="XP7-9K-6UE"/>
<constraint firstItem="xOQ-YR-iAc" firstAttribute="centerX" secondItem="WRu-Ic-lQK" secondAttribute="centerX" id="enR-Xo-ume"/>
<constraint firstItem="1GA-GG-Sdx" firstAttribute="top" relation="greaterThanOrEqual" secondItem="xOQ-YR-iAc" secondAttribute="bottom" constant="20" id="jM9-dz-8jm"/>
<constraint firstAttribute="bottom" secondItem="MTR-ds-I8o" secondAttribute="bottom" id="mbp-Lj-iuX"/>
- <constraint firstItem="D4V-Zd-qvB" firstAttribute="trailing" secondItem="MTR-ds-I8o" secondAttribute="trailing" id="uy6-SD-44y"/>
+ <constraint firstItem="D4V-Zd-qvB" firstAttribute="top" secondItem="WRu-Ic-lQK" secondAttribute="top" id="n1X-TQ-EW3"/>
</constraints>
<point key="canvasLocation" x="66" y="-232"/>
</customView>
=====================================
modules/gui/macosx/UI/VLCMainVideoViewAudioMediaDecorativeView.xib
=====================================
@@ -1,30 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="23504" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment version="101000" identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="23504"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner"/>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
- <customView id="WRu-Ic-lQK" customClass="VLCMainVideoViewAudioMediaDecorativeView">
- <rect key="frame" x="0.0" y="0.0" width="720" height="480"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <customView horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="WRu-Ic-lQK" customClass="VLCMainVideoViewAudioMediaDecorativeView">
+ <rect key="frame" x="0.0" y="0.0" width="316" height="336"/>
<subviews>
- <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="cDv-dn-65H">
- <rect key="frame" x="0.0" y="0.0" width="720" height="480"/>
+ <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="cDv-dn-65H">
+ <rect key="frame" x="0.0" y="0.0" width="316" height="336"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="axesIndependently" image="noart" id="3lz-lJ-nIL"/>
</imageView>
- <visualEffectView blendingMode="withinWindow" material="HUDWindow" state="active" translatesAutoresizingMaskIntoConstraints="NO" id="D1e-fS-bwO">
- <rect key="frame" x="0.0" y="0.0" width="720" height="480"/>
+ <visualEffectView horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" blendingMode="withinWindow" material="HUDWindow" state="active" translatesAutoresizingMaskIntoConstraints="NO" id="D1e-fS-bwO">
+ <rect key="frame" x="0.0" y="0.0" width="316" height="336"/>
</visualEffectView>
- <imageView wantsLayer="YES" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="40P-sL-Mzq">
- <rect key="frame" x="232" y="112" width="256" height="256"/>
+ <imageView wantsLayer="YES" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="40P-sL-Mzq">
+ <rect key="frame" x="95" y="105" width="126" height="126"/>
<constraints>
- <constraint firstAttribute="width" constant="256" id="PdS-Zh-d9T"/>
<constraint firstAttribute="width" secondItem="40P-sL-Mzq" secondAttribute="height" multiplier="1:1" id="dje-mE-ZfL"/>
+ <constraint firstAttribute="height" relation="lessThanOrEqual" constant="256" id="m0P-G9-9hZ"/>
</constraints>
<shadow key="shadow" blurRadius="20">
<color key="color" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -34,9 +33,12 @@
</subviews>
<constraints>
<constraint firstItem="40P-sL-Mzq" firstAttribute="centerX" secondItem="WRu-Ic-lQK" secondAttribute="centerX" id="4Ib-c0-egD"/>
+ <constraint firstItem="40P-sL-Mzq" firstAttribute="bottom" relation="lessThanOrEqual" secondItem="D1e-fS-bwO" secondAttribute="bottom" constant="-20" id="DHs-x0-cB0"/>
<constraint firstAttribute="trailing" secondItem="D1e-fS-bwO" secondAttribute="trailing" id="J68-x2-cY5"/>
<constraint firstItem="D1e-fS-bwO" firstAttribute="leading" secondItem="WRu-Ic-lQK" secondAttribute="leading" id="KBI-Gr-tTT"/>
+ <constraint firstItem="40P-sL-Mzq" firstAttribute="width" relation="lessThanOrEqual" secondItem="D1e-fS-bwO" secondAttribute="width" multiplier="0.4" id="Kuw-Nx-ZmH"/>
<constraint firstAttribute="bottom" secondItem="cDv-dn-65H" secondAttribute="bottom" id="Sv1-Hf-eCe"/>
+ <constraint firstItem="40P-sL-Mzq" firstAttribute="top" relation="greaterThanOrEqual" secondItem="D1e-fS-bwO" secondAttribute="top" constant="20" id="TVt-Xt-aoo"/>
<constraint firstItem="cDv-dn-65H" firstAttribute="leading" secondItem="WRu-Ic-lQK" secondAttribute="leading" id="bZL-GN-AAt"/>
<constraint firstItem="cDv-dn-65H" firstAttribute="top" secondItem="WRu-Ic-lQK" secondAttribute="top" id="dvc-kq-jk8"/>
<constraint firstItem="D1e-fS-bwO" firstAttribute="top" secondItem="WRu-Ic-lQK" secondAttribute="top" id="eDP-U6-Qt6"/>
=====================================
modules/gui/macosx/windows/video/VLCMainVideoViewController.m
=====================================
@@ -89,6 +89,8 @@
BOOL _isFadingIn;
}
+
+ at property NSWindow *retainedWindow;
@end
@implementation VLCMainVideoViewController
@@ -137,44 +139,6 @@
{
_audioDecorativeView = [VLCMainVideoViewAudioMediaDecorativeView fromNibWithOwner:self];
_audioDecorativeView.translatesAutoresizingMaskIntoConstraints = NO;
- [self.view addConstraints:@[
- [NSLayoutConstraint constraintWithItem:_audioDecorativeView
- attribute:NSLayoutAttributeTop
- relatedBy:NSLayoutRelationEqual
- toItem:self.view
- attribute:NSLayoutAttributeTop
- multiplier:1.
- constant:0.
- ],
- [NSLayoutConstraint constraintWithItem:_audioDecorativeView
- attribute:NSLayoutAttributeBottom
- relatedBy:NSLayoutRelationEqual
- toItem:self.view
- attribute:NSLayoutAttributeBottom
- multiplier:1.
- constant:0.
- ],
- [NSLayoutConstraint constraintWithItem:_audioDecorativeView
- attribute:NSLayoutAttributeLeft
- relatedBy:NSLayoutRelationEqual
- toItem:self.view
- attribute:NSLayoutAttributeLeft
- multiplier:1.
- constant:0.
- ],
- [NSLayoutConstraint constraintWithItem:_audioDecorativeView
- attribute:NSLayoutAttributeRight
- relatedBy:NSLayoutRelationEqual
- toItem:self.view
- attribute:NSLayoutAttributeRight
- multiplier:1.
- constant:0.
- ],
- ]];
-
- [self.view addSubview:self.audioDecorativeView
- positioned:NSWindowBelow
- relativeTo:self.mainControlsView];
VLCPlayerController * const controller =
VLCMain.sharedInstance.playlistController.playerController;
[self updateDecorativeViewVisibilityOnControllerChange:controller];
@@ -234,7 +198,43 @@
VLCInputItem * const inputItem = controller.currentMedia;
decorativeViewVisible = inputItem != nil && controller.videoTracks.count == 0;
}
- _audioDecorativeView.hidden = !decorativeViewVisible;
+
+ NSView * const targetView = decorativeViewVisible ? self.audioDecorativeView : self.voutView;
+ self.voutContainingView.subviews = @[targetView];
+ [self.voutContainingView addConstraints:@[
+ [NSLayoutConstraint constraintWithItem:targetView
+ attribute:NSLayoutAttributeTop
+ relatedBy:NSLayoutRelationEqual
+ toItem:self.voutContainingView
+ attribute:NSLayoutAttributeTop
+ multiplier:1.
+ constant:0.
+ ],
+ [NSLayoutConstraint constraintWithItem:targetView
+ attribute:NSLayoutAttributeBottom
+ relatedBy:NSLayoutRelationEqual
+ toItem:self.voutContainingView
+ attribute:NSLayoutAttributeBottom
+ multiplier:1.
+ constant:0.
+ ],
+ [NSLayoutConstraint constraintWithItem:targetView
+ attribute:NSLayoutAttributeLeft
+ relatedBy:NSLayoutRelationEqual
+ toItem:self.voutContainingView
+ attribute:NSLayoutAttributeLeft
+ multiplier:1.
+ constant:0.
+ ],
+ [NSLayoutConstraint constraintWithItem:targetView
+ attribute:NSLayoutAttributeRight
+ relatedBy:NSLayoutRelationEqual
+ toItem:self.voutContainingView
+ attribute:NSLayoutAttributeRight
+ multiplier:1.
+ constant:0.
+ ],
+ ]];
if (decorativeViewVisible) {
[self setAutohideControls:NO];
@@ -502,35 +502,46 @@
[_overlayView setNeedsDisplay:YES];
}
-- (void)pictureInPictureChanged:(VLCPlayerController *)playerController {
- if (_voutViewController)
+- (void)pictureInPictureChanged:(VLCPlayerController *)playerController
+{
+ if (_voutViewController) {
return;
- [self.view.window orderOut:self.view.window];
+ }
+
+ NSWindow * const window = self.view.window;
+ [window orderOut:window];
+ self.retainedWindow = window;
+
_voutViewController = [PIPVoutViewController new];
- _voutViewController.view = _voutView;
+ _voutViewController.view = self.voutContainingView;
VLCPlayerController * const controller =
VLCMain.sharedInstance.playlistController.playerController;
_pipViewController.playing = controller.playerState == VLC_PLAYER_STATE_PLAYING;
- VLCInputItem *item = controller.currentMedia;
+ VLCInputItem * const item = controller.currentMedia;
input_item_t * const p_input = item.vlcInputItem;
vlc_mutex_lock(&p_input->lock);
const struct input_item_es *item_es;
- vlc_vector_foreach_ref(item_es, &p_input->es_vec)
- {
- if (item_es->es.i_cat != VIDEO_ES)
+ vlc_vector_foreach_ref(item_es, &p_input->es_vec) {
+ if (item_es->es.i_cat != VIDEO_ES) {
continue;
- const video_format_t *fmt = &item_es->es.video;
+ }
+ const video_format_t * const fmt = &item_es->es.video;
unsigned int width = fmt->i_visible_width;
unsigned int height = fmt->i_visible_height;
- if (fmt->i_sar_num && fmt->i_sar_den)
+ if (fmt->i_sar_num && fmt->i_sar_den) {
height = (height * fmt->i_sar_den) / fmt->i_sar_num;
+ }
_pipViewController.aspectRatio = CGSizeMake(width, height);
break;
}
vlc_mutex_unlock(&p_input->lock);
- _pipViewController.title = self.view.window.title;
+ _pipViewController.title = window.title;
[_pipViewController presentViewControllerAsPictureInPicture:_voutViewController];
+
+ if ([window isKindOfClass:VLCLibraryWindow.class]) {
+ [self returnToLibrary:self];
+ }
}
- (IBAction)togglePlaylist:(id)sender
@@ -550,29 +561,42 @@
}
#pragma mark - PIPViewControllerDelegate
-- (BOOL)pipShouldClose:(PIPViewController *)pip {
+- (BOOL)pipShouldClose:(PIPViewController *)pip
+{
return YES;
}
-- (void)pipWillClose:(PIPViewController *)pip {
- [_voutView removeFromSuperview];
- [_voutContainingView addSubview:_voutView];
- [_voutContainingView.topAnchor constraintEqualToAnchor:_voutView.topAnchor].active = YES;
- [_voutContainingView.bottomAnchor constraintEqualToAnchor:_voutView.bottomAnchor].active = YES;
- [_voutContainingView.leftAnchor constraintEqualToAnchor:_voutView.leftAnchor].active = YES;
- [_voutContainingView.rightAnchor constraintEqualToAnchor:_voutView.rightAnchor].active = YES;
- _voutViewController = nil;
- pip.replacementWindow = self.view.window;
- pip.replacementRect = self.voutContainingView.frame;
+- (void)pipWillClose:(PIPViewController *)pip
+{
+ NSWindow * const window = self.retainedWindow;
+ pip.replacementWindow = window;
+ pip.replacementRect = self.view.frame;
+ if ([window isKindOfClass:VLCLibraryWindow.class]) {
+ [(VLCLibraryWindow *)window enableVideoPlaybackAppearance];
+ }
+ [window makeKeyAndOrderFront:window];
+ self.retainedWindow = nil;
}
-- (void)pipDidClose:(PIPViewController *)pip {
- [self.view.window orderFront:self.view.window];
+- (void)pipDidClose:(PIPViewController *)pip
+{
+ [self.voutContainingView removeFromSuperview];
+ [self.view addSubview:self.voutContainingView
+ positioned:NSWindowBelow
+ relativeTo:self.mainControlsView];
+ [NSLayoutConstraint activateConstraints:@[
+ [self.voutContainingView.topAnchor constraintEqualToAnchor:self.view.topAnchor],
+ [self.voutContainingView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor],
+ [self.voutContainingView.leftAnchor constraintEqualToAnchor:self.view.leftAnchor],
+ [self.voutContainingView.rightAnchor constraintEqualToAnchor:self.view.rightAnchor]
+ ]];
+ _voutViewController = nil;
}
-- (void)pipActionPlay:(PIPViewController *)pip {
+- (void)pipActionPlay:(PIPViewController *)pip
+{
VLCPlayerController * const controller =
- VLCMain.sharedInstance.playlistController.playerController;
+ VLCMain.sharedInstance.playlistController.playerController;
if (controller.playerState == VLC_PLAYER_STATE_PAUSED) {
[controller resume];
} else {
@@ -580,7 +604,8 @@
}
}
-- (void)pipActionStop:(PIPViewController *)pip {
+- (void)pipActionStop:(PIPViewController *)pip
+{
VLCPlayerController * const controller =
VLCMain.sharedInstance.playlistController.playerController;
[controller pause];
=====================================
modules/gui/macosx/windows/video/VLCVideoOutputProvider.h
=====================================
@@ -49,4 +49,6 @@ extern NSString * const VLCWindowFloatOnTopEnabledNotificationKey;
- (void)updateWindowLevelForHelperWindows:(NSInteger)i_level;
+- (VLCVideoWindowCommon *)videoWindowForVoutView:(VLCVoutView *)voutView;
+
@end
=====================================
modules/gui/macosx/windows/video/VLCVideoOutputProvider.m
=====================================
@@ -642,6 +642,11 @@ static int WindowFloatOnTop(vlc_object_t *obj,
[NSNotificationCenter.defaultCenter postNotificationName:VLCWindowShouldUpdateLevel object:self userInfo:@{VLCWindowLevelKey : @(_currentWindowLevel)}];
}
+- (VLCVideoWindowCommon *)videoWindowForVoutView:(VLCVoutView *)voutView
+{
+ return [self.voutWindows objectForKey:[NSValue valueWithPointer:voutView.voutWindow]];
+}
+
#pragma mark -
#pragma mark Property methods
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1dec8eff9011490f26071d89e1a0bced8d507261...e319ababe49e11a39ba1d6e4895b54fcfead3733
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1dec8eff9011490f26071d89e1a0bced8d507261...e319ababe49e11a39ba1d6e4895b54fcfead3733
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list