From fdfe53c70036f61b2c8bf3393dea872d244885ce Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Fri, 13 Mar 2020 16:49:59 +1100 Subject: [PATCH] oiiodecoder: check for sequential images in sequence heuristic --- app/codec/oiio/oiiodecoder.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/app/codec/oiio/oiiodecoder.cpp b/app/codec/oiio/oiiodecoder.cpp index f4a1e33f3..ea7daff5c 100644 --- a/app/codec/oiio/oiiodecoder.cpp +++ b/app/codec/oiio/oiiodecoder.cpp @@ -62,17 +62,23 @@ bool OIIODecoder::Probe(Footage *f, const QAtomicInt *cancelled) return false; } + is_sequence_ = false; + // Heuristically determine whether this file is part of an image sequence or not if (GetImageSequenceDigitCount(f->filename()) > 0) { - // We need user feedback here and since UI must occur in the UI thread (and we could be in any thread), we defer - // to the Core which will definitely be in the UI thread and block here until we get an answer from the user - QMetaObject::invokeMethod(Core::instance(), - "ConfirmImageSequence", - Qt::BlockingQueuedConnection, - Q_RETURN_ARG(bool, is_sequence_), - Q_ARG(QString, f->filename())); - } else { - is_sequence_ = false; + int64_t ind = GetImageSequenceIndex(f->filename()); + + // Check if files around exist around it with that follow a sequence + if (QFileInfo::exists(TransformImageSequenceFileName(f->filename(), ind - 1)) + || QFileInfo::exists(TransformImageSequenceFileName(f->filename(), ind + 1))) { + // We need user feedback here and since UI must occur in the UI thread (and we could be in any thread), we defer + // to the Core which will definitely be in the UI thread and block here until we get an answer from the user + QMetaObject::invokeMethod(Core::instance(), + "ConfirmImageSequence", + Qt::BlockingQueuedConnection, + Q_RETURN_ARG(bool, is_sequence_), + Q_ARG(QString, f->filename())); + } } ImageStreamPtr image_stream;