Skip to content

Commit

Permalink
Merge branch '0.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
timscaffidi committed Nov 10, 2015
2 parents ff0f51d + 9b9c95b commit ea03401
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 205 deletions.
13 changes: 0 additions & 13 deletions ofxVideoRecorderExample/Makefile

This file was deleted.

142 changes: 0 additions & 142 deletions ofxVideoRecorderExample/config.make

This file was deleted.

4 changes: 1 addition & 3 deletions ofxVideoRecorderExample/src/main.cpp
@@ -1,12 +1,10 @@
#include "ofMain.h"
#include "ofApp.h"
#include "ofAppGlutWindow.h"

//========================================================================
int main( ){

ofAppGlutWindow window;
ofSetupOpenGL(&window, 1024,768, OF_WINDOW); // <-------- setup the GL context
ofSetupOpenGL(1024,768, OF_WINDOW); // <-------- setup the GL context

// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
Expand Down
18 changes: 14 additions & 4 deletions ofxVideoRecorderExample/src/ofApp.cpp
Expand Up @@ -20,6 +20,8 @@ void ofApp::setup(){
vidRecorder.setVideoBitrate("800k");
vidRecorder.setAudioCodec("mp3");
vidRecorder.setAudioBitrate("192k");

ofAddListener(vidRecorder.outputFileCompleteEvent, this, &ofApp::recordingComplete);

// soundStream.listDevices();
// soundStream.setDeviceID(11);
Expand All @@ -30,15 +32,17 @@ void ofApp::setup(){
ofEnableAlphaBlending();
}

void ofApp::exit() {
//--------------------------------------------------------------
void ofApp::exit(){
ofRemoveListener(vidRecorder.outputFileCompleteEvent, this, &ofApp::recordingComplete);
vidRecorder.close();
}

//--------------------------------------------------------------
void ofApp::update(){
vidGrabber.update();
if(vidGrabber.isFrameNew() && bRecording){
bool success = vidRecorder.addFrame(vidGrabber.getPixelsRef());
bool success = vidRecorder.addFrame(vidGrabber.getPixels());
if (!success) {
ofLogWarning("This frame was not added!");
}
Expand Down Expand Up @@ -67,21 +71,27 @@ void ofApp::draw(){
<< (bRecording?"close current video file: c":"") << endl;

ofSetColor(0,0,0,100);
ofRect(0, 0, 260, 75);
ofDrawRectangle(0, 0, 260, 75);
ofSetColor(255, 255, 255);
ofDrawBitmapString(ss.str(),15,15);

if(bRecording){
ofSetColor(255, 0, 0);
ofCircle(ofGetWidth() - 20, 20, 5);
ofDrawCircle(ofGetWidth() - 20, 20, 5);
}
}

//--------------------------------------------------------------
void ofApp::audioIn(float *input, int bufferSize, int nChannels){
if(bRecording)
vidRecorder.addAudioSamples(input, bufferSize, nChannels);
}

//--------------------------------------------------------------
void ofApp::recordingComplete(ofxVideoRecorderOutputFileCompleteEventArgs& args){
cout << "The recoded video file is now complete." << endl;
}

//--------------------------------------------------------------
void ofApp::keyPressed(int key){
}
Expand Down
2 changes: 2 additions & 0 deletions ofxVideoRecorderExample/src/ofApp.h
Expand Up @@ -31,6 +31,8 @@ class ofApp : public ofBaseApp{
string fileName;
string fileExt;

void recordingComplete(ofxVideoRecorderOutputFileCompleteEventArgs& args);

ofFbo recordFbo;
ofPixels recordPixels;
};

0 comments on commit ea03401

Please sign in to comment.