From 383c0b6620b7ae726d8f5f7d04b3f50630629d53 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sun, 16 Aug 2020 17:31:56 +1000 Subject: [PATCH] node: hash based on stream timebase units --- app/node/node.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/node/node.cpp b/app/node/node.cpp index ec38c7fdb..f54822bfb 100644 --- a/app/node/node.cpp +++ b/app/node/node.cpp @@ -24,6 +24,7 @@ #include #include +#include "common/timecodefunctions.h" #include "common/xmlutils.h" #include "project/project.h" #include "project/item/footage/footage.h" @@ -378,11 +379,15 @@ void Node::Hash(QCryptographicHash &hash, const rational& time) const // Footage timestamp if (stream->type() == Stream::kVideo) { - hash.addData(QStringLiteral("%1/%2").arg(QString::number(input_time.numerator()), - QString::number(input_time.denominator())).toUtf8()); + VideoStreamPtr video_stream = std::static_pointer_cast(stream); - hash.addData(QString::number(static_cast(stream.get())->start_time()).toUtf8()); + int64_t video_ts = Timecode::time_to_timestamp(input_time, video_stream->timebase()); + // Add timestamp in units of the video stream's timebase + hash.addData(reinterpret_cast(&video_ts), sizeof(int64_t)); + + // Add start time - used for both image sequences and video streams + hash.addData(QString::number(video_stream->start_time()).toUtf8()); } } }