28 #ifndef OPENSHOT_CACHE_DISK_H 29 #define OPENSHOT_CACHE_DISK_H 39 #include <QTextStream> 53 map<long int, long int> frames;
54 deque<long int> frame_numbers;
59 long long int frame_size_bytes;
60 bool needs_range_processing;
62 vector<long int> ordered_frame_numbers;
63 map<long int, long int> frame_ranges;
64 long int range_version;
70 void InitPath(
string cache_path);
73 void CalculateRanges();
81 CacheDisk(
string cache_path,
string format,
float quality,
float scale);
89 CacheDisk(
string cache_path,
string format,
float quality,
float scale,
long long int max_bytes);
96 void Add(std::shared_ptr<Frame> frame);
106 std::shared_ptr<Frame>
GetFrame(
long int frame_number);
120 void Remove(
long int frame_number);
125 void Remove(
long int start_frame_number,
long int end_frame_number);
void Add(std::shared_ptr< Frame > frame)
Add a Frame to the cache.
long long int max_bytes
This is the max number of bytes to cache (0 = no limit)
long int Count()
Count the frames in the queue.
std::shared_ptr< Frame > GetFrame(long int frame_number)
Get a frame from the cache.
This class is a disk-based cache manager for Frame objects.
void SetJsonValue(Json::Value root)
Load Json::JsonValue into this object.
void MoveToFront(long int frame_number)
Move frame to front of queue (so it lasts longer)
long long int GetBytes()
Gets the maximum bytes value.
Exception when a reader is closed, and a frame is requested.
Header file for CacheBase class.
Header file for all Exception classes.
Header file for Frame class.
Exception for files that can not be found or opened.
Json::Value JsonValue()
Generate Json::JsonValue for this object.
All cache managers in libopenshot are based on this CacheBase class.
void Remove(long int frame_number)
Remove a specific frame.
void Clear()
Clear the cache of all frames.
This namespace is the default namespace for all code in the openshot library.
CacheDisk(string cache_path, string format, float quality, float scale)
Default constructor, no max bytes.
Exception for invalid JSON.
std::shared_ptr< Frame > GetSmallestFrame()
Get the smallest frame number.
void SetJson(string value)
Load JSON string into this object.
string Json()
Get and Set JSON methods.