[vlc-commits] [Git][videolan/vlc][master] 13 commits: macosx: Separate actual setting of cover art and notification response in...
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue Jul 16 06:12:42 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
ea1a82c1 by Claudio Cambra at 2024-07-16T05:55:41+00:00
macosx: Separate actual setting of cover art and notification response in audio media decorative view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
9d1a416c by Claudio Cambra at 2024-07-16T05:55:41+00:00
macosx: Properly set visibility of audio decorative view in main video view according to currently playing item on setup
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
1cf81621 by Claudio Cambra at 2024-07-16T05:55:41+00:00
macosx: Make sure to update cover art on audio decorative view setup in main video view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
67642075 by Claudio Cambra at 2024-07-16T05:55:41+00:00
macosx: Expose setupVideoWindow in video output provider header
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
9bc0b7d3 by Claudio Cambra at 2024-07-16T05:55:41+00:00
macosx: Present an "artificial" video window to display audio artwork when the user requests it and detached video windows are enabled
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
105c9df4 by Claudio Cambra at 2024-07-16T05:55:41+00:00
macosx: Store reference to temporary audio decorative view window
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
eded8b72 by Claudio Cambra at 2024-07-16T05:55:41+00:00
macosx: Rectify visibility of temporary audio window when real video window appears
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
6bf22163 by Claudio Cambra at 2024-07-16T05:55:41+00:00
macosx: Present detached audio window when clicking present item in library window
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
6f7f651c by Claudio Cambra at 2024-07-16T05:55:41+00:00
macosx: Automatically and internally update cover art for audio media decorative view when awaking from nib
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
884dec2a by Claudio Cambra at 2024-07-16T05:55:41+00:00
macosx: Replace image view in detached audio window with audio media decorative view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
cb473353 by Claudio Cambra at 2024-07-16T05:55:41+00:00
macosx: Correctly update all components of control bar on initialisation of control bar
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
100a1c81 by Claudio Cambra at 2024-07-16T05:55:41+00:00
macosx: Add playing item title label to detached audio window XIB
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
09a0a121 by Claudio Cambra at 2024-07-16T05:55:41+00:00
macosx: Adjust sizings and spacings of items in detached audio window
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
9 changed files:
- modules/gui/macosx/UI/VLCDetachedAudioWindow.xib
- modules/gui/macosx/library/VLCLibraryWindow.m
- modules/gui/macosx/windows/VLCDetachedAudioWindow.h
- modules/gui/macosx/windows/VLCDetachedAudioWindow.m
- modules/gui/macosx/windows/controlsbar/VLCControlsBarCommon.m
- modules/gui/macosx/windows/video/VLCMainVideoViewAudioMediaDecorativeView.h
- modules/gui/macosx/windows/video/VLCMainVideoViewAudioMediaDecorativeView.m
- modules/gui/macosx/windows/video/VLCMainVideoViewController.m
- modules/gui/macosx/windows/video/VLCVideoOutputProvider.h
Changes:
=====================================
modules/gui/macosx/UI/VLCDetachedAudioWindow.xib
=====================================
@@ -22,12 +22,6 @@
<rect key="frame" x="0.0" y="0.0" width="239" height="239"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
- <customView translatesAutoresizingMaskIntoConstraints="NO" id="63" customClass="VLCImageView">
- <rect key="frame" x="0.0" y="0.0" width="239" height="239"/>
- <constraints>
- <constraint firstAttribute="width" secondItem="63" secondAttribute="height" multiplier="1:1" id="RxG-T1-BEQ"/>
- </constraints>
- </customView>
<customView wantsLayer="YES" translatesAutoresizingMaskIntoConstraints="NO" id="s7h-2z-AKB" customClass="VLCMainVideoViewOverlayView">
<rect key="frame" x="0.0" y="0.0" width="239" height="239"/>
<subviews>
@@ -37,6 +31,17 @@
<customView translatesAutoresizingMaskIntoConstraints="NO" id="65" customClass="VLCDragDropView">
<rect key="frame" x="0.0" y="0.0" width="239" height="77"/>
<subviews>
+ <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hHQ-ue-m9C" customClass="VLCWrappableTextField">
+ <rect key="frame" x="8" y="71" width="223" height="19"/>
+ <shadow key="shadow" blurRadius="5">
+ <color key="color" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+ </shadow>
+ <textFieldCell key="cell" lineBreakMode="truncatingTail" title="Label" id="JyX-u7-Hkb">
+ <font key="font" textStyle="title3" name=".SFNS-Regular"/>
+ <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Vae-cT-EEI" userLabel="Play controls group">
<rect key="frame" x="72" y="10" width="96" height="32"/>
<subviews>
@@ -123,13 +128,17 @@
</textField>
</subviews>
<constraints>
+ <constraint firstItem="20" firstAttribute="top" secondItem="hHQ-ue-m9C" secondAttribute="bottom" constant="5" id="C7Y-fI-Dqe"/>
+ <constraint firstItem="hHQ-ue-m9C" firstAttribute="top" secondItem="65" secondAttribute="top" constant="5" id="JZy-V4-KFy"/>
+ <constraint firstItem="hHQ-ue-m9C" firstAttribute="trailing" secondItem="9" secondAttribute="trailing" id="KgS-6V-onl"/>
<constraint firstItem="20" firstAttribute="leading" secondItem="65" secondAttribute="leading" constant="10" id="KrJ-x3-HIr"/>
<constraint firstItem="Vae-cT-EEI" firstAttribute="centerX" secondItem="65" secondAttribute="centerX" id="Rf0-0E-Wiz"/>
<constraint firstItem="9" firstAttribute="centerY" secondItem="20" secondAttribute="centerY" id="SW9-5i-MQL"/>
<constraint firstAttribute="bottom" secondItem="Vae-cT-EEI" secondAttribute="bottom" constant="10" id="T6V-Vf-TOT"/>
+ <constraint firstItem="hHQ-ue-m9C" firstAttribute="leading" secondItem="20" secondAttribute="leading" id="VP9-OW-xmq"/>
<constraint firstItem="9" firstAttribute="leading" secondItem="20" secondAttribute="trailing" constant="5" id="gyE-0N-u6t"/>
<constraint firstAttribute="trailing" secondItem="9" secondAttribute="trailing" constant="10" id="p5i-nM-pBs"/>
- <constraint firstItem="Vae-cT-EEI" firstAttribute="top" secondItem="20" secondAttribute="bottom" constant="10" id="pfB-W2-CWB"/>
+ <constraint firstItem="Vae-cT-EEI" firstAttribute="top" secondItem="20" secondAttribute="bottom" constant="5" id="pfB-W2-CWB"/>
</constraints>
</customView>
</subviews>
@@ -138,7 +147,7 @@
<constraint firstItem="65" firstAttribute="leading" secondItem="5" secondAttribute="leading" id="84j-is-ZZ4"/>
<constraint firstAttribute="bottom" secondItem="65" secondAttribute="bottom" id="WrS-PS-vpi"/>
<constraint firstItem="65" firstAttribute="top" secondItem="5" secondAttribute="top" id="ecn-UJ-dvK"/>
- <constraint firstAttribute="height" constant="77" id="z2X-5w-wme"/>
+ <constraint firstAttribute="height" constant="90" id="z2X-5w-wme"/>
</constraints>
<shadow key="shadow" blurRadius="10">
<color key="color" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -154,19 +163,6 @@
</subviews>
<constraints>
<constraint firstItem="s7h-2z-AKB" firstAttribute="leading" secondItem="4" secondAttribute="leading" id="GSE-Q6-p8X"/>
- <constraint firstItem="63" firstAttribute="top" secondItem="4" secondAttribute="top" id="SR5-da-lz7">
- <attributedString key="userComments">
- <fragment content="Optional constraint if no titlebar">
- <attributes>
- <font key="NSFont" metaFont="smallSystem"/>
- <paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
- </attributes>
- </fragment>
- </attributedString>
- </constraint>
- <constraint firstAttribute="bottom" secondItem="63" secondAttribute="bottom" priority="750" id="Xml-gb-MF1"/>
- <constraint firstItem="63" firstAttribute="leading" secondItem="4" secondAttribute="leading" id="b8K-0j-YLT"/>
- <constraint firstAttribute="trailing" secondItem="63" secondAttribute="trailing" id="b8X-Kc-BfD"/>
<constraint firstAttribute="bottom" secondItem="s7h-2z-AKB" secondAttribute="bottom" id="d58-lr-6o8"/>
<constraint firstAttribute="trailing" secondItem="s7h-2z-AKB" secondAttribute="trailing" id="dB2-xi-SzA"/>
<constraint firstItem="s7h-2z-AKB" firstAttribute="top" secondItem="4" secondAttribute="top" id="plq-T3-bmm"/>
@@ -175,7 +171,6 @@
<connections>
<outlet property="bottomBarView" destination="5" id="xZs-ha-Bmg"/>
<outlet property="controlsBar" destination="3" id="69"/>
- <outlet property="imageView" destination="63" id="xYd-xT-wUa"/>
<outlet property="overlayView" destination="s7h-2z-AKB" id="VGk-aw-I4j"/>
</connections>
<point key="canvasLocation" x="138.5" y="146.5"/>
@@ -186,6 +181,7 @@
<outlet property="dropView" destination="65" id="9kL-XQ-Akn"/>
<outlet property="forwardButton" destination="12" id="f7L-YR-p1H"/>
<outlet property="playButton" destination="10" id="Gsq-tx-qf3"/>
+ <outlet property="playingItemDisplayField" destination="hHQ-ue-m9C" id="gz6-0p-XEt"/>
<outlet property="timeField" destination="9" id="uzI-2c-bs3"/>
<outlet property="timeSlider" destination="20" id="AFS-sq-vuw"/>
</connections>
=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -74,6 +74,7 @@
#import "windows/video/VLCVideoOutputProvider.h"
#import "windows/video/VLCMainVideoViewController.h"
+#import "windows/VLCDetachedAudioWindow.h"
#import "windows/VLCOpenWindowController.h"
#import "windows/VLCOpenInputMetadata.h"
@@ -89,6 +90,7 @@ const NSUserInterfaceItemIdentifier VLCLibraryWindowIdentifier = @"VLCLibraryWin
{
NSInteger _librarySegmentType;
NSInteger _currentSelectedViewModeSegment;
+ VLCVideoWindowCommon *_temporaryAudioDecorativeWindow;
}
@property NSTimer *searchInputTimer;
@@ -548,6 +550,15 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
{
VLCVideoOutputProvider * const voutProvider = VLCMain.sharedInstance.voutProvider;
NSArray<NSWindow *> * const voutWindows = voutProvider.voutWindows.allValues;
+
+ if (voutWindows.count == 0 && self.playerController.videoTracks.count == 0) {
+ // If we have no video windows in the video provider but are being asked to present a window
+ // then we are dealing with an audio item and the user wants to see the decorative artwork
+ // window for said audio
+ [VLCMain.sharedInstance.detachedAudioWindow makeKeyAndOrderFront:self];
+ return;
+ }
+
for (NSWindow * const window in voutWindows) {
[window makeKeyAndOrderFront:self];
}
=====================================
modules/gui/macosx/windows/VLCDetachedAudioWindow.h
=====================================
@@ -27,13 +27,14 @@
@class VLCImageView;
@class VLCBottomBarView;
@class VLCMainVideoViewOverlayView;
+ at class VLCMainVideoViewAudioMediaDecorativeView;
NS_ASSUME_NONNULL_BEGIN
@interface VLCDetachedAudioWindow : VLCWindow
+ at property (readonly) VLCMainVideoViewAudioMediaDecorativeView *decorativeView;
@property (nonatomic, weak) IBOutlet VLCMainVideoViewOverlayView *overlayView;
- at property (nonatomic, weak) IBOutlet VLCImageView *imageView;
@property (nonatomic, weak) IBOutlet VLCControlsBarCommon *controlsBar;
@property (nonatomic, weak) IBOutlet VLCBottomBarView *bottomBarView;
=====================================
modules/gui/macosx/windows/VLCDetachedAudioWindow.m
=====================================
@@ -32,12 +32,12 @@
#import "playlist/VLCPlaylistController.h"
#import "playlist/VLCPlayerController.h"
-#import "views/VLCImageView.h"
#import "views/VLCTrackingView.h"
#import "views/VLCBottomBarView.h"
#import "windows/controlsbar/VLCControlsBarCommon.h"
+#import "windows/video/VLCMainVideoViewAudioMediaDecorativeView.h"
#import "windows/video/VLCMainVideoViewOverlayView.h"
@interface VLCDetachedAudioWindow()
@@ -48,6 +48,49 @@
@implementation VLCDetachedAudioWindow
+- (void)setupAudioDecorativeView
+{
+ _decorativeView = [VLCMainVideoViewAudioMediaDecorativeView fromNibWithOwner:self.contentView];
+ self.decorativeView.translatesAutoresizingMaskIntoConstraints = NO;
+ [self.contentView addSubview:self.decorativeView
+ positioned:NSWindowBelow
+ relativeTo:self.overlayView];
+ [self.contentView addConstraints:@[
+ [NSLayoutConstraint constraintWithItem:self.decorativeView
+ attribute:NSLayoutAttributeTop
+ relatedBy:NSLayoutRelationEqual
+ toItem:self.contentView
+ attribute:NSLayoutAttributeTop
+ multiplier:1.
+ constant:0.
+ ],
+ [NSLayoutConstraint constraintWithItem:self.decorativeView
+ attribute:NSLayoutAttributeBottom
+ relatedBy:NSLayoutRelationEqual
+ toItem:self.contentView
+ attribute:NSLayoutAttributeBottom
+ multiplier:1.
+ constant:0.
+ ],
+ [NSLayoutConstraint constraintWithItem:self.decorativeView
+ attribute:NSLayoutAttributeLeft
+ relatedBy:NSLayoutRelationEqual
+ toItem:self.contentView
+ attribute:NSLayoutAttributeLeft
+ multiplier:1.
+ constant:0.
+ ],
+ [NSLayoutConstraint constraintWithItem:self.decorativeView
+ attribute:NSLayoutAttributeRight
+ relatedBy:NSLayoutRelationEqual
+ toItem:self.contentView
+ attribute:NSLayoutAttributeRight
+ multiplier:1.
+ constant:0.
+ ],
+ ]];
+}
+
- (void)awakeFromNib
{
self.title = @"";
@@ -69,13 +112,7 @@
self.bottomBarView.drawBorder = NO;
- NSNotificationCenter * const notificationCenter = NSNotificationCenter.defaultCenter;
- [notificationCenter addObserver:self
- selector:@selector(inputItemChanged:)
- name:VLCPlayerCurrentMediaItemChanged
- object:nil];
-
- [self inputItemChanged:nil];
+ [self setupAudioDecorativeView];
}
- (void)dealloc
@@ -83,16 +120,6 @@
[NSNotificationCenter.defaultCenter removeObserver:self];
}
-- (void)inputItemChanged:(NSNotification *)aNotification
-{
- VLCInputItem * const currentInput = _playerController.currentMedia;
- if (currentInput) {
- [self.imageView setImageURL:currentInput.artworkURL placeholderImage:[NSImage imageNamed:@"noart.png"]];
- } else {
- [self.imageView setImage:[NSImage imageNamed:@"noart.png"]];
- }
-}
-
- (BOOL)canBecomeKeyWindow
{
return YES;
=====================================
modules/gui/macosx/windows/controlsbar/VLCControlsBarCommon.m
=====================================
@@ -171,7 +171,6 @@
[self.playButton setAlternateImage: _pressedPlayImage];
[self.timeSlider setHidden:NO];
- [self updateTimeSlider:nil];
NSString *volumeTooltip = [NSString stringWithFormat:_NS("Volume: %i %%"), 100];
[self.volumeSlider setToolTip: volumeTooltip];
@@ -179,11 +178,9 @@
[self.volumeSlider setMaxValue: VLCVolumeMaximum];
[self.volumeSlider setDefaultValue: VLCVolumeDefault];
- [self updateVolumeSlider:nil];
[self.muteVolumeButton setToolTip: _NS("Mute")];
self.muteVolumeButton.accessibilityLabel = self.muteVolumeButton.toolTip;
- [self updateMuteVolumeButtonImage];
[self.timeField setNeedsDisplay:YES];
[self.timeField setRemainingIdentifier:VLCTimeFieldDisplayTimeAsElapsed];
@@ -216,6 +213,9 @@
[_artworkImageView setCropsImagesToRoundedCorners:YES];
[_artworkImageView setImage:[NSImage imageNamed:@"noart"]];
[_artworkImageView setContentGravity:VLCImageViewContentGravityResize];
+
+ // Update verything post-init
+ [self update];
}
- (void)dealloc
=====================================
modules/gui/macosx/windows/video/VLCMainVideoViewAudioMediaDecorativeView.h
=====================================
@@ -32,8 +32,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (readwrite, strong) IBOutlet NSImageView *backgroundCoverArtView;
@property (readwrite, strong) IBOutlet NSVisualEffectView *backgroundVisualEffectView;
-- (void)setCoverArt:(NSImage *)coverArtImage;
-
@end
NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/windows/video/VLCMainVideoViewAudioMediaDecorativeView.m
=====================================
@@ -24,6 +24,8 @@
#import "extensions/NSView+VLCAdditions.h"
+#import "main/VLCMain.h"
+
#import "library/VLCLibraryDataTypes.h"
#import "library/VLCLibraryImageCache.h"
@@ -46,17 +48,24 @@
selector:@selector(playerCurrentMediaItemChanged:)
name:VLCPlayerCurrentMediaItemChanged
object:nil];
+ [self updateCoverArt];
}
- (void)playerCurrentMediaItemChanged:(NSNotification *)notification
{
- NSParameterAssert(notification);
- VLCPlayerController * const controller = notification.object;
- NSAssert(controller != nil, @"Player current media item changed notification should carry a valid player controller");
+ [self updateCoverArt];
+}
- [VLCLibraryImageCache thumbnailForInputItem:controller.currentMedia withCompletion:^(NSImage * const thumbnail) {
- [self setCoverArt:thumbnail];
- }];
+- (void)updateCoverArt
+{
+ VLCPlayerController * const controller =
+ VLCMain.sharedInstance.playlistController.playerController;
+ if (controller.currentMedia) {
+ [VLCLibraryImageCache thumbnailForInputItem:controller.currentMedia
+ withCompletion:^(NSImage * const thumbnail) {
+ [self setCoverArt:thumbnail];
+ }];
+ }
}
- (void)setCoverArt:(NSImage *)coverArtImage
=====================================
modules/gui/macosx/windows/video/VLCMainVideoViewController.m
=====================================
@@ -130,7 +130,9 @@
]];
[self.view addSubview:_audioDecorativeView positioned:NSWindowAbove relativeTo:_voutView];
- _audioDecorativeView.hidden = YES;
+ VLCPlayerController * const controller =
+ VLCMain.sharedInstance.playlistController.playerController;
+ [self updateDecorativeViewVisibilityOnControllerChange:controller];
}
- (void)viewDidLoad
@@ -177,7 +179,8 @@
- (void)updateDecorativeViewVisibilityOnControllerChange:(VLCPlayerController *)controller
{
- VLCMediaLibraryMediaItem * const mediaItem = [VLCMediaLibraryMediaItem mediaItemForURL:controller.URLOfCurrentMediaItem];
+ VLCMediaLibraryMediaItem * const mediaItem =
+ [VLCMediaLibraryMediaItem mediaItemForURL:controller.URLOfCurrentMediaItem];
BOOL decorativeViewVisible = NO;
if (mediaItem != nil) {
=====================================
modules/gui/macosx/windows/video/VLCVideoOutputProvider.h
=====================================
@@ -40,6 +40,8 @@ extern NSString * const VLCWindowFloatOnTopEnabledNotificationKey;
@property (readonly) NSDictionary *voutWindows;
- (VLCVoutView *)setupVoutForWindow:(vlc_window_t *)p_wnd withProposedVideoViewPosition:(NSRect)videoViewPosition;
+- (VLCVideoWindowCommon *)setupVideoWindow;
+
- (void)removeVoutForDisplay:(NSValue *)o_key;
- (void)setNativeVideoSize:(NSSize)size forWindow:(vlc_window_t *)p_wnd;
- (void)setWindowLevel:(NSInteger)i_level forWindow:(vlc_window_t *)p_wnd;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5ecb82cf5805f62360d9e4e3c1a1dc4705c4cc9c...09a0a1215c2deeed5c582c7b618fe2b49f0c1142
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5ecb82cf5805f62360d9e4e3c1a1dc4705c4cc9c...09a0a1215c2deeed5c582c7b618fe2b49f0c1142
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