OpenShot Library | libopenshot
0.1.1
|
This class is a cache manager for Frame objects. More...
#include <Cache.h>
Public Member Functions | |
void | Add (long int frame_number, tr1::shared_ptr< Frame > frame) |
Add a Frame to the cache. More... | |
Cache () | |
Default constructor, no max bytes. More... | |
Cache (int64 max_bytes) | |
Constructor that sets the max bytes to cache. More... | |
void | Clear () |
Clear the cache of all frames. More... | |
long int | Count () |
Count the frames in the queue. More... | |
void | Display () |
Display a list of cached frame numbers. More... | |
int64 | GetBytes () |
Gets the maximum bytes value. More... | |
tr1::shared_ptr< Frame > | GetFrame (long int frame_number) |
Get a frame from the cache. More... | |
deque< long int > | GetFrameNumbers () |
Return a deque of all frame numbers in this queue (returns just a copy of the data) More... | |
int64 | GetMaxBytes () |
Gets the maximum bytes value. More... | |
tr1::shared_ptr< Frame > | GetSmallestFrame () |
Get the smallest frame number. More... | |
void | MoveToFront (long int frame_number) |
Move frame to front of queue (so it lasts longer) More... | |
void | Remove (long int frame_number) |
Remove a specific frame. More... | |
void | SetMaxBytes (int64 number_of_bytes) |
Set maximum bytes to a different amount. More... | |
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. More... | |
~Cache () | |
This class is a cache manager for Frame objects.
It is used by FileReaders (such as FFmpegReader) to cache recently accessed frames. Due to the high cost of decoding streams, once a frame is decoded, converted to RGB, and a Frame object is created, it critical to keep these Frames cached for performance reasons. However, the larger the cache, the more memory is required. You can set the max number of bytes to cache.
Cache::Cache | ( | int64 | max_bytes | ) |
void Cache::Add | ( | long int | frame_number, |
tr1::shared_ptr< Frame > | frame | ||
) |
Add a Frame to the cache.
frame_number | The frame number of the cached frame |
frame | The openshot::Frame object needing to be cached. |
void Cache::Display | ( | ) |
tr1::shared_ptr< Frame > Cache::GetFrame | ( | long int | frame_number | ) |
deque< long int > Cache::GetFrameNumbers | ( | ) |
|
inline |
tr1::shared_ptr< Frame > Cache::GetSmallestFrame | ( | ) |
void Cache::MoveToFront | ( | long int | frame_number | ) |
void Cache::Remove | ( | long int | frame_number | ) |
|
inline |
void Cache::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.
number_of_frames | The maximum number of frames to hold in cache |
width | The width of the frame's image |
height | The height of the frame's image |
sample_rate | The sample rate of the frame's audio data |
channels | The number of audio channels in the frame |