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,279 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef OAK_PROJECTSERIALIZER_H
|
||||
#define OAK_PROJECTSERIALIZER_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "common/define.h"
|
||||
#include "node/project.h"
|
||||
#include "node/project/serializer/mainwindowlayoutinfo.h"
|
||||
#include "typeserializer.h"
|
||||
|
||||
namespace olive
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief An abstract base class for serializing/deserializing project data
|
||||
*
|
||||
* The goal of this is to further abstract serialized project data from their
|
||||
* in-memory representations.
|
||||
*/
|
||||
class ProjectSerializer {
|
||||
public:
|
||||
enum LoadType {
|
||||
k_project,
|
||||
k_only_nodes,
|
||||
k_only_clips,
|
||||
k_only_markers,
|
||||
k_only_keyframes
|
||||
};
|
||||
|
||||
ProjectSerializer() = default;
|
||||
|
||||
virtual ~ProjectSerializer()
|
||||
{
|
||||
}
|
||||
|
||||
DISABLE_COPY_MOVE(ProjectSerializer)
|
||||
|
||||
enum ResultCode {
|
||||
k_success,
|
||||
k_project_too_old,
|
||||
k_project_too_new,
|
||||
k_unknown_version,
|
||||
k_file_error,
|
||||
k_xml_error,
|
||||
k_overwrite_error,
|
||||
k_no_data
|
||||
};
|
||||
|
||||
using SerializedProperties = QHash<Node *, QMap<QString, QString>>;
|
||||
using SerializedKeyframes = QHash<QString, QVector<NodeKeyframe *>>;
|
||||
|
||||
class LoadData {
|
||||
public:
|
||||
LoadData() = default;
|
||||
|
||||
SerializedProperties properties;
|
||||
|
||||
std::vector<TimelineMarker *> markers;
|
||||
|
||||
SerializedKeyframes keyframes;
|
||||
|
||||
MainWindowLayoutInfo layout;
|
||||
|
||||
QVector<Node *> nodes;
|
||||
|
||||
QHash<quintptr, Node *> node_ptrs;
|
||||
|
||||
QHash<Node *, QUuid> node_uuids;
|
||||
|
||||
Node::OutputConnections promised_connections;
|
||||
};
|
||||
|
||||
class Result {
|
||||
public:
|
||||
Result(const ResultCode &code)
|
||||
: code_(code)
|
||||
{
|
||||
}
|
||||
|
||||
bool operator==(const ResultCode &code)
|
||||
{
|
||||
return code_ == code;
|
||||
}
|
||||
bool operator!=(const ResultCode &code)
|
||||
{
|
||||
return code_ != code;
|
||||
}
|
||||
|
||||
const ResultCode &code() const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
const QString &get_details() const
|
||||
{
|
||||
return details_;
|
||||
}
|
||||
|
||||
void set_details(const QString &s)
|
||||
{
|
||||
details_ = s;
|
||||
}
|
||||
|
||||
const LoadData &get_load_data() const
|
||||
{
|
||||
return load_data_;
|
||||
}
|
||||
|
||||
void set_load_data(const LoadData &p)
|
||||
{
|
||||
load_data_ = p;
|
||||
}
|
||||
|
||||
private:
|
||||
ResultCode code_;
|
||||
|
||||
QString details_;
|
||||
|
||||
LoadData load_data_;
|
||||
};
|
||||
|
||||
class SaveData {
|
||||
public:
|
||||
SaveData(LoadType type, Project *project = nullptr,
|
||||
const QString &filename = QString())
|
||||
{
|
||||
type_ = type;
|
||||
project_ = project;
|
||||
filename_ = filename;
|
||||
}
|
||||
|
||||
Project *get_project() const
|
||||
{
|
||||
return project_;
|
||||
}
|
||||
void set_project(Project *p)
|
||||
{
|
||||
project_ = p;
|
||||
}
|
||||
|
||||
const QString &get_filename() const
|
||||
{
|
||||
return filename_;
|
||||
}
|
||||
void set_filename(const QString &s)
|
||||
{
|
||||
filename_ = s;
|
||||
}
|
||||
|
||||
LoadType type() const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
const MainWindowLayoutInfo &get_layout() const
|
||||
{
|
||||
return layout_;
|
||||
}
|
||||
void set_layout(const MainWindowLayoutInfo &layout)
|
||||
{
|
||||
layout_ = layout;
|
||||
}
|
||||
|
||||
const QVector<Node *> &get_only_serialize_nodes() const
|
||||
{
|
||||
return only_serialize_nodes_;
|
||||
}
|
||||
void set_only_serialize_nodes(const QVector<Node *> &only)
|
||||
{
|
||||
only_serialize_nodes_ = only;
|
||||
}
|
||||
void set_only_serialize_nodes_and_resolve_groups(QVector<Node *> only);
|
||||
|
||||
const std::vector<TimelineMarker *> &get_only_serialize_markers() const
|
||||
{
|
||||
return only_serialize_markers_;
|
||||
}
|
||||
void set_only_serialize_markers(const std::vector<TimelineMarker *> &only)
|
||||
{
|
||||
only_serialize_markers_ = only;
|
||||
}
|
||||
|
||||
const std::vector<NodeKeyframe *> &get_only_serialize_keyframes() const
|
||||
{
|
||||
return only_serialize_keyframes_;
|
||||
}
|
||||
void set_only_serialize_keyframes(const std::vector<NodeKeyframe *> &only)
|
||||
{
|
||||
only_serialize_keyframes_ = only;
|
||||
}
|
||||
|
||||
const SerializedProperties &get_properties() const
|
||||
{
|
||||
return properties_;
|
||||
}
|
||||
void set_properties(const SerializedProperties &p)
|
||||
{
|
||||
properties_ = p;
|
||||
}
|
||||
|
||||
private:
|
||||
LoadType type_;
|
||||
|
||||
Project *project_;
|
||||
|
||||
QString filename_;
|
||||
|
||||
MainWindowLayoutInfo layout_;
|
||||
|
||||
QVector<Node *> only_serialize_nodes_;
|
||||
|
||||
SerializedProperties properties_;
|
||||
|
||||
std::vector<TimelineMarker *> only_serialize_markers_;
|
||||
|
||||
std::vector<NodeKeyframe *> only_serialize_keyframes_;
|
||||
};
|
||||
|
||||
static void initialize();
|
||||
|
||||
static void destroy();
|
||||
|
||||
static Result load(Project *project, const QString &filename,
|
||||
LoadType load_type);
|
||||
static Result load(Project *project, QXmlStreamReader *read_device,
|
||||
LoadType load_type);
|
||||
static Result paste(LoadType load_type, Project *project = nullptr);
|
||||
|
||||
static Result save(const SaveData &data, bool compress);
|
||||
static Result save(QXmlStreamWriter *write_device, const SaveData &data);
|
||||
static Result copy(const SaveData &data);
|
||||
|
||||
static bool check_compressed_id(QFile *file);
|
||||
|
||||
protected:
|
||||
virtual LoadData load(Project *project, QXmlStreamReader *reader,
|
||||
LoadType load_type, void *reserved) const = 0;
|
||||
|
||||
virtual void save(QXmlStreamWriter *writer, const SaveData &data,
|
||||
void *reserved) const
|
||||
{
|
||||
}
|
||||
|
||||
virtual uint version() const = 0;
|
||||
|
||||
bool is_cancelled() const;
|
||||
|
||||
private:
|
||||
static Result load_with_serializer_version(uint version, Project *project,
|
||||
QXmlStreamReader *reader,
|
||||
LoadType load_type);
|
||||
|
||||
static QVector<ProjectSerializer *> instances;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // OAK_PROJECTSERIALIZER_H
|
||||
Reference in New Issue
Block a user