28 #ifndef OPENSHOT_CACHE_H
29 #define OPENSHOT_CACHE_H
59 map<long int, tr1::shared_ptr<Frame> > frames;
60 deque<long int> frame_numbers;
66 CriticalSection *cacheCriticalSection;
75 Cache(int64 max_bytes);
83 void Add(
long int frame_number, tr1::shared_ptr<Frame> frame);
96 tr1::shared_ptr<Frame>
GetFrame(
long int frame_number);
116 void Remove(
long int frame_number);
120 void SetMaxBytes(int64 number_of_bytes) { max_bytes = number_of_bytes; CleanUp(); };
128 void SetMaxBytesFromInfo(
long int number_of_frames,
int width,
int height,
int sample_rate,
int channels);
void SetMaxBytes(int64 number_of_bytes)
Set maximum bytes to a different amount.
void Add(long int frame_number, tr1::shared_ptr< Frame > frame)
Add a Frame to the cache.
void Remove(long int frame_number)
Remove a specific frame.
deque< long int > GetFrameNumbers()
Return a deque of all frame numbers in this queue (returns just a copy of the data) ...
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.
This class is a cache manager for Frame objects.
int64 GetBytes()
Gets the maximum bytes value.
tr1::shared_ptr< Frame > GetSmallestFrame()
Get the smallest frame number.
Cache()
Default constructor, no max bytes.
tr1::shared_ptr< Frame > GetFrame(long int frame_number)
Get a frame from the cache.
void Clear()
Clear the cache of all frames.
void Display()
Display a list of cached frame numbers.
int64 GetMaxBytes()
Gets the maximum bytes value.
void MoveToFront(long int frame_number)
Move frame to front of queue (so it lasts longer)
long int Count()
Count the frames in the queue.