clip: limit maximum multicam to 1

This commit is contained in:
itsmattkc
2022-10-05 20:54:17 -07:00
parent 4ea1870098
commit d9c50ce176
2 changed files with 13 additions and 10 deletions
+1 -1
View File
@@ -543,7 +543,7 @@ TimeRange ClipBlock::media_range() const
MultiCamNode *ClipBlock::FindMulticam()
{
auto v = FindInputNodesConnectedToInput<MultiCamNode>(NodeInput(this, kBufferIn));
auto v = FindInputNodesConnectedToInput<MultiCamNode>(NodeInput(this, kBufferIn), 1);
if (v.empty()) {
return nullptr;
} else {
+12 -9
View File
@@ -859,7 +859,7 @@ public:
* @brief Find nodes of a certain type that this Node takes inputs from
*/
template<class T>
static QVector<T*> FindInputNodesConnectedToInput(const NodeInput &input);
static QVector<T*> FindInputNodesConnectedToInput(const NodeInput &input, int maximum = 0);
template<class T>
/**
@@ -1400,10 +1400,10 @@ private:
* @brief Find nodes of a certain type that this Node takes inputs from
*/
template<class T>
static void FindInputNodesConnectedToInputInternal(const NodeInput &input, QVector<T *>& list);
static void FindInputNodesConnectedToInputInternal(const NodeInput &input, QVector<T *>& list, int maximum);
template<class T>
static void FindInputNodeInternal(const Node* n, QVector<T *>& list);
static void FindInputNodeInternal(const Node* n, QVector<T *>& list, int maximum);
template<class T>
static void FindOutputNodeInternal(const Node* n, QVector<T *>& list);
@@ -1512,7 +1512,7 @@ private slots:
};
template<class T>
void Node::FindInputNodesConnectedToInputInternal(const NodeInput &input, QVector<T *> &list)
void Node::FindInputNodesConnectedToInputInternal(const NodeInput &input, QVector<T *> &list, int maximum)
{
Node* edge = input.GetConnectedOutput();
if (!edge) {
@@ -1523,26 +1523,29 @@ void Node::FindInputNodesConnectedToInputInternal(const NodeInput &input, QVecto
if (cast_test) {
list.append(cast_test);
if (maximum != 0 && list.size() == maximum) {
return;
}
}
FindInputNodeInternal<T>(edge, list);
FindInputNodeInternal<T>(edge, list, maximum);
}
template<class T>
QVector<T *> Node::FindInputNodesConnectedToInput(const NodeInput &input)
QVector<T *> Node::FindInputNodesConnectedToInput(const NodeInput &input, int maximum)
{
QVector<T *> list;
FindInputNodesConnectedToInputInternal<T>(input, list);
FindInputNodesConnectedToInputInternal<T>(input, list, maximum);
return list;
}
template<class T>
void Node::FindInputNodeInternal(const Node* n, QVector<T *> &list)
void Node::FindInputNodeInternal(const Node* n, QVector<T *> &list, int maximum)
{
for (auto it=n->input_connections_.cbegin(); it!=n->input_connections_.cend(); it++) {
FindInputNodesConnectedToInputInternal(it->first, list);
FindInputNodesConnectedToInputInternal(it->first, list, maximum);
}
}