nodes: revert to single output

This commit is contained in:
itsmattkc
2021-09-07 22:01:36 -07:00
parent 9843fd47f0
commit b07bccb7dc
89 changed files with 511 additions and 616 deletions
+12 -12
View File
@@ -70,7 +70,7 @@ QVector<PreviewAutoCacher::HashData> PreviewAutoCacher::GenerateHashes(ViewerOut
const rational &time = times.at(i);
// See if hash already exists in disk cache
QByteArray hash = RenderManager::Hash(viewer->GetConnectedTextureOutput(), viewer->GetVideoParams(), time);
QByteArray hash = RenderManager::Hash(viewer->GetConnectedTextureOutput(), viewer->GetValueHintForInput(ViewerOutput::kTextureInput, -1), viewer->GetVideoParams(), time);
// Check memory list since disk checking is slow
bool hash_exists = existing_hashes.contains(hash);
@@ -357,20 +357,20 @@ void PreviewAutoCacher::RemoveNode(Node *node)
delete copy;
}
void PreviewAutoCacher::AddEdge(const NodeOutput &output, const NodeInput &input)
void PreviewAutoCacher::AddEdge(Node *output, const NodeInput &input)
{
Node* our_output = copy_map_.value(output.node());
Node* our_output = copy_map_.value(output);
Node* our_input = copy_map_.value(input.node());
Node::ConnectEdge(NodeOutput(our_output, output.output()), NodeInput(our_input, input.input(), input.element()));
Node::ConnectEdge(our_output, NodeInput(our_input, input.input(), input.element()));
}
void PreviewAutoCacher::RemoveEdge(const NodeOutput &output, const NodeInput &input)
void PreviewAutoCacher::RemoveEdge(Node *output, const NodeInput &input)
{
Node* our_output = copy_map_.value(output.node());
Node* our_output = copy_map_.value(output);
Node* our_input = copy_map_.value(input.node());
Node::DisconnectEdge(NodeOutput(our_output, output.output()), NodeInput(our_input, input.input(), input.element()));
Node::DisconnectEdge(our_output, NodeInput(our_input, input.input(), input.element()));
}
void PreviewAutoCacher::CopyValue(const NodeInput &input)
@@ -458,23 +458,23 @@ void PreviewAutoCacher::ClearVideoDownloadQueue(bool hard)
void PreviewAutoCacher::NodeAdded(Node *node)
{
graph_update_queue_.append({QueuedJob::kNodeAdded, node, NodeInput(), NodeOutput()});
graph_update_queue_.append({QueuedJob::kNodeAdded, node, NodeInput(), nullptr});
UpdateGraphChangeValue();
}
void PreviewAutoCacher::NodeRemoved(Node *node)
{
graph_update_queue_.append({QueuedJob::kNodeRemoved, node, NodeInput(), NodeOutput()});
graph_update_queue_.append({QueuedJob::kNodeRemoved, node, NodeInput(), nullptr});
UpdateGraphChangeValue();
}
void PreviewAutoCacher::EdgeAdded(const NodeOutput &output, const NodeInput &input)
void PreviewAutoCacher::EdgeAdded(Node *output, const NodeInput &input)
{
graph_update_queue_.append({QueuedJob::kEdgeAdded, nullptr, input, output});
UpdateGraphChangeValue();
}
void PreviewAutoCacher::EdgeRemoved(const NodeOutput &output, const NodeInput &input)
void PreviewAutoCacher::EdgeRemoved(Node *output, const NodeInput &input)
{
graph_update_queue_.append({QueuedJob::kEdgeRemoved, nullptr, input, output});
UpdateGraphChangeValue();
@@ -482,7 +482,7 @@ void PreviewAutoCacher::EdgeRemoved(const NodeOutput &output, const NodeInput &i
void PreviewAutoCacher::ValueChanged(const NodeInput &input)
{
graph_update_queue_.append({QueuedJob::kValueChanged, nullptr, input, NodeOutput()});
graph_update_queue_.append({QueuedJob::kValueChanged, nullptr, input, nullptr});
UpdateGraphChangeValue();
}
+5 -5
View File
@@ -87,8 +87,8 @@ private:
void AddNode(Node* node);
void RemoveNode(Node* node);
void AddEdge(const NodeOutput& output, const NodeInput& input);
void RemoveEdge(const NodeOutput& output, const NodeInput& input);
void AddEdge(Node *output, const NodeInput& input);
void RemoveEdge(Node *output, const NodeInput& input);
void CopyValue(const NodeInput& input);
void InsertIntoCopyMap(Node* node, Node* copy);
@@ -130,7 +130,7 @@ private:
Type type;
Node* node;
NodeInput input;
NodeOutput output;
Node *output;
};
ViewerOutput* viewer_node_;
@@ -214,9 +214,9 @@ private slots:
void NodeRemoved(Node* node);
void EdgeAdded(const NodeOutput& output, const NodeInput& input);
void EdgeAdded(Node *output, const NodeInput& input);
void EdgeRemoved(const NodeOutput& output, const NodeInput& input);
void EdgeRemoved(Node *output, const NodeInput& input);
void ValueChanged(const NodeInput& input);
+1 -1
View File
@@ -102,7 +102,7 @@ void RenderManager::ClearOldDecoders()
}
}
QByteArray RenderManager::Hash(const Node *n, const QString& output, const VideoParams &params, const rational &time)
QByteArray RenderManager::Hash(const Node *n, const Node::ValueHint &output, const VideoParams &params, const rational &time)
{
QCryptographicHash hasher(QCryptographicHash::Sha1);
+1 -5
View File
@@ -67,11 +67,7 @@ public:
/**
* @brief Generate a unique identifier for a certain node at a certain time
*/
static QByteArray Hash(const Node *n, const QString &output, const VideoParams &params, const rational &time);
static QByteArray Hash(const NodeOutput &output, const VideoParams &params, const rational &time)
{
return Hash(output.node(), output.output(), params, time);
}
static QByteArray Hash(const Node *n, const Node::ValueHint &output, const VideoParams &params, const rational &time);
/**
* @brief Asynchronously generate a frame at a given time
+7 -8
View File
@@ -47,10 +47,9 @@ TexturePtr RenderProcessor::GenerateTexture(const rational &time, const rational
ViewerOutput* viewer = Node::ValueToPtr<ViewerOutput>(ticket_->property("viewer"));
NodeValueTable table;
NodeOutput texture_output = viewer->GetConnectedTextureOutput();
if (texture_output.IsValid()) {
table = GenerateTable(texture_output.node(), texture_output.output(),
TimeRange(time, time + frame_length));
Node *texture_output = viewer->GetConnectedTextureOutput();
if (texture_output) {
table = GenerateTable(texture_output, viewer->GetValueHintForInput(ViewerOutput::kTextureInput, -1), TimeRange(time, time + frame_length));
}
return table.Get(NodeValue::kTexture).value<TexturePtr>();
@@ -170,9 +169,9 @@ void RenderProcessor::Run()
TimeRange time = ticket_->property("time").value<TimeRange>();
NodeValueTable table;
NodeOutput texture_output = viewer->GetConnectedSampleOutput();
if (texture_output.IsValid()) {
table = GenerateTable(texture_output.node(), texture_output.output(), time);
Node *texture_output = viewer->GetConnectedSampleOutput();
if (texture_output) {
table = GenerateTable(texture_output, viewer->GetValueHintForInput(ViewerOutput::kSamplesInput, -1),time);
}
QVariant sample_variant = table.Get(NodeValue::kSamples);
@@ -263,7 +262,7 @@ NodeValueTable RenderProcessor::GenerateBlockTable(const Track *track, const Tim
int max_dest_sz = audio_params.time_to_samples(range_for_block.length());
// Destination buffer
NodeValueTable table = GenerateTable(b, Track::TransformRangeForBlock(b, range_for_block));
NodeValueTable table = GenerateTable(b, track->GetValueHintForInput(Track::kBlockInput, track->GetArrayIndexFromBlock(b)),Track::TransformRangeForBlock(b, range_for_block));
SampleBufferPtr samples_from_this_block = table.Take(NodeValue::kSamples).value<SampleBufferPtr>();
if (!samples_from_this_block) {