Browse files

ofVideoGrabber: desiredFramerate was not being set if called before init

Closes #769
  • Loading branch information...
1 parent be2b260 commit 04f44b0b4b7b6f21b307bee8680c22bc9e5cf2f1 @arturoc arturoc committed Oct 10, 2011
Showing with 7 additions and 0 deletions.
  1. +6 −0 libs/openFrameworks/video/ofVideoGrabber.cpp
  2. +1 −0 libs/openFrameworks/video/ofVideoGrabber.h
View
6 libs/openFrameworks/video/ofVideoGrabber.cpp
@@ -19,6 +19,7 @@ ofVideoGrabber::ofVideoGrabber(){
bInitialized = false;
RequestedDeviceID = -1;
internalPixelFormat = OF_PIXELS_RGB;
+ desiredFramerate = -1;
#ifdef TARGET_ANDROID
if(!ofxAndroidInitGrabber(this)) return;
@@ -63,6 +64,10 @@ bool ofVideoGrabber::initGrabber(int w, int h, bool setUseTexture){
grabber->setPixelFormat(internalPixelFormat);
+ if( desiredFramerate!=-1 ){
+ grabber->setDesiredFrameRate(desiredFramerate);
+ }
+
bool bOk = grabber->initGrabber(w, h);
width = (int)grabber->getWidth();
height = (int)grabber->getHeight();
@@ -118,6 +123,7 @@ void ofVideoGrabber::setDeviceID(int _deviceID){
//--------------------------------------------------------------------
void ofVideoGrabber::setDesiredFrameRate(int framerate){
+ desiredFramerate = framerate;
if( grabber != NULL ){
grabber->setDesiredFrameRate(framerate);
}
View
1 libs/openFrameworks/video/ofVideoGrabber.h
@@ -87,6 +87,7 @@ class ofVideoGrabber : public ofBaseVideoGrabber,public ofBaseVideoDraws{
int RequestedDeviceID;
ofPixelFormat internalPixelFormat;
+ int desiredFramerate;
};

0 comments on commit 04f44b0

Please sign in to comment.