Created
August 22, 2012 07:22
-
-
Save bakercp/3423377 to your computer and use it in GitHub Desktop.
Testing Random Access and other speeds ofQuickTimePlayer vs ofQTKitPlayer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ofMain.h" | |
#include "testApp.h" | |
#include "ofAppGlutWindow.h" | |
//======================================================================== | |
int main( ){ | |
ofAppGlutWindow window; | |
ofSetupOpenGL(&window, 1024,768, OF_WINDOW); // <-------- setup the GL context | |
// this kicks off the running of my app | |
// can be OF_WINDOW or OF_FULLSCREEN | |
// pass in width and height too: | |
ofRunApp( new testApp()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "testApp.h" | |
//-------------------------------------------------------------- | |
void testApp::setup(){ | |
ofBackground(255, 255, 255); | |
ofSetVerticalSync(true); | |
int numReps = 10; | |
cout << "uh" << endl; | |
for(int i = 0; i < numReps; i++) { | |
unsigned long now = ofGetSystemTimeMicros(); | |
randomAccess(); | |
unsigned long then = ofGetSystemTimeMicros(); | |
cout << "\tTotal: " << (then - now) << endl; | |
cout << "------" << endl; | |
} | |
} | |
void testApp::randomAccess() { | |
// ofQuickTimePlayer player; // switch this on the branch | |
ofQTKitPlayer player; | |
unsigned long t0 = ofGetSystemTimeMicros(); | |
player.loadMovie("movies/fingers.mov"); | |
unsigned long t1 = ofGetSystemTimeMicros(); | |
unsigned long t3 = ofGetSystemTimeMicros(); | |
for(int i = 0; i < 10000; i++) { | |
player.setFrame(i); | |
} | |
unsigned long t4 = ofGetSystemTimeMicros(); | |
unsigned long t5 = ofGetSystemTimeMicros(); | |
player.close(); | |
unsigned long t6 = ofGetSystemTimeMicros(); | |
cout << "Elapsed Micros For Load: " << (t1 - t0) << " Random Access: " << (t4-t3) << " Close: " << (t6-t5) << endl; | |
} | |
//-------------------------------------------------------------- | |
void testApp::draw(){ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "ofMain.h" | |
class testApp : public ofBaseApp { | |
public: | |
void setup(); | |
void draw(); | |
void loadFrames(); | |
void randomAccess(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment