improved backend encapsulation
Various backend improvements are included in this commit, mostly for the benefit of exporting. These include: - Moving more non-GL code from OpenGL derivatives into base classes - An "export mode" that changes the cache behavior of video backends - Using the Viewer's UUID introduced a few commits ago - No longer hardcoding the pixel format/render mode in the backend (since they'll inevitably differ when exporting vs previewing) - Improved signalling for frames that are completed
This commit is contained in:
@@ -90,17 +90,11 @@ void RenderBackend::SetViewerNode(ViewerOutput *viewer_node)
|
||||
|
||||
if (viewer_node_ != nullptr) {
|
||||
ConnectViewer(viewer_node_);
|
||||
|
||||
RegenerateCacheID();
|
||||
}
|
||||
}
|
||||
|
||||
void RenderBackend::SetCacheName(const QString &s)
|
||||
{
|
||||
cache_name_ = s;
|
||||
cache_time_ = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
RegenerateCacheID();
|
||||
}
|
||||
|
||||
bool RenderBackend::IsInitiated()
|
||||
{
|
||||
return started_;
|
||||
@@ -170,22 +164,25 @@ void RenderBackend::RegenerateCacheID()
|
||||
{
|
||||
QCryptographicHash hash(QCryptographicHash::Sha1);
|
||||
|
||||
if (cache_name_.isEmpty()
|
||||
|| !cache_time_
|
||||
if (!viewer_node_
|
||||
|| !GenerateCacheIDInternal(hash)) {
|
||||
cache_id_.clear();
|
||||
CacheIDChangedEvent(QString());
|
||||
return;
|
||||
}
|
||||
|
||||
hash.addData(cache_name_.toUtf8());
|
||||
hash.addData(QString::number(cache_time_).toUtf8());
|
||||
hash.addData(viewer_node_->uuid().toByteArray());
|
||||
|
||||
QByteArray bytes = hash.result();
|
||||
cache_id_ = bytes.toHex();
|
||||
CacheIDChangedEvent(cache_id_);
|
||||
}
|
||||
|
||||
bool RenderBackend::CanRender()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
rational RenderBackend::GetSequenceLength()
|
||||
{
|
||||
if (viewer_node_ == nullptr) {
|
||||
@@ -214,7 +211,8 @@ void RenderBackend::CacheNext()
|
||||
{
|
||||
if (!Init()
|
||||
|| cache_queue_.isEmpty()
|
||||
|| !ViewerIsConnected()) {
|
||||
|| !ViewerIsConnected()
|
||||
|| !CanRender()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user