What I really want to do is be able to select individual frames in a movie, but the threads I've read suggest that's not possible. So the closest I can get is to divide the frame I want by the frame rate and jump to that time code.
There doesn't seem to be a way of requesting the frame rate (setting it doesn't seem override whatever the file believes) and I want to save the manual work of opening the movie in QT and looking up the frame rate manually, so I thought I could measure it doing something like this:
Code:x=theMovie.time();
for(i=0;i<j;i++)
{
theMovie.read();
}
println("Average spf: " + (theMovie.time()-x)/j );
Turns out I get very different numbers depending on the value of j, even when j is in the hundreds. Furthermore, I get different results when I run the exact same code multiple times.
I figured it was because the frame loading is async to the control thread, so I tried changing the inner loop to:
Code:theMovie.read();while(!(theMovie.available()));
That just looped forever. Looking at the reference material for "while" it seems to imply that nothing else happens outside the while loop while the loop is executing.
Finally, I figured I'd try this:
Code:theMovie.read();while(!(theMovie.available())){delay(1);};
and I'm still having no luck-- delay appears to seize all cycles, not yield to other processes.
How do I handle this?