Skip to content

Instantly share code, notes, and snippets.

@bakercp
Created August 22, 2012 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bakercp/3423377 to your computer and use it in GitHub Desktop.
Save bakercp/3423377 to your computer and use it in GitHub Desktop.
Testing Random Access and other speeds ofQuickTimePlayer vs ofQTKitPlayer
#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());
}
#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(){
}
#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