cache: save states to disk

This commit is contained in:
itsmattkc
2022-05-29 14:03:09 -07:00
parent 89b6cce2b2
commit 826090b621
10 changed files with 162 additions and 1 deletions
+26
View File
@@ -193,6 +193,32 @@ FramePtr FrameHashCache::LoadCacheFrame(const QString &fn)
return frame;
}
void FrameHashCache::LoadStateEvent(QDataStream &stream)
{
uint32_t version;
int num, den;
stream >> version;
switch (version) {
case 1:
stream >> num;
stream >> den;
timebase_ = rational(num, den);
break;
}
}
void FrameHashCache::SaveStateEvent(QDataStream &stream)
{
uint32_t version = 1;
stream << version;
stream << timebase_.numerator();
stream << timebase_.denominator();
}
rational FrameHashCache::ToTime(const int64_t &ts) const
{
return Timecode::timestamp_to_time(ts, timebase_);