Files
oak-editor/app/render/backend/videorenderframecache.h
T
itsmattkc 40b3879440 overhauled render classes to support video AND audio
Major refactoring work to try sharing as much code as possible between the
video renderers and audio renderers, as well as make them as
platform-independent as possible.
2019-11-15 13:50:58 +09:00

54 lines
1.1 KiB
C++

#ifndef VIDEORENDERFRAMECACHE_H
#define VIDEORENDERFRAMECACHE_H
#include <QMutex>
#include "common/rational.h"
class VideoRenderFrameCache
{
public:
VideoRenderFrameCache();
/**
* @brief Return whether a frame with this hash already exists
*/
bool HasHash(const QByteArray& hash);
/**
* @brief Return whether a frame is currently being cached
*/
bool IsCaching(const QByteArray& hash);
/**
* @brief Check if a frame is currently being cached, and if not reserve it
*/
bool TryCache(const QByteArray& hash);
/**
* @brief Return the path of the cached image at this time
*/
QString CachePathName(const QByteArray &hash);
void SetCacheID(const QString& id);
QByteArray TimeToHash(const rational& time);
void SetHash(const rational& time, const QByteArray& hash);
void RemoveHash(const rational& time);
void Truncate(const rational& time);
private:
void RemoveHashFromCurrentlyCaching(const QByteArray& hash);
QMap<rational, QByteArray> time_hash_map_;
QMutex currently_caching_lock_;
QVector<QByteArray> currently_caching_list_;
QString cache_id_;
};
#endif // VIDEORENDERFRAMECACHE_H