/***
Olive - Non-Linear Video Editor
Copyright (C) 2022 Olive Team
Modifications Copyright (C) 2025 mikesolar
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 .
***/
#include "tracklist.h"
#include "node/factory.h"
#include "node/math/math/math.h"
#include "node/math/merge/merge.h"
#include "node/output/viewer/viewer.h"
#include "node/project/sequence/sequence.h"
namespace olive
{
TrackList::TrackList(Sequence *parent, const Track::Type &type,
const QString &track_input)
: QObject(parent)
, track_input_(track_input)
, total_length_(0)
, type_(type)
{
}
Track *TrackList::get_track_at(int index) const
{
if (index >= 0 && index < track_cache_.size()) {
return track_cache_.at(index);
} else {
return nullptr;
}
}
void TrackList::track_connected(Node *node, int element)
{
if (element == -1) {
parent()->invalidate_all(track_input(), element);
return;
}
Track *track = dynamic_cast