From f9b60538fcd54ad74b334514defc718ef33fe6e0 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sun, 11 Apr 2021 18:52:12 +1000 Subject: [PATCH] project: removed footage comparison code that had been stubbed anyway --- app/core.cpp | 4 +- .../footagerelink/footagerelinkdialog.cpp | 16 +-- app/node/project/footage/footage.cpp | 104 ------------------ app/node/project/footage/footage.h | 3 - 4 files changed, 10 insertions(+), 117 deletions(-) diff --git a/app/core.cpp b/app/core.cpp index 92df5c3e7..6b0cebd5c 100644 --- a/app/core.cpp +++ b/app/core.cpp @@ -1504,8 +1504,8 @@ bool Core::ValidateFootageInLoadedProject(Project* project, const QString& proje } } - // Heuristically compare footage to file - if (Footage::CompareFootageToItsFilename(footage)) { + if (QFileInfo::exists(footage->filename())) { + // Assume valid footage->SetValid(); } else { footage_we_couldnt_validate.append(footage); diff --git a/app/dialog/footagerelink/footagerelinkdialog.cpp b/app/dialog/footagerelink/footagerelinkdialog.cpp index 7c3cf9c4e..be04e097b 100644 --- a/app/dialog/footagerelink/footagerelinkdialog.cpp +++ b/app/dialog/footagerelink/footagerelinkdialog.cpp @@ -114,13 +114,14 @@ void FootageRelinkDialog::BrowseForFootage() // Set new filename since this was set manually by the user f->set_filename(new_fn); - if (Footage::CompareFootageToItsFilename(f)) { - // Set footage to valid and update icon - f->SetValid(); + // Assume footage is valid here. We could do some decoder probing to ensure it's a usable file + // but otherwise we assume the user knows what they're doing here. - // Update item visually - UpdateFootageItem(index); - } + // Set footage to valid and update icon + f->SetValid(); + + // Update item visually + UpdateFootageItem(index); // Check all other footage files for matches for (int it=0; itset_filename(absolute_to_new); other_footage->SetValid(); UpdateFootageItem(it); diff --git a/app/node/project/footage/footage.cpp b/app/node/project/footage/footage.cpp index 1642d1e73..83e9e4eb4 100644 --- a/app/node/project/footage/footage.cpp +++ b/app/node/project/footage/footage.cpp @@ -298,41 +298,6 @@ QString Footage::DescribeAudioStream(const AudioParams ¶ms) QString::number(params.sample_rate())); } -bool Footage::CompareFootageToFile(Footage *footage, const QString &filename) -{ - // Heuristic to determine if file has changed - QFileInfo info(filename); - - if (info.exists()) { - /*if (info.lastModified().toMSecsSinceEpoch() == footage->timestamp()) { - // Footage has not been modified and is where we expect - return true; - } else { - // Footage may have changed and we'll have to re-probe it. It also may not have, in which - // case nothing needs to change. - DecoderPtr decoder = Decoder::CreateFromID(footage->decoder()); - - Streams probed_streams = decoder->Probe(filename, nullptr); - - if (probed_streams == footage->streams_) { - return true; - } - }*/ - Q_UNUSED(footage) - - // Simplified, since our footage node is much more tolerant, we'll try this - return true; - } - - // Footage file couldn't be found or resolved to something we didn't expect - return false; -} - -bool Footage::CompareFootageToItsFilename(Footage *footage) -{ - return CompareFootageToFile(footage, footage->filename()); -} - void Footage::Hash(const QString& output, QCryptographicHash &hash, const rational &time) const { super::Hash(output, hash, time); @@ -490,58 +455,6 @@ void Footage::UpdateTooltip() } } -/*void Footage::AddStreamAsInput(Track::Type type, int index, QVariant value) -{ - QString input_id = GetInputIDOfIndex(type, index); - - Track::Reference ref(type, index); - - // Create input for parameters - NodeValue::Type value_type; - uint64_t param_mask = 0; - - if (type == Track::kVideo) { - VideoParams vp = value.value(); - value_type = NodeValue::kVideoParams; - - // Universal parameters for video/image footage - param_mask |= VideoParamEdit::kEnabled; - param_mask |= VideoParamEdit::kColorspace; - param_mask |= VideoParamEdit::kPixelAspect; - param_mask |= VideoParamEdit::kInterlacing; - - if (vp.channel_count() == VideoParams::kRGBAChannelCount) { - // If this has an alpha channel, add a premultiplied optino - param_mask |= VideoParamEdit::kPremultipliedAlpha; - } - - if (vp.video_type() != VideoParams::kVideoTypeVideo) { - // This is either a still image or an image sequence, add properties for those - param_mask |= VideoParamEdit::kIsImageSequence; - param_mask |= VideoParamEdit::kStartTime; - param_mask |= VideoParamEdit::kEndTime; - param_mask |= VideoParamEdit::kFrameRate; - } else { - // Ensure timebase isn't overwritten by the frame rate field - param_mask |= VideoParamEdit::kFrameRateIsNotTimebase; - } - } else { - value_type = NodeValue::kAudioParams; - param_mask = 0; - } - - AddInput(input_id, value_type, - InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable)); - SetStandardValue(input_id, value); - SetInputProperty(input_id, QStringLiteral("mask"), QVariant::fromValue(param_mask)); - inputs_for_stream_properties_.insert(ref, input_id); - - // Create output for stream - QString output_id = Track::Reference(type, index).ToString(); - AddOutput(output_id); - outputs_for_streams_.insert(ref, output_id); -}*/ - void Footage::CheckFootage() { QString fn = filename(); @@ -559,21 +472,4 @@ void Footage::CheckFootage() } } -/*QString Track::Reference::video_colorspace(bool default_if_empty) const -{ - if (IsValid()) { - VideoParams params = footage_->GetVideoParams(index_); - - if (params.is_valid()) { - if (params.colorspace().isEmpty() && default_if_empty) { - - } else { - return params.colorspace(); - } - } - } - - return QString(); -}*/ - } diff --git a/app/node/project/footage/footage.h b/app/node/project/footage/footage.h index 96336a737..153880987 100644 --- a/app/node/project/footage/footage.h +++ b/app/node/project/footage/footage.h @@ -170,9 +170,6 @@ public: static QString DescribeVideoStream(const VideoParams& params); static QString DescribeAudioStream(const AudioParams& params); - static bool CompareFootageToFile(Footage* footage, const QString& filename); - static bool CompareFootageToItsFilename(Footage* footage); - virtual void Hash(const QString& output, QCryptographicHash &hash, const rational &time) const override; virtual NodeValueTable Value(const QString &output, NodeValueDatabase& value) const override;