Ejemplo n.º 1
0
void RecLoopRender::draw(){
    VideoFrame * bufferFrame = buffer->getNextVideoFrame();
    VideoFrame * liveFrame   = live->getNextVideoFrame();
    if(bufferFrame!=NULL && liveFrame!=NULL){
        if(!imageAllocated){
            image.allocate(liveFrame->getWidth(),liveFrame->getHeight(),OF_IMAGE_COLOR);
            imageAllocated=true;
        }

        ofEnableAlphaBlending();
        ofSetColor(tintR,tintG,tintB,alpha);
        if(minmaxBlend)
            glBlendEquationEXT(GL_MAX);
        else
            glBlendEquationEXT(GL_MIN);

        liveFrame->getTextureRef().draw(0,0);

        if(!stopped){
            bufferFrame->getTextureRef().draw(0,0);
			image.grabScreen(0,0,liveFrame->getWidth(),liveFrame->getHeight());
			bufferFrame->getTextureRef().loadData(image.getPixelsRef());
        }

        liveFrame->release();
        bufferFrame->release();

        ofDisableAlphaBlending();
        glBlendEquationEXT(GL_FUNC_ADD);

    }
}
	void avLooperRenderer::draw(int x,int y,int w,int h)
	{
		// audio -> video Sync !!
		//////////////////////////
		// 1
		//VideoFrame * frame = vHeader.getVideoFrame(int(float(aHeader2.getIndex())/float(aBuffer->sizeInSamples()))*vBuffer->getMaxSize());
		//printf("index %d of size %d = %d\n",aHeader2.getIndex(),aBuffer->sizeInSamples(),int(float(aHeader2.getIndex())/float(aBuffer->sizeInSamples()))*vBuffer->getMaxSize());
		
		// 2
		float delayToVideo = (float(aHeader2.getIndex()) / float(audioSampleRate)) * 1000.0; 
		vHeader.setDelayMs(float(maximumSizeInMs)-delayToVideo-float(videoOffsetInMs));
		//printf("avR ::DELAY is = %f || maxSize %d delayToVideo in ms = %f / index %d\n",float(maximumSizeInMs)-delayToVideo-float(videoOffsetInMs),maximumSizeInMs,delayToVideo,aHeader2.getIndex());
		//printf("AVLR:: videoDelayMs :: %f \n",float(maximumSizeInMs)-delayToVideo-float(videoOffsetInMs));
		
		VideoFrame frame = vHeader.getNextVideoFrame();
		if(frame!=NULL){
			// draw the frame texture to screen
			ofSetColor(vHeader.getOpacity(),vHeader.getOpacity(),vHeader.getOpacity());
			frame.getTextureRef().draw(x,y,w,h);
		}
		
		// draw av header interfaces
		aBuffer->draw();
		vBuffer->draw();

		vHeader.draw();
		aHeader2.draw();
		
		ofSetColor(255,255,255);
		
	}
Ejemplo n.º 3
0
void VideoRenderer::drawNextFrame(){
    VideoFrame * frame = source->getNextVideoFrame();
    if(frame!=NULL){
        frame->getTextureRef().draw(0,0);
        frame->release();
    }
}
	void avLooperRenderer::draw()
	{
		VideoFrame frame = vHeader.getNextVideoFrame();
		if(frame!=NULL){
			// draw the frame texture to screen
			frame.getTextureRef().draw(0,0);
		}
		// draw av header interfaces
		vHeader.draw();
		aHeader2.draw();
	}
Ejemplo n.º 5
0
void VideoBuffer::setup(VideoSource & source, int size, bool allocateOnSetup){
	this->source=&source;
	totalFrames=0;
	maxSize = size;
	if(allocateOnSetup){
		for(int i=0;i<size;i++){
			VideoFrame videoFrame = VideoFrame::newVideoFrame(source.getNextVideoFrame().getPixelsRef());
			videoFrame.getTextureRef();
			newVideoFrame(videoFrame);
		}
	}
	resume();
	microsOneSec=-1;
}