feat(rust): oakcodec/oaktask/oakplugin crates + oakotio + node/render/storage skeletons

- oakcodec: full crate incl. real FFmpeg decode/encode via ffmpeg-next
  (162 tests, 84.4% cov); new oakcodec_encoding_* metadata family
  (include/codec/format.h, C++ + Rust sides)
- oaktask: manager/tasks/project load-save incl. OTIO via oakotio
  (82 tests, 86.4% cov); concurrent render loop with reorder buffer
- oakplugin: M11 phase 1+2 — self-contained OFX host, GL path,
  ofxColour, pluginrenderer absorbed as render_driver (99 tests,
  81.7% cov); instance.h additions documented
- oakotio: native serde-based OTIO read/write (24 tests)
- oaknode gap fill: dragger/keyframe-helper/multicam C ABI families
  (113/113 gtest); fixes a latent NodeInputDragger segfault
- oaknode Rust skeleton: 43 built-in node type declarations
- oakrender/oakstorage: declaration skeletons (implementation pending)
- notes.md: gap analysis + tech-debt ledger
This commit is contained in:
2026-08-09 05:49:15 +08:00
parent 4b24aa9d67
commit cac41d92c1
270 changed files with 68323 additions and 10 deletions
+217
View File
@@ -0,0 +1,217 @@
/***
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_CODEC_FORMAT_H
#define OAK_EDITOR_CODEC_FORMAT_H
#include "error.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @file format.h
* @brief C ABI for the oakcodec container-format / codec metadata queries
* (olive::ExportFormat / olive::ExportCodec / olive::Encoder statics).
*
* This family is the module-side mirror of the facade's
* oakengine_encoding_format_* / codec_* surface (oakengine/encoding.h):
* the export dialog queries it to populate its format/codec combo boxes and
* to enable/disable the bit-rate controls. The functions are stateless —
* no handles involved.
*
* Enum int fields carry the engine's own enum values
* (olive::ExportFormat::Format, olive::ExportCodec::Codec,
* olive::core::SampleFormat::Format) — the same values oakengine/encoding.h
* documents. Return-code convention follows include/codec/error.h: 0
* (OAKCODEC_OK) on success, a negative OAKCODEC_E_* code on failure, and
* string getters return the required buffer size in bytes INCLUDING the
* terminating NUL as a non-negative value (two-stage convention). Note this
* differs from oakcodec_export_format_get_extension() (encoder.h), which
* predates this family and reports unknown formats as the empty string.
*/
/**
* @brief Container formats (olive::ExportFormat::Format) referenced by name
* in UI code. Only append; the values are serialized in project/preset
* files. The complete list lives in src/codec/src/exportformat.h.
*/
#define OAKCODEC_ENCODING_FORMAT_MATROSKA 1
#define OAKCODEC_ENCODING_FORMAT_MPEG4_VIDEO 2
#define OAKCODEC_ENCODING_FORMAT_QUICKTIME 4
#define OAKCODEC_ENCODING_FORMAT_PNG 5
#define OAKCODEC_ENCODING_FORMAT_WAV 7
#define OAKCODEC_ENCODING_FORMAT_SRT 13
/**
* @brief Codecs (olive::ExportCodec::Codec) referenced by name in UI code.
* Only append; the values are serialized. The complete list lives in
* src/codec/src/exportcodec.h.
*/
#define OAKCODEC_ENCODING_CODEC_H264 1
#define OAKCODEC_ENCODING_CODEC_H264RGB 2
#define OAKCODEC_ENCODING_CODEC_H265 3
#define OAKCODEC_ENCODING_CODEC_CINEFORM 7
#define OAKCODEC_ENCODING_CODEC_AAC 12
#define OAKCODEC_ENCODING_CODEC_PCM 13
#define OAKCODEC_ENCODING_CODEC_SRT 17
#define OAKCODEC_ENCODING_CODEC_AV1 18
/* ---- Container format / codec metadata ---------------------------------- */
/**
* @brief Number of container formats (olive::ExportFormat::k_format_count).
*/
OAKCODEC_API int oakcodec_encoding_format_count(void);
/**
* @brief Display name of a container format (buf/size, two-stage).
*
* @return The required buffer size (including the NUL), or
* OAKCODEC_E_INVALID when `format` is out of range.
*/
OAKCODEC_API int oakcodec_encoding_format_name(int format, char *buf,
int buf_size);
/**
* @brief File extension (no dot) of a container format (buf/size,
* two-stage); same return convention as
* oakcodec_encoding_format_name().
*/
OAKCODEC_API int oakcodec_encoding_format_extension(int format, char *buf,
int buf_size);
/**
* @brief Number of video codecs a container format supports, or
* OAKCODEC_E_INVALID when the format is invalid.
*/
OAKCODEC_API int oakcodec_encoding_format_video_codec_count(int format);
/**
* @brief The `index`-th video codec of `format` as an
* olive::ExportCodec::Codec value.
*
* @return OAKCODEC_E_INVALID when the format is invalid, or
* OAKCODEC_E_NOT_FOUND when the index is out of range.
*/
OAKCODEC_API int oakcodec_encoding_format_video_codec_at(int format,
int index);
/** @brief Audio-codec variant of the two functions above. */
OAKCODEC_API int oakcodec_encoding_format_audio_codec_count(int format);
OAKCODEC_API int oakcodec_encoding_format_audio_codec_at(int format,
int index);
/** @brief Subtitle-codec variant of the two functions above. */
OAKCODEC_API int oakcodec_encoding_format_subtitle_codec_count(int format);
OAKCODEC_API int oakcodec_encoding_format_subtitle_codec_at(int format,
int index);
/**
* @brief Display name of a codec (buf/size, two-stage).
*
* @return The required buffer size (including the NUL), or
* OAKCODEC_E_INVALID when `codec` is out of range.
*/
OAKCODEC_API int oakcodec_encoding_codec_name(int codec, char *buf,
int buf_size);
/** @brief 1 when `codec` encodes still images (PNG/TIFF/OpenEXR), else 0
* (0 also for an invalid codec). */
OAKCODEC_API int oakcodec_encoding_codec_is_still_image(int codec);
/** @brief 1 when `codec` is lossless (no bit-rate setting applies), else 0
* (0 also for an invalid codec). */
OAKCODEC_API int oakcodec_encoding_codec_is_lossless(int codec);
/**
* @brief Number of encoded pixel formats (e.g. "yuv420p") usable with
* `codec` inside `format`, or OAKCODEC_E_INVALID when either
* argument is out of range. The list is queried from the format's
* encoder (FFmpeg/OIIO), so codecs without an encoder report 0.
*/
OAKCODEC_API int oakcodec_encoding_pix_fmt_count(int format, int codec);
/**
* @brief The `index`-th encoded pixel format name (buf/size, two-stage).
*
* @return The required buffer size (including the NUL), or
* OAKCODEC_E_INVALID for bad format/codec, or
* OAKCODEC_E_NOT_FOUND when the index is out of range.
*/
OAKCODEC_API int oakcodec_encoding_pix_fmt_at(int format, int codec,
int index, char *buf,
int buf_size);
/**
* @brief Index of `pix_fmt` (e.g. "yuv420p") in `codec`'s supported pixel
* format list; 0 (the codec's preferred format) when absent or
* `pix_fmt` is NULL/empty or `codec` is invalid.
*/
OAKCODEC_API int oakcodec_encoding_pix_fmt_index(int codec,
const char *pix_fmt);
/**
* @brief Number of sample formats usable with `codec` inside `format`, or
* OAKCODEC_E_INVALID when either argument is out of range.
*/
OAKCODEC_API int oakcodec_encoding_sample_format_count(int format,
int codec);
/**
* @brief The `index`-th sample format as an olive::core::SampleFormat::Format
* value.
*
* @return OAKCODEC_E_INVALID for bad format/codec, or
* OAKCODEC_E_NOT_FOUND when the index is out of range.
*/
OAKCODEC_API int oakcodec_encoding_sample_format_at(int format, int codec,
int index);
/* ---- Image-sequence filename helpers (olive::Encoder statics) ----------- */
/** @brief 1 when `filename` contains a "[#####]" digit placeholder, else 0
* (0 for NULL). */
OAKCODEC_API int
oakcodec_encoding_filename_contains_digit_placeholder(const char *filename);
/** @brief Digit count of the filename's "[#####]" placeholder; 0 when none
* (0 for NULL). */
OAKCODEC_API int
oakcodec_encoding_image_sequence_digit_count(const char *filename);
/**
* @brief `filename` with the digit placeholder removed (buf/size, two-stage;
* a leading separator like "_"/"-"/"."/" " before the placeholder is
* removed along with it).
*
* @return The required buffer size (including the NUL), or
* OAKCODEC_E_INVALID when `filename` is NULL.
*/
OAKCODEC_API int
oakcodec_encoding_filename_remove_digit_placeholder(const char *filename,
char *buf, int buf_size);
#ifdef __cplusplus
}
#endif
#endif //OAK_EDITOR_CODEC_FORMAT_H
+137
View File
@@ -0,0 +1,137 @@
/***
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_NODE_DRAGGER_H
#define OAK_EDITOR_NODE_DRAGGER_H
#include <stdint.h>
#include "node/error.h"
#include "node/node.h"
#include "undo/undocommand.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @file dragger.h
* @brief C ABI for olive::NodeInputDragger (src/node/src/inputdragger.h):
* live drag of an input's value with a single commit command.
*
* A dragger wraps the engine's NodeInputDragger state machine
* (start -> drag* -> end). start() records the drag anchor and, when the
* input is keyframing, creates one keyframe at the drag time (on every
* track when requested); drag() live-sets the dragged component (clamped
* by the input's min/max properties when present); end() returns ONE
* undoable command that commits the whole drag -- undo removes the
* created keyframe(s) (restoring the pre-drag keyframe count), redo
* re-creates them with the final value.
*
* A dragger must be ended before it is freed; freeing a started dragger
* leaks the created keyframe(s) (the same ownership rule as the C++
* class).
*/
/**
* @brief Reference-counted handle to an input dragger
* (olive::NodeInputDragger).
*
* The object never leaves the library that created it; every external
* reference is one of these handles. Semantics are shared_ptr-like:
* oaknode_dragger_create() returns a handle with count 1, addref(ctx)
* takes another reference, release(ctx) drops one and the library
* destroys the object when the count reaches zero.
*/
typedef struct OakNodeDragger {
void *ctx; /**< Opaque pointer to the reference-counted object. */
void (*addref)(void *ctx); /**< Atomically increments the count. */
void (*release)(void *ctx); /**< Decrements the count, destroys at 0. */
uint32_t abi_version; /**< OAKNODE_ABI_VERSION. */
} OakNodeDragger;
/**
* @brief Create an input dragger for live-drag of an input's value.
*
* `input_id` must name an existing input of `node`; `element` addresses
* an array input's element (-1 for non-array inputs). `track` is the
* create-time default; the track passed to oaknode_dragger_start()
* establishes the actual drag track.
*
* @return Dragger handle with count 1; ctx is NULL on invalid arguments
* or allocation failure.
*/
OakNodeDragger oaknode_dragger_create(OakNodeNode node, const char *input_id,
int element, int track);
/**
* @brief Start the drag at the given rational time (creates a keyframe
* when the input is keyframing).
*
* `insert_on_all_tracks` != 0 also creates sibling keyframes on every
* other track of the input. OAKNODE_E_STATE when the dragger was already
* started.
*/
int oaknode_dragger_start(OakNodeDragger dragger, int64_t time_num,
int64_t time_den, int track,
int insert_on_all_tracks);
/**
* @brief Drag to a new per-track component value (live; no undo).
*
* `value` carries the dragged component of the input's declared type:
* scalar types in f[0]/num; for split-track types (VEC2/3/4/COLOR) the
* POD type must match the input's declared type and the dragged
* component sits in f[0] (the facade's dragger convention). The value is
* clamped to the input's min/max properties when present.
* OAKNODE_E_STATE when the dragger was not started.
*/
int oaknode_dragger_drag(OakNodeDragger dragger, const oaknode_value *value);
/**
* @brief End the drag, returning ONE undoable command for the whole drag.
*
* `*out_command` receives an owned command handle (execute it with
* oakundo_command_redo_now(), push it onto an OakUndoStack, or release
* it with oakundo_command_free()). OAKNODE_E_STATE when the dragger was
* not started.
*/
int oaknode_dragger_end(OakNodeDragger dragger, OakUndoCommand *out_command);
/**
* @brief 1 if the dragger has been started and not yet ended.
*/
int oaknode_dragger_is_started(OakNodeDragger dragger, int *out_started);
/**
* @brief Release one reference to a dragger handle.
*
* Convenience wrapper around handle.release(handle.ctx): destroys the
* dragger when the count reaches zero. NULL handle or NULL ctx is a
* no-op; clears `dragger->ctx` after releasing. The dragger must have
* been ended (see the file comment).
*/
void oaknode_dragger_free(OakNodeDragger *dragger);
#ifdef __cplusplus
}
#endif
#endif //OAK_EDITOR_NODE_DRAGGER_H
+53
View File
@@ -235,6 +235,59 @@ int oaknode_keyframe_get_input(OakNodeKeyframe keyframe, char *buf,
int oaknode_keyframe_get_parent(OakNodeKeyframe keyframe,
OakNodeNode *out_node);
/**
* @brief A bezier control point guaranteed valid for animation
* (NodeKeyframe::valid_bezier_control_in()/out()).
*
* Unlike oaknode_keyframe_get_bezier_control(), the returned point is
* clamped so the curve never overlaps: the in-handle's x cannot pass the
* previous keyframe's time and the out-handle's x cannot pass the next
* keyframe's time. `handle` is an oaknode_keyframe_bezier.
*/
int oaknode_keyframe_get_valid_bezier_control(OakNodeKeyframe keyframe,
int handle, double *out_x,
double *out_y);
/**
* @brief The opposing bezier handle type
* (NodeKeyframe::get_opposing_bezier_type): OAKNODE_KEYFRAME_IN_HANDLE
* (0) <-> OAKNODE_KEYFRAME_OUT_HANDLE (1).
*
* @return The opposing handle type, or OAKNODE_E_INVALID for a type
* outside the two handle values.
*/
int oaknode_keyframe_opposing_bezier_type(int type);
/**
* @brief Compute the combined node value to use when inserting
* `keyframe` onto `target_node` (the keyframe paste path).
*
* Takes the target node's split value at the keyframe's time, replaces
* the keyframe's own track with the keyframe's value, and combines the
* per-track components into a single normal value (mirrors the facade's
* oakengine_keyframe_compute_paste_value). OAKNODE_E_NOT_FOUND when the
* keyframe's input id does not exist on `target_node`; OAKNODE_E_FAILED
* for input types without a POD representation.
*/
int oaknode_keyframe_compute_paste_value(OakNodeNode target_node,
OakNodeKeyframe keyframe,
oaknode_value *out);
/**
* @brief 1 if a sibling keyframe exists at the given rational time on
* this keyframe's own track (NodeKeyframe::has_sibling_at_time(): the
* track's key at `time` that is not this keyframe — the move-collision
* check). Unlike the facade, the time is an exact rational rather than a
* whole-second frame timestamp, and no track argument is needed (the
* lookup is relative to this keyframe's track).
*
* An orphaned keyframe (no parent node) has no siblings: `*out_value`
* is set to 0 and OAKNODE_OK is returned.
*/
int oaknode_keyframe_has_sibling_at_time(OakNodeKeyframe keyframe,
int64_t time_num, int64_t time_den,
int *out_value);
#ifdef __cplusplus
}
#endif
+119
View File
@@ -0,0 +1,119 @@
/***
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_NODE_MULTICAM_H
#define OAK_EDITOR_NODE_MULTICAM_H
#include <stdint.h>
#include "node/error.h"
#include "node/node.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @file multicam.h
* @brief C ABI for olive::MultiCamNode (src/node/src/input/multicam/
* multicamnode.h): multi-camera source switching and the source-grid
* math used by the multicam viewer.
*
* The input-id getters return static strings (never freed) naming the
* multicam node's inputs: current source (combo), sources (array),
* sequence and sequence type. A node that is not a MultiCamNode (or a
* NULL handle) fails the per-node queries with OAKNODE_E_INVALID.
*
* The grid helpers are static and pure: they only depend on their
* arguments, not on a node.
*/
/**
* @brief The input id string for the current camera ("current_in").
*/
const char *oaknode_multicam_input_current(void);
/**
* @brief The input id string for the sources array ("sources_in").
*/
const char *oaknode_multicam_input_sources(void);
/**
* @brief The input id string for the sequence ("sequence_in").
*/
const char *oaknode_multicam_input_sequence(void);
/**
* @brief The input id string for the sequence type ("sequence_type_in").
*/
const char *oaknode_multicam_input_sequence_type(void);
/**
* @brief Number of connected source cameras (MultiCamNode::
* get_source_count(); the connected sequence's track count, or the
* sources array size when no sequence is connected).
*
* OAKNODE_E_INVALID when `node` is not a multicam.
*/
int oaknode_multicam_get_source_count(OakNodeNode node, int *out_count);
/**
* @brief Compute the grid (rows, cols) that holds `source_count` cells.
*
* Mirrors MultiCamNode::get_rows_and_columns(): the grid grows from
* 1x1, widening the smaller dimension, until rows * cols >= source_count
* (0 sources yields 1x1). OAKNODE_E_INVALID for a negative count or
* NULL out pointers.
*/
int oaknode_multicam_get_rows_and_columns(int source_count, int *rows,
int *cols);
/**
* @brief Convert a flat source index to (row, col) in a rows x cols grid
* (row-major: col = index % cols, row = index / cols).
*
* OAKNODE_E_INVALID for a negative index, degenerate grid or NULL out
* pointers.
*/
int oaknode_multicam_index_to_row_cols(int index, int rows, int cols,
int *out_row, int *out_col);
/**
* @brief Convert (row, col) to a flat source index (col + row * cols).
*
* @return The flat index (>= 0), or OAKNODE_E_INVALID when the cell is
* out of range or the grid is degenerate.
*/
int oaknode_multicam_rows_cols_to_index(int row, int col, int rows,
int cols);
/**
* @brief The current source index (MultiCamNode::get_current_source(),
* the "current_in" combo value).
*
* OAKNODE_E_INVALID when `node` is not a multicam.
*/
int oaknode_multicam_get_current_source(OakNodeNode node, int *out_source);
#ifdef __cplusplus
}
#endif
#endif //OAK_EDITOR_NODE_MULTICAM_H
+68
View File
@@ -96,6 +96,74 @@ int oakplugin_instance_cancel(OakPluginInstance instance);
/** @brief Alive-count for leak assertions in tests. */
int oakplugin_debug_alive_count(void);
/*
* M11 §4GL 路径 + render 驱动收编)新增声明。既有签名不变。
*
* oakrender 的 PluginJob 经本组入口把整帧渲染流程(RoI/RoD、
* 多输入收集、isIdentity 短路、参数覆盖、CPU/GL 渲染与输出装配)
* 委托给 oakplugin 的 render 驱动(Rust 侧 render_driver 模块,
* 语义对照 src/render/src/plugin/pluginrenderer.cpp)。
*/
/** @brief 一帧渲染任务的参数覆盖条目(参数名 → oaknode_value POD
* 字符串参数走 oakplugin_instance_set_param_string)。 */
typedef struct oakplugin_job_value {
const char *key;
oaknode_value value;
} oakplugin_job_value;
/** @brief 一帧渲染任务的输入 clip 纹理条目。纹理为借用句柄
* (job 内有效)。 */
typedef struct oakplugin_job_texture {
const char *clip;
OakRenderTexture texture;
} oakplugin_job_texture;
/**
* @brief beginSequenceRender 括号。oakrender 对同一实例的一批帧先
* begin 后 end,中间逐帧 oakplugin_instance_render_job
* OFXrender action 由 begin/end sequence render 括号包围)。
* `interactive` 为信息性标记(Phase 2 不传入 action)。
*/
int oakplugin_instance_render_begin_sequence(OakPluginInstance instance,
double start_time,
double end_time,
int interactive);
/** @brief endSequenceRender 括号(与 render_begin_sequence 配对)。 */
int oakplugin_instance_render_end_sequence(OakPluginInstance instance,
double start_time,
double end_time,
int interactive);
/**
* @brief 一帧渲染的单一 C ABI 调用(PluginJob 的载体)。
*
* @param dst 目标纹理(oakrender 创建)。GL 模式下调用方须先把
* dst 附着为渲染器输出目标并保持 GL 上下文 current
* OFX "OpenGL Current Context" 规则;等价 C++
* PluginRenderer::attach_output_texture)。
* @param src 主输入纹理(effect_input_id / SimpleSource;可空句柄)。
* @param effect_input_id job.src 落点的 clip 名(可 NULL)。
* @param inputs / input_count 其余输入 clip 的纹理表。
* @param values / value_count 参数覆盖表。
* @param renderer GL 渲染器(空句柄 → CPU 路径)。
* @param clear_destination / interactive 信息性标记(Phase 2
* render 驱动暂不处理;上层渲染器负责目标清空)。
*/
int oakplugin_instance_render_job(OakPluginInstance instance,
OakRenderTexture dst,
double time_seconds,
int clear_destination,
int interactive,
const char *effect_input_id,
OakRenderTexture src,
const oakplugin_job_texture *inputs,
int input_count,
const oakplugin_job_value *values,
int value_count,
OakRenderRenderer renderer);
#ifdef __cplusplus
}
#endif