implement entire project in nodes

Project items are now represented directly in nodes opening up more versatility and possibilities. This is the first iteration of this and will be buggy. Need to test thoroughly.
This commit is contained in:
itsmattkc
2021-02-15 21:31:57 +11:00
parent 155470bec1
commit d7c5ac4b44
174 changed files with 3515 additions and 4658 deletions
-1
View File
@@ -14,7 +14,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
add_subdirectory(media)
add_subdirectory(time)
set(OLIVE_SOURCES
-22
View File
@@ -1,22 +0,0 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2020 Olive Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set(OLIVE_SOURCES
${OLIVE_SOURCES}
node/input/media/media.h
node/input/media/media.cpp
PARENT_SCOPE
)
-100
View File
@@ -1,100 +0,0 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2020 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "media.h"
#include "common/timecodefunctions.h"
#include "common/tohex.h"
namespace olive {
const QString MediaInput::kFootageInput = QStringLiteral("footage_in");
MediaInput::MediaInput() :
connected_footage_(nullptr)
{
AddInput(kFootageInput, NodeValue::kFootage, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
}
QVector<Node::CategoryID> MediaInput::Category() const
{
return {kCategoryInput};
}
Stream *MediaInput::stream() const
{
return Node::ValueToPtr<Stream>(GetStandardValue(kFootageInput));
}
void MediaInput::SetStream(Stream* s)
{
SetStandardValue(kFootageInput, Node::PtrToValue(s));
}
void MediaInput::Retranslate()
{
SetInputName(kFootageInput, tr("Media"));
}
NodeValueTable MediaInput::Value(const QString &output, NodeValueDatabase &value) const
{
Q_UNUSED(output)
NodeValueTable table = value.Merge();
if (connected_footage_) {
rational media_duration = Timecode::timestamp_to_time(connected_footage_->duration(),
connected_footage_->timebase());
table.Push(NodeValue::kRational, QVariant::fromValue(media_duration), this, false, QStringLiteral("length"));
}
return table;
}
void MediaInput::InputValueChangedEvent(const QString &input, int element)
{
Q_UNUSED(element)
if (input == kFootageInput) {
Stream* new_footage = stream();
if (new_footage == connected_footage_) {
return;
}
if (connected_footage_) {
disconnect(connected_footage_, &Stream::ParametersChanged, this, &MediaInput::FootageParametersChanged);
}
connected_footage_ = new_footage;
if (connected_footage_) {
connect(connected_footage_, &Stream::ParametersChanged, this, &MediaInput::FootageParametersChanged);
}
}
}
void MediaInput::FootageParametersChanged()
{
InvalidateCache(TimeRange(0, RATIONAL_MAX), kFootageInput);
}
}
-82
View File
@@ -1,82 +0,0 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2020 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef MEDIAINPUT_H
#define MEDIAINPUT_H
#include "codec/decoder.h"
#include "node/node.h"
#include "project/item/footage/stream.h"
namespace olive {
/**
* @brief A node that imports an image
*/
class MediaInput : public Node
{
Q_OBJECT
public:
MediaInput();
virtual QString Name() const override
{
return tr("Media");
}
virtual QString id() const override
{
return QStringLiteral("org.olivevideoeditor.Olive.mediainput");
}
virtual QString Description() const override
{
return tr("Import footage into the node graph.");
}
virtual Node* copy() const override
{
return new MediaInput();
}
virtual QVector<CategoryID> Category() const override;
Stream* stream() const;
void SetStream(Stream *s);
virtual void Retranslate() override;
virtual NodeValueTable Value(const QString& output, NodeValueDatabase& value) const override;
static const QString kFootageInput;
protected:
virtual void InputValueChangedEvent(const QString& input, int element);
Stream* connected_footage_;
private slots:
void FootageParametersChanged();
};
}
#endif // MEDIAINPUT_H
+2 -2
View File
@@ -66,9 +66,9 @@ NodeValueTable TimeInput::Value(const QString &output, NodeValueDatabase &value)
return table;
}
void TimeInput::Hash(QCryptographicHash &hash, const rational &time) const
void TimeInput::Hash(const QString &output, QCryptographicHash &hash, const rational &time) const
{
Node::Hash(hash, time);
Node::Hash(output, hash, time);
// Make sure time is hashed
hash.addData(NodeValue::ValueToBytes(NodeValue::kRational, QVariant::fromValue(time)));
+1 -1
View File
@@ -40,7 +40,7 @@ public:
virtual NodeValueTable Value(const QString& output, NodeValueDatabase& value) const override;
virtual void Hash(QCryptographicHash& hash, const rational& time) const override;
virtual void Hash(const QString& output, QCryptographicHash& hash, const rational& time) const override;
};