multicam: initial implementation

This commit is contained in:
itsmattkc
2022-09-19 08:55:56 -07:00
parent 3abc9eb1d1
commit 2dc2edf3e0
6 changed files with 109 additions and 1 deletions
+1
View File
@@ -14,6 +14,7 @@
# 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(multicam)
add_subdirectory(time)
add_subdirectory(value)
+22
View File
@@ -0,0 +1,22 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2022 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/multicam/multicamnode.h
node/input/multicam/multicamnode.cpp
PARENT_SCOPE
)
+58
View File
@@ -1,6 +1,64 @@
#include "multicamnode.h"
namespace olive {
#define super Node
const QString MultiCamNode::kCurrentInput = QStringLiteral("current_in");
const QString MultiCamNode::kSourcesInput = QStringLiteral("sources_in");
MultiCamNode::MultiCamNode()
{
AddInput(kCurrentInput, NodeValue::kInt, InputFlags(kInputFlagStatic));
AddInput(kSourcesInput, NodeValue::kNone, InputFlags(kInputFlagNotKeyframable | kInputFlagArray));
}
QString MultiCamNode::Name() const
{
return tr("Multi-Cam");
}
QString MultiCamNode::id() const
{
return QStringLiteral("org.olivevideoeditor.Olive.multicam");
}
QVector<Node::CategoryID> MultiCamNode::Category() const
{
return {kCategoryTimeline};
}
QString MultiCamNode::Description() const
{
return tr("Allows easy switching between multiple sources.");
}
Node::ActiveElements MultiCamNode::GetActiveElementsAtTime(const QString &input, const TimeRange &r) const
{
if (input == kSourcesInput) {
Node::ActiveElements a;
a.add(GetStandardValue(kCurrentInput).toInt());
return a;
} else {
return super::GetActiveElementsAtTime(input, r);
}
}
void MultiCamNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
{
NodeValueArray arr = value[kSourcesInput].toArray();
if (!arr.empty()) {
table->Push(arr.begin()->second);
}
}
void MultiCamNode::Retranslate()
{
super::Retranslate();
SetInputName(kCurrentInput, tr("Current"));
SetInputName(kSourcesInput, tr("Sources"));
}
}
+24 -1
View File
@@ -1,11 +1,34 @@
#ifndef MULTICAMNODE_H
#define MULTICAMNODE_H
#include "node/node.h"
class MultiCamNode
namespace olive {
class MultiCamNode : public Node
{
Q_OBJECT
public:
MultiCamNode();
NODE_DEFAULT_FUNCTIONS(MultiCamNode)
virtual QString Name() const override;
virtual QString id() const override;
virtual QVector<CategoryID> Category() const override;
virtual QString Description() const override;
virtual ActiveElements GetActiveElementsAtTime(const QString &input, const TimeRange &r) const override;
virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override;
virtual void Retranslate() override;
static const QString kCurrentInput;
static const QString kSourcesInput;
};
}
#endif // MULTICAMNODE_H