Пример #1
0
void VideoViewer::videoFrameCallback(const Video::FrameBuffer* frameBuffer)
{
    double timeStamp=saveVideoTimer.peekTime();

    /* Start a new value in the input triple buffer: */
    Images::RGBImage& image=videoFrames.startNewValue();

    /* Extract an RGB image from the provided frame buffer into the new value: */
    videoExtractor->extractRGB(frameBuffer,image.modifyPixels());

    /* Finish the new value in the triple buffer and wake up the main loop: */
    videoFrames.postNewValue();
    Vrui::requestUpdate();

    if(saveVideoFrames)
    {
        /* Create a filename for the new video frame: */
        char videoFrameFileName[1024];
        snprintf(videoFrameFileName,sizeof(videoFrameFileName),saveVideoFrameNameTemplate.c_str(),saveVideoNextFrameIndex);

        /* Save the new video frame: */
        Images::writeImageFile(image,videoFrameFileName);

        std::cout<<"Saving frame "<<videoFrameFileName<<" at "<<timeStamp*1000.0<<" ms"<<std::endl;

        /* Increment the frame counter: */
        ++saveVideoNextFrameIndex;
    }
}
Пример #2
0
void VideoViewer::videoFrameCallback(const Video::FrameBuffer* frameBuffer)
	{
	/* Start a new value in the input triple buffer: */
	Images::RGBImage& image=videoFrames.startNewValue();
	
	/* Extract an RGB image from the provided frame buffer into the new value: */
	videoExtractor->extractRGB(frameBuffer,image.modifyPixels());
	
	/* Finish the new value in the triple buffer and wake up the main loop: */
	videoFrames.postNewValue();
	Vrui::requestUpdate();
	}