void PhVideoPool::requestFrames(PhFrame frame, bool backward) { PHDBG(24) << frame; if(_frameLength == 0) { PHDBG(24) << "not ready"; return; } // clip to stream boundaries if(frame < 0) frame = 0; if (frame >= _frameLength) frame = _frameLength; // we make sure we have requested "readahead_count" frames for (int i = 0; i < _settings->videoReadhead(); i++) { int factor = i; if (backward) { factor *= -1; } PhFrame requestedFrame = frame + factor; if (!isFrameRequested(requestedFrame)) { requestFrame(requestedFrame); } } cleanup(frame); }
void RequestLinear::insertCacheFrame(int pframe, IScriptEnvironment *env) { RFrame *cf; PVideoFrame nframe; int first = pframe-clim+1; start_pos = (start_pos+1)%clim; if (debug) { sprintf(buf, "RequestLinear: cache inserting frame %d\n", pframe); OutputDebugString(buf); } for (int i=0; i<clim; ++i) { cf = frames[getCachePos(i)]; if (first+i == pframe && (cf->num != pframe || cf->valid != 1)) { cf->data = requestFrame(mapn(first+i), env); cf->num = first+i; cf->valid = 1; } else if (cf->num != first+i) { cf->data = nframe; // force release cf->num = first+i; cf->valid = 0; } } }
bool QCamera::startStream() { return false; if(streaming) return false; timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(requestFrame())); timer->start(); return true; }
void PixelStreamUpdater::_onFrameSwapped(deflect::server::FramePtr frame) { _readyToSwap = false; auto leftOrMono = std::make_shared<deflect::server::Frame>(); auto right = std::make_shared<deflect::server::Frame>(); _splitByView(frame->tiles, leftOrMono->tiles, right->tiles); _sortByChannelAndPosition(leftOrMono->tiles); _sortByChannelAndPosition(right->tiles); { const QWriteLocker frameLock(&_frameMutex); _frameLeftOrMono = std::move(leftOrMono); _frameRight = std::move(right); _createFrameProcessors(); _createPerTileMutexes(); } emit pictureUpdated(); emit requestFrame(frame->uri); }
PVideoFrame __stdcall RequestLinear::GetFrame(int n, IScriptEnvironment *env) { n = mapn(n); if (debug) { sprintf(buf, "RequestLinear: frame %d -- last_request = %d\n", n, last_request); OutputDebugString(buf); } if (clim <= 0) { if (n > last_request && n-last_request <= rlim) { for (int i=last_request+1; i<n; ++i) requestFrame(i, env); } else if (n <= last_request && n <= rlim) { for (int i=0; i<n; ++i) requestFrame(i, env); } else if (rall) { int start = n > last_request ? last_request+1 : 0; for (int i=start; i<n; ++i) requestFrame(i, env); } else if (elim > 0) { for (int i=max(0,n-elim); i<n; ++i) requestFrame(i, env); } last_request = n; return requestFrame(n, env); } if (n > last_request) { if (n-last_request <= rlim || rall) { for (int i=last_request+1; i<=n; ++i) insertCacheFrame(i, env); } else { clearCache(n, env); for (int i=max(0,n-elim); i<=n; ++i) insertCacheFrame(i, env); } last_request = n; return findCachedFrame(n, env); } if (last_request-n < clim) return findCachedFrame(n, env); if (n <= rlim || rall) { for (int i=0; i<=n; ++i) insertCacheFrame(i, env); } else { clearCache(n, env); for (int i=max(0,n-elim); i<=n; ++i) insertCacheFrame(i, env); } last_request = n; return findCachedFrame(n, env); }