Files
oak-editor/app/render/backend/renderworker.h
T
itsmattkc f424d8b44e rewrote renderers where necessary for new node structure
Largely conforming renderers to new NodeValue system. Code seems a lot cleaner
this way which is a nice advantage. Likely non-functional as this won't
compile just yet and still needs probably another day or two of testing to get
it back to where it was before.
2019-12-05 03:53:52 +11:00

96 lines
2.6 KiB
C++

#ifndef RENDERWORKER_H
#define RENDERWORKER_H
#include <QObject>
#include "common/constructors.h"
#include "node/block/block.h"
#include "node/node.h"
#include "decodercache.h"
class RenderWorker : public QObject
{
Q_OBJECT
public:
RenderWorker(DecoderCache* decoder_cache, QObject* parent = nullptr);
DISABLE_COPY_MOVE(RenderWorker)
bool Init();
bool IsStarted();
bool IsAvailable();
public slots:
void Close();
void Render(NodeDependency path);
NodeValueTable RenderAsSibling(NodeDependency dep);
signals:
void RequestSibling(NodeDependency path);
void CompletedCache(NodeDependency dep, NodeValueTable data);
protected:
/**
* @brief Returns the block in a sequence that is active at a given time
*
* Blocks are connected to each other previous/next to create a BlockList or a sequence of blocks. The block that
* is currently "active" depends on the time and only one block in a track can be active at any given time.
*
* Calling this function with a block and a time will traverse the provided block's track to find the block that will
* be active at that time. The block must be valid (non-null) and the time must be valid (>= 0).
*
* This function may return the same block that it was called with. It will never return nullptr.
*/
Block *ValidateBlock(Block* block, const rational& time);
/**
* @brief Returns all the blocks that could be active within a range of time
*
* Similar to ValidateBlock() but rather than returning one block for a single time, this function returns a list of
* blocks that could be active within a range of time.
*
* The block must be valid (non-null) and the time must be valid (>= 0).
*
* The list will always contain at least one entry.
*/
QList<Block*> ValidateBlockRange(Block* n, const TimeRange& range);
virtual bool InitInternal() = 0;
virtual void CloseInternal() = 0;
virtual NodeValueTable RenderInternal(const NodeDependency& path);
virtual bool OutputIsAccelerated(NodeOutput *output) = 0;
virtual NodeValueTable RunNodeAccelerated(NodeOutput *output) = 0;
StreamPtr ResolveStreamFromInput(NodeInput* input);
DecoderPtr ResolveDecoderFromInput(NodeInput* input);
virtual FramePtr RetrieveFromDecoder(DecoderPtr decoder, const TimeRange& range) = 0;
virtual QVariant FrameToValue(FramePtr frame) = 0;
NodeValueTable ProcessNodeNormally(const NodeDependency &dep);
virtual NodeValueTable RenderBlock(NodeOutput *output, const TimeRange& range) = 0;
DecoderCache* decoder_cache();
QAtomicInt working_;
private:
bool started_;
DecoderCache* decoder_cache_;
};
#endif // RENDERWORKER_H