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:
itsmattkc
2020-04-16 23:12:05 +10:00
parent cc8699c0bc
commit 2f80be437a
30 changed files with 179 additions and 101 deletions
+9 -2
View File
@@ -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;
}