nodes: fixed hashing issues
This commit is contained in:
@@ -114,12 +114,15 @@ void ClipBlock::Retranslate()
|
||||
SetInputName(kBufferIn, tr("Buffer"));
|
||||
}
|
||||
|
||||
void ClipBlock::Hash(const QString &output, QCryptographicHash &hash, const rational &time) const
|
||||
void ClipBlock::Hash(const QString &out, QCryptographicHash &hash, const rational &time) const
|
||||
{
|
||||
Q_UNUSED(out)
|
||||
|
||||
if (IsInputConnected(kBufferIn)) {
|
||||
rational t = InputTimeAdjustment(kBufferIn, -1, TimeRange(time, time)).in();
|
||||
|
||||
GetConnectedNode(kBufferIn)->Hash(output, hash, t);
|
||||
NodeOutput output = GetConnectedOutput(kBufferIn);
|
||||
output.node()->Hash(output.output(), hash, t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,13 +107,16 @@ void MergeNode::Hash(const QString &output, QCryptographicHash &hash, const rati
|
||||
// connected node happens to return nothing (a gap for instance). Therefore we only add our
|
||||
// fingerprint if the base AND the blend change the hash. Otherwise, we assume it's a passthrough.
|
||||
|
||||
Q_UNUSED(output)
|
||||
|
||||
QByteArray current_result = hash.result();
|
||||
|
||||
bool base_changed_hash = false;
|
||||
bool blend_changed_hash = false;
|
||||
|
||||
if (IsInputConnected(kBaseIn)) {
|
||||
GetConnectedNode(kBaseIn)->Hash(output, hash, time);
|
||||
NodeOutput base_output = GetConnectedOutput(kBaseIn);
|
||||
base_output.node()->Hash(base_output.output(), hash, time);
|
||||
|
||||
QByteArray post_base_hash = hash.result();
|
||||
base_changed_hash = (post_base_hash != current_result);
|
||||
@@ -121,7 +124,8 @@ void MergeNode::Hash(const QString &output, QCryptographicHash &hash, const rati
|
||||
}
|
||||
|
||||
if(IsInputConnected(kBlendIn)) {
|
||||
GetConnectedNode(kBlendIn)->Hash(output, hash, time);
|
||||
NodeOutput blend_output = GetConnectedOutput(kBlendIn);
|
||||
blend_output.node()->Hash(blend_output.output(), hash, time);
|
||||
|
||||
blend_changed_hash = (hash.result() != current_result);
|
||||
}
|
||||
|
||||
@@ -574,11 +574,13 @@ bool Track::IsLocked() const
|
||||
|
||||
void Track::Hash(const QString &output, QCryptographicHash &hash, const rational &time) const
|
||||
{
|
||||
Q_UNUSED(output)
|
||||
|
||||
Block* b = BlockAtTime(time);
|
||||
|
||||
// Defer to block at this time, don't add any of our own information to the hash
|
||||
if (b) {
|
||||
b->Hash(output, hash, TransformTimeForBlock(b, time));
|
||||
b->Hash(kDefaultOutput, hash, TransformTimeForBlock(b, time));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -302,27 +302,23 @@ void Footage::Hash(const QString& output, QCryptographicHash &hash, const ration
|
||||
{
|
||||
super::Hash(output, hash, time);
|
||||
|
||||
// Footage last modified date
|
||||
hash.addData(QString::number(timestamp()).toUtf8());
|
||||
|
||||
// Translate output ID to stream
|
||||
Track::Reference ref = Track::Reference::FromString(output);
|
||||
|
||||
QString fn = filename();
|
||||
|
||||
if (!fn.isEmpty()) {
|
||||
if (ref.type() == Track::kVideo) {
|
||||
VideoParams params = GetVideoParams(ref.index());
|
||||
|
||||
if (params.is_valid()) {
|
||||
// Add footage details to hash
|
||||
|
||||
// Footage filename
|
||||
hash.addData(filename().toUtf8());
|
||||
|
||||
// Footage last modified date
|
||||
hash.addData(QString::number(timestamp()).toUtf8());
|
||||
QString fn = filename();
|
||||
|
||||
// Footage stream
|
||||
hash.addData(QString::number(ref.index()).toUtf8());
|
||||
|
||||
if (ref.type() == Track::kVideo) {
|
||||
if (!fn.isEmpty()) {
|
||||
// Current color config and space
|
||||
hash.addData(project()->color_manager()->GetConfigFilename().toUtf8());
|
||||
hash.addData(GetColorspaceToUse(params).toUtf8());
|
||||
@@ -338,10 +334,11 @@ void Footage::Hash(const QString& output, QCryptographicHash &hash, const ration
|
||||
int64_t video_ts = Timecode::time_to_timestamp(time, params.time_base());
|
||||
|
||||
// Add timestamp in units of the video stream's timebase
|
||||
hash.addData(reinterpret_cast<const char*>(&video_ts), sizeof(int64_t));
|
||||
hash.addData(reinterpret_cast<const char*>(&video_ts), sizeof(video_ts));
|
||||
|
||||
// Add start time - used for both image sequences and video streams
|
||||
hash.addData(QString::number(params.start_time()).toUtf8());
|
||||
auto start_time = params.start_time();
|
||||
hash.addData(reinterpret_cast<const char*>(&start_time), sizeof(start_time));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user