| 
    OpenShot Library | libopenshot
    0.4.0
    
   | 
 
 
 
 
Go to the documentation of this file.
   31     int64_t bytes = number_of_frames * (height * width * 4 + (sample_rate * channels * 4));
 
   41         const std::lock_guard<std::recursive_mutex> lock(*
cacheMutex);
 
   47         Json::Value ranges = Json::Value(Json::arrayValue);
 
   52         std::vector<int64_t>::iterator itr_ordered;
 
   54         int64_t starting_frame = 0;
 
   55         int64_t ending_frame = 0;
 
   62                 int64_t frame_number = *itr_ordered;
 
   63                 if (frame_number - ending_frame > 1) {
 
   69                     range[
"start"] = std::to_string(starting_frame);
 
   70                     range[
"end"] = std::to_string(ending_frame);
 
   74                     starting_frame = frame_number;
 
   78                 ending_frame = frame_number;
 
   87         range[
"start"] = std::to_string(starting_frame);
 
   88         range[
"end"] = std::to_string(ending_frame);
 
  104     root[
"max_bytes"] = std::to_string(
max_bytes);
 
  114     if (!root[
"max_bytes"].isNull())
 
  115         max_bytes = std::stoll(root[
"max_bytes"].asString());
 
  
bool needs_range_processing
Something has changed, and the range data needs to be re-calculated.
 
int64_t max_bytes
This is the max number of bytes to cache (0 = no limit)
 
std::vector< int64_t > ordered_frame_numbers
Ordered list of frame numbers used by cache.
 
This namespace is the default namespace for all code in the openshot library.
 
std::string json_ranges
JSON ranges of frame numbers.
 
All cache managers in libopenshot are based on this CacheBase class.
 
Header file for CacheBase class.
 
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 void SetJsonValue(const Json::Value root)=0
Load Json::Value into this object.
 
virtual Json::Value JsonValue()=0
Generate Json::Value for this object.
 
void CalculateRanges()
Calculate ranges of frames.
 
void SetMaxBytes(int64_t number_of_bytes)
Set maximum bytes to a different amount.
 
CacheBase()
Default constructor, no max bytes.
 
int64_t range_version
The version of the JSON range data (incremented with each change)
 
std::recursive_mutex * cacheMutex
Mutex for multiple threads.