cache: add passthroughs to allow shallow copies of data

This commit is contained in:
itsmattkc
2022-06-06 20:06:43 -07:00
parent dfc401b63c
commit eeea16c5c3
11 changed files with 223 additions and 59 deletions
+21
View File
@@ -64,6 +64,21 @@ void FrameHashCache::ValidateTime(const rational &time)
Validate(TimeRange(time, time + timebase_));
}
QString FrameHashCache::GetValidCacheFilename(const rational &time) const
{
if (IsFrameCached(time)) {
return CachePathName(time);
} else if (!GetPassthroughs().empty()) {
for (const Passthrough &p : GetPassthroughs()) {
if (p.Contains(time)) {
return CachePathName(GetCacheDirectory(), p.cache, time, timebase_);
}
}
}
return QString();
}
bool FrameHashCache::SaveCacheFrame(const int64_t &time, FramePtr frame) const
{
return SaveCacheFrame(GetCacheDirectory(), GetUuid(), time, frame);
@@ -224,6 +239,12 @@ FramePtr FrameHashCache::LoadCacheFrame(const QString &fn)
return frame;
}
void FrameHashCache::SetPassthrough(PlaybackCache *cache)
{
super::SetPassthrough(cache);
SetTimebase(static_cast<FrameHashCache*>(cache)->GetTimebase());
}
void FrameHashCache::LoadStateEvent(QDataStream &stream)
{
uint32_t version;