Clear all caches
| 1777 | |
| 1778 | // Clear all caches |
| 1779 | void Timeline::ClearAllCache(bool deep) { |
| 1780 | // Get lock (prevent getting frames while this happens) |
| 1781 | const std::lock_guard<std::recursive_mutex> guard(getFrameMutex); |
| 1782 | |
| 1783 | // Clear primary cache |
| 1784 | if (final_cache) { |
| 1785 | final_cache->Clear(); |
| 1786 | } |
| 1787 | |
| 1788 | // Loop through all clips |
| 1789 | try { |
| 1790 | for (const auto clip : clips) { |
| 1791 | // Clear cache on clip and reader if present |
| 1792 | if (clip->Reader()) { |
| 1793 | if (auto rc = clip->Reader()->GetCache()) |
| 1794 | rc->Clear(); |
| 1795 | |
| 1796 | // Clear nested Reader (if deep clear requested) |
| 1797 | if (deep && clip->Reader()->Name() == "FrameMapper") { |
| 1798 | FrameMapper *nested_reader = static_cast<FrameMapper *>(clip->Reader()); |
| 1799 | if (nested_reader->Reader()) { |
| 1800 | if (auto nc = nested_reader->Reader()->GetCache()) |
| 1801 | nc->Clear(); |
| 1802 | } |
| 1803 | } |
| 1804 | } |
| 1805 | |
| 1806 | // Clear clip cache |
| 1807 | if (auto cc = clip->GetCache()) |
| 1808 | cc->Clear(); |
| 1809 | } |
| 1810 | } catch (const ReaderClosed & e) { |
| 1811 | // ... |
| 1812 | } |
| 1813 | |
| 1814 | // Cache content changed: notify cache clients to rebuild their window baseline. |
| 1815 | BumpCacheEpoch(); |
| 1816 | } |
| 1817 | |
| 1818 | // Set Max Image Size (used for performance optimization). Convenience function for setting |
| 1819 | // Settings::Instance()->MAX_WIDTH and Settings::Instance()->MAX_HEIGHT. |
no test coverage detected