Commit 75e8dc1e authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

thumbnailer: make sure to also prepare network resources if those were requested to be thumbnailed

parent b45b127f
......@@ -143,10 +143,10 @@ static void display(void *opaque, void *picture)
{
NSAssert(!_data, @"We are already fetching a thumbnail");
VLCMediaParsedStatus parsedStatus = [_media parsedStatus];
if (!(parsedStatus == VLCMediaParsedStatusFailed || parsedStatus == VLCMediaParsedStatusDone)) {
VLCMediaParsedStatus parsedStatus = [_media parsedStatus];
if (!(parsedStatus == VLCMediaParsedStatusFailed || parsedStatus == VLCMediaParsedStatusDone)) {
[_media addObserver:self forKeyPath:@"parsed" options:0 context:NULL];
[_media parseWithOptions:VLCMediaParseLocal];
[_media parseWithOptions:VLCMediaParseLocal | VLCMediaParseNetwork];
NSAssert(!_parsingTimeoutTimer, @"We already have a timer around");
_parsingTimeoutTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(mediaParsingTimedOut) userInfo:nil repeats:NO];
return;
......@@ -243,8 +243,8 @@ static void display(void *opaque, void *picture)
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if (object == _media && [keyPath isEqualToString:@"parsed"]) {
VLCMediaParsedStatus parsedStatus = [_media parsedStatus];
if (parsedStatus == VLCMediaParsedStatusFailed || parsedStatus == VLCMediaParsedStatusDone) {
VLCMediaParsedStatus parsedStatus = [_media parsedStatus];
if (parsedStatus == VLCMediaParsedStatusFailed || parsedStatus == VLCMediaParsedStatusDone) {
[_parsingTimeoutTimer invalidate];
_parsingTimeoutTimer = nil;
[_media removeObserver:self forKeyPath:@"parsed"];
......@@ -290,12 +290,12 @@ static void display(void *opaque, void *picture)
const CGFloat height = _effectiveThumbnailHeight;
const CGFloat pitch = 4 * width;
CGContextRef bitmap = CGBitmapContextCreate(_data,
width,
height,
8,
pitch,
colorSpace,
kCGImageAlphaNoneSkipLast);
width,
height,
8,
pitch,
colorSpace,
kCGImageAlphaNoneSkipLast);
CGColorSpaceRelease(colorSpace);
NSAssert(bitmap, @"Can't create bitmap");
......@@ -345,7 +345,6 @@ static void display(void *opaque, void *picture)
// Call delegate
[_delegate mediaThumbnailer:self didFinishThumbnail:_thumbnail];
}
- (void)mediaThumbnailingTimedOut
......
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