viewer: use auto-cache as sequence parameter

This commit is contained in:
itsmattkc
2021-07-23 14:55:19 -07:00
parent b7a559ab58
commit db29dfdf1a
12 changed files with 170 additions and 112 deletions
+10 -1
View File
@@ -31,6 +31,7 @@ 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::kAutoCacheInput = QStringLiteral("autocache_in");
const uint64_t ViewerOutput::kVideoParamEditMask = VideoParamEdit::kWidthHeight | VideoParamEdit::kInterlacing | VideoParamEdit::kFrameRate | VideoParamEdit::kPixelAspect;
@@ -55,6 +56,10 @@ ViewerOutput::ViewerOutput(bool create_buffer_inputs, bool create_default_stream
if (create_buffer_inputs) {
AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
AddInput(kSamplesInput, NodeValue::kSamples, InputFlags(kInputFlagNotKeyframable));
AddInput(kAutoCacheInput, NodeValue::kBoolean, true, InputFlags(kInputFlagNotKeyframable | kInputFlagNotConnectable));
IgnoreHashingFrom(kAutoCacheInput);
IgnoreInvalidationsFrom(kAutoCacheInput);
}
if (create_default_streams) {
@@ -198,6 +203,8 @@ void ViewerOutput::set_default_parameters()
Config::Current()["DefaultSequenceAudioLayout"].toULongLong(),
AudioParams::kInternalFormat
));
SetAutoCacheEnabled(Config::Current()["DefaultSequenceAutoCache"].toBool());
}
void ViewerOutput::ShiftVideoCache(const rational &from, const rational &to)
@@ -382,7 +389,9 @@ NodeOutput ViewerOutput::GetConnectedSampleOutput()
void ViewerOutput::InputValueChangedEvent(const QString &input, int element)
{
if (element == 0) {
if (input == kAutoCacheInput) {
emit AutoCacheChanged(GetAutoCacheEnabled());
} else if (element == 0) {
if (input == kVideoParamsInput) {
VideoParams new_video_params = GetVideoParams();
+20
View File
@@ -157,12 +157,30 @@ public:
void SetViewerVideoCacheEnabled(bool e) { video_cache_enabled_ = e; }
void SetViewerAudioCacheEnabled(bool e) { audio_cache_enabled_ = e; }
bool GetAutoCacheEnabled() const
{
if (HasInputWithID(kAutoCacheInput)) {
return GetStandardValue(kAutoCacheInput).toBool();
} else {
return false;
}
}
void SetAutoCacheEnabled(bool e)
{
if (HasInputWithID(kAutoCacheInput)) {
return SetStandardValue(kAutoCacheInput, e);
}
}
static const QString kVideoParamsInput;
static const QString kAudioParamsInput;
static const QString kTextureInput;
static const QString kSamplesInput;
static const QString kAutoCacheInput;
static const uint64_t kVideoParamEditMask;
signals:
@@ -176,6 +194,8 @@ signals:
void InterlacingChanged(VideoParams::Interlacing mode);
void AutoCacheChanged(bool e);
void VideoParamsChanged();
void AudioParamsChanged();