VideoFrame VideoFrame::newVideoFrame(VideoFrame videoFrame){ if(videoFrame.data->createdTexPixels){ return newVideoFrame(videoFrame.getPixelsRef()); }else{ return newVideoFrame(videoFrame.getFboRef()); } }
void VideoBuffer::setSize(int numFrames){ maxSize = numFrames; for(int i=0;i<numFrames;i++){ VideoFrame videoFrame = VideoFrame::newVideoFrame(source->getNextVideoFrame().getPixelsRef()); newVideoFrame(videoFrame); } }
void MediaSourceBase::newVideoFrameFromSink(QImage image) { //qDebug() << "MEDIASOURCE" << id << "NEW VIDEO DRAME FROM SINK."; // display it in the preview QImage previewImage = image.scaled(320, 180, Qt::KeepAspectRatio, Qt::FastTransformation); previewPixmapItem->setPixmap(QPixmap::fromImage(previewImage)); // Emit it so that the mainWindow can pick it up for the main image emit newVideoFrame(image); }
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; }
void Camera::run(){ mIsFetchingVideoframes = true; cv::Mat vCurrentFrame = cv::Mat(mInfo.dim.cy, mInfo.dim.cx, CV_8UC1); bool vTookFrame = false; mCamera.startLive(false); while( mIsFetchingVideoframes ){ mSink->snapImages(1); memcpy(vCurrentFrame.ptr(), mBuffer[0], mInfo.buffersize); emit newVideoFrame(vCurrentFrame); } mCamera.suspendLive(); mCamera.stopLive(); }
void VideoBuffer::setup(VideoSource & _source, int size, bool allocateOnSetup){ source=&_source; totalFrames=0; maxSize = size; VideoSource::width = _source.getWidth(); VideoSource::height = _source.getHeight(); if(allocateOnSetup){ printf("VideoBuffer:: allocating on setup %d %d : ",VideoSource::getWidth(),VideoSource::getHeight()); for(int i=0;i<size;i++){ VideoFrame videoFrame = VideoFrame::newVideoFrame(source->getNextVideoFrame().getPixelsRef()); //videoFrame.getTextureRef(); newVideoFrame(videoFrame); printf("%d-",i); } printf("//\n"); } resume(); microsOneSec=-1; }