Commit 81dc52be authored by Pierre's avatar Pierre
Browse files

macosx/framework: Only create the NSImage corresponding to the artwork if asked.

parent 1d034f0a
......@@ -114,6 +114,7 @@ typedef enum VLCMediaState
id delegate; //< Delegate object
BOOL isArtFetched; //< Value used to determine of the artwork has been preparsed
BOOL areOthersMetaFetched; //< Value used to determine of the other meta has been preparsed
BOOL isArtURLFetched; //< Value used to determine of the other meta has been preparsed
VLCMediaState state; //< Current state of the media
}
......
......@@ -466,12 +466,12 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
if ( newValue != oldValue && !(oldValue && newValue && [oldValue compare:newValue] == NSOrderedSame) )
{
if ([metaType isEqualToString:VLCMetaInformationArtworkURL])
// Only fetch the art if needed. (ie, create the NSImage, if it was requested before)
if (isArtFetched && [metaType isEqualToString:VLCMetaInformationArtworkURL])
{
[NSThread detachNewThreadSelector:@selector(fetchMetaInformationForArtWorkWithURL:)
toTarget:self
withObject:newValue];
return;
}
[metaDictionary setValue:newValue forKeyPath:metaType];
......@@ -550,7 +550,14 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
* And all the other meta will be added through the libvlc event system */
[self fetchMetaInformationFromLibVLCWithType: VLCMetaInformationTitle];
}
else if( !isArtURLFetched && [keyPath hasPrefix:@"metaDictionary.artworkURL"])
{
isArtURLFetched = YES;
/* Force isArtURLFetched, that will trigger artwork download eventually
* And all the other meta will be added through the libvlc event system */
[self fetchMetaInformationFromLibVLCWithType: VLCMetaInformationArtworkURL];
}
return [super valueForKeyPath:keyPath];
}
@end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment