refactor(plugin): de-Qt oakplugin and wrap it in a pure C ABI

- de-Qt src/plugin/src (olivehost/oliveplugininstance/oliveclip/
  paraminstance/image/pluginprogressreporter); QMessageBox/
  QApplication replaced by facade callbacks
- new C ABI in include/plugin/{error,host,instance}.h with
  refcounted OakPluginInstance value handle
- paraminstance bridges via oaknode C ABI (OakNodeNode value handle,
  oaknode_node_identity registry); undo via oakundo C ABI
- oliveclip textures are OakRenderTexture value handles; oakrender
  gains texture/copier/ticket C API additions
- oaknode gains get_input_at_time/set_input_at_time_undoable/
  node_identity/sequence_from_node/sequence_set_default_parameters/
  find_input_footage
- move avframeptr.h to src/common/src (shared by codec and render)
- node transition pluginSupport stubs bridge the real oakplugin
  headers; all oaknode-building standalone trees add src/plugin and
  link oakplugin into their test binaries
- plugin tests self-sufficient (ipc shim, OfxHost force_load,
  PRE_TEST discovery, OCIO env); timeline standalone gains
  render/c_api
- restore ffmpegdecoder.cpp in src/codec/src/ffmpeg/CMakeLists.txt
  (dropped in 3d004c081, caused jump-to-0 in decoder/encoder tests)

All six standalone trees green: codec 22, audio 40, task 110,
render 49, timeline 121, plugin 100.
This commit is contained in:
2026-08-07 22:18:36 +08:00
parent 0462842f8c
commit fd2111d560
54 changed files with 6014 additions and 324 deletions
+40
View File
@@ -0,0 +1,40 @@
/***
Oak Video Editor - Non-Linear Video Editor
Copyright (C) 2026 Oak 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/>.
***/
#ifndef OAK_EDITOR_PLUGIN_ERROR_H
#define OAK_EDITOR_PLUGIN_ERROR_H
#include <stdint.h>
/**
* @brief Status and error codes shared by all oakplugin C API families.
*/
#define OAKPLUGIN_OK 0 /**< Success. */
#define OAKPLUGIN_E_INVALID (-1) /**< NULL handle or invalid argument. */
#define OAKPLUGIN_E_STATE (-2) /**< Call not valid in the current state. */
#define OAKPLUGIN_E_FAILED (-3) /**< The underlying operation failed. */
#define OAKPLUGIN_E_NOT_FOUND (-4) /**< Entry not found. */
#define OAKPLUGIN_E_NOMEM (-5) /**< Allocation failed. */
#define OAKPLUGIN_E_CANCELLED (-6) /**< The operation was cancelled. */
/** @brief ABI version stamped into every oakplugin handle. */
#define OAKPLUGIN_ABI_VERSION 1
#endif //OAK_EDITOR_PLUGIN_ERROR_H
+69
View File
@@ -0,0 +1,69 @@
/***
Oak Video Editor - Non-Linear Video Editor
Copyright (C) 2026 Oak 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/>.
***/
#ifndef OAK_EDITOR_PLUGIN_HOST_H
#define OAK_EDITOR_PLUGIN_HOST_H
#include "plugin/error.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Initialize the OFX host (olive::plugin::load_plugins() with the
* default search paths). Idempotent.
*/
int oakplugin_host_init(void);
/** @brief Shut the host down (persistent messages cleared). */
void oakplugin_host_shutdown(void);
/** @brief Scan additional bundle directories. */
int oakplugin_host_scan(const char *const *bundle_dirs, int dir_count);
/** @brief Number of discovered plugins (>= 0), or a negative error. */
int oakplugin_host_plugin_count(void);
/** @brief Plugin identifier at index (two-stage string getter). */
int oakplugin_host_plugin_id_at(int index, char *buf, int buf_size);
/** @brief Plugin label for an identifier (two-stage; currently the
* identifier itself). OAKPLUGIN_E_NOT_FOUND for unknown ids. */
int oakplugin_host_plugin_label(const char *plugin_id, char *buf,
int buf_size);
/**
* @brief UI message handler for OFX host messages (question replies use
* OAKPLUGIN_MESSAGE_ANSWER_YES/NO). Without a handler, messages
* are logged and questions get "no".
*/
#define OAKPLUGIN_MESSAGE_ANSWER_NO 0
#define OAKPLUGIN_MESSAGE_ANSWER_YES 1
typedef int (*oakplugin_message_fn)(const char *type, const char *message,
void *userdata);
void oakplugin_host_set_message_handler(oakplugin_message_fn fn,
void *userdata);
#ifdef __cplusplus
}
#endif
#endif //OAK_EDITOR_PLUGIN_HOST_H
+103
View File
@@ -0,0 +1,103 @@
/***
Oak Video Editor - Non-Linear Video Editor
Copyright (C) 2026 Oak 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/>.
***/
#ifndef OAK_EDITOR_PLUGIN_INSTANCE_H
#define OAK_EDITOR_PLUGIN_INSTANCE_H
#include <stdint.h>
#include "node/node.h"
#include "plugin/error.h"
#include "render/renderer.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Reference-counted handle to an OFX plugin instance
* (olive::plugin::OlivePluginInstance).
*
* Ownership/count semantics follow include/common/handle.h: create
* returns count 1, addref/release adjust it, release destroys at zero.
*/
typedef struct OakPluginInstance {
void *ctx;
void (*addref)(void *ctx);
void (*release)(void *ctx);
uint32_t abi_version; /**< OAKPLUGIN_ABI_VERSION. */
} OakPluginInstance;
/**
* @brief Create an instance of a discovered plugin (filter context).
* Returns an empty handle (ctx == NULL) for unknown ids/failure.
*/
OakPluginInstance oakplugin_instance_create(const char *plugin_id);
/** @brief Release one reference. NULL/empty no-op; clears ctx. */
void oakplugin_instance_free(OakPluginInstance *instance);
/**
* @brief Set/get a parameter as an oaknode_value POD (type rules from
* node/node.h). String-typed params use
* oakplugin_instance_set_param_string()/get_param_string().
*/
int oakplugin_instance_set_param(OakPluginInstance instance,
const char *param_id,
const oaknode_value *value);
int oakplugin_instance_get_param(OakPluginInstance instance,
const char *param_id, oaknode_value *out);
int oakplugin_instance_set_param_string(OakPluginInstance instance,
const char *param_id,
const char *value);
int oakplugin_instance_get_param_string(OakPluginInstance instance,
const char *param_id, char *buf,
int buf_size);
/**
* @brief Render one frame through the instance (renderAction).
*
* `src` may be an empty handle for generator plugins. Textures stay
* owned by the caller (borrowed for the call).
*/
int oakplugin_instance_render(OakPluginInstance instance,
OakRenderTexture dst, OakRenderTexture src,
double time_seconds);
/**
* @brief Progress callback for long renders (async return channel,
* 01 §4 exception). Return non-zero to abort processing.
*/
typedef int (*oakplugin_progress_fn)(double progress, void *userdata);
int oakplugin_instance_set_progress_cb(OakPluginInstance instance,
oakplugin_progress_fn fn,
void *userdata);
/** @brief Cancel any in-progress render/progress reporting. */
int oakplugin_instance_cancel(OakPluginInstance instance);
/** @brief Alive-count for leak assertions in tests. */
int oakplugin_debug_alive_count(void);
#ifdef __cplusplus
}
#endif
#endif //OAK_EDITOR_PLUGIN_INSTANCE_H