[Album Art] macOS Ventura natively supports AVIF

Disable the compiled in AVIF support there, as the OS supports it
natively. Keep the libraries for older OSes.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
lastfm
Christopher Snowhill 2022-07-05 23:44:35 -07:00
parent 02e1276df8
commit ab285417ae
1 changed files with 11 additions and 7 deletions

View File

@ -324,6 +324,9 @@ extern NSMutableDictionary<NSString *, AlbumArtwork *> *kArtworkDictionary;
NSImage *image = [NSImage imageNamed:imageCacheTag]; NSImage *image = [NSImage imageNamed:imageCacheTag];
if(image == nil) { if(image == nil) {
if(@available(macOS 13.0, *)) {
image = [[NSImage alloc] initWithData:self.albumArtInternal];
} else {
if([AVIFDecoder isAVIFFormatForData:self.albumArtInternal]) { if([AVIFDecoder isAVIFFormatForData:self.albumArtInternal]) {
CGImageRef imageRef = [AVIFDecoder createAVIFImageWithData:self.albumArtInternal]; CGImageRef imageRef = [AVIFDecoder createAVIFImageWithData:self.albumArtInternal];
if(imageRef) { if(imageRef) {
@ -333,6 +336,7 @@ extern NSMutableDictionary<NSString *, AlbumArtwork *> *kArtworkDictionary;
} else { } else {
image = [[NSImage alloc] initWithData:self.albumArtInternal]; image = [[NSImage alloc] initWithData:self.albumArtInternal];
} }
}
[image setName:imageCacheTag]; [image setName:imageCacheTag];
} }