![]() |
ApraPipes 1.0
|
#include <OrderedCacheOfFiles.h>
Classes | |
struct | CacheIteratorState |
struct | Video |
struct | videoPath |
struct | videoTS |
Public Member Functions | |
OrderedCacheOfFiles (std::string &video_folder, uint32_t initial_batch_size=1440, uint32_t _lowerWaterMark=1441, uint32_t _upperWaterMark=2880) | |
~OrderedCacheOfFiles () | |
void | updateBatchSize (uint32_t _batchSize) |
void | cleanCacheOnSeperateThread (bool flag) |
void | deleteLostEntry (std::string &filePath) |
uint64_t | getFileDuration (std::string &filename) |
std::string | getFileAt (uint64_t timestamp, bool direction) |
bool | isTimeStampInFile (std::string &filename, uint64_t timestamp) |
std::string | getNextFileAfter (std::string ¤tFile, bool direction) |
std::vector< boost::filesystem::path > | parseAndSortDateDir (const std::string &rootDir) |
std::vector< boost::filesystem::path > | parseAndSortHourDir (const std::string &rootDir) |
std::vector< boost::filesystem::path > | parseAndSortMp4Files (const std::string &rootDir) |
bool | parseFiles (uint64_t start_ts, bool direction, bool includeFloorFile=false, bool disableBatchSizeCheck=false, uint64_t skipTS=0) |
bool | getRandomSeekFile (uint64_t ts, bool direction, uint64_t &skipMsecs, std::string &fileName) |
bool | getFileFromCache (uint64_t timestamp, bool direction, std::string &fileName) |
size_t | getCacheSize () |
bool | fetchAndUpdateFromDisk (std::string videoFile, uint64_t &start_ts, uint64_t &end_ts) |
bool | fetchFromCache (std::string &videoFile, uint64_t &start_ts, uint64_t &end_ts) |
void | readVideoStartEnd (std::string &filePath, uint64_t &start_ts, uint64_t &end_ts) |
void | clearCache () |
bool | refreshCache () |
std::string | getLastVideoInCache () |
void | updateCache (std::string &filePath, uint64_t &start_ts, uint64_t &end_ts) |
std::map< std::string, std::pair< uint64_t, uint64_t > > | getSnapShot () |
bool | probe (boost::filesystem::path dirPath, std::string &videoName) |
bool | getPreviousAndNextFile (std::string videoPath, std::string &previousFile, std::string &nextFile) |
Private Types | |
typedef boost::multi_index_container< Video, bmi::indexed_by< bmi::ordered_unique< bmi::tag< videoPath >, bmi::member< Video, std::string, &Video::path > >, bmi::ordered_non_unique< bmi::tag< videoTS >, bmi::member< Video, uint64_t, &Video::start_ts > > > > | VideoCache |
Private Member Functions | |
bool | filePatternCheck (const fs::path &path) |
bool | datePatternCheck (const boost::filesystem::path &path) |
bool | hourPatternCheck (const boost::filesystem::path &path) |
void | insertInVideoCache (Video vid) |
void | retireOldFiles (uint64_t startTSofRelevantFile) |
void | dropFarthestFromTS (uint64_t startTS) |
Private Attributes | |
bool | lastKnownPlaybackDir = true |
boost::mutex | m_mutex |
boost::shared_ptr< boost::thread > | mThread = nullptr |
int | cacheSize = 1440 |
int | batchSize = 1440 |
std::string | rootDir = "" |
uint32_t | lowerWaterMark |
uint32_t | upperWaterMark |
bool | cleanCacheOnMainThread = true |
struct OrderedCacheOfFiles::CacheIteratorState | cacheIteratorState |
VideoCache | videoCache |
VideoCache::index< videoTS >::type & | videoCacheStartTSIndex = videoCache.get<videoTS>() |
|
private |
OrderedCacheOfFiles::OrderedCacheOfFiles | ( | std::string & | video_folder, |
uint32_t | initial_batch_size = 1440, | ||
uint32_t | _lowerWaterMark = 1441, | ||
uint32_t | _upperWaterMark = 2880 ) |
|
inline |
|
inline |
void OrderedCacheOfFiles::clearCache | ( | ) |
|
private |
void OrderedCacheOfFiles::deleteLostEntry | ( | std::string & | filePath | ) |
|
private |
bool OrderedCacheOfFiles::fetchAndUpdateFromDisk | ( | std::string | videoFile, |
uint64_t & | start_ts, | ||
uint64_t & | end_ts ) |
bool OrderedCacheOfFiles::fetchFromCache | ( | std::string & | videoFile, |
uint64_t & | start_ts, | ||
uint64_t & | end_ts ) |
|
private |
|
inline |
std::string OrderedCacheOfFiles::getFileAt | ( | uint64_t | timestamp, |
bool | direction ) |
uint64_t OrderedCacheOfFiles::getFileDuration | ( | std::string & | filename | ) |
bool OrderedCacheOfFiles::getFileFromCache | ( | uint64_t | timestamp, |
bool | direction, | ||
std::string & | fileName ) |
|
inline |
std::string OrderedCacheOfFiles::getNextFileAfter | ( | std::string & | currentFile, |
bool | direction ) |
bool OrderedCacheOfFiles::getPreviousAndNextFile | ( | std::string | videoPath, |
std::string & | previousFile, | ||
std::string & | nextFile ) |
bool OrderedCacheOfFiles::getRandomSeekFile | ( | uint64_t | ts, |
bool | direction, | ||
uint64_t & | skipMsecs, | ||
std::string & | fileName ) |
std::map< std::string, std::pair< uint64_t, uint64_t > > OrderedCacheOfFiles::getSnapShot | ( | ) |
|
private |
|
private |
bool OrderedCacheOfFiles::isTimeStampInFile | ( | std::string & | filename, |
uint64_t | timestamp ) |
std::vector< boost::filesystem::path > OrderedCacheOfFiles::parseAndSortDateDir | ( | const std::string & | rootDir | ) |
std::vector< boost::filesystem::path > OrderedCacheOfFiles::parseAndSortHourDir | ( | const std::string & | rootDir | ) |
std::vector< boost::filesystem::path > OrderedCacheOfFiles::parseAndSortMp4Files | ( | const std::string & | rootDir | ) |
bool OrderedCacheOfFiles::parseFiles | ( | uint64_t | start_ts, |
bool | direction, | ||
bool | includeFloorFile = false, | ||
bool | disableBatchSizeCheck = false, | ||
uint64_t | skipTS = 0 ) |
bool OrderedCacheOfFiles::probe | ( | boost::filesystem::path | dirPath, |
std::string & | videoName ) |
void OrderedCacheOfFiles::readVideoStartEnd | ( | std::string & | filePath, |
uint64_t & | start_ts, | ||
uint64_t & | end_ts ) |
bool OrderedCacheOfFiles::refreshCache | ( | ) |
|
private |
|
inline |
void OrderedCacheOfFiles::updateCache | ( | std::string & | filePath, |
uint64_t & | start_ts, | ||
uint64_t & | end_ts ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |