VideoFrame VideoFrame::newVideoFrame(VideoFrame videoFrame){ if(videoFrame.data->createdTexPixels){ return newVideoFrame(videoFrame.getPixelsRef()); }else{ return newVideoFrame(videoFrame.getFboRef()); } }
VideoFrame VideoFrame::newVideoFrame(ofFbo & videoFrame){ VideoFormat format(videoFrame); poolMutex.lock(); if(!pool[format].empty()){ VideoFrame frame; //cout << "returning frame from pool" << endl; frame.data = pool[format].back(); pool[format].pop_back(); poolMutex.unlock(); frame.refreshTimestamp(); frame.getFboRef(); frame.data->updateTexture(videoFrame); frame.data->pixelsChanged = false; frame.data->createdTexPixels = false; return frame; }else{ poolMutex.unlock(); return VideoFrame(videoFrame); } }