How do I get a movie frame without everything grinding to a halt?
Here's what I'm trying to do:
long long pos = 0;
long long end = [movie duration].timeValue;
NSImage* image;
while(pos < length) {
// Add an autorelease pool so we don't end up with loads of
unreleased NSImage*s in the loop.
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
// This line causes the trouble.
image = [movie currentFrameImage];
[movie stepForward];
pos = [movie currentTime].timeValue;
[pool release];
}
Without the line 'image = [movie currentFrameImage];' the loop
finishes in about two seconds for a sixteen second movie. With the
line it takes nearly 350 seconds. Why so slow? How can I get movie
frames at a reasonable rate?