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