cache: attempt to automatically re-match hashes on invalidate
This code is slow and unoptimized. Will require some more work.
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "codec/frame.h"
|
||||
#include "common/filefunctions.h"
|
||||
#include "common/timecodefunctions.h"
|
||||
#include "render/diskmanager.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
@@ -104,6 +105,36 @@ QString FrameHashCache::GetFormatExtension(const PixelFormat::Format &f)
|
||||
}
|
||||
}
|
||||
|
||||
QList<rational> FrameHashCache::GetFrameListFromTimeRange(TimeRangeList range_list, const rational &timebase)
|
||||
{
|
||||
QList<rational> times;
|
||||
|
||||
while (!range_list.isEmpty()) {
|
||||
const TimeRange& range = range_list.first();
|
||||
|
||||
rational time = range.in();
|
||||
rational snapped = Timecode::snap_time_to_timebase(time, timebase);
|
||||
rational next;
|
||||
|
||||
if (snapped > time) {
|
||||
next = snapped;
|
||||
snapped -= timebase;
|
||||
} else {
|
||||
next = snapped + timebase;
|
||||
}
|
||||
|
||||
times.append(snapped);
|
||||
range_list.RemoveTimeRange(TimeRange(snapped, next));
|
||||
}
|
||||
|
||||
return times;
|
||||
}
|
||||
|
||||
QList<rational> FrameHashCache::GetFrameListFromTimeRange(const TimeRangeList &range) const
|
||||
{
|
||||
return GetFrameListFromTimeRange(range, timebase_);
|
||||
}
|
||||
|
||||
void FrameHashCache::SaveCacheFrame(const QByteArray& hash,
|
||||
char* data,
|
||||
const VideoRenderingParams& vparam)
|
||||
|
||||
Reference in New Issue
Block a user