renderer: move conform to task
Improved rendering system and user interface Fixes #1375
This commit is contained in:
@@ -20,42 +20,33 @@
|
||||
|
||||
#include "conform.h"
|
||||
|
||||
#include "codec/decoder.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
ConformTask::ConformTask(Footage* footage, int index, const AudioParams& params) :
|
||||
footage_(footage),
|
||||
index_(index),
|
||||
params_(params)
|
||||
ConformTask::ConformTask(const QString &decoder_id, const Decoder::CodecStream &stream, const AudioParams& params, const QString &output_filename) :
|
||||
decoder_id_(decoder_id),
|
||||
stream_(stream),
|
||||
params_(params),
|
||||
output_filename_(output_filename)
|
||||
{
|
||||
SetTitle(tr("Conforming Audio %1:%2").arg(footage_->filename(), QString::number(index_)));
|
||||
SetTitle(tr("Conforming Audio %1:%2").arg(stream.filename(), QString::number(stream.stream())));
|
||||
}
|
||||
|
||||
bool ConformTask::Run()
|
||||
{
|
||||
// Conforming is done by the renderer now, but I would like to use something like this just to
|
||||
// show progress
|
||||
DecoderPtr decoder = Decoder::CreateFromID(decoder_id_);
|
||||
|
||||
/*if (stream_->footage()->decoder().isEmpty()) {
|
||||
SetError(tr("Failed to find decoder to conform audio stream"));
|
||||
if (!decoder->Open(stream_)) {
|
||||
SetError(tr("Failed to open decoder for audio conform"));
|
||||
return false;
|
||||
} else {
|
||||
DecoderPtr decoder = Decoder::CreateFromID(stream_->footage()->decoder());
|
||||
}
|
||||
|
||||
decoder->set_stream(stream_);
|
||||
connect(decoder.get(), &Decoder::IndexProgress, this, &ConformTask::ProgressChanged);
|
||||
|
||||
connect(decoder.get(), &Decoder::IndexProgress, this, &ConformTask::ProgressChanged);
|
||||
bool ret = decoder->ConformAudio(output_filename_, params_, &IsCancelled());
|
||||
|
||||
if (!decoder->ConformAudio(&IsCancelled(), params_)) {
|
||||
SetError(tr("Failed to conform audio"));
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
decoder->Close();
|
||||
|
||||
return true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#ifndef CONFORMTASK_H
|
||||
#define CONFORMTASK_H
|
||||
|
||||
#include "codec/decoder.h"
|
||||
#include "node/project/footage/footage.h"
|
||||
#include "render/audioparams.h"
|
||||
#include "task/task.h"
|
||||
@@ -31,18 +32,20 @@ class ConformTask : public Task
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConformTask(Footage* stream, int index, const AudioParams& params);
|
||||
ConformTask(const QString &decoder_id, const Decoder::CodecStream &stream, const AudioParams& params, const QString &output_filename);
|
||||
|
||||
protected:
|
||||
virtual bool Run() override;
|
||||
|
||||
private:
|
||||
Footage* footage_;
|
||||
QString decoder_id_;
|
||||
|
||||
int index_;
|
||||
Decoder::CodecStream stream_;
|
||||
|
||||
AudioParams params_;
|
||||
|
||||
QString output_filename_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ bool RenderTask::Render(ColorManager* manager,
|
||||
watcher->setProperty("range", QVariant::fromValue(this_range));
|
||||
PrepareWatcher(watcher, &watcher_thread);
|
||||
IncrementRunningTickets();
|
||||
watcher->SetTicket(RenderManager::instance()->RenderAudio(viewer_, this_range, audio_params_, false));
|
||||
watcher->SetTicket(RenderManager::instance()->RenderAudio(viewer_, this_range, audio_params_, mode, false));
|
||||
|
||||
r = end;
|
||||
}
|
||||
|
||||
@@ -99,6 +99,8 @@ public slots:
|
||||
// Print how long this task took for debugging purposes
|
||||
qDebug() << this << "took" << (QDateTime::currentMSecsSinceEpoch() - start_time_);
|
||||
|
||||
emit Finished(this, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -159,6 +161,13 @@ signals:
|
||||
*/
|
||||
void ProgressChanged(double d);
|
||||
|
||||
/**
|
||||
* @brief Emitted when task is finished
|
||||
*
|
||||
* Do NOT delete immediately after this signal, call deleteLater() instead.
|
||||
*/
|
||||
void Finished(Task *task, bool succeeded);
|
||||
|
||||
private:
|
||||
QString title_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user