transition: reworked hashing
This commit is contained in:
@@ -215,6 +215,20 @@ void Block::LinkChangeEvent()
|
||||
}
|
||||
}
|
||||
|
||||
bool Block::HashPassthrough(const QString &input, const QString &output, QCryptographicHash &hash, const rational &time, const VideoParams &video_params) const
|
||||
{
|
||||
if (IsInputConnected(input)) {
|
||||
rational t = InputTimeAdjustment(input, -1, TimeRange(time, time)).in();
|
||||
|
||||
NodeOutput output = GetConnectedOutput(input);
|
||||
output.node()->Hash(output.output(), hash, t, video_params);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Block::set_length_internal(const rational &length)
|
||||
{
|
||||
SetStandardValue(kLengthInput, QVariant::fromValue(length));
|
||||
|
||||
@@ -179,6 +179,8 @@ protected:
|
||||
|
||||
virtual void LinkChangeEvent() override;
|
||||
|
||||
bool HashPassthrough(const QString &input, const QString& output, QCryptographicHash &hash, const rational &time, const VideoParams& video_params) const;
|
||||
|
||||
Block* previous_;
|
||||
Block* next_;
|
||||
|
||||
|
||||
@@ -117,14 +117,7 @@ void ClipBlock::Retranslate()
|
||||
|
||||
void ClipBlock::Hash(const QString &out, QCryptographicHash &hash, const rational &time, const VideoParams &video_params) const
|
||||
{
|
||||
Q_UNUSED(out)
|
||||
|
||||
if (IsInputConnected(kBufferIn)) {
|
||||
rational t = InputTimeAdjustment(kBufferIn, -1, TimeRange(time, time)).in();
|
||||
|
||||
NodeOutput output = GetConnectedOutput(kBufferIn);
|
||||
output.node()->Hash(output.output(), hash, t, video_params);
|
||||
}
|
||||
HashPassthrough(kBufferIn, out, hash, time, video_params);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -121,16 +121,18 @@ double TransitionBlock::GetInProgress(const double &time) const
|
||||
|
||||
void TransitionBlock::Hash(const QString &output, QCryptographicHash &hash, const rational &time, const VideoParams &video_params) const
|
||||
{
|
||||
Node::Hash(output, hash, time, video_params);
|
||||
if (HashPassthrough(kInBlockInput, output, hash, time, video_params) || HashPassthrough(kOutBlockInput, output, hash, time, video_params)) {
|
||||
HashAddNodeSignature(hash, output);
|
||||
|
||||
double time_dbl = time.toDouble();
|
||||
double all_prog = GetTotalProgress(time_dbl);
|
||||
double in_prog = GetInProgress(time_dbl);
|
||||
double out_prog = GetOutProgress(time_dbl);
|
||||
double time_dbl = time.toDouble();
|
||||
double all_prog = GetTotalProgress(time_dbl);
|
||||
double in_prog = GetInProgress(time_dbl);
|
||||
double out_prog = GetOutProgress(time_dbl);
|
||||
|
||||
hash.addData(reinterpret_cast<const char*>(&all_prog), sizeof(double));
|
||||
hash.addData(reinterpret_cast<const char*>(&in_prog), sizeof(double));
|
||||
hash.addData(reinterpret_cast<const char*>(&out_prog), sizeof(double));
|
||||
hash.addData(reinterpret_cast<const char*>(&all_prog), sizeof(all_prog));
|
||||
hash.addData(reinterpret_cast<const char*>(&in_prog), sizeof(in_prog));
|
||||
hash.addData(reinterpret_cast<const char*>(&out_prog), sizeof(out_prog));
|
||||
}
|
||||
}
|
||||
|
||||
double TransitionBlock::GetInternalTransitionTime(const double &time) const
|
||||
|
||||
Reference in New Issue
Block a user