[vlc-commits] [Git][videolan/vlc][master] 9 commits: macosx: Add asynchronous thumbnailForInputItem withCompletion method to VLCLibraryImageCache
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat May 6 05:47:24 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
3b5bc3b5 by Claudio Cambra at 2023-05-06T05:27:03+00:00
macosx: Add asynchronous thumbnailForInputItem withCompletion method to VLCLibraryImageCache
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
5e4e609b by Claudio Cambra at 2023-05-06T05:27:03+00:00
macosx: Use new standardised async VLCLibraryImageCache thumbnailForInputItem method instead of repeating code
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
4edcd90f by Claudio Cambra at 2023-05-06T05:27:03+00:00
macosx: Asynchronously load thumbnail in VLCInputNodePathControlItem
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
9cd4bd7e by Claudio Cambra at 2023-05-06T05:27:03+00:00
macosx: Add convenience method to asynchronously get thumbnailForPlaylistItem in VLCLibraryImageCache
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
2e19bbe5 by Claudio Cambra at 2023-05-06T05:27:03+00:00
macosx: Use new convenience async method in VLCLibraryImageCache in VLCPlaylistTableCellView
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
e897aca7 by Claudio Cambra at 2023-05-06T05:27:03+00:00
macosx: Add convenience method to get thumbnails for VLCAbstractMediaLibraryItems in VLCLibraryImageCache
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
9685bb1e by Claudio Cambra at 2023-05-06T05:27:03+00:00
macosx: Replace use of smallArtworkImage property in media library items with asynchronous thumbnail method in VLCLibraryImageCache
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
28a35c07 by Claudio Cambra at 2023-05-06T05:27:03+00:00
macosx: Provide fallback no-art when provided item does not have thumbnail in VLCLibraryImageCache
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
2a2a29fb by Claudio Cambra at 2023-05-06T05:27:03+00:00
macosx: Remove now unused smallArtworkImage in VLCAbstractMediaLibraryItem
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
14 changed files:
- modules/gui/macosx/library/VLCInputNodePathControlItem.m
- modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
- modules/gui/macosx/library/VLCLibraryCollectionViewMediaItemSupplementaryDetailView.m
- modules/gui/macosx/library/VLCLibraryDataTypes.h
- modules/gui/macosx/library/VLCLibraryDataTypes.m
- modules/gui/macosx/library/VLCLibraryImageCache.h
- modules/gui/macosx/library/VLCLibraryImageCache.m
- modules/gui/macosx/library/VLCLibraryInformationPanel.m
- modules/gui/macosx/library/VLCLibraryTableCellView.m
- modules/gui/macosx/library/audio-library/VLCLibraryAlbumTableCellView.m
- modules/gui/macosx/library/audio-library/VLCLibraryCollectionViewAlbumSupplementaryDetailView.m
- modules/gui/macosx/library/media-source/VLCMediaSourceCollectionViewItem.m
- modules/gui/macosx/playlist/VLCPlaylistTableCellView.m
- modules/gui/macosx/windows/video/VLCMainVideoViewAudioMediaDecorativeView.m
Changes:
=====================================
modules/gui/macosx/library/VLCInputNodePathControlItem.m
=====================================
@@ -33,16 +33,19 @@
if (self && inputNode != nil && inputNode.inputItem != nil) {
_inputNode = inputNode;
- VLCInputItem *inputItem = inputNode.inputItem;
- self.image = [VLCLibraryImageCache thumbnailForInputItem:inputItem];
+ VLCInputItem * const inputItem = inputNode.inputItem;
self.title = inputItem.name;
- // HACK: We have no way when we get the clicked item from the path control
- // of knowing specifically which input node this path item corresponds to,
- // as the path control returns a copy for clickedPathItem that is not of
- // this class. As a very awkward workaround, lets set the name of the image
- // used here as the MRL of the node's input item
- self.image.name = inputItem.MRL;
+ [VLCLibraryImageCache thumbnailForInputItem:inputItem withCompletion:^(NSImage * const thumbnail) {
+ self.image = thumbnail;
+
+ // HACK: We have no way when we get the clicked item from the path control
+ // of knowing specifically which input node this path item corresponds to,
+ // as the path control returns a copy for clickedPathItem that is not of
+ // this class. As a very awkward workaround, lets set the name of the image
+ // used here as the MRL of the node's input item
+ self.image.name = inputItem.MRL;
+ }];
}
return self;
}
=====================================
modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
=====================================
@@ -22,23 +22,24 @@
#import "VLCLibraryCollectionViewItem.h"
-#import "main/VLCMain.h"
+#import "extensions/NSString+Helpers.h"
+#import "extensions/NSFont+VLCAdditions.h"
+#import "extensions/NSColor+VLCAdditions.h"
+#import "extensions/NSView+VLCAdditions.h"
#import "library/VLCLibraryController.h"
#import "library/VLCLibraryDataTypes.h"
+#import "library/VLCLibraryImageCache.h"
#import "library/VLCLibraryModel.h"
#import "library/VLCLibraryMenuController.h"
#import "library/VLCLibraryUIUnits.h"
+#import "main/VLCMain.h"
+
#import "views/VLCImageView.h"
#import "views/VLCLinearProgressIndicator.h"
#import "views/VLCTrackingView.h"
-#import "extensions/NSString+Helpers.h"
-#import "extensions/NSFont+VLCAdditions.h"
-#import "extensions/NSColor+VLCAdditions.h"
-#import "extensions/NSView+VLCAdditions.h"
-
NSString *VLCLibraryCellIdentifier = @"VLCLibraryCellIdentifier";
const CGFloat VLCLibraryCollectionViewItemMinimalDisplayedProgress = 0.05;
const CGFloat VLCLibraryCollectionViewItemMaximumDisplayedProgress = 0.95;
@@ -233,14 +234,17 @@ const CGFloat VLCLibraryCollectionViewItemMaximumDisplayedProgress = 0.95;
_mediaTitleTextField.stringValue = _representedItem.displayString;
_secondaryInfoTextField.stringValue = _representedItem.detailString;
- _mediaImageView.image = _representedItem.smallArtworkImage;
+
+ [VLCLibraryImageCache thumbnailForLibraryItem:_representedItem withCompletion:^(NSImage * const thumbnail) {
+ self->_mediaImageView.image = thumbnail;
+ }];
// TODO: Add handling for the other types
if([_representedItem isKindOfClass:[VLCMediaLibraryMediaItem class]]) {
- VLCMediaLibraryMediaItem *mediaItem = (VLCMediaLibraryMediaItem *)_representedItem;
+ VLCMediaLibraryMediaItem * const mediaItem = (VLCMediaLibraryMediaItem *)_representedItem;
if (mediaItem.mediaType == VLC_ML_MEDIA_TYPE_VIDEO) {
- VLCMediaLibraryTrack *videoTrack = mediaItem.firstVideoTrack;
+ VLCMediaLibraryTrack * const videoTrack = mediaItem.firstVideoTrack;
[self showVideoSizeIfNeededForWidth:videoTrack.videoWidth
andHeight:videoTrack.videoHeight];
_videoImageViewAspectRatioConstraint.active = YES;
@@ -248,7 +252,7 @@ const CGFloat VLCLibraryCollectionViewItemMaximumDisplayedProgress = 0.95;
_videoImageViewAspectRatioConstraint.active = NO;
}
- CGFloat position = mediaItem.progress;
+ const CGFloat position = mediaItem.progress;
if (position > VLCLibraryCollectionViewItemMinimalDisplayedProgress && position < VLCLibraryCollectionViewItemMaximumDisplayedProgress) {
_progressIndicator.progress = position;
_progressIndicator.hidden = NO;
=====================================
modules/gui/macosx/library/VLCLibraryCollectionViewMediaItemSupplementaryDetailView.m
=====================================
@@ -22,17 +22,21 @@
#import "VLCLibraryCollectionViewMediaItemSupplementaryDetailView.h"
+#import "extensions/NSString+Helpers.h"
+#import "extensions/NSFont+VLCAdditions.h"
+#import "extensions/NSColor+VLCAdditions.h"
+#import "extensions/NSView+VLCAdditions.h"
+
#import "main/VLCMain.h"
+
#import "library/VLCInputItem.h"
#import "library/VLCLibraryController.h"
#import "library/VLCLibraryDataTypes.h"
+#import "library/VLCLibraryImageCache.h"
#import "library/VLCLibraryModel.h"
#import "library/VLCLibraryMenuController.h"
+
#import "views/VLCImageView.h"
-#import "extensions/NSString+Helpers.h"
-#import "extensions/NSFont+VLCAdditions.h"
-#import "extensions/NSColor+VLCAdditions.h"
-#import "extensions/NSView+VLCAdditions.h"
NSString *const VLCLibraryCollectionViewMediaItemSupplementaryDetailViewIdentifier = @"VLCLibraryCollectionViewMediaItemSupplementaryDetailViewIdentifier";
NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewMediaItemSupplementaryDetailViewKind = @"VLCLibraryCollectionViewMediaItemSupplementaryDetailViewIdentifier";
@@ -93,7 +97,10 @@ NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewMediaItem
_mediaItemYearAndDurationTextField.stringValue = [self formattedYearAndDurationString];
_mediaItemFileNameTextField.stringValue = _representedMediaItem.inputItem.name;
_mediaItemPathTextField.stringValue = _representedMediaItem.inputItem.decodedMRL;
- _mediaItemArtworkImageView.image = _representedMediaItem.smallArtworkImage;
+
+ [VLCLibraryImageCache thumbnailForLibraryItem:_representedMediaItem withCompletion:^(NSImage * const thumbnail) {
+ self->_mediaItemArtworkImageView.image = thumbnail;
+ }];
}
- (IBAction)playAction:(id)sender
=====================================
modules/gui/macosx/library/VLCLibraryDataTypes.h
=====================================
@@ -112,7 +112,6 @@ extern const long long int VLCMediaLibraryMediaItemDurationDenominator;
@property (readonly) int64_t libraryID;
@property (readonly) BOOL smallArtworkGenerated;
- at property (readonly) NSImage *smallArtworkImage;
@property (readonly) NSString *smallArtworkMRL;
@property (readonly) NSString *displayString;
@property (readonly) NSString *detailString;
@@ -140,7 +139,6 @@ extern const long long int VLCMediaLibraryMediaItemDurationDenominator;
@property (readonly) int64_t libraryID;
@property (readonly) BOOL smallArtworkGenerated;
- at property (readonly) NSImage *smallArtworkImage;
@property (readonly, strong, atomic) NSString *smallArtworkMRL;
@end
=====================================
modules/gui/macosx/library/VLCLibraryDataTypes.m
=====================================
@@ -264,16 +264,6 @@ static NSArray<VLCMediaLibraryArtist *> *fetchArtistsForLibraryItem(library_arti
@end
@implementation VLCAbstractMediaLibraryItem
-
-- (NSImage *)smallArtworkImage
-{
- NSImage *image = [VLCLibraryImageCache thumbnailForLibraryItem:self];
- if (!image) {
- image = [NSImage imageNamed:@"noart.png"];
- }
- return image;
-}
-
@end
@implementation VLCAbstractMediaLibraryAudioGroup
@@ -1127,7 +1117,6 @@ static NSArray<VLCMediaLibraryArtist *> *fetchArtistsForLibraryItem(library_arti
@synthesize firstMediaItem = _firstMediaItem;
@synthesize libraryID = _libraryId;
@synthesize smallArtworkGenerated = _smallArtworkGenerated;
- at synthesize smallArtworkImage = _smallArtworkImage;
@synthesize smallArtworkMRL = _smallArtworkMRL;
=====================================
modules/gui/macosx/library/VLCLibraryImageCache.h
=====================================
@@ -34,6 +34,13 @@ NS_ASSUME_NONNULL_BEGIN
+ (nullable NSImage *)thumbnailForInputItem:(VLCInputItem*)inputItem;
+ (nullable NSImage *)thumbnailForPlaylistItem:(VLCPlaylistItem*)playlistItem;
++ (void)thumbnailForLibraryItem:(VLCAbstractMediaLibraryItem *)libraryItem
+ withCompletion:(void(^)(const NSImage *))completionHandler;
++ (void)thumbnailForInputItem:(VLCInputItem *)inputItem
+ withCompletion:(void(^)(const NSImage *))completionHandler;
++ (void)thumbnailForPlaylistItem:(VLCPlaylistItem *)playlistItem
+ withCompletion:(void(^)(const NSImage *))completionHandler;
+
@end
NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/VLCLibraryImageCache.m
=====================================
@@ -81,19 +81,24 @@ float kVLCDefaultThumbnailPosition = .15;
- (NSImage *)smallThumbnailForLibraryItem:(VLCAbstractMediaLibraryItem*)libraryItem
{
NSImage *image;
- NSString *artworkMRL = libraryItem.smallArtworkMRL;
+ NSString * const artworkMRL = libraryItem.smallArtworkMRL;
+
if (libraryItem.smallArtworkGenerated) {
image = [[NSImage alloc] initWithContentsOfURL:[NSURL URLWithString:artworkMRL]];
} else if ([libraryItem isKindOfClass:[VLCMediaLibraryMediaItem class]]) {
- VLCMediaLibraryMediaItem* mediaItem = (VLCMediaLibraryMediaItem*)libraryItem;
+ VLCMediaLibraryMediaItem * const mediaItem = (VLCMediaLibraryMediaItem*)libraryItem;
if (mediaItem.mediaType != VLC_ML_MEDIA_TYPE_AUDIO) {
[self generateThumbnailForMediaItem:mediaItem.libraryID];
}
}
+
if (image) {
[_imageCache setObject:image forKey:artworkMRL];
+ } else { // If nothing so far worked, then fall back on default image
+ image = [NSImage imageNamed:@"noart.png"];
}
+
return image;
}
@@ -127,8 +132,8 @@ float kVLCDefaultThumbnailPosition = .15;
- (NSImage *)generateImageForInputItem:(VLCInputItem *)inputItem
{
NSImage *image;
- NSURL *artworkURL = inputItem.artworkURL;
- NSSize imageSize = NSMakeSize(kVLCDesiredThumbnailWidth, kVLCDesiredThumbnailHeight);
+ NSURL * const artworkURL = inputItem.artworkURL;
+ const NSSize imageSize = NSMakeSize(kVLCDesiredThumbnailWidth, kVLCDesiredThumbnailHeight);
if (artworkURL) {
image = [[NSImage alloc] initWithContentsOfURL:artworkURL];
@@ -140,6 +145,8 @@ float kVLCDefaultThumbnailPosition = .15;
if (image) {
[_imageCache setObject:image forKey:inputItem.MRL];
+ } else { // If nothing so far worked, then fall back on default image
+ image = [NSImage imageNamed:@"noart.png"];
}
return image;
@@ -150,4 +157,32 @@ float kVLCDefaultThumbnailPosition = .15;
return [VLCLibraryImageCache.sharedImageCache imageForInputItem:playlistItem.inputItem];
}
++ (void)thumbnailForLibraryItem:(VLCAbstractMediaLibraryItem *)libraryItem
+ withCompletion:(void(^)(const NSImage *))completionHandler
+{
+ dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
+ NSImage * const image = [VLCLibraryImageCache thumbnailForLibraryItem:libraryItem];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ completionHandler(image);
+ });
+ });
+}
+
++ (void)thumbnailForInputItem:(VLCInputItem *)inputItem
+ withCompletion:(void(^)(const NSImage *))completionHandler
+{
+ dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
+ NSImage * const image = [VLCLibraryImageCache thumbnailForInputItem:inputItem];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ completionHandler(image);
+ });
+ });
+}
+
++ (void)thumbnailForPlaylistItem:(VLCPlaylistItem *)playlistItem
+ withCompletion:(void(^)(const NSImage *))completionHandler
+{
+ [self thumbnailForInputItem:playlistItem.inputItem withCompletion:completionHandler];
+}
+
@end
=====================================
modules/gui/macosx/library/VLCLibraryInformationPanel.m
=====================================
@@ -21,9 +21,12 @@
*****************************************************************************/
#import "VLCLibraryInformationPanel.h"
+
+#import "extensions/NSString+Helpers.h"
+
#import "library/VLCLibraryDataTypes.h"
+#import "library/VLCLibraryImageCache.h"
#import "library/VLCInputItem.h"
-#import "extensions/NSString+Helpers.h"
@interface VLCLibraryInformationPanel ()
{
@@ -47,9 +50,9 @@
- (void)updateRepresentation
{
- NSMutableString *textContent = [[NSMutableString alloc] initWithFormat:@"Title: '%@', ID: %lli\n", _representedItem.displayString, _representedItem.libraryID];
+ NSMutableString * const textContent = [[NSMutableString alloc] initWithFormat:@"Title: '%@', ID: %lli\n", _representedItem.displayString, _representedItem.libraryID];
- NSString *itemDetailsString;
+ NSString * itemDetailsString;
if([_representedItem isKindOfClass:[VLCMediaLibraryMediaItem class]]) {
itemDetailsString = [self detailsStringForMediaItem:(VLCMediaLibraryMediaItem *)_representedItem];
} else {
@@ -57,13 +60,16 @@
}
[textContent appendString:itemDetailsString];
- NSString *fileDetailsString = [self fileDetailsStringForLibraryItem:_representedItem];
+ NSString * const fileDetailsString = [self fileDetailsStringForLibraryItem:_representedItem];
[textContent appendString:fileDetailsString];
_textField.attributedStringValue = [[NSAttributedString alloc] initWithString:textContent];
_textField.font = [NSFont systemFontOfSize:13.];
_textField.textColor = [NSColor whiteColor];
- _imageView.image = _representedItem.smallArtworkImage;
+
+ [VLCLibraryImageCache thumbnailForLibraryItem:_representedItem withCompletion:^(NSImage * const thumbnail) {
+ self->_imageView.image = thumbnail;
+ }];
self.window.title = _representedItem.displayString;
}
=====================================
modules/gui/macosx/library/VLCLibraryTableCellView.m
=====================================
@@ -76,7 +76,9 @@
self.playInstantlyButton.action = @selector(playMediaItemInstantly:);
self.playInstantlyButton.target = self;
- self.representedImageView.image = representedItem.smallArtworkImage;
+ [VLCLibraryImageCache thumbnailForLibraryItem:_representedItem withCompletion:^(NSImage * const thumbnail) {
+ self.representedImageView.image = thumbnail;
+ }];
if(representedItem.detailString.length > 0) {
self.primaryTitleTextField.hidden = NO;
@@ -96,12 +98,9 @@
self.singlePrimaryTitleTextField.hidden = NO;
self.singlePrimaryTitleTextField.stringValue = _representedInputItem.name;
- dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
- NSImage *image = [VLCLibraryImageCache thumbnailForInputItem:self->_representedInputItem];
- dispatch_async(dispatch_get_main_queue(), ^{
- self.representedImageView.image = image;
- });
- });
+ [VLCLibraryImageCache thumbnailForInputItem:self->_representedInputItem withCompletion:^(NSImage * const thumbnail) {
+ self->_representedImageView.image = thumbnail;
+ }];
self.trackingView.viewToHide = self.playInstantlyButton;
self.playInstantlyButton.action = @selector(playInputItemInstantly:);
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAlbumTableCellView.m
=====================================
@@ -34,6 +34,7 @@
#import "library/VLCLibraryController.h"
#import "library/VLCLibraryDataTypes.h"
+#import "library/VLCLibraryImageCache.h"
#import "library/VLCLibraryModel.h"
#import "library/VLCLibraryTableCellView.h"
#import "library/VLCLibraryTableView.h"
@@ -260,7 +261,9 @@ const CGFloat VLCLibraryAlbumTableCellViewDefaultHeight = 168.;
self.summaryTextField.stringValue = _representedAlbum.durationString;
}
- self.representedImageView.image = _representedAlbum.smallArtworkImage;
+ [VLCLibraryImageCache thumbnailForLibraryItem:_representedAlbum withCompletion:^(NSImage * const thumbnail) {
+ self.representedImageView.image = thumbnail;
+ }];
__weak typeof(self) weakSelf = self; // Prevent retain cycle
[_tracksDataSource setRepresentedAlbum:_representedAlbum withCompletion:^{
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryCollectionViewAlbumSupplementaryDetailView.m
=====================================
@@ -23,21 +23,25 @@
#import "VLCLibraryCollectionViewAlbumSupplementaryDetailView.h"
-#import "main/VLCMain.h"
-#import "library/VLCLibraryController.h"
-#import "library/VLCLibraryDataTypes.h"
-#import "library/VLCLibraryModel.h"
-#import "library/VLCLibraryMenuController.h"
-#import "views/VLCImageView.h"
#import "extensions/NSString+Helpers.h"
#import "extensions/NSFont+VLCAdditions.h"
#import "extensions/NSColor+VLCAdditions.h"
#import "extensions/NSView+VLCAdditions.h"
+#import "library/VLCLibraryController.h"
+#import "library/VLCLibraryDataTypes.h"
+#import "library/VLCLibraryImageCache.h"
+#import "library/VLCLibraryModel.h"
+#import "library/VLCLibraryMenuController.h"
+
#import "library/audio-library/VLCLibraryAlbumTracksDataSource.h"
#import "library/audio-library/VLCLibraryAlbumTracksTableViewDelegate.h"
#import "library/audio-library/VLCLibraryAlbumTableCellView.h"
+#import "main/VLCMain.h"
+
+#import "views/VLCImageView.h"
+
NSString *const VLCLibraryCollectionViewAlbumSupplementaryDetailViewIdentifier = @"VLCLibraryCollectionViewAlbumSupplementaryDetailViewIdentifier";
NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewAlbumSupplementaryDetailViewKind = @"VLCLibraryCollectionViewAlbumSupplementaryDetailViewIdentifier";
@@ -114,7 +118,10 @@ NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewAlbumSupp
_albumTitleTextField.stringValue = _representedAlbum.displayString;
_albumDetailsTextField.stringValue = _representedAlbum.artistName;
_albumYearAndDurationTextField.stringValue = [NSString stringWithFormat:@"%u · %@", _representedAlbum.year, _representedAlbum.durationString];
- _albumArtworkImageView.image = _representedAlbum.smallArtworkImage;
+
+ [VLCLibraryImageCache thumbnailForLibraryItem:_representedAlbum withCompletion:^(NSImage * const thumbnail) {
+ self->_albumArtworkImageView.image = thumbnail;
+ }];
__weak typeof(self) weakSelf = self; // Prevent retain cycle
[_tracksDataSource setRepresentedAlbum:_representedAlbum withCompletion:^{
=====================================
modules/gui/macosx/library/media-source/VLCMediaSourceCollectionViewItem.m
=====================================
@@ -149,12 +149,10 @@ NSString *VLCMediaSourceCellIdentifier = @"VLCLibraryCellIdentifier";
}
_mediaTitleTextField.stringValue = _representedInputItem.name;
- dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
- NSImage *image = [VLCLibraryImageCache thumbnailForInputItem:self->_representedInputItem];
- dispatch_async(dispatch_get_main_queue(), ^{
- self->_mediaImageView.image = image;
- });
- });
+ [VLCLibraryImageCache thumbnailForInputItem:self->_representedInputItem withCompletion:^(NSImage * const thumbnail) {
+ self->_mediaImageView.image = thumbnail;
+ }];
+
switch (_representedInputItem.inputType) {
case ITEM_TYPE_STREAM:
=====================================
modules/gui/macosx/playlist/VLCPlaylistTableCellView.m
=====================================
@@ -68,13 +68,10 @@
- (void)setRepresentedPlaylistItem:(VLCPlaylistItem *)item
{
- dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
- NSImage *image = [VLCLibraryImageCache thumbnailForPlaylistItem:item];
- dispatch_async(dispatch_get_main_queue(), ^{
- self.audioArtworkImageView.image = image;
- self.mediaImageView.image = image;
- });
- });
+ [VLCLibraryImageCache thumbnailForPlaylistItem:item withCompletion:^(NSImage * const thumbnail) {
+ self.audioArtworkImageView.image = thumbnail;
+ self.mediaImageView.image = thumbnail;
+ }];
NSString *artist = item.artistName;
if (artist && artist.length > 0) {
=====================================
modules/gui/macosx/windows/video/VLCMainVideoViewAudioMediaDecorativeView.m
=====================================
@@ -54,13 +54,9 @@
VLCPlayerController * const controller = notification.object;
NSAssert(controller != nil, @"Player current media item changed notification should carry a valid player controller");
- VLCInputItem * const currentInputItem = controller.currentMedia;
- dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
- NSImage * const image = [VLCLibraryImageCache thumbnailForInputItem:currentInputItem];
- dispatch_async(dispatch_get_main_queue(), ^{
- [self setCoverArt:image];
- });
- });
+ [VLCLibraryImageCache thumbnailForInputItem:controller.currentMedia withCompletion:^(NSImage * const thumbnail) {
+ [self setCoverArt:thumbnail];
+ }];
}
- (void)setCoverArt:(NSImage *)coverArtImage
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d060da25a89311b9eba3fe25af705a875364e490...2a2a29fbae499d9832054cc966e1e9768911c683
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d060da25a89311b9eba3fe25af705a875364e490...2a2a29fbae499d9832054cc966e1e9768911c683
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