began node hashing for improved cache

This commit is contained in:
itsmattkc
2019-09-02 12:06:24 +10:00
parent f2972651af
commit b563b9e783
7 changed files with 106 additions and 24 deletions
+16 -4
View File
@@ -195,10 +195,7 @@ FramePtr FFmpegDecoder::Retrieve(const rational &timecode, const rational &lengt
}
// Convert timecode to AVStream timebase
int64_t target_ts = qFloor(timecode.toDouble() * rational(avstream_->time_base).flipped().toDouble());
// Find closest actual timebase in the file
target_ts = GetClosestTimestampInIndex(target_ts);
int64_t target_ts = GetTimestampFromTime(timecode);
if (target_ts < 0) {
Error(tr("Index failed to produce a valid timestamp"));
@@ -323,6 +320,21 @@ QString FFmpegDecoder::id()
return "ffmpeg";
}
int64_t FFmpegDecoder::GetTimestampFromTime(const rational &time)
{
if (!open_ && !Open()) {
return -1;
}
// Convert timecode to AVStream timebase
int64_t target_ts = qFloor(time.toDouble() * rational(avstream_->time_base).flipped().toDouble());
// Find closest actual timebase in the file
target_ts = GetClosestTimestampInIndex(target_ts);
return target_ts;
}
bool FFmpegDecoder::Probe(Footage *f)
{
if (open_) {