task: Created ConformTask so audio conforming can be done as a background

process
This commit is contained in:
itsmattkc
2020-02-19 12:44:29 +11:00
parent 08e6c6ffc0
commit 4bcbe290f4
2 changed files with 51 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
#include "conform.h"
#include "codec/decoder.h"
ConformTask::ConformTask(AudioStreamPtr stream, const AudioRenderingParams& params) :
stream_(stream),
params_(params)
{
}
void ConformTask::Action()
{
if (stream_->footage()->decoder().isEmpty()) {
emit Failed(QStringLiteral("Stream has no decoder"));
} else {
DecoderPtr decoder = Decoder::CreateFromID(stream_->footage()->decoder());
decoder->set_stream(stream_);
connect(decoder.get(), &Decoder::IndexProgress, this, &ConformTask::ProgressChanged);
decoder->Open();
decoder->Conform(params_, &IsCancelled());
decoder->Close();
emit Succeeded();
}
}
+23
View File
@@ -0,0 +1,23 @@
#ifndef CONFORMTASK_H
#define CONFORMTASK_H
#include "project/item/footage/audiostream.h"
#include "render/audioparams.h"
#include "task/task.h"
class ConformTask : public Task
{
public:
ConformTask(AudioStreamPtr stream, const AudioRenderingParams& params);
protected:
virtual void Action() override;
private:
AudioStreamPtr stream_;
AudioRenderingParams params_;
};
#endif // CONFORMTASK_H