cache: add audio option
This commit is contained in:
@@ -31,7 +31,8 @@ const QString ViewerOutput::kVideoParamsInput = QStringLiteral("video_param_in")
|
||||
const QString ViewerOutput::kAudioParamsInput = QStringLiteral("audio_param_in");
|
||||
const QString ViewerOutput::kTextureInput = QStringLiteral("tex_in");
|
||||
const QString ViewerOutput::kSamplesInput = QStringLiteral("samples_in");
|
||||
const QString ViewerOutput::kVideoAutoCacheInput = QStringLiteral("autocache_in");
|
||||
const QString ViewerOutput::kVideoAutoCacheInput = QStringLiteral("video_autocache_in");
|
||||
const QString ViewerOutput::kAudioAutoCacheInput = QStringLiteral("audio_autocache_in");
|
||||
|
||||
const uint64_t ViewerOutput::kVideoParamEditMask = VideoParamEdit::kWidthHeight | VideoParamEdit::kInterlacing | VideoParamEdit::kFrameRate | VideoParamEdit::kPixelAspect;
|
||||
|
||||
@@ -58,6 +59,10 @@ ViewerOutput::ViewerOutput(bool create_buffer_inputs, bool create_default_stream
|
||||
AddInput(kVideoAutoCacheInput, NodeValue::kBoolean, true, InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
|
||||
IgnoreHashingFrom(kVideoAutoCacheInput);
|
||||
IgnoreInvalidationsFrom(kVideoAutoCacheInput);
|
||||
|
||||
AddInput(kAudioAutoCacheInput, NodeValue::kBoolean, true, InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
|
||||
IgnoreHashingFrom(kAudioAutoCacheInput);
|
||||
IgnoreInvalidationsFrom(kAudioAutoCacheInput);
|
||||
}
|
||||
|
||||
if (create_default_streams) {
|
||||
@@ -297,6 +302,10 @@ void ViewerOutput::Retranslate()
|
||||
if (HasInputWithID(kVideoAutoCacheInput)) {
|
||||
SetInputName(kVideoAutoCacheInput, tr("Auto-Cache Video"));
|
||||
}
|
||||
|
||||
if (HasInputWithID(kAudioAutoCacheInput)) {
|
||||
SetInputName(kAudioAutoCacheInput, tr("Auto-Cache Audio"));
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerOutput::VerifyLength()
|
||||
@@ -389,6 +398,8 @@ void ViewerOutput::InputValueChangedEvent(const QString &input, int element)
|
||||
{
|
||||
if (input == kVideoAutoCacheInput) {
|
||||
emit VideoAutoCacheChanged(GetVideoAutoCacheEnabled());
|
||||
} else if (input == kAudioAutoCacheInput) {
|
||||
emit AudioAutoCacheChanged(GetAudioAutoCacheEnabled());
|
||||
} else if (element == 0) {
|
||||
if (input == kVideoParamsInput) {
|
||||
|
||||
|
||||
@@ -175,6 +175,22 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool GetAudioAutoCacheEnabled() const
|
||||
{
|
||||
if (HasInputWithID(kAudioAutoCacheInput)) {
|
||||
return GetStandardValue(kAudioAutoCacheInput).toBool();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void SetAudioAutoCacheEnabled(bool e)
|
||||
{
|
||||
if (HasInputWithID(kAudioAutoCacheInput)) {
|
||||
return SetStandardValue(kAudioAutoCacheInput, e);
|
||||
}
|
||||
}
|
||||
|
||||
static const QString kVideoParamsInput;
|
||||
static const QString kAudioParamsInput;
|
||||
|
||||
@@ -182,6 +198,7 @@ public:
|
||||
static const QString kSamplesInput;
|
||||
|
||||
static const QString kVideoAutoCacheInput;
|
||||
static const QString kAudioAutoCacheInput;
|
||||
|
||||
static const uint64_t kVideoParamEditMask;
|
||||
|
||||
@@ -197,6 +214,7 @@ signals:
|
||||
void InterlacingChanged(VideoParams::Interlacing mode);
|
||||
|
||||
void VideoAutoCacheChanged(bool e);
|
||||
void AudioAutoCacheChanged(bool e);
|
||||
|
||||
void VideoParamsChanged();
|
||||
void AudioParamsChanged();
|
||||
|
||||
@@ -116,12 +116,14 @@ void PreviewAutoCacher::AudioInvalidated(const TimeRange &range)
|
||||
// cancelled, so some areas may end up unrendered forever
|
||||
// ClearAudioQueue();
|
||||
|
||||
audio_job_tracker_.insert(range, graph_changed_time_);
|
||||
if (viewer_node_->GetAudioAutoCacheEnabled()) {
|
||||
audio_job_tracker_.insert(range, graph_changed_time_);
|
||||
|
||||
// Start jobs to re-render the audio at this range, split into 2 second chunks
|
||||
invalidated_audio_.insert(range);
|
||||
// Start jobs to re-render the audio at this range, split into 2 second chunks
|
||||
invalidated_audio_.insert(range);
|
||||
|
||||
TryRender();
|
||||
TryRender();
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewAutoCacher::HashesProcessed()
|
||||
@@ -698,6 +700,19 @@ void PreviewAutoCacher::VideoAutoCacheEnableChanged(bool e)
|
||||
{
|
||||
if (e) {
|
||||
RequeueFrames();
|
||||
} else {
|
||||
CancelVideoTasks();
|
||||
queued_frame_iterator_.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewAutoCacher::AudioAutoCacheEnableChanged(bool e)
|
||||
{
|
||||
if (e) {
|
||||
AudioInvalidatedList(viewer_node_->audio_playback_cache()->GetInvalidatedRanges(viewer_node_->GetAudioLength()));
|
||||
} else {
|
||||
CancelAudioTasks();
|
||||
audio_iterator_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -791,6 +806,11 @@ void PreviewAutoCacher::SetViewerNode(ViewerOutput *viewer_node)
|
||||
this,
|
||||
&PreviewAutoCacher::VideoAutoCacheEnableChanged);
|
||||
|
||||
disconnect(viewer_node_,
|
||||
&ViewerOutput::AudioAutoCacheChanged,
|
||||
this,
|
||||
&PreviewAutoCacher::AudioAutoCacheEnableChanged);
|
||||
|
||||
disconnect(viewer_node_->video_frame_cache(),
|
||||
&PlaybackCache::Invalidated,
|
||||
this,
|
||||
@@ -846,6 +866,11 @@ void PreviewAutoCacher::SetViewerNode(ViewerOutput *viewer_node)
|
||||
this,
|
||||
&PreviewAutoCacher::VideoAutoCacheEnableChanged);
|
||||
|
||||
connect(viewer_node_,
|
||||
&ViewerOutput::AudioAutoCacheChanged,
|
||||
this,
|
||||
&PreviewAutoCacher::AudioAutoCacheEnableChanged);
|
||||
|
||||
connect(viewer_node_->video_frame_cache(),
|
||||
&PlaybackCache::Invalidated,
|
||||
this,
|
||||
|
||||
@@ -220,6 +220,8 @@ private slots:
|
||||
|
||||
void VideoAutoCacheEnableChanged(bool e);
|
||||
|
||||
void AudioAutoCacheEnableChanged(bool e);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user