Files
oak-editor/app/render/backend/videorenderworker.h
T
itsmattkc 7385e3dc56 fixes jitters by using signals/slots to pass image buffers around
Updating values rapidly would cause strange jitters as a
byproduct of the viewer trying to update from the renderer while
it was still working. Rather than the viewer trying to access the
the renderer, we now send textures in the initial update signal
to keep everything synchronized.
2019-11-18 02:14:54 +09:00

61 lines
1.5 KiB
C++

#ifndef VIDEORENDERWORKER_H
#define VIDEORENDERWORKER_H
#include <QCryptographicHash>
#include "node/dependency.h"
#include "render/videoparams.h"
#include "renderworker.h"
#include "videorenderframecache.h"
class VideoRenderWorker : public RenderWorker {
Q_OBJECT
public:
VideoRenderWorker(DecoderCache* decoder_cache, VideoRenderFrameCache* frame_cache, QObject* parent = nullptr);
void SetParameters(const VideoRenderingParams& video_params);
public slots:
virtual QVariant RenderAsSibling(NodeDependency dep) override;
void Download(NodeDependency dep, QByteArray hash, QVariant texture, QString filename);
signals:
void CompletedFrame(NodeDependency path, QByteArray hash, QVariant value);
void CompletedDownload(NodeDependency path, QByteArray hash);
void HashAlreadyBeingCached();
void HashAlreadyExists(NodeDependency path, QByteArray hash);
protected:
virtual bool InitInternal() override;
virtual void CloseInternal() override;
const VideoRenderingParams& video_params();
virtual void ParametersChangedEvent(){}
virtual void TextureToBuffer(const QVariant& texture, QByteArray& buffer) = 0;
virtual void RenderInternal(const NodeDependency& path) override;
private:
void ProcessNode();
void HashNodeRecursively(QCryptographicHash* hash, Node *n, const rational &time);
VideoRenderingParams video_params_;
VideoRenderFrameCache* frame_cache_;
QByteArray download_buffer_;
private slots:
};
#endif // VIDEORENDERWORKER_H