[vlc-commits] [Git][videolan/vlc][master] 5 commits: macosx: Provide labels for more resolution classes
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Tue Jun 9 13:22:35 UTC 2026
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
095b81bd by Claudio Cambra at 2026-06-09T15:09:00+02:00
macosx: Provide labels for more resolution classes
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
2496f742 by Claudio Cambra at 2026-06-09T15:09:00+02:00
macosx: Make resolution annotations less visible
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
61bba822 by Claudio Cambra at 2026-06-09T15:09:00+02:00
macosx: Unify resolution label logic
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
322dcc83 by Claudio Cambra at 2026-06-09T15:09:00+02:00
macosx: Make sure resolutionLabel applies correctly for portrait and landscape videos
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
5636c376 by Claudio Cambra at 2026-06-09T15:09:00+02:00
macosx: Adjust resolution label positioning
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
7 changed files:
- modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
- modules/gui/macosx/extensions/NSColor+VLCAdditions.m
- modules/gui/macosx/extensions/NSFont+VLCAdditions.m
- modules/gui/macosx/library/VLCLibraryCarouselViewItemView.m
- modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
- modules/gui/macosx/library/VLCLibraryDataTypes.h
- modules/gui/macosx/library/VLCLibraryDataTypes.m
Changes:
=====================================
modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
=====================================
@@ -25,8 +25,8 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
- <customView misplaced="YES" id="Hz6-mo-xeY" customClass="VLCTrackingView">
- <rect key="frame" x="0.0" y="0.0" width="212" height="243"/>
+ <customView id="Hz6-mo-xeY" customClass="VLCTrackingView">
+ <rect key="frame" x="0.0" y="0.0" width="207" height="243"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="2aB-sB-hfY" customClass="VLCImageView">
@@ -48,14 +48,6 @@
<action selector="playInstantly:" target="-2" id="E2B-oj-rx3"/>
</connections>
</button>
- <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tm2-NW-WsZ" customClass="VLCRoundedCornerTextField">
- <rect key="frame" x="8" y="184" width="37" height="16"/>
- <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="tyb-Ur-7J9">
- <font key="font" metaFont="system"/>
- <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
- <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
- </textFieldCell>
- </textField>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="dFt-oZ-h9P" secondAttribute="bottom" id="4q3-3S-7PA"/>
@@ -66,15 +58,15 @@
<constraint firstAttribute="trailing" secondItem="dFt-oZ-h9P" secondAttribute="trailing" id="kBI-UU-vnc"/>
</constraints>
</customView>
- <box boxType="custom" borderType="line" borderWidth="5" cornerRadius="4" title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="Vwd-1n-Sbd">
+ <box boxType="custom" borderType="line" borderWidth="3" cornerRadius="4" title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="Vwd-1n-Sbd">
<rect key="frame" x="0.0" y="36" width="207" height="207"/>
<view key="contentView" id="HJG-tt-Xh8">
- <rect key="frame" x="5" y="5" width="197" height="197"/>
+ <rect key="frame" x="3" y="3" width="201" height="201"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
<color key="borderColor" red="1" green="0.38123786450000002" blue="0.039215686270000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</box>
- <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="OBS-Eh-1mT">
+ <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="OBS-Eh-1mT">
<rect key="frame" x="-2" y="16" width="37" height="16"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" title="Label" usesSingleLineMode="YES" id="7Hy-o3-LvX">
<font key="font" metaFont="system"/>
@@ -82,7 +74,7 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
- <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="u2r-zy-XEW">
+ <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="u2r-zy-XEW">
<rect key="frame" x="174" y="0.0" width="35" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="NEW" id="NeT-5U-eZn">
<font key="font" metaFont="systemBold"/>
@@ -91,7 +83,7 @@
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ubz-8I-W2F">
- <rect key="frame" x="177" y="213" width="20" height="20"/>
+ <rect key="frame" x="182" y="218" width="20" height="20"/>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ellipsis" imagePosition="only" alignment="center" inset="2" id="6ko-MM-ds0">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -104,7 +96,15 @@
<action selector="addToPlayQueue:" target="-2" id="2C9-Rn-VAb"/>
</connections>
</button>
- <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VAn-gF-QiZ">
+ <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tm2-NW-WsZ" customClass="VLCRoundedCornerTextField">
+ <rect key="frame" x="6" y="220" width="37" height="16"/>
+ <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="tyb-Ur-7J9">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VAn-gF-QiZ">
<rect key="frame" x="-2" y="0.0" width="175" height="16"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" title="Label" id="LSS-jh-llZ">
<font key="font" metaFont="system"/>
@@ -116,7 +116,7 @@
<constraints>
<constraint firstItem="2aB-sB-hfY" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="3Ah-0T-rA9"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="OBS-Eh-1mT" secondAttribute="trailing" id="457-oy-EbD"/>
- <constraint firstItem="Ubz-8I-W2F" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="10" id="8Qf-Un-Gdl"/>
+ <constraint firstItem="Ubz-8I-W2F" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="5" id="8Qf-Un-Gdl"/>
<constraint firstItem="VAn-gF-QiZ" firstAttribute="top" secondItem="OBS-Eh-1mT" secondAttribute="bottom" id="ALi-0z-Mza"/>
<constraint firstAttribute="trailing" secondItem="u2r-zy-XEW" secondAttribute="trailing" id="Dd7-va-0UJ"/>
<constraint firstItem="u2r-zy-XEW" firstAttribute="centerY" secondItem="VAn-gF-QiZ" secondAttribute="centerY" id="H5N-j9-THf"/>
@@ -125,12 +125,12 @@
<constraint firstItem="VAn-gF-QiZ" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="QUW-dn-Fbc"/>
<constraint firstItem="Vwd-1n-Sbd" firstAttribute="top" secondItem="2aB-sB-hfY" secondAttribute="top" id="Qpt-yS-z2k"/>
<constraint firstItem="Vwd-1n-Sbd" firstAttribute="leading" secondItem="2aB-sB-hfY" secondAttribute="leading" id="Yqz-VL-Ul7"/>
- <constraint firstAttribute="trailing" secondItem="Ubz-8I-W2F" secondAttribute="trailing" constant="10" id="ZVz-SL-rxZ"/>
+ <constraint firstAttribute="trailing" secondItem="Ubz-8I-W2F" secondAttribute="trailing" constant="5" id="ZVz-SL-rxZ"/>
<constraint firstAttribute="trailing" secondItem="VAn-gF-QiZ" secondAttribute="trailing" priority="750" id="Zci-25-m59"/>
- <constraint firstItem="tm2-NW-WsZ" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="10" id="cvk-A5-enS"/>
- <constraint firstItem="tm2-NW-WsZ" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="10" id="fH0-Om-7gV"/>
<constraint firstItem="Vwd-1n-Sbd" firstAttribute="trailing" secondItem="2aB-sB-hfY" secondAttribute="trailing" id="fag-50-6qS"/>
+ <constraint firstItem="tm2-NW-WsZ" firstAttribute="centerY" secondItem="Ubz-8I-W2F" secondAttribute="centerY" id="gQI-nK-lpw"/>
<constraint firstAttribute="trailing" secondItem="2aB-sB-hfY" secondAttribute="trailing" id="oZw-Ab-83p"/>
+ <constraint firstItem="tm2-NW-WsZ" firstAttribute="leading" secondItem="HJG-tt-Xh8" secondAttribute="leading" constant="5" id="rnK-Cu-EMG"/>
<constraint firstItem="Vwd-1n-Sbd" firstAttribute="bottom" secondItem="2aB-sB-hfY" secondAttribute="bottom" id="sIE-go-0nP"/>
<constraint firstItem="2aB-sB-hfY" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="t9g-tX-AQX"/>
<constraint firstItem="OBS-Eh-1mT" firstAttribute="top" secondItem="2aB-sB-hfY" secondAttribute="bottom" constant="4" id="vJy-Kf-4Jh"/>
=====================================
modules/gui/macosx/extensions/NSColor+VLCAdditions.m
=====================================
@@ -65,7 +65,7 @@
+ (NSColor *)VLClibraryAnnotationBackgroundColor
{
- return [NSColor colorWithRed:0. green:0. blue:0. alpha:.4];
+ return [NSColor colorWithRed:0. green:0. blue:0. alpha:.2];
}
+ (NSColor *)VLClibrarySeparatorLightColor
=====================================
modules/gui/macosx/extensions/NSFont+VLCAdditions.m
=====================================
@@ -41,7 +41,10 @@
+ (NSFont *)VLCLibraryItemAnnotationFont
{
- return [NSFont systemFontOfSize:NSFont.systemFontSize weight:NSFontWeightBold];
+ if (@available(macOS 11.0, *)) {
+ return [NSFont preferredFontForTextStyle:NSFontTextStyleCaption1 options:@{}];
+ }
+ return [NSFont systemFontOfSize:10 weight:NSFontWeightRegular];
}
@end
=====================================
modules/gui/macosx/library/VLCLibraryCarouselViewItemView.m
=====================================
@@ -124,7 +124,11 @@
if (mediaItem.mediaType == VLC_ML_MEDIA_TYPE_VIDEO) {
VLCMediaLibraryTrack * const videoTrack = mediaItem.firstVideoTrack;
- [self showVideoSizeIfNeededForWidth:videoTrack.videoWidth andHeight:videoTrack.videoHeight];
+ NSString * const resolutionLabel = videoTrack.resolutionLabel;
+ if (resolutionLabel) {
+ self.annotationTextField.stringValue = resolutionLabel;
+ self.annotationTextField.hidden = NO;
+ }
}
const CGFloat position = mediaItem.progress;
@@ -135,17 +139,6 @@
}
}
-- (void)showVideoSizeIfNeededForWidth:(CGFloat)width andHeight:(CGFloat)height
-{
- if (width >= VLCMediaLibrary4KWidth || height >= VLCMediaLibrary4KHeight) {
- _annotationTextField.stringValue = _NS("4K");
- _annotationTextField.hidden = NO;
- } else if (width >= VLCMediaLibrary720pWidth || height >= VLCMediaLibrary720pHeight) {
- _annotationTextField.stringValue = _NS("HD");
- _annotationTextField.hidden = NO;
- }
-}
-
- (void)setRepresentedItem:(VLCLibraryRepresentedItem *)representedItem
{
if (representedItem == _representedItem) {
=====================================
modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
=====================================
@@ -241,8 +241,11 @@ const CGFloat VLCLibraryCollectionViewItemMaximumDisplayedProgress = 0.95;
if (mediaItem.mediaType == VLC_ML_MEDIA_TYPE_VIDEO ||
mediaItem.mediaType == VLC_ML_MEDIA_TYPE_UNKNOWN) {
VLCMediaLibraryTrack * const videoTrack = mediaItem.firstVideoTrack;
- [self showVideoSizeIfNeededForWidth:videoTrack.videoWidth
- andHeight:videoTrack.videoHeight];
+ NSString * const resolutionLabel = videoTrack.resolutionLabel;
+ if (resolutionLabel) {
+ self.annotationTextField.stringValue = resolutionLabel;
+ self.annotationTextField.hidden = NO;
+ }
if (!_videoImageViewAspectRatioConstraint.active) {
self.imageViewAspectRatioConstraint.active = NO;
_videoImageViewAspectRatioConstraint.active = YES;
@@ -273,17 +276,6 @@ const CGFloat VLCLibraryCollectionViewItemMaximumDisplayedProgress = 0.95;
}
}
-- (void)showVideoSizeIfNeededForWidth:(CGFloat)width andHeight:(CGFloat)height
-{
- if (width >= VLCMediaLibrary4KWidth || height >= VLCMediaLibrary4KHeight) {
- _annotationTextField.stringValue = _NS("4K");
- _annotationTextField.hidden = NO;
- } else if (width >= VLCMediaLibrary720pWidth || height >= VLCMediaLibrary720pHeight) {
- _annotationTextField.stringValue = _NS("HD");
- _annotationTextField.hidden = NO;
- }
-}
-
- (void)setUnplayedIndicatorHidden:(BOOL)indicatorHidden
{
if (_unplayedIndicatorTextField.hidden == indicatorHidden) {
=====================================
modules/gui/macosx/library/VLCLibraryDataTypes.h
=====================================
@@ -34,10 +34,6 @@ extern NSString * const VLCMediaLibraryMediaItemUTI;
@class VLCMediaLibraryGenre;
@class VLCInputItem;
-extern const CGFloat VLCMediaLibrary4KWidth;
-extern const CGFloat VLCMediaLibrary4KHeight;
-extern const CGFloat VLCMediaLibrary720pWidth;
-extern const CGFloat VLCMediaLibrary720pHeight;
extern const long long int VLCMediaLibraryMediaItemDurationDenominator;
vlc_medialibrary_t * _Nullable getMediaLibrary(void);
@@ -84,6 +80,7 @@ typedef NS_ENUM(NSUInteger, VLCMediaLibraryParentGroupType) {
@property (readonly) NSString *readableCodecName;
@property (readonly) NSString *language;
@property (readonly) NSString *trackDescription;
+ at property (readonly, nullable) NSString *resolutionLabel;
@property (readonly) vlc_ml_track_type_t trackType;
@property (readonly) NSString *readableTrackType;
@property (readonly) uint32_t bitrate;
=====================================
modules/gui/macosx/library/VLCLibraryDataTypes.m
=====================================
@@ -34,10 +34,14 @@
NSString * const VLCMediaLibraryMediaItemPasteboardType = @"VLCMediaLibraryMediaItemPasteboardType";
NSString * const VLCMediaLibraryMediaItemUTI = @"org.videolan.vlc.VLCMediaLibraryMediaItem";
+const CGFloat VLCMediaLibrary8KWidth = 7680.;
+const CGFloat VLCMediaLibrary8KHeight = 4320.;
const CGFloat VLCMediaLibrary4KWidth = 3840.;
const CGFloat VLCMediaLibrary4KHeight = 2160.;
-const CGFloat VLCMediaLibrary720pWidth = 1280.;
-const CGFloat VLCMediaLibrary720pHeight = 720.;
+const CGFloat VLCMediaLibrary1080pWidth = 1920.;
+const CGFloat VLCMediaLibrary1080pHeight = 1080.;
+const CGFloat VLCMediaLibrary540pWidth = 960.;
+const CGFloat VLCMediaLibrary540pHeight = 540.;
const long long int VLCMediaLibraryMediaItemDurationDenominator = 1000;
NSString *VLCMediaLibraryMediaItemLibraryID = @"VLCMediaLibraryMediaItemLibraryID";
@@ -241,6 +245,19 @@ static NSString *genreArrayDisplayString(NSArray<VLCMediaLibraryGenre *> * const
_sourceAspectRatioDenominator = p_track->v.i_sarDen;
_frameRate = p_track->v.i_fpsNum;
_frameRateDenominator = p_track->v.i_fpsDen;
+
+ const unsigned int realHeight = MIN(_videoWidth, _videoHeight);
+ const unsigned int realWidth = MAX(_videoWidth, _videoHeight);
+
+ if (realHeight >= VLCMediaLibrary8KHeight || realWidth >= VLCMediaLibrary8KHeight * (16.0 / 9.0)) {
+ _resolutionLabel = _NS("8K");
+ } else if (realHeight >= VLCMediaLibrary4KHeight || realWidth >= VLCMediaLibrary4KHeight * (16.0 / 9.0)) {
+ _resolutionLabel = _NS("4K");
+ } else if (realHeight >= VLCMediaLibrary1080pHeight || realWidth >= VLCMediaLibrary1080pHeight * (16.0 / 9.0)) {
+ _resolutionLabel = _NS("HD");
+ } else if (realHeight >= VLCMediaLibrary540pHeight || realWidth >= VLCMediaLibrary540pHeight * (16.0 / 9.0)) {
+ _resolutionLabel = _NS("SD");
+ }
}
return self;
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cb361557b790d891fbf6b1fd3eb030f5bfc018da...5636c376366aece1c117ddb03210a174dfdd5e9a
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cb361557b790d891fbf6b1fd3eb030f5bfc018da...5636c376366aece1c117ddb03210a174dfdd5e9a
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list