framehashcache: refactored to remove hashes
This commit is contained in:
+14
-29
@@ -22,6 +22,7 @@
|
||||
#define VIDEORENDERFRAMECACHE_H
|
||||
|
||||
#include <QMutex>
|
||||
#include <QUuid>
|
||||
|
||||
#include "common/rational.h"
|
||||
#include "common/timecodefunctions.h"
|
||||
@@ -38,35 +39,25 @@ class FrameHashCache : public PlaybackCache
|
||||
public:
|
||||
FrameHashCache(QObject* parent = nullptr);
|
||||
|
||||
QByteArray GetHash(const int64_t& time);
|
||||
QByteArray GetHash(const rational& time);
|
||||
|
||||
const rational &GetTimebase() const
|
||||
{
|
||||
return timebase_;
|
||||
}
|
||||
const rational &GetTimebase() const { return timebase_; }
|
||||
|
||||
void SetTimebase(const rational& tb);
|
||||
|
||||
void ValidateFramesWithHash(const QByteArray& hash);
|
||||
void ValidateTimestamp(const int64_t &ts);
|
||||
|
||||
/**
|
||||
* @brief Return the path of the cached image at this time
|
||||
*/
|
||||
QString CachePathName(const QByteArray &hash) const;
|
||||
static QString CachePathName(const QString& cache_path, const QByteArray &hash);
|
||||
QString CachePathName(const int64_t &time) const;
|
||||
static QString CachePathName(const QString& cache_path, const QUuid &cache_id, const int64_t &time);
|
||||
|
||||
static bool SaveCacheFrame(const QString& filename, char *data, const VideoParams &vparam, int linesize_bytes);
|
||||
bool SaveCacheFrame(const QByteArray& hash, char *data, const VideoParams &vparam, int linesize_bytes) const;
|
||||
bool SaveCacheFrame(const QByteArray& hash, FramePtr frame) const;
|
||||
static bool SaveCacheFrame(const QString& cache_path, const QByteArray& hash, char *data, const VideoParams &vparam, int linesize_bytes);
|
||||
static bool SaveCacheFrame(const QString& cache_path, const QByteArray& hash, FramePtr frame);
|
||||
static FramePtr LoadCacheFrame(const QString& cache_path, const QByteArray& hash);
|
||||
FramePtr LoadCacheFrame(const QByteArray& hash) const;
|
||||
static bool SaveCacheFrame(const QString& filename, FramePtr frame);
|
||||
bool SaveCacheFrame(const int64_t &time, FramePtr frame) const;
|
||||
static bool SaveCacheFrame(const QString& cache_path, const QUuid &uuid, const int64_t &time, FramePtr frame);
|
||||
static FramePtr LoadCacheFrame(const QString& cache_path, const QUuid &uuid, const int64_t &time);
|
||||
FramePtr LoadCacheFrame(const int64_t &time) const;
|
||||
static FramePtr LoadCacheFrame(const QString& fn);
|
||||
|
||||
void SetHash(const olive::rational &time, const QByteArray& hash, bool frame_exists);
|
||||
|
||||
protected:
|
||||
virtual void ShiftEvent(const rational& from, const rational& to) override;
|
||||
|
||||
@@ -76,22 +67,16 @@ private:
|
||||
rational ToTime(const int64_t &ts) const;
|
||||
int64_t ToTimestamp(const rational &ts, Timecode::Rounding rounding = Timecode::kRound) const;
|
||||
|
||||
int64_t GetMapSize() const
|
||||
{
|
||||
return int64_t(time_hash_map_.size());
|
||||
}
|
||||
|
||||
std::vector<QByteArray> time_hash_map_;
|
||||
std::map<QByteArray, std::vector<int64_t> > hash_time_map_;
|
||||
|
||||
rational timebase_;
|
||||
|
||||
QUuid uuid_;
|
||||
|
||||
static QMutex currently_saving_frames_mutex_;
|
||||
static QMap<QByteArray, FramePtr> currently_saving_frames_;
|
||||
static QMap<QString, FramePtr> currently_saving_frames_;
|
||||
static const QString kCacheFormatExtension;
|
||||
|
||||
private slots:
|
||||
void HashDeleted(const QString &s, const QByteArray& hash);
|
||||
void HashDeleted(const QString &path, const QString &filename);
|
||||
|
||||
void ProjectInvalidated(Project* p);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user