started new cache
This commit is contained in:
@@ -60,7 +60,7 @@ ViewerOutput::ViewerOutput(bool create_buffer_inputs, bool create_default_stream
|
|||||||
IgnoreHashingFrom(kVideoAutoCacheInput);
|
IgnoreHashingFrom(kVideoAutoCacheInput);
|
||||||
IgnoreInvalidationsFrom(kVideoAutoCacheInput);
|
IgnoreInvalidationsFrom(kVideoAutoCacheInput);
|
||||||
|
|
||||||
AddInput(kAudioAutoCacheInput, NodeValue::kBoolean, true, InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
|
AddInput(kAudioAutoCacheInput, NodeValue::kBoolean, false, InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
|
||||||
IgnoreHashingFrom(kAudioAutoCacheInput);
|
IgnoreHashingFrom(kAudioAutoCacheInput);
|
||||||
IgnoreInvalidationsFrom(kAudioAutoCacheInput);
|
IgnoreInvalidationsFrom(kAudioAutoCacheInput);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -887,4 +887,31 @@ void PreviewAutoCacher::SetViewerNode(ViewerOutput *viewer_node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PreviewAutoCacher::PlaybackDevice::PlaybackDevice(PreviewAutoCacher *cacher, QObject *parent) :
|
||||||
|
cacher_(cacher),
|
||||||
|
current_time_(0)
|
||||||
|
{
|
||||||
|
audio_params_ = viewer()->GetAudioParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PreviewAutoCacher::PlaybackDevice::seek(qint64 pos)
|
||||||
|
{
|
||||||
|
// Call super function
|
||||||
|
if (QIODevice::seek(pos)) {
|
||||||
|
// Convert bytes to time
|
||||||
|
current_time_ = audio_params_.bytes_to_time(pos);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 PreviewAutoCacher::PlaybackDevice::size() const
|
||||||
|
{
|
||||||
|
rational audio_length = cacher_->copied_viewer_node_->GetAudioLength();
|
||||||
|
|
||||||
|
return audio_params_.time_to_bytes(audio_length);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "node/node.h"
|
#include "node/node.h"
|
||||||
#include "node/output/viewer/viewer.h"
|
#include "node/output/viewer/viewer.h"
|
||||||
#include "node/project/project.h"
|
#include "node/project/project.h"
|
||||||
|
#include "render/audioparams.h"
|
||||||
#include "render/renderjobtracker.h"
|
#include "render/renderjobtracker.h"
|
||||||
#include "threading/threadticketwatcher.h"
|
#include "threading/threadticketwatcher.h"
|
||||||
|
|
||||||
@@ -71,6 +72,37 @@ public:
|
|||||||
void CancelVideoTasks(bool and_wait_for_them_to_finish = false);
|
void CancelVideoTasks(bool and_wait_for_them_to_finish = false);
|
||||||
void CancelAudioTasks(bool and_wait_for_them_to_finish = false);
|
void CancelAudioTasks(bool and_wait_for_them_to_finish = false);
|
||||||
|
|
||||||
|
class PlaybackDevice : public QIODevice
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PlaybackDevice(PreviewAutoCacher *cacher, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
virtual ~PlaybackDevice() override;
|
||||||
|
|
||||||
|
virtual bool isSequential() const override;
|
||||||
|
|
||||||
|
virtual bool seek(qint64 pos) override;
|
||||||
|
|
||||||
|
virtual qint64 size() const override;
|
||||||
|
|
||||||
|
virtual qint64 readData(char *data, qint64 maxSize) override;
|
||||||
|
|
||||||
|
virtual qint64 writeData(const char *, qint64) override;
|
||||||
|
|
||||||
|
ViewerOutput *viewer() const
|
||||||
|
{
|
||||||
|
return cacher_->copied_viewer_node_;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
PreviewAutoCacher *cacher_;
|
||||||
|
|
||||||
|
rational current_time_;
|
||||||
|
|
||||||
|
AudioParams audio_params_;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void TryRender();
|
void TryRender();
|
||||||
|
|
||||||
|
|||||||
@@ -603,7 +603,7 @@ void ViewerWidget::PushScrubbedAudio()
|
|||||||
const AudioParams& params = GetConnectedNode()->audio_playback_cache()->GetParameters();
|
const AudioParams& params = GetConnectedNode()->audio_playback_cache()->GetParameters();
|
||||||
|
|
||||||
if (params.is_valid()) {
|
if (params.is_valid()) {
|
||||||
AudioPlaybackCache::PlaybackDevice* audio_src = GetConnectedNode()->audio_playback_cache()->CreatePlaybackDevice();
|
PreviewAutoCacher::PlaybackDevice *audio_src = new PreviewAutoCacher::PlaybackDevice(&auto_cacher_, this);
|
||||||
|
|
||||||
if (audio_src->open(QIODevice::ReadOnly)) {
|
if (audio_src->open(QIODevice::ReadOnly)) {
|
||||||
// FIXME: Hardcoded scrubbing interval (20ms)
|
// FIXME: Hardcoded scrubbing interval (20ms)
|
||||||
|
|||||||
Reference in New Issue
Block a user