render: improved overall flow

This commit is contained in:
itsmattkc
2022-05-16 15:41:50 -07:00
parent bfd6a407a5
commit 23973699b4
8 changed files with 62 additions and 47 deletions
+21 -7
View File
@@ -49,16 +49,19 @@ public:
void ValidateTimestamp(const int64_t &ts);
void ValidateTime(const rational &time);
/**
* @brief Return the path of the cached image at this time
*/
QString CachePathName(const int64_t &time) const;
QString CachePathName(const rational &time) const
bool IsFrameCached(const rational &time) const
{
return CachePathName(ToTimestamp(time, Timecode::kFloor));
return GetValidatedRanges().contains(time);
}
static QString CachePathName(const QString& cache_path, const QUuid &cache_id, const int64_t &time);
QString GetValidCacheFilename(const rational &time) const
{
if (IsFrameCached(time)) {
return CachePathName(time);
} else {
return QString();
}
}
static bool SaveCacheFrame(const QString& filename, FramePtr frame);
bool SaveCacheFrame(const int64_t &time, FramePtr frame) const;
@@ -71,6 +74,17 @@ private:
rational ToTime(const int64_t &ts) const;
int64_t ToTimestamp(const rational &ts, Timecode::Rounding rounding = Timecode::kRound) const;
/**
* @brief Return the path of the cached image at this time
*/
QString CachePathName(const int64_t &time) const;
QString CachePathName(const rational &time) const
{
return CachePathName(ToTimestamp(time, Timecode::kRound));
}
static QString CachePathName(const QString& cache_path, const QUuid &cache_id, const int64_t &time);
rational timebase_;
QUuid uuid_;