Exemplo n.º 1
0
bool OpenNIDevice::hasNext()
{
    if (!m_device.isFile())
        return true;

    return m_lastFrame < getTotalFrames();
}
Exemplo n.º 2
0
	//--------------------------------------------------------------
	void SequenceRamses::preloadAllFrames()
	{
		for (int i = 0; i < getTotalFrames(); ++i)
		{
			loadFrame(i);
		}
	}
Exemplo n.º 3
0
unsigned long Common::getRandSeed()
{
	auto director = cocos2d::Director::getInstance();
	auto ps = director->getSecondsPerFrame();
	auto tf = director->getTotalFrames();
	auto ret = (unsigned long)(ps*tf*RAND_SCALE);  
	return ret;
}
void ofxImageSequence::preloadAllFrames()
{
	if(!loaded){
		ofLog(OF_LOG_ERROR, "ofxImageSequence - Calling preloadAllFrames on unitialized image sequence.");
		return;
	}
	
	loadFrame(getTotalFrames()-1);
}
Exemplo n.º 5
0
void YCbCrLabView::onStateChanged(ffSequenceState state)
{
    switch (state)
    {
    case (isValid):
        break;
    case (isInvalid):
        disconnect(m_pSlider, SIGNAL(signal_valueChanged(long)), this,
                   SLOT(onSliderChanged(long)));
        m_pSlider->setEnabled(false);
        m_pSlider->setMinimum(0);
        m_pSlider->setValue(0);
        m_pSlider->setMaximum(0);
        break;
    case (justLoading):
    case (isLoading):
        disconnect(m_pSlider, SIGNAL(signal_valueChanged(long)), this,
                   SLOT(onSliderChanged(long)));
        m_pSlider->setEnabled(false);
        m_pSlider->setMinimum(0);
        m_pSlider->setValue(0);
        m_pSlider->setMaximum(0);
        break;
    case (justOpened):
        fitToView();
        m_pSlider->setMaximum(getTotalFrames());
        m_pSlider->setValue(ffDefault::FirstFrame);
        m_pSlider->setMinimum(ffDefault::FirstFrame);
        connect(m_pSlider, SIGNAL(signal_valueChanged(long)), this,
                SLOT(onSliderChanged(long)));
        m_pSlider->setEnabled(true);

        m_pSlider->setGraphicsEffect(m_pFadeFrameScrubber);
        m_pFadeFrameScrubberAnimation->setDirection(
                    QAbstractAnimation::Forward);
        m_pSlider->setOpacity(YCBCRVIEW_OPAQUE);
        m_pFadeFrameScrubberAnimation->start();

        // FUTURE_RACE
        m_pGraphicsPixmapItem->setGraphicsEffect(m_pFadePixmap);
        m_pFadePixmapAnimation->setDirection(QAbstractAnimation::Forward);
        m_pFadePixmapAnimation->start();

        m_pTextPill->start(tr("Loaded file ") +
                           QString::fromStdString(m_pffSequence->getFileURI()));
        break;
    case (justClosed):
        m_pGraphicsPixmapItem->setGraphicsEffect(m_pFadePixmap);
        m_pFadePixmapAnimation->setDirection(QAbstractAnimation::Backward);
        m_pFadePixmapAnimation->start();

        m_pSlider->setGraphicsEffect(m_pFadeFrameScrubber);
        m_pFadeFrameScrubberAnimation->setDirection(QAbstractAnimation::Backward);
        m_pFadeFrameScrubberAnimation->start();
        break;
    }
}
Exemplo n.º 6
0
void AnimatedImage::drawFrame(int frame){
	if (frame < getTotalFrames()){
		int ww = (size.x*3);
		int hh = 0;	
		
		hh = (size.y)*frame;
		for (int y = 0; y<size.y; y++){
			for (int x=0; x<size.x; x++){
				w.drawPixel( (x+location.x), y+location.y,
								image[(hh*ww)+(x*3)+6], image[(hh*ww)+(x*3+1)+6], image[(hh*ww)+(x*3+2)+6]);			
			}
			hh += 1;
		}				
	}
}
void ofxImageSequence::setFrame(int index)
{
	if(!loaded){
		ofLogError("ofxImageSequence::setFrame") << "Calling getFrame on unitialized image sequence.";
		return;
	}

	if(index < 0){
		ofLogError("ofxImageSequence::setFrame") << "Asking for negative index.";
		return;
	}
	
	index %= getTotalFrames();
	
	loadFrame(index);
	currentFrame = index;
}
void ofxImageSequence::setFrame(int index)
{
	if(!loaded){
		ofLog(OF_LOG_ERROR, "ofxImageSequence - Calling getFrame on unitialized image sequence.");
		return;
	}
	if(index < 0){
		ofLog(OF_LOG_ERROR, "ofxImageSequence - Asking for negative index.");
		return;
	}
	
	index %= getTotalFrames();
	
	if(sequence[index] == NULL){
		loadFrame(index);
	}
	
	currentFrame = index;
}
Exemplo n.º 9
0
	//--------------------------------------------------------------
	void SequenceRamses::setFrame(int index)
	{
		if (!m_bReady) 
		{
			ofLogError("SequenceRamses::setFrame") << "Not ready, call setup() first!";
			return;
		}

		if (index < 0) 
		{
			ofLogError("SequenceRamses::setFrame") << "Index must be a positive number!";
			return;
		}

		index %= getTotalFrames();

		loadFrame(index);
		m_currFrame = index;
	}
Exemplo n.º 10
0
ofTexture* ofxImageSequence::getFrame(int index)
{
	if(!loaded){
		ofLog(OF_LOG_ERROR, "ofxImageSequence - Calling getFrame on unitialized image sequence.");
		return NULL;
	}
	if(index < 0){
		ofLog(OF_LOG_ERROR, "ofxImageSequence - Asking for negative index.");
		return NULL;
	}
	
	index %= getTotalFrames();
	
	if(sequence[index] == NULL){
		loadFrame(index);
	}
		
	return sequence[index];
}
Exemplo n.º 11
0
void VideoBuffer::draw(int _x, int _y, int _w, int _h){
    
        float length = _w;
        float oneLength=(float)(ofGetWidth()-_x)/(float)(maxSize);
        int drawBufferY = _y;
        if(stopped) ofSetColor(255,0,0);
        else ofSetColor(255);
    
        ofDrawLine(_x,drawBufferY,length,drawBufferY);
        
        ofSetColor(255);
        
        char measureMessage[10];
        for(int i=0;i<(int)size()+1;i++){
            /*
             if(i%100==0){
             ofLine(oneLength*i,710,oneLength*i,700);
             sprintf(measureMessage,"%0.2f",(float)(frames[i]->getTimestamp()-initTime)/1000000.0);
             ofDrawBitmapString(measureMessage,oneLength*i,695);
             }
             */
            int fps = getFps();
            if(fps && i%(int)fps==0)
            {
                ofSetLineWidth(2.0);
                ofSetColor(255,128,0);
                if(i!=int(size())) ofDrawBitmapString(ofToString(int(size()-i-1)),oneLength*(i)+_x + oneLength/2,PMDRAWELEMENTSY+104);
                else
                {
                    ofSetColor(50);
                    ofDrawBitmapString(ofToString(getTotalFrames()),oneLength*(i)+_x - 10,PMDRAWELEMENTSY+55);
                }
                //if(i!=int(size())) ofDrawBitmapString(ofToString(getTotalFrames()-i),ofGetWidth()-PMDRAWSPACING-(oneLength*(i+1)) + oneLength/2,drawBufferY-15);
            }
            else 
            {
                ofSetLineWidth(1.0);
                ofSetColor(155,58,0);
            }
            ofDrawLine(oneLength*(i)+_x,drawBufferY,oneLength*(i)+_x,drawBufferY-10);
        }
    }
float ofxImageSequence::getLengthInSeconds()
{
	return getTotalFrames() / frameRate;
}
Exemplo n.º 13
0
	//--------------------------------------------------------------
	float SequenceRamses::getTotalTime() const
	{
		return getTotalFrames() / m_frameRate;
	}
Exemplo n.º 14
0
const float mpgDecoder::getRemainFrames( )
{
	return (getTotalFrames()<getPlayedFrames())?0:getTotalFrames()-getPlayedFrames( );
}
Exemplo n.º 15
0
const float oggDecoder::getRemainFrames( )
{
	return getTotalFrames( )-getPlayedFrames( );
}