Put the frame into the cache (if it is not already in there)
| 267 | |
| 268 | // Put the frame into the cache (if it is not already in there) |
| 269 | void 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 | |
| 296 | unsigned videoHandler::getCachingFrameSize() const |
| 297 | { |
no outgoing calls
no test coverage detected