Hi everybody,
I'm having a problem with an NSMovieView. My App shows previews for files which are selected which works fine. The previews can either be images or movies, that's why I don't use a statically typed IBOutlet but id. The method that causes trouble is passed two arguments: the NSMovieView or NSImageView to display and a short string to show with some further information.
The views I pass are autoreleased and the view is not being altered/changed elsewhere.
Here's the method:
- (void)setPreviewid)prev withInfoStringNSString *)theInfo
{
[previewLock lock];
if ([fileSelectedPreview isKindOfClass:[NSMovieView class]])
{
if ([fileSelectedPreview isPlaying])
{
[fileSelectedPreview stop:self];
}
}
[prev setFrame:[fileSelectedPreview frame]];
[previewView replaceSubview:fileSelectedPreview withrev];
[fileSelectedPreview autorelease];
fileSelectedPreview = [prev retain];
[fileSelectedOtherInfo setStringValue:theInfo];
[fileSelectedOtherInfo display];
[fileSelectedPreview setNeedsDisplay:YES];
/*if ([fileSelectedPreview isKindOfClass:[NSMovieView class]])
{
[fileSelectedPreview gotoBeginning:self];
}*/
[previewLock unlock];
}
The weird thing is that it only crashes when the movie is playing. I also noted that the retaincount of an NSMovieView that is playing or was playing is one higher than that of an NSMovieView that has never started playing. Does this have anything to do with that?
Also, I noticed that when I compile without code optimiztion and run it in the debugger, stuff works. My guess is that this has to do with the fact that Quicktime has enough time to do its initializations since the app runs slower.
Is my assumption correct? And if it is, what do I do? I'm no big pure c programmer and don't feel like digging that much into Quicktime.
Any help would be highly appreciated
[edit: turned off smilies]
I'm having a problem with an NSMovieView. My App shows previews for files which are selected which works fine. The previews can either be images or movies, that's why I don't use a statically typed IBOutlet but id. The method that causes trouble is passed two arguments: the NSMovieView or NSImageView to display and a short string to show with some further information.
The views I pass are autoreleased and the view is not being altered/changed elsewhere.
Here's the method:
- (void)setPreviewid)prev withInfoStringNSString *)theInfo
{
[previewLock lock];
if ([fileSelectedPreview isKindOfClass:[NSMovieView class]])
{
if ([fileSelectedPreview isPlaying])
{
[fileSelectedPreview stop:self];
}
}
[prev setFrame:[fileSelectedPreview frame]];
[previewView replaceSubview:fileSelectedPreview withrev];
[fileSelectedPreview autorelease];
fileSelectedPreview = [prev retain];
[fileSelectedOtherInfo setStringValue:theInfo];
[fileSelectedOtherInfo display];
[fileSelectedPreview setNeedsDisplay:YES];
/*if ([fileSelectedPreview isKindOfClass:[NSMovieView class]])
{
[fileSelectedPreview gotoBeginning:self];
}*/
[previewLock unlock];
}
The weird thing is that it only crashes when the movie is playing. I also noted that the retaincount of an NSMovieView that is playing or was playing is one higher than that of an NSMovieView that has never started playing. Does this have anything to do with that?
Also, I noticed that when I compile without code optimiztion and run it in the debugger, stuff works. My guess is that this has to do with the fact that Quicktime has enough time to do its initializations since the app runs slower.
Is my assumption correct? And if it is, what do I do? I'm no big pure c programmer and don't feel like digging that much into Quicktime.
Any help would be highly appreciated
[edit: turned off smilies]