Skip to content

Instantly share code, notes, and snippets.

@bakercp
Created August 27, 2012 04:31
Show Gist options
  • Save bakercp/3485582 to your computer and use it in GitHub Desktop.
Save bakercp/3485582 to your computer and use it in GitHub Desktop.
Testing Sequential Synchronous Access ofQuickTimePlayer vs ofQTKitPlayer
#include "ofMain.h"
#include "testApp.h"
#include "ofAppGlutWindow.h"
//========================================================================
int main( ){
ofAppGlutWindow window;
ofSetupOpenGL(&window, 320,240, 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);
// ofSetFrameRate(60);
player.loadMovie("movies/fingers.mov");
player.play();
totalFrames = player.getTotalNumFrames();
frameNum = 0;
}
//--------------------------------------------------------------
void testApp::update(){
frameNum = (frameNum + 1) % totalFrames;
player.setFrame(frameNum);
img.setFromPixels(player.getPixelsRef());
}
//--------------------------------------------------------------
void testApp::draw(){
ofBackground(0,0,0);
ofSetColor(255);
img.draw(0,0);
ofDrawBitmapString("FPS:" + ofToString(ofGetFrameRate()), 10, ofGetHeight() - 10);
}
#pragma once
#include "ofMain.h"
class testApp : public ofBaseApp {
public:
void setup();
void update();
void draw();
void loadFrames();
void randomAccess();
int totalFrames;
int frameNum;
ofVideoPlayer player;
ofImage img;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment