node: fixed issue with "taking" values from input tables
As opposed to simply leaving all values in the table, nodes can now "take" values that they use to free up memory (e.g. "taking" input buffers if they're used to produce an output buffer). This is a fairly large change, expect regressions.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "media.h"
|
||||
|
||||
#include "common/timecodefunctions.h"
|
||||
#include "common/tohex.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
@@ -54,9 +55,9 @@ void MediaInput::Retranslate()
|
||||
footage_input_->set_name(tr("Footage"));
|
||||
}
|
||||
|
||||
NodeValueTable MediaInput::Value(const NodeValueDatabase &value) const
|
||||
NodeValueTable MediaInput::Value(NodeValueDatabase &value) const
|
||||
{
|
||||
NodeValueTable table = value.Merge();
|
||||
NodeValueTable table;
|
||||
|
||||
if (connected_footage_) {
|
||||
rational media_duration = Timecode::timestamp_to_time(connected_footage_->duration(),
|
||||
@@ -65,6 +66,12 @@ NodeValueTable MediaInput::Value(const NodeValueDatabase &value) const
|
||||
table.Push(NodeInput::kRational, QVariant::fromValue(media_duration), "length");
|
||||
}
|
||||
|
||||
// Push buffer to the top of the stack
|
||||
NodeValue buffer = value[footage_input_].GetWithMeta(NodeParam::kSamples);
|
||||
if (buffer.type() != NodeParam::kNone) {
|
||||
table.Push(buffer);
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
|
||||
virtual void Retranslate() override;
|
||||
|
||||
virtual NodeValueTable Value(const NodeValueDatabase& value) const override;
|
||||
virtual NodeValueTable Value(NodeValueDatabase& value) const override;
|
||||
|
||||
protected:
|
||||
NodeInput* footage_input_;
|
||||
|
||||
@@ -51,7 +51,7 @@ QString TimeInput::Description() const
|
||||
return tr("Generates the time (in seconds) at this frame");
|
||||
}
|
||||
|
||||
NodeValueTable TimeInput::Value(const NodeValueDatabase &value) const
|
||||
NodeValueTable TimeInput::Value(NodeValueDatabase &value) const
|
||||
{
|
||||
NodeValueTable table = value.Merge();
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
virtual QString Category() const override;
|
||||
virtual QString Description() const override;
|
||||
|
||||
virtual NodeValueTable Value(const NodeValueDatabase& value) const override;
|
||||
virtual NodeValueTable Value(NodeValueDatabase& value) const override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user