Permalink
Browse files

changes to make it work with newest ofxPlaymodes

  • Loading branch information...
1 parent a3469aa commit e1663007c833f61dbf5763c70e34042183cf9140 @arturoc committed Oct 8, 2012
@@ -6,4 +6,5 @@ ofxGui
ofxXmlSettings
ofxPlaymodes
ofxOsc
-ofxV4L2Settings
+ofxV4L2Settings
+ofxGstV4L2Sink
@@ -23,7 +23,7 @@ USER_LDFLAGS = -fopenmp
# use this to add system libraries for example:
# USER_LIBS = -lpango
-USER_LIBS = -lv4l2 -ltbb
+USER_LIBS = -lv4l2
# change this to add different compiler optimizations to your project
@@ -12,7 +12,6 @@ using namespace ofxPm;
string FaceBlinkRecorder::LOG_NAME = "FaceBlinkRecorder";
FaceBlinkRecorder::FaceBlinkRecorder() {
- vframe = NULL;
}
@@ -73,9 +72,8 @@ void FaceBlinkRecorder::update(ofPixels & frame){
if(recording && mutex.tryLock()){
- if(vframe) vframe->release();
vframe = VideoFrame::newVideoFrame(frame);
- newFrameEvent.notify(this,*vframe);
+ newFrameEvent.notify(this,vframe);
mutex.unlock();
}
}
@@ -88,19 +86,16 @@ void FaceBlinkRecorder::threadedFunction(){
int initFrame = int(buffer.size())-framesToSave;
if(initFrame>=0){
ofLogVerbose(LOG_NAME) << "start recording" << framesToSave << "frames at " << fps*1.2 << "fps";
- recorder.setup("recordings/" + ofGetTimestampString()+".mp4",vframe->getWidth(),vframe->getHeight(),fps*1.2,false);
+ recorder.setup("recordings/" + ofGetTimestampString()+".mp4",vframe.getWidth(),vframe.getHeight(),fps*1.2,false);
for(int i=initFrame;i<(int)buffer.size();i++){
- VideoFrame * frame = buffer.getVideoFrame(i);
- recorder.addFrame(frame->getPixelsRef());
- frame->release();
+ VideoFrame frame = buffer.getVideoFrame(i);
+ recorder.addFrame(frame.getPixelsRef());
}
recorder.encodeVideo();
}else{
ofLogVerbose(LOG_NAME) << "eyes clsed to sson only" << framesToSave << "frames at " << fps << "fps, dropping video";
}
buffer.clear();
- vframe->release();
- vframe = NULL;
encoding = false;
}
}
@@ -117,11 +112,11 @@ void FaceBlinkRecorder::setEyesClosed(bool closed){
eyesClosed = closed;
}
-VideoFrame * FaceBlinkRecorder::getNextVideoFrame(){
+VideoFrame FaceBlinkRecorder::getNextVideoFrame(){
return vframe;
}
-int FaceBlinkRecorder::getFps(){
+float FaceBlinkRecorder::getFps(){
return fps;
}
@@ -26,8 +26,8 @@ class FaceBlinkRecorder: public ofThread, public ofxPm::VideoSource {
void setEyesClosed(bool closed);
- ofxPm::VideoFrame * getNextVideoFrame();
- int getFps();
+ ofxPm::VideoFrame getNextVideoFrame();
+ float getFps();
static string LOG_NAME;
@@ -53,7 +53,7 @@ class FaceBlinkRecorder: public ofThread, public ofxPm::VideoSource {
bool recording;
bool eyesClosed;
ofxPm::VideoBuffer buffer;
- ofxPm::VideoFrame * vframe;
+ ofxPm::VideoFrame vframe;
bool encoding;
float oneSec;

0 comments on commit e166300

Please sign in to comment.