31 #ifndef OPENSHOT_CACHE_DISK_H 32 #define OPENSHOT_CACHE_DISK_H 53 std::map<int64_t, int64_t> frames;
54 std::deque<int64_t> frame_numbers;
55 std::string image_format;
59 int64_t frame_size_bytes;
60 bool needs_range_processing;
61 std::string json_ranges;
62 std::vector<int64_t> ordered_frame_numbers;
63 std::map<int64_t, int64_t> frame_ranges;
64 int64_t range_version;
70 void InitPath(std::string cache_path);
73 void CalculateRanges();
81 CacheDisk(std::string cache_path, std::string format,
float quality,
float scale);
89 CacheDisk(std::string cache_path, std::string format,
float quality,
float scale, int64_t
max_bytes);
96 void Add(std::shared_ptr<openshot::Frame> frame);
106 std::shared_ptr<openshot::Frame>
GetFrame(int64_t frame_number);
120 void Remove(int64_t frame_number);
125 void Remove(int64_t start_frame_number, int64_t end_frame_number);
129 void SetJson(
const std::string value);
void Add(std::shared_ptr< openshot::Frame > frame)
Add a Frame to the cache.
int64_t Count()
Count the frames in the queue.
This class is a disk-based cache manager for Frame objects.
int64_t GetBytes()
Gets the maximum bytes value.
std::string Json()
Generate JSON string of this object.
Header file for CacheBase class.
std::shared_ptr< openshot::Frame > GetFrame(int64_t frame_number)
Get a frame from the cache.
Header file for Frame class.
void Remove(int64_t frame_number)
Remove a specific frame.
Json::Value JsonValue()
Generate Json::Value for this object.
void MoveToFront(int64_t frame_number)
Move frame to front of queue (so it lasts longer)
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
All cache managers in libopenshot are based on this CacheBase class.
void Clear()
Clear the cache of all frames.
This namespace is the default namespace for all code in the openshot library.
std::shared_ptr< openshot::Frame > GetSmallestFrame()
Get the smallest frame number.
int64_t max_bytes
This is the max number of bytes to cache (0 = no limit)
void SetJson(const std::string value)
Load JSON string into this object.
CacheDisk(std::string cache_path, std::string format, float quality, float scale)
Default constructor, no max bytes.