Files
Mike-Solar 66d761b4b7 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
2026-07-31 22:46:52 +08:00

142 lines
4.7 KiB
C++

/***
Oak - 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_NODEVALUEHANDLE_H
#define OAK_NODEVALUEHANDLE_H
#include "oakengine/node.h"
namespace olive
{
/**
* @brief App-side mirror of engine NodeValue::Type (engine/node/value.h).
*
* Ordinals MUST stay in sync with the engine enum: call sites that still
* hold an engine NodeValue::Type reach the helpers below through an
* implicit int conversion. The static_asserts pin the engine ordinals as
* of the R8 wave 1 migration; update both sides together.
*
* NOTE: the C ABI oak_node_value_type (OAK_NODE_VALUE_*) does NOT share
* these ordinals (e.g. k_boolean=4 vs OAK_NODE_VALUE_BOOL=3), so a plain
* int cast between the two domains is a bug. Convert with
* node_value_type_to_c().
*/
class NodeValueType
{
public:
enum Type {
k_none = 0,
k_int,
k_float,
k_rational,
k_boolean,
k_color,
k_matrix,
k_text,
k_font,
k_file,
k_texture,
k_samples,
k_vec2,
k_vec3,
k_vec4,
k_bezier,
k_combo,
k_str_combo,
k_video_params,
k_audio_params,
k_subtitle_params,
k_binary,
k_push_button,
k_data_type_count
};
};
// Ordinal sync guards against engine/node/value.h.
static_assert(NodeValueType::k_boolean == 4,
"NodeValueType out of sync with engine NodeValue::Type");
static_assert(NodeValueType::k_vec2 == 12,
"NodeValueType out of sync with engine NodeValue::Type");
static_assert(NodeValueType::k_data_type_count == 23,
"NodeValueType out of sync with engine NodeValue::Type");
/**
* @brief App-side mirror of engine NodeKeyframe::Type
* (engine/node/keyframe.h).
*
* Ordinals MUST stay in sync with the engine enum (k_invalid=-1,
* k_linear=0, k_hold=1, k_bezier=2). The facade easing type transported
* over the C ABI is a DIFFERENT numbering: 0=linear, 1=bezier, 2=hold
* (see oakengine/node.h) — convert with NodeKeyframeTypeToFacade() in
* oakvaluehelper.h, never with a plain cast.
*/
class NodeKeyframeType
{
public:
enum Type { k_invalid = -1, k_linear = 0, k_hold = 1, k_bezier = 2 };
};
// Ordinal sync guard against engine/node/keyframe.h.
static_assert(NodeKeyframeType::k_bezier == 2,
"NodeKeyframeType out of sync with engine NodeKeyframe::Type");
/**
* @brief Convert engine NodeValue::Type ordinals to oak_node_value_type (app-side).
*
* `t` uses engine NodeValue::Type ordinals (see the NodeValueType mirror
* above); callers holding an engine NodeValue::Type pass it through an
* implicit int conversion. The two enums do NOT share ordinals (e.g.
* k_boolean=4 vs BOOL=3), so a plain int cast is a bug. Mirrors
* from_c_type() in engine/src/capi/node.cpp. Lives in an app header, NOT
* in the public facade headers — the C ABI surface stays pure C (see
* docs/zh/r6-cleanup-plan.md red line 3 context). Returns -1 for types the
* facade cannot represent (caller falls back to the input's declared type).
*/
inline int node_value_type_to_c(int t)
{
switch (t) {
case NodeValueType::k_int: return OAK_NODE_VALUE_INT;
case NodeValueType::k_float: return OAK_NODE_VALUE_FLOAT;
case NodeValueType::k_boolean: return OAK_NODE_VALUE_BOOL;
case NodeValueType::k_rational: return OAK_NODE_VALUE_RATIONAL;
case NodeValueType::k_color: return OAK_NODE_VALUE_COLOR;
case NodeValueType::k_vec2: return OAK_NODE_VALUE_VEC2;
case NodeValueType::k_vec3: return OAK_NODE_VALUE_VEC3;
case NodeValueType::k_vec4: return OAK_NODE_VALUE_VEC4;
case NodeValueType::k_combo: return OAK_NODE_VALUE_COMBO;
case NodeValueType::k_file: return OAK_NODE_VALUE_STRING;
case NodeValueType::k_text: return OAK_NODE_VALUE_TEXT;
case NodeValueType::k_font: return OAK_NODE_VALUE_FONT;
case NodeValueType::k_str_combo: return OAK_NODE_VALUE_STR_COMBO;
case NodeValueType::k_binary: return OAK_NODE_VALUE_BINARY;
case NodeValueType::k_bezier: return OAK_NODE_VALUE_BEZIER;
case NodeValueType::k_texture: return OAK_NODE_VALUE_TEXTURE;
case NodeValueType::k_samples: return OAK_NODE_VALUE_SAMPLES;
case NodeValueType::k_video_params: return OAK_NODE_VALUE_VIDEO_PARAMS;
case NodeValueType::k_audio_params: return OAK_NODE_VALUE_AUDIO_PARAMS;
default: return -1;
}
}
} // namespace olive
#endif // OAK_NODEVALUEHANDLE_H