MCPcopy Create free account
hub / github.com/IENT/YUView / cacheFrame

Method cacheFrame

YUViewLib/src/video/videoHandler.cpp:269–294  ·  view source on GitHub ↗

Put the frame into the cache (if it is not already in there)

Source from the content-addressed store, hash-verified

267
268// Put the frame into the cache (if it is not already in there)
269void videoHandler::cacheFrame(int frameIdx, bool testMode)
270{
271 DEBUG_VIDEO("videoHandler::cacheFrame %d %s", frameIdx, testMode ? "testMode" : "");
272
273 if (cacheValid && isInCache(frameIdx) && !testMode)
274 {
275 // No need to add it again
276 DEBUG_VIDEO("videoHandler::cacheFrame frame %i already in cache - returning", frameIdx);
277 return;
278 }
279
280 // Load the frame. While this is happening in the background the frame size must not change.
281 QImage cacheImage;
282 loadFrameForCaching(frameIdx, cacheImage);
283
284 // Put it into the cache
285 if (!cacheImage.isNull())
286 {
287 DEBUG_VIDEO("videoHandler::cacheFrame insert frame %i into cache", frameIdx);
288 QMutexLocker imageCacheLock(&imageCacheAccess);
289 if (cacheValid && !testMode)
290 imageCache.insert(frameIdx, cacheImage);
291 }
292 else
293 DEBUG_VIDEO("videoHandler::cacheFrame loading frame %i for caching failed", frameIdx);
294}
295
296unsigned videoHandler::getCachingFrameSize() const
297{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected