refactor(node): switch oaknode to refcounted value handles, migrate consumers

- all 15 OakNode* handle types become neutral by-value structs
  {ctx, addref, release, abi_version}; shared box in
  src/node/c_api/nodehandle.h with owns flag (borrowed accessors
  return non-owning boxes; graph insertion flips owns off)
- oaktimeline/oaktask/oakrender call sites and their own public
  headers migrated to value handles; identity comparisons in
  timeline/task now compare native pointers
- regressions green: oaknode 96, oaktimeline 117, oaktask 106,
  oakrender 44, oakcommon 193, oakcodec 18, oakaudio 36
This commit is contained in:
2026-08-07 17:20:42 +08:00
parent 295ea1bfe5
commit 67176281d9
87 changed files with 4499 additions and 3431 deletions
+12 -8
View File
@@ -34,9 +34,11 @@ extern "C" {
* internal node-type library.
*
* The library must be populated with oaknode_factory_initialize() before
* any other call; oaknode_factory_destroy() releases it. Prototype nodes
* from oaknode_factory_node_at() are owned by the library: read-only
* metadata queries only, never free them or add them to a graph.
* any other call; oaknode_factory_destroy() releases it. The factory is
* a process-wide singleton (static olive::NodeFactory), so there is no
* OakNodeFactory handle type. Prototype nodes from
* oaknode_factory_node_at() are owned by the library: read-only metadata
* queries only, never add them to a graph.
*/
/**
@@ -77,17 +79,19 @@ int oaknode_factory_name_from_id(const char *type_id, char *buf,
/**
* @brief Create a node of `type_id` WITHOUT adding it to any graph
* (NodeFactory::create_from_id()). The caller owns the returned node
* and must release it with oaknode_node_free() while it is still
* orphaned. Returns NULL when the id is unknown or not initialized.
* (reference count 1) and must release it with oaknode_node_free() while
* it is still orphaned. ctx is NULL when the id is unknown or not
* initialized.
*/
OakNodeNode *oaknode_factory_create_from_id(const char *type_id);
OakNodeNode oaknode_factory_create_from_id(const char *type_id);
/**
* @brief Borrow the prototype node at `index` in the library.
* @brief Borrow the prototype node at `index` in the library (non-owning
* handle written to `out_node`; release it with oaknode_node_free()).
* OAKNODE_E_NOT_FOUND for an out-of-range index, OAKNODE_E_STATE when
* not initialized.
*/
int oaknode_factory_node_at(int index, OakNodeNode **out_node);
int oaknode_factory_node_at(int index, OakNodeNode *out_node);
#ifdef __cplusplus
}