Skip to content

Commit

Permalink
Merge pull request #5 from emmanuelgeoffray/master
Browse files Browse the repository at this point in the history
Change a few things to make it compile for the latest oF and add a format option for files
  • Loading branch information
atduskgreg committed Jan 24, 2016
2 parents 9f715da + dd8cdca commit b0ad0a6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
4 changes: 1 addition & 3 deletions example/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#include "testApp.h"
#include "ofAppGlutWindow.h"

//--------------------------------------------------------------
int main(){
ofAppGlutWindow window; // create a window
// set width, height, mode (OF_WINDOW or OF_FULLSCREEN)
ofSetupOpenGL(&window, 1024, 768, OF_WINDOW);
ofSetupOpenGL(1024, 768, OF_WINDOW);
ofRunApp(new testApp()); // start the app
}
4 changes: 2 additions & 2 deletions example/src/testApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void testApp::setup(){

//--------------------------------------------------------------
void testApp::update(){
cam.grabFrame();
cam.update();

if (cam.isFrameNew() && recording){
recorder.addFrame(cam);
Expand Down Expand Up @@ -88,4 +88,4 @@ void testApp::gotMessage(ofMessage msg){
//--------------------------------------------------------------
void testApp::dragEvent(ofDragInfo dragInfo){

}
}
17 changes: 14 additions & 3 deletions src/ofxImageSequenceRecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ class ofxImageSequenceRecorder : public ofThread {
queue<QueuedImage> q;
string prefix;
string format;
int numberWidth;

ofxImageSequenceRecorder(){
counter=0;
numberWidth=4;

}

Expand All @@ -33,6 +35,14 @@ class ofxImageSequenceRecorder : public ofThread {
format = fmt;
}

void setCounter(int count){
counter = count;
}

void setNumberWidth(int nbwidth){
numberWidth = nbwidth;
}

void threadedFunction() {
while(isThreadRunning()) {
if(!q.empty()){
Expand Down Expand Up @@ -62,8 +72,9 @@ class ofxImageSequenceRecorder : public ofThread {



char fileName[100];
sprintf(fileName, "%s%.4i.%s" , prefix.c_str(), counter, format.c_str());
//char fileName[100];
//snprintf(fileName, "%s%.4i.%s" , prefix.c_str(), counter, format.c_str());
string fileName = prefix + ofToString(counter, numberWidth, '0') + "." + format;
counter++;

QueuedImage qImage;
Expand All @@ -74,4 +85,4 @@ class ofxImageSequenceRecorder : public ofThread {
q.push(qImage);

}
};
};

0 comments on commit b0ad0a6

Please sign in to comment.