furthered development of audio renderers
Mostly reimplementing functions from other workers to produce audio samples
This commit is contained in:
@@ -12,31 +12,31 @@ VideoRenderFrameCache::VideoRenderFrameCache()
|
||||
|
||||
bool VideoRenderFrameCache::HasHash(const QByteArray &hash)
|
||||
{
|
||||
return QFileInfo::exists(CachePathName(hash));
|
||||
return QFileInfo::exists(CachePathName(hash)) && !IsCaching(hash);
|
||||
}
|
||||
|
||||
bool VideoRenderFrameCache::IsCaching(const QByteArray &hash)
|
||||
{
|
||||
cache_hash_list_mutex_.lock();
|
||||
currently_caching_lock_.lock();
|
||||
|
||||
bool is_caching = cache_hash_list_.contains(hash);
|
||||
bool is_caching = currently_caching_list_.contains(hash);
|
||||
|
||||
cache_hash_list_mutex_.unlock();
|
||||
currently_caching_lock_.unlock();
|
||||
|
||||
return is_caching;
|
||||
}
|
||||
|
||||
bool VideoRenderFrameCache::TryCache(const QByteArray &hash)
|
||||
{
|
||||
cache_hash_list_mutex_.lock();
|
||||
currently_caching_lock_.lock();
|
||||
|
||||
bool is_caching = cache_hash_list_.contains(hash);
|
||||
bool is_caching = currently_caching_list_.contains(hash);
|
||||
|
||||
if (!is_caching) {
|
||||
cache_hash_list_.append(hash);
|
||||
currently_caching_list_.append(hash);
|
||||
}
|
||||
|
||||
cache_hash_list_mutex_.unlock();
|
||||
currently_caching_lock_.unlock();
|
||||
|
||||
return !is_caching;
|
||||
}
|
||||
@@ -51,6 +51,29 @@ QByteArray VideoRenderFrameCache::TimeToHash(const rational &time)
|
||||
return time_hash_map_.value(time);
|
||||
}
|
||||
|
||||
void VideoRenderFrameCache::SetHash(const rational &time, const QByteArray &hash)
|
||||
{
|
||||
// No longer currently caching this frame
|
||||
RemoveHashFromCurrentlyCaching(hash);
|
||||
|
||||
// Insert frame into map
|
||||
time_hash_map_.insert(time, hash);
|
||||
}
|
||||
|
||||
void VideoRenderFrameCache::RemoveHash(const rational &time)
|
||||
{
|
||||
RemoveHashFromCurrentlyCaching(time_hash_map_.value(time));
|
||||
|
||||
time_hash_map_.remove(time);
|
||||
}
|
||||
|
||||
void VideoRenderFrameCache::RemoveHashFromCurrentlyCaching(const QByteArray &hash)
|
||||
{
|
||||
currently_caching_lock_.lock();
|
||||
currently_caching_list_.removeOne(hash);
|
||||
currently_caching_lock_.unlock();
|
||||
}
|
||||
|
||||
QString VideoRenderFrameCache::CachePathName(const QByteArray &hash)
|
||||
{
|
||||
QDir this_cache_dir = QDir(GetMediaCacheLocation()).filePath(cache_id_);
|
||||
|
||||
Reference in New Issue
Block a user