31 #ifndef OPENSHOT_CACHE_BASE_H 32 #define OPENSHOT_CACHE_BASE_H 68 virtual void Add(std::shared_ptr<openshot::Frame> frame) = 0;
71 virtual void Clear() = 0;
74 virtual int64_t
Count() = 0;
78 virtual std::shared_ptr<openshot::Frame>
GetFrame(int64_t frame_number) = 0;
88 virtual void Remove(int64_t frame_number) = 0;
93 virtual void Remove(int64_t start_frame_number, int64_t end_frame_number) = 0;
100 void SetMaxBytes(int64_t number_of_bytes) { max_bytes = number_of_bytes; };
108 void SetMaxBytesFromInfo(int64_t number_of_frames,
int width,
int height,
int sample_rate,
int channels);
111 virtual std::string
Json() = 0;
112 virtual void SetJson(
const std::string value) = 0;
juce::CriticalSection * cacheCriticalSection
Section lock for multiple threads.
virtual std::string Json()=0
Generate JSON string of this object.
virtual void SetJson(const std::string value)=0
Load JSON string into this object.
void SetMaxBytesFromInfo(int64_t number_of_frames, int width, int height, int sample_rate, int channels)
Set maximum bytes to a different amount based on a ReaderInfo struct.
virtual ~CacheBase()=default
Header file for Frame class.
virtual void Remove(int64_t frame_number)=0
Remove a specific frame.
virtual int64_t Count()=0
Count the frames in the queue.
Header file for JSON class.
virtual std::shared_ptr< openshot::Frame > GetSmallestFrame()=0
Get the smallest frame number.
virtual std::shared_ptr< openshot::Frame > GetFrame(int64_t frame_number)=0
Get a frame from the cache.
All cache managers in libopenshot are based on this CacheBase class.
CacheBase()
Default constructor, no max bytes.
virtual int64_t GetBytes()=0
Gets the maximum bytes value.
virtual Json::Value JsonValue()=0
Generate Json::Value for this object.
void SetMaxBytes(int64_t number_of_bytes)
Set maximum bytes to a different amount.
std::string cache_type
This is a friendly type name of the derived cache instance.
This namespace is the default namespace for all code in the openshot library.
virtual void Clear()=0
Clear the cache of all frames.
virtual void SetJsonValue(const Json::Value root)=0
Load Json::Value into this object.
int64_t GetMaxBytes()
Gets the maximum bytes value.
virtual void Add(std::shared_ptr< openshot::Frame > frame)=0
Add a Frame to the cache.
int64_t max_bytes
This is the max number of bytes to cache (0 = no limit)