various: greatly simplified job times
Hopefully this doesn't break everything
This commit is contained in:
@@ -36,6 +36,8 @@ set(OLIVE_SOURCES
|
||||
common/flipmodifiers.cpp
|
||||
common/flipmodifiers.h
|
||||
common/functiontimer.h
|
||||
common/jobtime.cpp
|
||||
common/jobtime.h
|
||||
common/lerp.h
|
||||
common/memorypool.h
|
||||
common/ocioutils.cpp
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#include "jobtime.h"
|
||||
|
||||
#include <QMutex>
|
||||
|
||||
namespace olive {
|
||||
|
||||
uint64_t job_time_index = 0;
|
||||
QMutex job_time_mutex;
|
||||
|
||||
JobTime::JobTime()
|
||||
{
|
||||
Acquire();
|
||||
}
|
||||
|
||||
void JobTime::Acquire()
|
||||
{
|
||||
job_time_mutex.lock();
|
||||
|
||||
value_ = job_time_index;
|
||||
job_time_index++;
|
||||
|
||||
job_time_mutex.unlock();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const olive::JobTime& r)
|
||||
{
|
||||
return debug.space() << r.value();
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
#ifndef JOBTIME_H
|
||||
#define JOBTIME_H
|
||||
|
||||
#include <QDebug>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace olive {
|
||||
|
||||
class JobTime
|
||||
{
|
||||
public:
|
||||
JobTime();
|
||||
|
||||
void Acquire();
|
||||
|
||||
uint64_t value() const
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
bool operator==(const JobTime &rhs) const
|
||||
{
|
||||
return value_ == rhs.value_;
|
||||
}
|
||||
|
||||
bool operator!=(const JobTime &rhs) const
|
||||
{
|
||||
return value_ != rhs.value_;
|
||||
}
|
||||
|
||||
bool operator<(const JobTime &rhs) const
|
||||
{
|
||||
return value_ < rhs.value_;
|
||||
}
|
||||
|
||||
bool operator>(const JobTime &rhs) const
|
||||
{
|
||||
return value_ > rhs.value_;
|
||||
}
|
||||
|
||||
bool operator<=(const JobTime &rhs) const
|
||||
{
|
||||
return value_ <= rhs.value_;
|
||||
}
|
||||
|
||||
bool operator>=(const JobTime &rhs) const
|
||||
{
|
||||
return value_ >= rhs.value_;
|
||||
}
|
||||
|
||||
private:
|
||||
uint64_t value_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const olive::JobTime& r);
|
||||
|
||||
Q_DECLARE_METATYPE(olive::JobTime)
|
||||
|
||||
#endif // JOBTIME_H
|
||||
@@ -53,7 +53,7 @@ QString ClipBlock::Description() const
|
||||
return tr("A time-based node that represents a media source.");
|
||||
}
|
||||
|
||||
void ClipBlock::InvalidateCache(const TimeRange& range, const QString& from, int element, qint64 job_time)
|
||||
void ClipBlock::InvalidateCache(const TimeRange& range, const QString& from, int element)
|
||||
{
|
||||
Q_UNUSED(element)
|
||||
|
||||
@@ -63,10 +63,10 @@ void ClipBlock::InvalidateCache(const TimeRange& range, const QString& from, int
|
||||
rational start = MediaToSequenceTime(range.in());
|
||||
rational end = MediaToSequenceTime(range.out());
|
||||
|
||||
super::InvalidateCache(TimeRange(start, end), from, element, job_time);
|
||||
super::InvalidateCache(TimeRange(start, end), from, element);
|
||||
} else {
|
||||
// Otherwise, pass signal along normally
|
||||
super::InvalidateCache(range, from, element, job_time);
|
||||
super::InvalidateCache(range, from, element);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
virtual QString id() const override;
|
||||
virtual QString Description() const override;
|
||||
|
||||
virtual void InvalidateCache(const TimeRange& range, const QString& from, int element, qint64 job_time) override;
|
||||
virtual void InvalidateCache(const TimeRange& range, const QString& from, int element) override;
|
||||
|
||||
virtual TimeRange InputTimeAdjustment(const QString& input, int element, const TimeRange& input_time) const override;
|
||||
|
||||
|
||||
+4
-18
@@ -46,7 +46,6 @@ const QString Node::kDefaultOutput = QStringLiteral("output");
|
||||
Node::Node(bool create_default_output) :
|
||||
can_be_deleted_(true),
|
||||
override_color_(-1),
|
||||
last_change_time_(0),
|
||||
folder_(nullptr),
|
||||
operation_stack_(0),
|
||||
cache_result_(false)
|
||||
@@ -263,9 +262,6 @@ void Node::ConnectEdge(const NodeOutput &output, const NodeInput &input)
|
||||
input.node()->input_connections_[input] = output;
|
||||
output.node()->output_connections_.push_back(std::pair<NodeOutput, NodeInput>({output, input}));
|
||||
|
||||
// Update change times
|
||||
input.node()->UpdateLastChangedTime();
|
||||
|
||||
// Call internal events
|
||||
input.node()->InputConnectedEvent(input.input(), input.element(), output);
|
||||
output.node()->OutputConnectedEvent(output.output(), input);
|
||||
@@ -295,9 +291,6 @@ void Node::DisconnectEdge(const NodeOutput &output, const NodeInput &input)
|
||||
OutputConnections& outputs = output.node()->output_connections_;
|
||||
outputs.erase(std::find(outputs.begin(), outputs.end(), std::pair<NodeOutput, NodeInput>({output, input})));
|
||||
|
||||
// Update change times
|
||||
input.node()->UpdateLastChangedTime();
|
||||
|
||||
// Call internal events
|
||||
input.node()->InputDisconnectedEvent(input.input(), input.element(), output);
|
||||
output.node()->OutputDisconnectedEvent(output.output(), input);
|
||||
@@ -1026,12 +1019,12 @@ NodeValueTable Node::Value(const QString& output, NodeValueDatabase &value) cons
|
||||
return value.Merge();
|
||||
}
|
||||
|
||||
void Node::InvalidateCache(const TimeRange &range, const QString &from, int element, qint64 job_time)
|
||||
void Node::InvalidateCache(const TimeRange &range, const QString &from, int element)
|
||||
{
|
||||
Q_UNUSED(from)
|
||||
Q_UNUSED(element)
|
||||
|
||||
SendInvalidateCache(range, job_time);
|
||||
SendInvalidateCache(range);
|
||||
}
|
||||
|
||||
void Node::BeginOperation()
|
||||
@@ -1180,14 +1173,14 @@ Node *Node::CopyNodeInGraph(const Node *node, MultiUndoCommand *command)
|
||||
return copy;
|
||||
}
|
||||
|
||||
void Node::SendInvalidateCache(const TimeRange &range, qint64 job_time)
|
||||
void Node::SendInvalidateCache(const TimeRange &range)
|
||||
{
|
||||
if (GetOperationStack() == 0) {
|
||||
for (const OutputConnection& conn : output_connections_) {
|
||||
// Send clear cache signal to the Node
|
||||
const NodeInput& in = conn.second;
|
||||
|
||||
in.node()->InvalidateCache(range, in.input(), in.element(), job_time);
|
||||
in.node()->InvalidateCache(range, in.input(), in.element());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1826,8 +1819,6 @@ QVariant Node::PtrToValue(void *ptr)
|
||||
|
||||
void Node::ParameterValueChanged(const QString& input, int element, const TimeRange& range)
|
||||
{
|
||||
UpdateLastChangedTime();
|
||||
|
||||
InputValueChangedEvent(input, element);
|
||||
|
||||
emit ValueChanged(NodeInput(this, input, element), range);
|
||||
@@ -2019,11 +2010,6 @@ void Node::SaveImmediate(QXmlStreamWriter *writer, const QString& input, int ele
|
||||
}
|
||||
}
|
||||
|
||||
void Node::UpdateLastChangedTime()
|
||||
{
|
||||
last_change_time_ = QDateTime::currentMSecsSinceEpoch();
|
||||
}
|
||||
|
||||
TimeRange Node::GetRangeAffectedByKeyframe(NodeKeyframe *key) const
|
||||
{
|
||||
const NodeKeyframeTrack& key_track = GetTrackFromKeyframe(key);
|
||||
|
||||
+3
-11
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <map>
|
||||
#include <QCryptographicHash>
|
||||
#include <QMutex>
|
||||
#include <QObject>
|
||||
#include <QPainter>
|
||||
#include <QPointF>
|
||||
@@ -631,12 +632,7 @@ public:
|
||||
* the DAG. Even if the time needs to be transformed somehow (e.g. converting media time to sequence time), you can
|
||||
* call this function with transformed time and relay the signal that way.
|
||||
*/
|
||||
virtual void InvalidateCache(const TimeRange& range, const QString& from, int element, qint64 job_time);
|
||||
|
||||
void InvalidateCache(const TimeRange& range, const QString& from, int element = -1)
|
||||
{
|
||||
InvalidateCache(range, from, element, last_change_time_);
|
||||
}
|
||||
virtual void InvalidateCache(const TimeRange& range, const QString& from, int element = -1);
|
||||
|
||||
void InvalidateCache(const TimeRange& range, const NodeInput& from)
|
||||
{
|
||||
@@ -886,7 +882,7 @@ protected:
|
||||
SetInputProperty(id, QStringLiteral("combo_str"), strings);
|
||||
}
|
||||
|
||||
void SendInvalidateCache(const TimeRange &range, qint64 job_time);
|
||||
void SendInvalidateCache(const TimeRange &range);
|
||||
|
||||
/**
|
||||
* @brief Don't send cache invalidation signals if `input` is connected or disconnected
|
||||
@@ -1154,8 +1150,6 @@ private:
|
||||
|
||||
void SaveImmediate(QXmlStreamWriter *writer, const QString &input, int element) const;
|
||||
|
||||
void UpdateLastChangedTime();
|
||||
|
||||
/**
|
||||
* @brief Intelligently determine how what time range is affected by a keyframe
|
||||
*/
|
||||
@@ -1205,8 +1199,6 @@ private:
|
||||
|
||||
OutputConnections output_connections_;
|
||||
|
||||
qint64 last_change_time_;
|
||||
|
||||
QString tooltip_;
|
||||
|
||||
Folder* folder_;
|
||||
|
||||
@@ -431,7 +431,7 @@ QVector<Block *> Track::BlocksAtTimeRange(const TimeRange &range) const
|
||||
return list;
|
||||
}
|
||||
|
||||
void Track::InvalidateCache(const TimeRange& range, const QString& from, int element, qint64 job_time)
|
||||
void Track::InvalidateCache(const TimeRange& range, const QString& from, int element)
|
||||
{
|
||||
if (GetOperationStack() != 0) {
|
||||
return;
|
||||
@@ -455,7 +455,7 @@ void Track::InvalidateCache(const TimeRange& range, const QString& from, int ele
|
||||
preop_track_length_ = track_length_;
|
||||
}
|
||||
|
||||
Node::InvalidateCache(limited, from, element, job_time);
|
||||
Node::InvalidateCache(limited, from, element);
|
||||
}
|
||||
|
||||
void Track::InsertBlockBefore(Block* block, Block* after)
|
||||
|
||||
@@ -286,7 +286,7 @@ public:
|
||||
return blocks_;
|
||||
}
|
||||
|
||||
virtual void InvalidateCache(const TimeRange& range, const QString& from, int element, qint64 job_time) override;
|
||||
virtual void InvalidateCache(const TimeRange& range, const QString& from, int element) override;
|
||||
|
||||
/**
|
||||
* @brief Adds Block `block` at the very beginning of the Sequence before all other clips
|
||||
|
||||
@@ -222,7 +222,7 @@ void ViewerOutput::ShiftCache(const rational &from, const rational &to)
|
||||
ShiftAudioCache(from, to);
|
||||
}
|
||||
|
||||
void ViewerOutput::InvalidateCache(const TimeRange& range, const QString& from, int element, qint64 job_time)
|
||||
void ViewerOutput::InvalidateCache(const TimeRange& range, const QString& from, int element)
|
||||
{
|
||||
Q_UNUSED(element)
|
||||
|
||||
@@ -233,16 +233,16 @@ void ViewerOutput::InvalidateCache(const TimeRange& range, const QString& from,
|
||||
|
||||
if (invalidated_range.in() != invalidated_range.out()) {
|
||||
if (from == kTextureInput || from == kVideoParamsInput) {
|
||||
video_frame_cache_.Invalidate(invalidated_range, job_time);
|
||||
video_frame_cache_.Invalidate(invalidated_range);
|
||||
} else {
|
||||
audio_playback_cache_.Invalidate(invalidated_range, job_time);
|
||||
audio_playback_cache_.Invalidate(invalidated_range);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VerifyLength();
|
||||
|
||||
super::InvalidateCache(range, from, element, job_time);
|
||||
super::InvalidateCache(range, from, element);
|
||||
}
|
||||
|
||||
QVector<QString> ViewerOutput::inputs_for_output(const QString &output) const
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
void ShiftAudioCache(const rational& from, const rational& to);
|
||||
void ShiftCache(const rational& from, const rational& to);
|
||||
|
||||
virtual void InvalidateCache(const TimeRange& range, const QString& from, int element, qint64 job_time) override;
|
||||
virtual void InvalidateCache(const TimeRange& range, const QString& from, int element) override;
|
||||
|
||||
virtual QVector<QString> inputs_for_output(const QString& output) const override;
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ void AudioPlaybackCache::SetParameters(const AudioParams ¶ms)
|
||||
emit ParametersChanged();
|
||||
}
|
||||
|
||||
void AudioPlaybackCache::WritePCM(const TimeRange &range, SampleBufferPtr samples, const AudioVisualWaveform *waveform, const qint64 &job_time)
|
||||
void AudioPlaybackCache::WritePCM(const TimeRange &range, SampleBufferPtr samples, const AudioVisualWaveform *waveform, const JobTime &job_time)
|
||||
{
|
||||
QList<TimeRange> valid_ranges = GetValidRanges(range, job_time);
|
||||
if (valid_ranges.isEmpty()) {
|
||||
@@ -154,7 +154,7 @@ void AudioPlaybackCache::WritePCM(const TimeRange &range, SampleBufferPtr sample
|
||||
}
|
||||
}
|
||||
|
||||
void AudioPlaybackCache::WriteSilence(const TimeRange &range, qint64 job_time)
|
||||
void AudioPlaybackCache::WriteSilence(const TimeRange &range, JobTime job_time)
|
||||
{
|
||||
// WritePCM will automatically fill non-existent bytes with silence, so we just have to send
|
||||
// it an empty sample buffer
|
||||
@@ -391,7 +391,7 @@ void AudioPlaybackCache::UpdateOffsetsFrom(int index)
|
||||
}
|
||||
}
|
||||
|
||||
QList<TimeRange> AudioPlaybackCache::GetValidRanges(const TimeRange& range, const qint64& job_time)
|
||||
QList<TimeRange> AudioPlaybackCache::GetValidRanges(const TimeRange& range, const JobTime& job_time)
|
||||
{
|
||||
QList<TimeRange> valid_ranges;
|
||||
|
||||
|
||||
@@ -66,11 +66,11 @@ public:
|
||||
|
||||
void SetParameters(const AudioParams& params);
|
||||
|
||||
void WritePCM(const TimeRange &range, SampleBufferPtr samples, const AudioVisualWaveform *waveform, const qint64& job_time);
|
||||
void WritePCM(const TimeRange &range, SampleBufferPtr samples, const AudioVisualWaveform *waveform, const JobTime& job_time);
|
||||
|
||||
void WriteSilence(const TimeRange &range, qint64 job_time);
|
||||
void WriteSilence(const TimeRange &range, JobTime job_time);
|
||||
|
||||
QList<TimeRange> GetValidRanges(const TimeRange &range, const qint64 &job_time);
|
||||
QList<TimeRange> GetValidRanges(const TimeRange &range, const JobTime &job_time);
|
||||
|
||||
class Segment
|
||||
{
|
||||
|
||||
@@ -65,7 +65,7 @@ QByteArray FrameHashCache::GetHash(const rational &time)
|
||||
return GetHash(ToTimestamp(time));
|
||||
}
|
||||
|
||||
void FrameHashCache::SetHash(const rational &time, const QByteArray &hash, const qint64& job_time, bool frame_exists)
|
||||
void FrameHashCache::SetHash(const rational &time, const QByteArray &hash, const JobTime& job_time, bool frame_exists)
|
||||
{
|
||||
for (int i=jobs_.size()-1; i>=0; i--) {
|
||||
const JobIdentifier& job = jobs_.at(i);
|
||||
@@ -328,7 +328,7 @@ void FrameHashCache::HashDeleted(const QString& s, const QByteArray &hash)
|
||||
foreach (const TimeRange& range, ranges_to_invalidate) {
|
||||
// We set job time to 0 because the nodes haven't changed and any render job should be up
|
||||
// to date
|
||||
Invalidate(range, 0);
|
||||
Invalidate(range);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
static FramePtr LoadCacheFrame(const QString& fn);
|
||||
|
||||
public slots:
|
||||
void SetHash(const olive::rational &time, const QByteArray& hash, const qint64 &job_time, bool frame_exists);
|
||||
void SetHash(const olive::rational &time, const QByteArray& hash, const olive::JobTime &job_time, bool frame_exists);
|
||||
|
||||
protected:
|
||||
virtual void LengthChangedEvent(const rational& old, const rational& newlen) override;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
void PlaybackCache::Invalidate(const TimeRange &r, qint64 job_time)
|
||||
void PlaybackCache::Invalidate(const TimeRange &r)
|
||||
{
|
||||
if (r.in() == r.out()) {
|
||||
qWarning() << "Tried to invalidate zero-length range";
|
||||
@@ -37,7 +37,7 @@ void PlaybackCache::Invalidate(const TimeRange &r, qint64 job_time)
|
||||
invalidated_.insert(r);
|
||||
|
||||
RemoveRangeFromJobs(r);
|
||||
jobs_.append({r, job_time});
|
||||
jobs_.append({r, JobTime()});
|
||||
|
||||
InvalidateEvent(r);
|
||||
|
||||
@@ -50,7 +50,7 @@ void PlaybackCache::InvalidateAll()
|
||||
return;
|
||||
}
|
||||
|
||||
Invalidate(TimeRange(0, length_), 0);
|
||||
Invalidate(TimeRange(0, length_));
|
||||
}
|
||||
|
||||
void PlaybackCache::SetLength(const rational &r)
|
||||
@@ -70,7 +70,7 @@ void PlaybackCache::SetLength(const rational &r)
|
||||
} else if (r > length_) {
|
||||
// If new length is greater, simply extend the invalidated range for now
|
||||
invalidated_.insert(range_diff);
|
||||
jobs_.append({range_diff, 0});
|
||||
jobs_.append({range_diff, JobTime()});
|
||||
} else {
|
||||
// If new length is smaller, removed hashes
|
||||
invalidated_.remove(range_diff);
|
||||
@@ -105,8 +105,6 @@ void PlaybackCache::Shift(rational from, rational to)
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "FIXME: 0 job time may cause cache desyncs";
|
||||
|
||||
// An region between `from` and `to` will be inserted or spliced out
|
||||
TimeRangeList ranges_to_shift = invalidated_.Intersects(TimeRange(from, RATIONAL_MAX));
|
||||
|
||||
@@ -119,7 +117,7 @@ void PlaybackCache::Shift(rational from, rational to)
|
||||
// (`diff` is POSITIVE when moving forward -> and NEGATIVE when moving backward <-)
|
||||
rational diff = to - from;
|
||||
foreach (const TimeRange& r, ranges_to_shift) {
|
||||
Invalidate(r + diff, 0);
|
||||
Invalidate(r + diff);
|
||||
}
|
||||
|
||||
ShiftEvent(from, to);
|
||||
@@ -128,7 +126,7 @@ void PlaybackCache::Shift(rational from, rational to)
|
||||
|
||||
if (diff > 0) {
|
||||
// If shifting forward, add this section to the invalidated region
|
||||
Invalidate(TimeRange(from, to), 0);
|
||||
Invalidate(TimeRange(from, to));
|
||||
}
|
||||
|
||||
// Emit signals
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <QMutex>
|
||||
#include <QObject>
|
||||
|
||||
#include "common/jobtime.h"
|
||||
#include "common/timerange.h"
|
||||
|
||||
namespace olive {
|
||||
@@ -63,7 +64,7 @@ public:
|
||||
QString GetCacheDirectory() const;
|
||||
|
||||
public slots:
|
||||
void Invalidate(const TimeRange& r, qint64 job_time);
|
||||
void Invalidate(const TimeRange& r);
|
||||
|
||||
void InvalidateAll();
|
||||
|
||||
@@ -93,7 +94,7 @@ protected:
|
||||
|
||||
struct JobIdentifier {
|
||||
TimeRange range;
|
||||
qint64 job_time;
|
||||
JobTime job_time;
|
||||
};
|
||||
|
||||
QList<JobIdentifier> jobs_;
|
||||
|
||||
@@ -15,9 +15,7 @@ PreviewAutoCacher::PreviewAutoCacher() :
|
||||
has_changed_(false),
|
||||
use_custom_range_(false),
|
||||
single_frame_render_(nullptr),
|
||||
last_update_time_(0),
|
||||
ignore_next_mouse_button_(false),
|
||||
last_conform_task_(0)
|
||||
ignore_next_mouse_button_(false)
|
||||
{
|
||||
paused_ = !Config::Current()[QStringLiteral("AutoCacheEnabled")].toBool(),
|
||||
|
||||
@@ -63,7 +61,7 @@ void PreviewAutoCacher::SetPaused(bool paused)
|
||||
paused_ = paused;
|
||||
}
|
||||
|
||||
void GenerateHashesInternal(ViewerOutput *viewer, FrameHashCache* cache, const QVector<rational> ×, qint64 job_time)
|
||||
void GenerateHashesInternal(ViewerOutput *viewer, FrameHashCache* cache, const QVector<rational> ×, JobTime job_time)
|
||||
{
|
||||
std::vector<QByteArray> existing_hashes;
|
||||
|
||||
@@ -86,12 +84,12 @@ void GenerateHashesInternal(ViewerOutput *viewer, FrameHashCache* cache, const Q
|
||||
QMetaObject::invokeMethod(cache, "SetHash", Qt::QueuedConnection,
|
||||
OLIVE_NS_ARG(rational, time),
|
||||
Q_ARG(QByteArray, hash),
|
||||
Q_ARG(qint64, job_time),
|
||||
OLIVE_NS_ARG(JobTime, job_time),
|
||||
Q_ARG(bool, hash_exists));
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewAutoCacher::GenerateHashes(ViewerOutput *viewer, FrameHashCache* cache, TimeRangeListFrameIterator iterator, qint64 job_time)
|
||||
void PreviewAutoCacher::GenerateHashes(ViewerOutput *viewer, FrameHashCache* cache, TimeRangeListFrameIterator iterator, JobTime job_time)
|
||||
{
|
||||
QVector<rational> times = iterator.ToVector();
|
||||
|
||||
@@ -185,7 +183,7 @@ void PreviewAutoCacher::AudioRendered()
|
||||
if (watcher->GetTicket()->property("incomplete").toBool()) {
|
||||
if (last_conform_task_ > watcher->GetTicket()->GetJobTime()) {
|
||||
// Requeue now
|
||||
viewer_node_->audio_playback_cache()->Invalidate(range, QDateTime::currentMSecsSinceEpoch());
|
||||
viewer_node_->audio_playback_cache()->Invalidate(range);
|
||||
pcm_is_usable = false;
|
||||
} else {
|
||||
// Wait for conform
|
||||
@@ -398,7 +396,7 @@ void PreviewAutoCacher::InsertIntoCopyMap(Node *node, Node *copy)
|
||||
|
||||
void PreviewAutoCacher::UpdateLastSyncedValue()
|
||||
{
|
||||
last_update_time_ = QDateTime::currentMSecsSinceEpoch();
|
||||
last_update_time_.Acquire();
|
||||
}
|
||||
|
||||
void PreviewAutoCacher::CancelQueuedSingleFrameRender()
|
||||
@@ -613,11 +611,11 @@ void PreviewAutoCacher::RequeueFrames()
|
||||
|
||||
void PreviewAutoCacher::ConformFinished()
|
||||
{
|
||||
last_conform_task_ = QDateTime::currentMSecsSinceEpoch();
|
||||
last_conform_task_.Acquire();
|
||||
|
||||
if (viewer_node_) {
|
||||
foreach (const TimeRange &range, audio_needing_conform_) {
|
||||
viewer_node_->audio_playback_cache()->Invalidate(range, QDateTime::currentMSecsSinceEpoch());
|
||||
viewer_node_->audio_playback_cache()->Invalidate(range);
|
||||
}
|
||||
audio_needing_conform_.clear();
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
void ClearVideoDownloadQueue(bool wait = false);
|
||||
|
||||
private:
|
||||
static void GenerateHashes(ViewerOutput *viewer, FrameHashCache *cache, TimeRangeListFrameIterator times, qint64 job_time);
|
||||
static void GenerateHashes(ViewerOutput *viewer, FrameHashCache *cache, TimeRangeListFrameIterator times, JobTime job_time);
|
||||
|
||||
void TryRender();
|
||||
|
||||
@@ -161,7 +161,7 @@ private:
|
||||
QMap<RenderTicketWatcher*, QByteArray> video_download_tasks_;
|
||||
QMap<RenderTicketWatcher*, QVector<RenderTicketPtr> > video_immediate_passthroughs_;
|
||||
|
||||
qint64 last_update_time_;
|
||||
JobTime last_update_time_;
|
||||
|
||||
bool ignore_next_mouse_button_;
|
||||
|
||||
@@ -169,7 +169,7 @@ private:
|
||||
|
||||
TimeRangeList audio_needing_conform_;
|
||||
|
||||
qint64 last_conform_task_;
|
||||
JobTime last_conform_task_;
|
||||
|
||||
private slots:
|
||||
/**
|
||||
|
||||
@@ -147,9 +147,8 @@ bool ExportTask::Run()
|
||||
return success;
|
||||
}
|
||||
|
||||
void ExportTask::FrameDownloaded(FramePtr f, const QByteArray &hash, const QVector<rational> ×, qint64 job_time)
|
||||
void ExportTask::FrameDownloaded(FramePtr f, const QByteArray &hash, const QVector<rational> ×)
|
||||
{
|
||||
Q_UNUSED(job_time)
|
||||
Q_UNUSED(hash)
|
||||
|
||||
foreach (const rational& t, times) {
|
||||
@@ -179,10 +178,8 @@ void ExportTask::FrameDownloaded(FramePtr f, const QByteArray &hash, const QVect
|
||||
}
|
||||
}
|
||||
|
||||
void ExportTask::AudioDownloaded(const TimeRange &range, SampleBufferPtr samples, qint64 job_time)
|
||||
void ExportTask::AudioDownloaded(const TimeRange &range, SampleBufferPtr samples)
|
||||
{
|
||||
Q_UNUSED(job_time)
|
||||
|
||||
TimeRange adjusted_range = range;
|
||||
|
||||
if (params_.has_custom_range()) {
|
||||
|
||||
@@ -38,9 +38,9 @@ public:
|
||||
protected:
|
||||
virtual bool Run() override;
|
||||
|
||||
virtual void FrameDownloaded(FramePtr frame, const QByteArray& hash, const QVector<rational>& times, qint64 job_time) override;
|
||||
virtual void FrameDownloaded(FramePtr frame, const QByteArray& hash, const QVector<rational>& times) override;
|
||||
|
||||
virtual void AudioDownloaded(const TimeRange& range, SampleBufferPtr samples, qint64 job_time) override;
|
||||
virtual void AudioDownloaded(const TimeRange& range, SampleBufferPtr samples) override;
|
||||
|
||||
virtual void EncodeSubtitle(const SubtitleBlock *sub) override;
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ bool PreCacheTask::Run()
|
||||
return true;
|
||||
}
|
||||
|
||||
void PreCacheTask::FrameDownloaded(FramePtr frame, const QByteArray &hash, const QVector<rational> ×, qint64 job_time)
|
||||
void PreCacheTask::FrameDownloaded(FramePtr frame, const QByteArray &hash, const QVector<rational> ×)
|
||||
{
|
||||
// Do nothing. Pre-cache essentially just creates more frames in the cache, it doesn't need to do
|
||||
// anything else.
|
||||
@@ -82,16 +82,14 @@ void PreCacheTask::FrameDownloaded(FramePtr frame, const QByteArray &hash, const
|
||||
Q_UNUSED(frame)
|
||||
Q_UNUSED(hash)
|
||||
Q_UNUSED(times)
|
||||
Q_UNUSED(job_time)
|
||||
}
|
||||
|
||||
void PreCacheTask::AudioDownloaded(const TimeRange &range, SampleBufferPtr samples, qint64 job_time)
|
||||
void PreCacheTask::AudioDownloaded(const TimeRange &range, SampleBufferPtr samples)
|
||||
{
|
||||
// Pre-cache doesn't cache any audio
|
||||
|
||||
Q_UNUSED(range)
|
||||
Q_UNUSED(samples)
|
||||
Q_UNUSED(job_time)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ public:
|
||||
protected:
|
||||
virtual bool Run() override;
|
||||
|
||||
virtual void FrameDownloaded(FramePtr frame, const QByteArray& hash, const QVector<rational>& times, qint64 job_time) override;
|
||||
virtual void FrameDownloaded(FramePtr frame, const QByteArray& hash, const QVector<rational>& times) override;
|
||||
|
||||
virtual void AudioDownloaded(const TimeRange& range, SampleBufferPtr samples, qint64 job_time) override;
|
||||
virtual void AudioDownloaded(const TimeRange& range, SampleBufferPtr samples) override;
|
||||
|
||||
private:
|
||||
Project* project_;
|
||||
|
||||
@@ -55,8 +55,6 @@ bool RenderTask::Render(ColorManager* manager,
|
||||
double total_length = 0;
|
||||
|
||||
// Store real time before any rendering takes place
|
||||
qint64 job_time = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
// Queue audio jobs
|
||||
foreach (const TimeRange& range, audio_range) {
|
||||
// Don't count audio progress, since it's generally a lot faster than video and is weighted at
|
||||
@@ -193,9 +191,7 @@ bool RenderTask::Render(ColorManager* manager,
|
||||
|
||||
TimeRange range = watcher->property("range").value<TimeRange>();
|
||||
|
||||
AudioDownloaded(range,
|
||||
watcher->Get().value<SampleBufferPtr>(),
|
||||
job_time);
|
||||
AudioDownloaded(range, watcher->Get().value<SampleBufferPtr>());
|
||||
|
||||
// Don't count audio progress, since it's generally a lot faster than video and is weighted at
|
||||
// 50%, which makes the progress bar look weird to the uninitiated
|
||||
@@ -217,7 +213,7 @@ bool RenderTask::Render(ColorManager* manager,
|
||||
|
||||
// Assume single-step video or video download ticket
|
||||
QByteArray rendered_hash = watcher->property("hash").toByteArray();
|
||||
FrameDownloaded(watcher->Get().value<FramePtr>(), rendered_hash, time_map.value(rendered_hash), job_time);
|
||||
FrameDownloaded(watcher->Get().value<FramePtr>(), rendered_hash, time_map.value(rendered_hash));
|
||||
|
||||
if (native_progress_signalling_) {
|
||||
double progress_to_add = 1.0;
|
||||
|
||||
@@ -51,9 +51,9 @@ protected:
|
||||
|
||||
virtual void DownloadFrame(QThread* thread, FramePtr frame, const QByteArray &hash);
|
||||
|
||||
virtual void FrameDownloaded(FramePtr frame, const QByteArray& hash, const QVector<rational>& times, qint64 job_time) = 0;
|
||||
virtual void FrameDownloaded(FramePtr frame, const QByteArray& hash, const QVector<rational>& times) = 0;
|
||||
|
||||
virtual void AudioDownloaded(const TimeRange& range, SampleBufferPtr samples, qint64 job_time) = 0;
|
||||
virtual void AudioDownloaded(const TimeRange& range, SampleBufferPtr samples) = 0;
|
||||
|
||||
virtual void EncodeSubtitle(const SubtitleBlock *subtitle);
|
||||
|
||||
|
||||
@@ -38,14 +38,14 @@ class RenderTicket : public QObject
|
||||
public:
|
||||
RenderTicket();
|
||||
|
||||
qint64 GetJobTime() const
|
||||
JobTime GetJobTime() const
|
||||
{
|
||||
return job_time_;
|
||||
}
|
||||
|
||||
void SetJobTime()
|
||||
{
|
||||
job_time_ = QDateTime::currentMSecsSinceEpoch();
|
||||
job_time_.Acquire();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +137,7 @@ private:
|
||||
|
||||
QWaitCondition wait_;
|
||||
|
||||
qint64 job_time_;
|
||||
JobTime job_time_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ const int kMaxPreQueueSize = 8;
|
||||
ViewerWidget::ViewerWidget(QWidget *parent) :
|
||||
super(false, true, parent),
|
||||
playback_speed_(0),
|
||||
frame_cache_job_time_(0),
|
||||
color_menu_enabled_(true),
|
||||
time_changed_from_timer_(false),
|
||||
prequeuing_(false),
|
||||
|
||||
@@ -215,8 +215,6 @@ private:
|
||||
|
||||
QAtomicInt playback_speed_;
|
||||
|
||||
qint64 frame_cache_job_time_;
|
||||
|
||||
int64_t last_time_;
|
||||
|
||||
bool color_menu_enabled_;
|
||||
|
||||
Reference in New Issue
Block a user