Skip to content

Commit

Permalink
ofVideoGrabber: desiredFramerate was not being set if called before init
Browse files Browse the repository at this point in the history
  • Loading branch information
arturoc committed Oct 10, 2011
1 parent be2b260 commit 04f44b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libs/openFrameworks/video/ofVideoGrabber.cpp
Expand Up @@ -19,6 +19,7 @@ ofVideoGrabber::ofVideoGrabber(){
bInitialized = false;
RequestedDeviceID = -1;
internalPixelFormat = OF_PIXELS_RGB;
desiredFramerate = -1;

#ifdef TARGET_ANDROID
if(!ofxAndroidInitGrabber(this)) return;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -118,6 +123,7 @@ void ofVideoGrabber::setDeviceID(int _deviceID){

//--------------------------------------------------------------------
void ofVideoGrabber::setDesiredFrameRate(int framerate){
desiredFramerate = framerate;
if( grabber != NULL ){
grabber->setDesiredFrameRate(framerate);
}
Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/video/ofVideoGrabber.h
Expand Up @@ -87,6 +87,7 @@ class ofVideoGrabber : public ofBaseVideoGrabber,public ofBaseVideoDraws{
int RequestedDeviceID;

ofPixelFormat internalPixelFormat;
int desiredFramerate;
};


Expand Down

0 comments on commit 04f44b0

Please sign in to comment.