Files
oak-editor/app/render/backend/audiorenderbackend.h
T
itsmattkc 53ae25a7cb nodes: optimize node graph changes by only updating from inputs that changed
A huge optimization that ensures only the parts of a node graph that have
changed get pushed to the renderer. For thread-safety, the node graph is
copied elsewhere so that users can make changes asynchronously and the graph
can update when its threads are ready. Up until now, if an input value changed,
every node's values would be re-copied, or worse, if a connection was changed,
the entire graph would be recopied. This has been negligible in testing since
we've been largely testing with small graphs, but for massive projects, it's
important that this be as optimized as possible.
2020-04-26 04:16:15 +10:00

102 lines
2.6 KiB
C++

/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef AUDIORENDERBACKEND_H
#define AUDIORENDERBACKEND_H
#include "common/timerange.h"
#include "renderbackend.h"
OLIVE_NAMESPACE_ENTER
class AudioRenderBackend : public RenderBackend
{
Q_OBJECT
public:
AudioRenderBackend(QObject* parent = nullptr);
/**
* @brief Set parameters of the Renderer
*
* The Renderer owns the buffers that are used in the rendering process and this function sets the kind of buffers
* to use. The Renderer must be stopped when calling this function.
*/
void SetParameters(const AudioRenderingParams &params);
const AudioRenderingParams& params() const;
QString CachePathName() const;
signals:
void ParamsChanged();
void AudioComplete();
protected:
virtual void ConnectViewer(ViewerOutput* node) override;
virtual void DisconnectViewer(ViewerOutput* node) override;
/**
* @brief Internal function for generating the cache ID
*/
virtual bool GenerateCacheIDInternal(QCryptographicHash& hash) override;
virtual NodeInput* GetDependentInput() override;
virtual bool CanRender() override;
virtual void ConnectWorkerToThis(RenderWorker* worker) override;
virtual TimeRange PopNextFrameFromQueue() override;
virtual void InvalidateCacheInternal(const rational &start_range, const rational &end_range) override;
private:
struct ConformWaitInfo {
StreamPtr stream;
AudioRenderingParams params;
TimeRange affected_range;
rational stream_time;
bool operator==(const ConformWaitInfo& rhs) const;
};
QList<ConformWaitInfo> conform_wait_info_;
AudioRenderingParams params_;
bool ic_from_conform_;
private slots:
void ConformUnavailable(StreamPtr stream, TimeRange range, rational stream_time, AudioRenderingParams params);
void ConformUpdated(Stream *stream, AudioRenderingParams params);
void TruncateCache(const rational& r);
void FilterQueueCompleteSignal();
};
OLIVE_NAMESPACE_EXIT
#endif // AUDIORENDERBACKEND_H