build: split the engine into liboakengine.so; worker drops the UI entirely
Physical split: app/{audio,cli,codec,common,config,node,pluginSupport,
render,task,timeline,undo,tool,shaders} plus coreengine, version and
ui/icons+colorcoding move to a new top-level engine/ tree, built as
liboakengine.so (shared). The render backends (oakgl/oakvulkan) move
with it and link the engine library instead of embedding a static
render-core subset (libolive-rendercore is gone).
- oak-render-worker now links liboakengine instead of the whole
libolive-editor object set: 336MB -> 2.9MB, no Qt Widgets UI
- the editor links liboakengine for the engine and keeps only UI
objects in libolive-editor
- install/packaging: GNUInstallDirs libdir on Linux, bundle copy on
macOS, oakengine.dll staged for NSIS, AppImage validation entry
- fix backend lookup for the new layout: DynamicRenderer searched
../app but backends now live in engine/; a stale pre-split liboakgl
in the build tree got dlopened instead, re-initialized and later
destroyed the interposed engine statics (full-suite segfault at
DialogSequenceParameterTab, found via gdb watchpoint)
This commit is contained in:
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Oak Video Editor - Non-Linear Video Editor
|
||||
* Copyright (C) 2025 Olive CE 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 "conformmanager.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
#include "task/taskmanager.h"
|
||||
|
||||
namespace olive
|
||||
{
|
||||
|
||||
ConformManager *ConformManager::instance_ = nullptr;
|
||||
|
||||
ConformManager::Conform ConformManager::get_conform_state(
|
||||
const QString &decoder_id, const QString &cache_path,
|
||||
const Decoder::CodecStream &stream, const AudioParams ¶ms, bool wait)
|
||||
{
|
||||
// Mutex because we'll need to check the status of a conform task
|
||||
QMutexLocker locker(&mutex_);
|
||||
|
||||
// Return existing conform if exists
|
||||
QVector<QString> filenames =
|
||||
get_conformed_filename(cache_path, stream, params);
|
||||
if (all_conforms_exist(filenames)) {
|
||||
return { k_conform_exists, filenames, nullptr };
|
||||
}
|
||||
|
||||
ConformTask *conforming_task = nullptr;
|
||||
|
||||
foreach (const ConformData &data, conforming_) {
|
||||
if (data.stream == stream && data.params == params) {
|
||||
// Already creating conform in a task
|
||||
conforming_task = data.task;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!conforming_task) {
|
||||
// Not conforming yet, create a task to do so
|
||||
|
||||
// We conform to a different filename until it's done to make it clear even across sessions
|
||||
// whether this conform is ready or not
|
||||
QVector<QString> working_filenames = filenames;
|
||||
for (int i = 0; i < working_filenames.size(); i++) {
|
||||
working_filenames[i].append(QStringLiteral(".working"));
|
||||
}
|
||||
|
||||
conforming_task =
|
||||
new ConformTask(decoder_id, stream, params, working_filenames);
|
||||
connect(conforming_task, &ConformTask::finished, this,
|
||||
&ConformManager::conform_task_finished);
|
||||
conforming_task->moveToThread(TaskManager::instance()->thread());
|
||||
QMetaObject::invokeMethod(TaskManager::instance(), "add_task",
|
||||
Qt::QueuedConnection,
|
||||
Q_ARG(Task *, conforming_task));
|
||||
|
||||
conforming_.append(
|
||||
{ stream, params, conforming_task, working_filenames, filenames });
|
||||
}
|
||||
|
||||
if (wait) {
|
||||
do {
|
||||
conform_done_condition_.wait(&mutex_);
|
||||
} while (!all_conforms_exist(filenames));
|
||||
return { k_conform_exists, filenames, nullptr };
|
||||
}
|
||||
|
||||
return { k_conform_generating, QVector<QString>(), conforming_task };
|
||||
}
|
||||
|
||||
QVector<QString>
|
||||
ConformManager::get_conformed_filename(const QString &cache_path,
|
||||
const Decoder::CodecStream &stream,
|
||||
const AudioParams ¶ms)
|
||||
{
|
||||
QVector<QString> filenames(params.channel_count());
|
||||
|
||||
for (int i = 0; i < filenames.size(); i++) {
|
||||
QString index_fn =
|
||||
QStringLiteral("%1-%2.%3.%4.%5.%6.pcm")
|
||||
.arg(FileFunctions::get_unique_file_identifier(stream.filename()),
|
||||
QString::number(stream.stream()),
|
||||
QString::number(params.sample_rate()),
|
||||
QString::number(params.format()),
|
||||
QString::number(params.channel_layout()),
|
||||
QString::number(i));
|
||||
|
||||
filenames[i] = QDir(cache_path).filePath(index_fn);
|
||||
}
|
||||
|
||||
return filenames;
|
||||
}
|
||||
|
||||
bool ConformManager::all_conforms_exist(const QVector<QString> &filenames)
|
||||
{
|
||||
foreach (const QString &fn, filenames) {
|
||||
if (!QFileInfo::exists(fn)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConformManager::conform_task_finished(Task *task, bool succeeded)
|
||||
{
|
||||
QMutexLocker locker(&mutex_);
|
||||
|
||||
ConformData data;
|
||||
|
||||
// Remove conform data from list
|
||||
for (int i = 0; i < conforming_.size(); i++) {
|
||||
const ConformData &c = conforming_.at(i);
|
||||
if (c.task == task) {
|
||||
data = c;
|
||||
conforming_.removeAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (succeeded) {
|
||||
// Move file to standard conform name, making it clear this conform is ready for use
|
||||
for (int i = 0; i < data.finished_filename.size(); i++) {
|
||||
const QString &finished = data.finished_filename.at(i);
|
||||
const QString &working = data.working_filename.at(i);
|
||||
|
||||
QFile::remove(finished);
|
||||
QFile::rename(working, finished);
|
||||
}
|
||||
|
||||
conform_done_condition_.wakeAll();
|
||||
locker.unlock();
|
||||
emit conform_ready();
|
||||
} else {
|
||||
// Failed, just delete the working filename if exists
|
||||
for (int i = 0; i < data.working_filename.size(); i++) {
|
||||
QFile::remove(data.working_filename.at(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user