R8: finish app/ pure C ABI migration (P3-P9) and make OTIO required

- app/ no longer includes engine C++ headers nor holds engine C++ types:
  engine access goes through the oakengine C ABI plus C++ wrappers
  (oakutil/oaknode.h, oakutil/oakvideo.h) and app-local mirror types
  (tooltypes, trackreferencehandle, timelinecommonapp, keyframetypes,
  subtitleapp, serializedlayoutinfoapp, nodevaluehandle, sliderdisplaytypeapp)
- engine: new C ABI functions for block/track/clip/transition navigation
  and predicates, links, caches, waveform/playback, disk folder,
  sequence_track_list, node_free, footage_is_valid, block_get_track,
  get_brush; loadotio/saveotio ported to the current engine API
- OTIO is now a required dependency: CI and CD build it on every
  platform, FindOpenTimelineIO fixed for OTIO 0.16/0.19 (the old deps
  include requirement silently disabled OTIO everywhere), runtime
  libraries are bundled into packages and copied next to macOS binaries
  (oak_copy_otio_runtime)
- fix ProjectViewModel drag&drop mime read/write size mismatch (segfault)
- unify color label naming (k_olive -> "Oak") in the app-side mirror
- docs: OTIO required, FFmpeg minimum corrected to 6.0 (en/zh)
- gtest suite: 1925 passed, 0 failed
This commit is contained in:
2026-07-31 22:46:52 +08:00
parent 18aed979a2
commit 66d761b4b7
285 changed files with 13261 additions and 5895 deletions
+40 -41
View File
@@ -46,7 +46,6 @@
#include "node/project/footage/footage.h"
#include "node/project/sequence/sequence.h"
#include "timeline/timelineundogeneral.h"
#include "window/mainwindow/mainwindowundo.h"
namespace olive
{
@@ -56,23 +55,23 @@ LoadOTIOTask::LoadOTIOTask(const QString &s)
{
}
bool LoadOTIOTask::Run()
bool LoadOTIOTask::run()
{
OTIO::ErrorStatus es;
auto root = OTIO::SerializableObjectWithMetadata::from_json_file(
GetFilename().toStdString(), &es);
get_filename().toStdString(), &es);
if (es.outcome != OTIO::ErrorStatus::Outcome::OK) {
SetError(
set_error(
tr("Failed to load OpenTimelineIO from file \"%1\" \n\nOpenTimelineIO Error:\n\n%2")
.arg(GetFilename(),
.arg(get_filename(),
QString::fromStdString(es.full_description)));
return false;
}
project_ = new Project();
project_->Initialize();
project_->initialize();
project_->set_modified(true);
std::vector<OTIO::Timeline *> timelines;
@@ -93,7 +92,7 @@ bool LoadOTIOTask::Run()
timelines.push_back(static_cast<OTIO::Timeline *>(root));
} else {
// Unknown root, we don't know what to do with this
SetError(tr("Unknown OpenTimelineIO root element"));
set_error(tr("Unknown OpenTimelineIO root element"));
delete project_;
project_ = nullptr;
return false;
@@ -113,12 +112,12 @@ bool LoadOTIOTask::Run()
foreach (auto timeline, timelines) {
Sequence *sequence = new Sequence();
if (!timeline->name().empty()) {
sequence->SetLabel(QString::fromStdString(timeline->name()));
sequence->set_label(QString::fromStdString(timeline->name()));
} else {
// If the otio timeline does not provide a name, create a default one here
unnamed_sequence_count++;
QString label = tr("Sequence %1").arg(unnamed_sequence_count);
sequence->SetLabel(QString::fromStdString(label.toStdString()));
sequence->set_label(QString::fromStdString(label.toStdString()));
}
// Set default params incase they aren't edited.
sequence->set_default_parameters();
@@ -152,7 +151,7 @@ bool LoadOTIOTask::Run()
// Create a folder for this sequence's footage
Folder *sequence_footage = new Folder();
sequence_footage->SetLabel(QString::fromStdString(timeline->name()));
sequence_footage->set_label(QString::fromStdString(timeline->name()));
sequence_footage->setParent(project_);
FolderAddChild(project_->root(), sequence_footage).redo_now();
@@ -169,9 +168,9 @@ bool LoadOTIOTask::Run()
Track::Type type;
if (otio_track->kind() == "Video") {
type = Track::kVideo;
type = Track::k_video;
} else {
type = Track::kAudio;
type = Track::k_audio;
}
// Create track
@@ -187,7 +186,7 @@ bool LoadOTIOTask::Run()
// Get clips from track
auto clip_map = otio_track->children();
if (es.outcome != OTIO::ErrorStatus::Outcome::OK) {
SetError(tr("Failed to load clip"));
set_error(tr("Failed to load clip"));
return false;
}
@@ -217,21 +216,21 @@ bool LoadOTIOTask::Run()
}
block->setParent(project_);
block->SetLabel(QString::fromStdString(otio_block->name()));
block->set_label(QString::fromStdString(otio_block->name()));
track->AppendBlock(block);
track->append_block(block);
Rational start_time;
Rational duration;
if (otio_block->schema_name() == "Clip" ||
otio_block->schema_name() == "Gap") {
start_time = Rational::fromDouble(
start_time = Rational::from_double(
static_cast<OTIO::Item *>(otio_block)
->source_range()
->start_time()
.to_seconds());
duration = Rational::fromDouble(
duration = Rational::from_double(
static_cast<OTIO::Item *>(otio_block)
->source_range()
->duration()
@@ -248,9 +247,9 @@ bool LoadOTIOTask::Run()
if (prev_block_transition) {
TransitionBlock *previous_transition_block =
static_cast<TransitionBlock *>(previous_block);
Node::ConnectEdge(
Node::connect_edge(
block, NodeInput(previous_transition_block,
TransitionBlock::kInBlockInput));
TransitionBlock::k_in_block_input));
prev_block_transition = false;
}
@@ -268,10 +267,10 @@ bool LoadOTIOTask::Run()
otio_block_transition->out_offset()));
if (previous_block) {
Node::ConnectEdge(
Node::connect_edge(
previous_block,
NodeInput(transition_block,
TransitionBlock::kOutBlockInput));
TransitionBlock::k_out_block_input));
}
prev_block_transition = true;
@@ -279,7 +278,7 @@ bool LoadOTIOTask::Run()
block->setParent(sequence->parent());
// Position transition in its own context
block->SetNodePositionInContext(block, QPointF(0, 0));
block->set_node_position_in_context(block, QPointF(0, 0));
}
if (otio_block->schema_name() == "Gap") {
@@ -287,7 +286,7 @@ bool LoadOTIOTask::Run()
block->setParent(sequence->parent());
// Position transition in its own context
block->SetNodePositionInContext(block, QPointF(0, 0));
block->set_node_position_in_context(block, QPointF(0, 0));
}
// Update this after it's used but before any continue statements
@@ -316,7 +315,7 @@ bool LoadOTIOTask::Run()
probed_item->setParent(project_);
QFileInfo info(probed_item->filename());
probed_item->SetLabel(info.fileName());
probed_item->set_label(info.fileName());
FolderAddChild add(sequence_footage, probed_item);
add.redo_now();
@@ -326,44 +325,44 @@ bool LoadOTIOTask::Run()
block->setParent(sequence->parent());
// Position clip in its own context
block->SetNodePositionInContext(block, QPointF(0, 0));
block->set_node_position_in_context(block, QPointF(0, 0));
// Position footage in its context
block->SetNodePositionInContext(probed_item,
QPointF(-2, 0));
block->set_node_position_in_context(probed_item,
QPointF(-2, 0));
if (track->type() == Track::kVideo) {
if (track->type() == Track::k_video) {
TransformDistortNode *transform =
new TransformDistortNode();
transform->setParent(sequence->parent());
Node::ConnectEdge(
Node::connect_edge(
probed_item,
NodeInput(transform,
TransformDistortNode::kTextureInput));
Node::ConnectEdge(transform,
TransformDistortNode::k_texture_input));
Node::connect_edge(transform,
NodeInput(block,
ClipBlock::kBufferIn));
block->SetNodePositionInContext(transform,
QPointF(-1, 0));
ClipBlock::k_buffer_in));
block->set_node_position_in_context(transform,
QPointF(-1, 0));
} else {
VolumeNode *volume_node = new VolumeNode();
volume_node->setParent(sequence->parent());
Node::ConnectEdge(
Node::connect_edge(
probed_item,
NodeInput(volume_node,
VolumeNode::kSamplesInput));
Node::ConnectEdge(volume_node,
VolumeNode::k_samples_input));
Node::connect_edge(volume_node,
NodeInput(block,
ClipBlock::kBufferIn));
block->SetNodePositionInContext(volume_node,
QPointF(-1, 0));
ClipBlock::k_buffer_in));
block->set_node_position_in_context(volume_node,
QPointF(-1, 0));
}
}
}
clips_done++;
emit ProgressChanged(clips_done / number_of_clips);
emit progress_changed(clips_done / number_of_clips);
}
}
}
+1 -1
View File
@@ -37,7 +37,7 @@ public:
LoadOTIOTask(const QString &filename);
protected:
virtual bool Run() override;
virtual bool run() override;
};
}
+27 -27
View File
@@ -41,16 +41,16 @@ namespace olive
SaveOTIOTask::SaveOTIOTask(Project *project)
: project_(project)
{
SetTitle(tr("Exporting project to OpenTimelineIO"));
set_title(tr("Exporting project to OpenTimelineIO"));
}
bool SaveOTIOTask::Run()
bool SaveOTIOTask::run()
{
QVector<Sequence *> sequences =
project_->root()->ListChildrenOfType<Sequence>();
project_->root()->list_children_of_type<Sequence>();
if (sequences.isEmpty()) {
SetError(tr("Project contains no sequences to export."));
set_error(tr("Project contains no sequences to export."));
return false;
}
@@ -69,8 +69,8 @@ bool SaveOTIOTask::Run()
}
// Error out of function
SetError(
tr("Failed to serialize sequence \"%1\"").arg(seq->GetLabel()));
set_error(
tr("Failed to serialize sequence \"%1\"").arg(seq->get_label()));
return false;
}
@@ -101,21 +101,21 @@ bool SaveOTIOTask::Run()
OTIO::Timeline *SaveOTIOTask::SerializeTimeline(Sequence *sequence)
{
auto otio_timeline = new OTIO::Timeline(sequence->GetLabel().toStdString());
auto otio_timeline = new OTIO::Timeline(sequence->get_label().toStdString());
// Retainers clean themselves up when the final user is removed
OTIO::Timeline::Retainer<OTIO::Timeline> *timeline_retainer =
new OTIO::Timeline::Retainer<OTIO::Timeline>(otio_timeline);
// Suppress unused variable warning
Q_UNUSED(timeline_retainer);
double rate = sequence->GetVideoParams().frame_rate().toDouble();
double rate = sequence->get_video_params().frame_rate().to_double();
if (qIsNaN(rate)) {
return nullptr;
}
if (!SerializeTrackList(sequence->track_list(Track::kVideo), otio_timeline,
if (!SerializeTrackList(sequence->track_list(Track::k_video), otio_timeline,
rate) ||
!SerializeTrackList(sequence->track_list(Track::kAudio), otio_timeline,
!SerializeTrackList(sequence->track_list(Track::k_audio), otio_timeline,
rate)) {
otio_timeline->possibly_delete();
return nullptr;
@@ -132,10 +132,10 @@ OTIO::Track *SaveOTIOTask::SerializeTrack(Track *track, double sequence_rate,
OTIO::ErrorStatus es;
switch (track->type()) {
case Track::kVideo:
case Track::k_video:
otio_track->set_kind("Video");
break;
case Track::kAudio:
case Track::k_audio:
otio_track->set_kind("Audio");
break;
default:
@@ -144,17 +144,17 @@ OTIO::Track *SaveOTIOTask::SerializeTrack(Track *track, double sequence_rate,
goto fail;
}
foreach (Block *block, track->Blocks()) {
foreach (Block *block, track->blocks()) {
OTIO::Composable *otio_block = nullptr;
if (dynamic_cast<ClipBlock *>(block)) {
auto otio_clip = new OTIO::Clip(block->GetLabel().toStdString());
auto otio_clip = new OTIO::Clip(block->get_label().toStdString());
otio_clip->set_source_range(
OTIO::TimeRange(block->in().toRationalTime(sequence_rate),
block->length().toRationalTime(sequence_rate)));
QVector<Footage *> media_nodes = block->FindInputNodes<Footage>();
QVector<Footage *> media_nodes = block->find_input_nodes<Footage>();
if (!media_nodes.isEmpty()) {
OTIO::TimeRange available_range;
if (otio_track->kind().compare("Video") == 0) {
@@ -162,22 +162,22 @@ OTIO::Track *SaveOTIOTask::SerializeTrack(Track *track, double sequence_rate,
// the sequences rate
double source_frame_rate = static_cast<ClipBlock *>(block)
->connected_viewer()
->GetVideoParams()
->get_video_params()
.frame_rate()
.toDouble();
.to_double();
available_range = OTIO::TimeRange(
OTIO::RationalTime(0, source_frame_rate),
OTIO::RationalTime(
media_nodes.first()->GetVideoParams().duration(),
media_nodes.first()->get_video_params().duration(),
source_frame_rate));
} else if (otio_track->kind().compare("Audio") == 0) {
available_range = OTIO::TimeRange(
OTIO::RationalTime(
0,
media_nodes.first()->GetAudioParams().sample_rate()),
media_nodes.first()->get_audio_params().sample_rate()),
OTIO::RationalTime(
media_nodes.first()->GetAudioParams().duration(),
media_nodes.first()->GetAudioParams().sample_rate()));
media_nodes.first()->get_audio_params().duration(),
media_nodes.first()->get_audio_params().sample_rate()));
}
auto media_ref = new OTIO::ExternalReference(
media_nodes.first()->filename().toStdString(),
@@ -190,10 +190,10 @@ OTIO::Track *SaveOTIOTask::SerializeTrack(Track *track, double sequence_rate,
otio_block =
new OTIO::Gap(OTIO::TimeRange(block->in().toRationalTime(),
block->length().toRationalTime()),
block->GetLabel().toStdString());
block->get_label().toStdString());
} else if (dynamic_cast<TransitionBlock *>(block)) {
auto otio_transition =
new OTIO::Transition(block->GetLabel().toStdString());
new OTIO::Transition(block->get_label().toStdString());
TransitionBlock *our_transition =
static_cast<TransitionBlock *>(block);
@@ -219,8 +219,8 @@ OTIO::Track *SaveOTIOTask::SerializeTrack(Track *track, double sequence_rate,
}
// All OTIO tracks must have the same duration so we add a Gap to fill the remaining time
if (otio_track->duration(&es).to_seconds() < max_track_length.toDouble()) {
double time_left = max_track_length.toDouble() -
if (otio_track->duration(&es).to_seconds() < max_track_length.to_double()) {
double time_left = max_track_length.to_double() -
otio_track->duration(&es).to_seconds();
OTIO::Gap *gap = new OTIO::Gap(OTIO::TimeRange(
@@ -248,13 +248,13 @@ bool SaveOTIOTask::SerializeTrackList(TrackList *list,
Rational max_track_length = RATIONAL_MIN;
foreach (Track *track, list->GetTracks()) {
foreach (Track *track, list->get_tracks()) {
if (track->track_length() > max_track_length) {
max_track_length = track->track_length();
}
}
foreach (Track *track, list->GetTracks()) {
foreach (Track *track, list->get_tracks()) {
auto otio_track =
SerializeTrack(track, sequence_rate, max_track_length);
+1 -1
View File
@@ -40,7 +40,7 @@ public:
SaveOTIOTask(Project *project);
protected:
virtual bool Run() override;
virtual bool run() override;
private:
OTIO::Timeline *SerializeTimeline(Sequence *sequence);