cache: heavily reworked exporting for new system
Also cleans up cache in general and moves it to the Task infrastructure.
This commit is contained in:
@@ -474,8 +474,8 @@ void OpenGLProxy::TextureToBuffer(const QVariant& tex_in,
|
||||
0,
|
||||
frame->width(),
|
||||
frame->height(),
|
||||
OpenGLRenderFunctions::GetPixelFormat(texture->texture()->format()),
|
||||
OpenGLRenderFunctions::GetPixelType(texture->texture()->format()),
|
||||
OpenGLRenderFunctions::GetPixelFormat(frame->format()),
|
||||
OpenGLRenderFunctions::GetPixelType(frame->format()),
|
||||
frame->data());
|
||||
|
||||
functions_->glPixelStorei(GL_PACK_ROW_LENGTH, 0);
|
||||
|
||||
@@ -34,7 +34,7 @@ OLIVE_NAMESPACE_ENTER
|
||||
RenderBackend::RenderBackend(QObject *parent) :
|
||||
QObject(parent),
|
||||
viewer_node_(nullptr),
|
||||
audio_enabled_(true),
|
||||
audio_mode_(kAudioPreview),
|
||||
divider_(1),
|
||||
render_mode_(RenderMode::kOnline),
|
||||
pix_fmt_(PixelFormat::PIX_FMT_RGBA32F),
|
||||
@@ -91,7 +91,7 @@ void RenderBackend::SetViewerNode(ViewerOutput *viewer_node)
|
||||
this,
|
||||
&RenderBackend::NodeGraphChanged);
|
||||
|
||||
if (audio_enabled_) {
|
||||
if (audio_mode_ == kAudioPreview) {
|
||||
// Listen for audio invalidation signals
|
||||
connect(viewer_node_->audio_playback_cache(),
|
||||
&AudioPlaybackCache::Invalidated,
|
||||
@@ -161,9 +161,9 @@ void RenderBackend::SetVideoDownloadMatrix(const QMatrix4x4 &mat)
|
||||
video_download_matrix_ = mat;
|
||||
}
|
||||
|
||||
void RenderBackend::SetAudioEnabled(bool e)
|
||||
void RenderBackend::SetAudioMode(AudioMode e)
|
||||
{
|
||||
audio_enabled_ = e;
|
||||
audio_mode_ = e;
|
||||
}
|
||||
|
||||
void RenderBackend::WorkerStartedRenderingAudio(const TimeRange &r)
|
||||
@@ -391,7 +391,8 @@ void RenderBackend::AudioInvalidated(const TimeRange& r)
|
||||
watcher->setFuture(QtConcurrent::run(&audio_pool_.threads,
|
||||
GetInstanceFromPool(audio_pool_),
|
||||
&RenderWorker::RenderAudio,
|
||||
this_range));
|
||||
this_range,
|
||||
audio_mode_ == kAudioPreview));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,13 @@ public:
|
||||
|
||||
void SetVideoDownloadMatrix(const QMatrix4x4& mat);
|
||||
|
||||
void SetAudioEnabled(bool e);
|
||||
enum AudioMode {
|
||||
kAudioDisabled,
|
||||
kAudioPreview,
|
||||
kAudioRender
|
||||
};
|
||||
|
||||
void SetAudioMode(AudioMode e);
|
||||
|
||||
void WorkerStartedRenderingAudio(const TimeRange& r);
|
||||
|
||||
@@ -107,7 +113,7 @@ private:
|
||||
QMutex queued_audio_lock_;
|
||||
TimeRangeList queued_audio_;
|
||||
|
||||
bool audio_enabled_;
|
||||
AudioMode audio_mode_;
|
||||
|
||||
// VIDEO MEMBERS
|
||||
int divider_;
|
||||
|
||||
@@ -99,7 +99,7 @@ FramePtr RenderWorker::RenderFrame(const rational &time, bool block_for_update)
|
||||
return frame;
|
||||
}
|
||||
|
||||
SampleBufferPtr RenderWorker::RenderAudio(const TimeRange &range)
|
||||
SampleBufferPtr RenderWorker::RenderAudio(const TimeRange &range, bool block_for_update)
|
||||
{
|
||||
if (!viewer_) {
|
||||
return nullptr;
|
||||
@@ -109,7 +109,7 @@ SampleBufferPtr RenderWorker::RenderAudio(const TimeRange &range)
|
||||
|
||||
parent_->WorkerStartedRenderingAudio(range);
|
||||
|
||||
UpdateData(true);
|
||||
UpdateData(block_for_update);
|
||||
|
||||
audio_render_time_ = range;
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
*/
|
||||
FramePtr RenderFrame(const rational& time, bool block_for_update);
|
||||
|
||||
SampleBufferPtr RenderAudio(const TimeRange& range);
|
||||
SampleBufferPtr RenderAudio(const TimeRange& range, bool block_for_update);
|
||||
|
||||
protected:
|
||||
virtual void TextureToFrame(const QVariant& texture, FramePtr frame, const QMatrix4x4 &mat) const = 0;
|
||||
|
||||
Reference in New Issue
Block a user