refactor(timeline): de-Qt oaktimeline and wrap it in a pure C ABI
- de-Qt all 11 sources: markers/workarea lose QObject/signals (list re-sort via direct resort() call, drawing moves to the app layer), explicit unique_ptr ownership for marker lists and viewer's workarea/markers - timeline undo command families (split/pointer/ripple/general/track) now hold oaknode C handles and do all graph work through the oaknode C ABI (no adapter layer); gaps are attached to the project graph before insertion, orphan handles tracked and freed - fix the de-Qt severed Block->Track length-changed chain with a direct block_length_changed() call (positions were stale after split/trim) - expand oaknode C API by ~20 functions needed by timeline (copy_in_graph, block kind/casts, connect_element, input arrays, tracklist family, marker/workarea borrowed outlets) - pure C ABI in include/timeline (marker/workarea/edit, command factories returning OakUndoCommand), oakcommon XML get_native accessors - oaknode<->oaktimeline resolve each other at runtime; standalone drivers link both into test binaries - tests: oaktimeline 117, regressions oakcommon 193 / oaknode 96 / oakrender 42 / oakcodec 18 / oakaudio 36 all green
This commit is contained in:
@@ -64,6 +64,21 @@ typedef struct OakXmlWriter {
|
||||
*/
|
||||
OakXmlReader oakcommon_xml_reader_init(const char *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
namespace olive { class XmlStreamReader; class XmlStreamWriter; }
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Borrowed access to the underlying C++ reader/writer (C++ only,
|
||||
* for adapter layers). Valid while the handle is held. NULL-safe.
|
||||
*/
|
||||
olive::XmlStreamReader *oakcommon_xml_reader_get_native(OakXmlReader reader);
|
||||
olive::XmlStreamWriter *oakcommon_xml_writer_get_native(OakXmlWriter writer);
|
||||
|
||||
/**
|
||||
* @brief Release one reference to a reader.
|
||||
*
|
||||
|
||||
@@ -49,6 +49,13 @@ typedef struct OakNodeBlock OakNodeBlock;
|
||||
*/
|
||||
typedef struct OakNodeTrack OakNodeTrack;
|
||||
|
||||
/**
|
||||
* @brief Opaque handle to a node (olive::Node), see node/node.h.
|
||||
*
|
||||
* Re-declared here so block.h is self-contained; the typedef is identical.
|
||||
*/
|
||||
typedef struct OakNodeNode OakNodeNode;
|
||||
|
||||
/**
|
||||
* @brief Concrete transition kinds for oaknode_block_transition_create().
|
||||
*/
|
||||
@@ -57,6 +64,14 @@ enum OakNodeTransitionKind {
|
||||
OAKNODE_TRANSITION_DIP_TO_COLOR = 1 /**< DipToColorTransition. */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Input ids of a TransitionBlock's block connections
|
||||
* (TransitionBlock::k_out_block_input / k_in_block_input). Pinned by
|
||||
* test; pass to oaknode_node_connect()/oaknode_node_disconnect().
|
||||
*/
|
||||
#define OAKNODE_TRANSITION_OUT_BLOCK_INPUT "out_block_in"
|
||||
#define OAKNODE_TRANSITION_IN_BLOCK_INPUT "in_block_in"
|
||||
|
||||
/**
|
||||
* @brief Create a ClipBlock.
|
||||
*
|
||||
@@ -91,6 +106,32 @@ OakNodeBlock *oaknode_block_transition_create(int kind);
|
||||
*/
|
||||
void oaknode_block_free(OakNodeBlock *block);
|
||||
|
||||
enum OakNodeBlockKind {
|
||||
OAKNODE_BLOCK_OTHER = 0,
|
||||
OAKNODE_BLOCK_CLIP = 1,
|
||||
OAKNODE_BLOCK_GAP = 2,
|
||||
OAKNODE_BLOCK_TRANSITION = 3
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Concrete kind of a block (dynamic_cast query).
|
||||
*/
|
||||
int oaknode_block_get_kind(OakNodeBlock *block, int *out_kind);
|
||||
|
||||
/**
|
||||
* @brief Borrowed cast from a block handle to its node handle.
|
||||
*
|
||||
* Every Block is a Node; the result must not be freed. NULL for NULL.
|
||||
*/
|
||||
OakNodeNode *oaknode_block_as_node(OakNodeBlock *block);
|
||||
|
||||
/**
|
||||
* @brief Borrowed cast from a node handle to a block handle.
|
||||
*
|
||||
* Returns NULL if the node is not a Block (or for NULL).
|
||||
*/
|
||||
OakNodeBlock *oaknode_block_from_node(OakNodeNode *node);
|
||||
|
||||
/**
|
||||
* @brief Rational getters/setters use numerator/denominator out pairs.
|
||||
*
|
||||
@@ -233,6 +274,14 @@ int oaknode_transition_get_connected_out_block(OakNodeBlock *transition,
|
||||
int oaknode_transition_get_connected_in_block(OakNodeBlock *transition,
|
||||
OakNodeBlock **out);
|
||||
|
||||
/**
|
||||
* @brief Forward cache passthroughs from another clip
|
||||
* (ClipBlock::add_cache_passthrough_from()). Used after splitting a
|
||||
* clip so the new part shares the render caches.
|
||||
*/
|
||||
int oaknode_clip_add_cache_passthrough_from(OakNodeBlock *clip,
|
||||
OakNodeBlock *other);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -99,6 +99,17 @@ typedef struct oaknode_value {
|
||||
*/
|
||||
typedef struct OakNodeNode OakNodeNode;
|
||||
|
||||
/* Re-declared here so node.h is self-contained; see node/project.h. */
|
||||
typedef struct OakNodeProject OakNodeProject;
|
||||
|
||||
/**
|
||||
* @brief Opaque borrowed handles to the timeline data owned by viewer
|
||||
* nodes (TimelineMarkerList / TimelineWorkArea in oaktimeline).
|
||||
* oaktimeline reinterprets these into its own handle types.
|
||||
*/
|
||||
typedef struct OakNodeMarkerList OakNodeMarkerList;
|
||||
typedef struct OakNodeWorkArea OakNodeWorkArea;
|
||||
|
||||
/**
|
||||
* @brief Number of live owned objects created through this API
|
||||
* (nodes from oaknode_factory_create_from_id()/oaknode_node_create_copy(),
|
||||
@@ -469,6 +480,79 @@ int oaknode_node_remove_from_context(OakNodeNode *node, OakNodeNode *context);
|
||||
*/
|
||||
OakNodeNode *oaknode_node_create_copy(const OakNodeNode *node);
|
||||
|
||||
/**
|
||||
* @brief Copy a node inside its graph (Node::copy_node_in_graph()),
|
||||
* recording the reconnect operations in a new MultiUndoCommand.
|
||||
*
|
||||
* `*out_command` receives an owned undo command handle (free with
|
||||
* oakundo_command_free()). The copy is inserted into the graph only when
|
||||
* the returned command is redone; treat it as owned (oaknode_node_free())
|
||||
* until then. Returns NULL on failure.
|
||||
*/
|
||||
OakNodeNode *oaknode_node_copy_in_graph(OakNodeNode *node,
|
||||
OakUndoCommand **out_command);
|
||||
|
||||
/**
|
||||
* @brief Get the project this node belongs to (borrowed). *out may be
|
||||
* NULL if the node is orphaned.
|
||||
*/
|
||||
int oaknode_node_get_project(const OakNodeNode *node,
|
||||
OakNodeProject **out);
|
||||
|
||||
/**
|
||||
* @brief Insert/remove an element in an input array (live,
|
||||
* Node::input_array_insert/remove()). OAKNODE_E_NOT_FOUND for an
|
||||
* unknown input id.
|
||||
*/
|
||||
int oaknode_node_input_array_insert(OakNodeNode *node,
|
||||
const char *input_id, int index);
|
||||
int oaknode_node_input_array_remove(OakNodeNode *node,
|
||||
const char *input_id, int index);
|
||||
|
||||
/**
|
||||
* @brief Element-aware variants of oaknode_node_connect()/disconnect()
|
||||
* (NodeInput element != -1, e.g. Sequence's track_in_N array inputs).
|
||||
*/
|
||||
int oaknode_node_connect_element(OakNodeNode *output_node,
|
||||
OakNodeNode *input_node,
|
||||
const char *input_id, int element);
|
||||
int oaknode_node_disconnect_element(OakNodeNode *input_node,
|
||||
const char *input_id, int element);
|
||||
|
||||
/**
|
||||
* @brief Create a command that adds a node to a project's graph
|
||||
* (olive::NodeAddCommand). Owned; free with oakundo_command_free().
|
||||
*/
|
||||
OakUndoCommand *oaknode_command_create_add_node(OakNodeProject *graph,
|
||||
OakNodeNode *node);
|
||||
|
||||
/**
|
||||
* @brief Create a command that sets a node's position in a context and
|
||||
* repositions its dependencies recursively
|
||||
* (olive::NodeSetPositionAndDependenciesRecursivelyCommand). Owned.
|
||||
*/
|
||||
OakUndoCommand *oaknode_command_create_set_position_recursive(
|
||||
OakNodeNode *node, OakNodeNode *context, double x, double y);
|
||||
|
||||
/**
|
||||
* @brief Borrowed marker list / work area of a viewer node. *out is NULL
|
||||
* when the node is not a viewer (or for NULL input).
|
||||
*/
|
||||
int oaknode_node_get_markers(const OakNodeNode *node,
|
||||
OakNodeMarkerList **out);
|
||||
int oaknode_node_get_work_area(const OakNodeNode *node,
|
||||
OakNodeWorkArea **out);
|
||||
|
||||
/**
|
||||
* @brief Create a command that removes a node from its graph together
|
||||
* with its exclusive dependencies and disconnects its edges
|
||||
* (NodeRemoveWithExclusiveDependenciesAndDisconnect).
|
||||
*
|
||||
* Owned command handle; free with oakundo_command_free(). Returns NULL
|
||||
* on failure.
|
||||
*/
|
||||
OakUndoCommand *oaknode_command_create_remove_node(OakNodeNode *node);
|
||||
|
||||
/**
|
||||
* @brief Destroy an OWNED node immediately (C++ delete). NULL is a no-op.
|
||||
*
|
||||
|
||||
@@ -33,6 +33,18 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Sequence texture/samples input ids (ViewerOutput::k_texture_input
|
||||
* / k_samples_input) and the track input id format
|
||||
* (Sequence::k_track_input_format). Pinned by test.
|
||||
*/
|
||||
#define OAKNODE_SEQUENCE_TEXTURE_INPUT "tex_in"
|
||||
#define OAKNODE_SEQUENCE_SAMPLES_INPUT "samples_in"
|
||||
#define OAKNODE_SEQUENCE_TRACK_INPUT_FORMAT "track_in_%1"
|
||||
|
||||
/* Re-declared here so sequence.h is self-contained; see node/node.h. */
|
||||
typedef struct OakNodeNode OakNodeNode;
|
||||
|
||||
/**
|
||||
* @brief Opaque handle to a sequence (olive::Sequence).
|
||||
*
|
||||
@@ -71,6 +83,12 @@ void oaknode_sequence_free(OakNodeSequence *sequence);
|
||||
* @param type One of OAKNODE_TRACK_TYPE_VIDEO / _AUDIO / _SUBTITLE.
|
||||
* @return OAKNODE_OK, OAKNODE_E_INVALID or OAKNODE_E_NOT_FOUND (bad type).
|
||||
*/
|
||||
/**
|
||||
* @brief Borrowed cast from a sequence handle to its node handle.
|
||||
* NULL for NULL.
|
||||
*/
|
||||
OakNodeNode *oaknode_sequence_as_node(OakNodeSequence *sequence);
|
||||
|
||||
int oaknode_sequence_get_track_list(OakNodeSequence *sequence, int type,
|
||||
OakNodeTrackList **out);
|
||||
|
||||
|
||||
@@ -67,6 +67,15 @@ enum OakNodeTrackType {
|
||||
OAKNODE_TRACK_TYPE_COUNT = 3
|
||||
};
|
||||
|
||||
/* Re-declared here so track.h is self-contained; see node/node.h. */
|
||||
typedef struct OakNodeNode OakNodeNode;
|
||||
|
||||
/**
|
||||
* @brief Borrowed cast from a track handle to its node handle.
|
||||
* NULL for NULL.
|
||||
*/
|
||||
OakNodeNode *oaknode_track_as_node(OakNodeTrack *track);
|
||||
|
||||
/* ---------------------------------------------------------------- Track */
|
||||
|
||||
/**
|
||||
@@ -220,6 +229,42 @@ int oaknode_track_is_range_free(OakNodeTrack *track, int in_num, int in_den,
|
||||
/**
|
||||
* @brief Track list type (OakNodeTrackType values).
|
||||
*/
|
||||
/**
|
||||
* @brief Nearest block lookups (Track::nearest_block_before_or_at /
|
||||
* nearest_block_after_or_at). *out is a borrowed handle or NULL.
|
||||
*/
|
||||
int oaknode_track_get_nearest_block_before_or_at(OakNodeTrack *track,
|
||||
int numerator, int denominator, OakNodeBlock **out);
|
||||
int oaknode_track_get_nearest_block_after_or_at(OakNodeTrack *track,
|
||||
int numerator, int denominator, OakNodeBlock **out);
|
||||
|
||||
/**
|
||||
* @brief Borrowed sequence owning this track list.
|
||||
*/
|
||||
int oaknode_tracklist_get_sequence(OakNodeTrackList *list,
|
||||
OakNodeSequence **out);
|
||||
|
||||
/**
|
||||
* @brief The list's track input id on the parent sequence
|
||||
* (e.g. "track_in_0"). Two-stage string getter.
|
||||
*/
|
||||
int oaknode_tracklist_get_track_input_id(OakNodeTrackList *list,
|
||||
char *buf, int buf_size);
|
||||
|
||||
/**
|
||||
* @brief Live input-array append/remove on the parent sequence for this
|
||||
* list's track input (TrackList::array_append/array_remove_last()).
|
||||
*/
|
||||
int oaknode_tracklist_array_append(OakNodeTrackList *list);
|
||||
int oaknode_tracklist_array_remove_last(OakNodeTrackList *list);
|
||||
|
||||
/**
|
||||
* @brief Map a cached track index to the input-array element index
|
||||
* (TrackList::get_array_index_from_cache_index()).
|
||||
*/
|
||||
int oaknode_tracklist_get_array_index_from_cache_index(
|
||||
OakNodeTrackList *list, int cache_index, int *out_index);
|
||||
|
||||
int oaknode_tracklist_get_type(OakNodeTrackList *list, int *type);
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
/***
|
||||
|
||||
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_TIMELINE_EDIT_H
|
||||
#define OAK_EDITOR_TIMELINE_EDIT_H
|
||||
|
||||
#include "node/block.h"
|
||||
#include "node/sequence.h"
|
||||
#include "node/track.h"
|
||||
#include "timeline/error.h"
|
||||
#include "undo/undocommand.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Timeline edit primitives (M4 §2.3).
|
||||
*
|
||||
* The timeline undo command classes stay inside oaktimeline (01 §5);
|
||||
* consumers create commands through these factories, receiving base
|
||||
* OakUndoCommand handles (owned; free with oakundo_command_free()).
|
||||
* Redo a command directly or push it on an undo stack.
|
||||
*/
|
||||
|
||||
/** @brief olive::TimelineAddTrackCommand. */
|
||||
OakUndoCommand *oaktimeline_add_track_command(OakNodeTrackList *list);
|
||||
|
||||
/** @brief olive::TimelineRemoveTrackCommand. */
|
||||
OakUndoCommand *oaktimeline_remove_track_command(OakNodeTrack *track);
|
||||
|
||||
/** @brief olive::TrackPlaceBlockCommand. */
|
||||
OakUndoCommand *oaktimeline_place_block_command(OakNodeTrackList *list,
|
||||
int track_index,
|
||||
OakNodeBlock *block,
|
||||
int64_t in_num,
|
||||
int64_t in_den);
|
||||
|
||||
/** @brief olive::TrackReplaceBlockWithGapCommand. */
|
||||
OakUndoCommand *oaktimeline_replace_block_with_gap_command(
|
||||
OakNodeTrack *track, OakNodeBlock *block);
|
||||
|
||||
/**
|
||||
* @brief olive::BlockTrimCommand. `mode` is an OakTimelineMovementMode
|
||||
* value (k_trim_in / k_trim_out).
|
||||
*/
|
||||
OakUndoCommand *oaktimeline_trim_command(OakNodeTrack *track,
|
||||
OakNodeBlock *block,
|
||||
int64_t new_length_num,
|
||||
int64_t new_length_den, int mode);
|
||||
|
||||
/** @brief olive::BlockSplitCommand on a set of blocks at one point. */
|
||||
OakUndoCommand *oaktimeline_split_command(OakNodeBlock *const *blocks,
|
||||
int count, int64_t point_num,
|
||||
int64_t point_den);
|
||||
|
||||
/** @brief olive::BlockSplitPreservingLinksCommand. */
|
||||
OakUndoCommand *oaktimeline_split_preserving_links_command(
|
||||
OakNodeBlock *const *blocks, int count, const int64_t *point_nums,
|
||||
const int64_t *point_dens, int time_count);
|
||||
|
||||
/** @brief olive::TimelineRippleDeleteGapsAtRegionsCommand. */
|
||||
OakUndoCommand *oaktimeline_ripple_delete_gaps_command(
|
||||
OakNodeSequence *sequence, const int64_t *in_nums,
|
||||
const int64_t *in_dens, const int64_t *out_nums,
|
||||
const int64_t *out_dens, OakNodeTrack *const *tracks, int range_count);
|
||||
|
||||
/** @brief olive::TrackSlideCommand. */
|
||||
OakUndoCommand *oaktimeline_slide_command(
|
||||
OakNodeTrack *track, OakNodeBlock *const *blocks, int block_count,
|
||||
OakNodeBlock *in_adjacent, OakNodeBlock *out_adjacent,
|
||||
int64_t movement_num, int64_t movement_den);
|
||||
|
||||
/** @brief olive::TrackRippleRemoveAreaCommand. */
|
||||
OakUndoCommand *oaktimeline_ripple_remove_area_command(
|
||||
OakNodeTrack *track, int64_t in_num, int64_t in_den, int64_t out_num,
|
||||
int64_t out_den);
|
||||
|
||||
/** @brief olive::TrackListInsertGaps. */
|
||||
OakUndoCommand *oaktimeline_insert_gaps_command(OakNodeTrackList *list,
|
||||
int64_t point_num,
|
||||
int64_t point_den,
|
||||
int64_t length_num,
|
||||
int64_t length_den);
|
||||
|
||||
/** @brief Movement modes (olive::Timeline::MovementMode). */
|
||||
enum OakTimelineMovementMode {
|
||||
OAKTIMELINE_MOVEMENT_NONE = 0,
|
||||
OAKTIMELINE_MOVEMENT_MOVE = 1,
|
||||
OAKTIMELINE_MOVEMENT_TRIM_IN = 2,
|
||||
OAKTIMELINE_MOVEMENT_TRIM_OUT = 3
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //OAK_EDITOR_TIMELINE_EDIT_H
|
||||
@@ -0,0 +1,39 @@
|
||||
/***
|
||||
|
||||
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_TIMELINE_ERROR_H
|
||||
#define OAK_EDITOR_TIMELINE_ERROR_H
|
||||
|
||||
/**
|
||||
* @brief Status and error codes shared by all oaktimeline C API families.
|
||||
*
|
||||
* Return-code convention (mirrors engine/include/oakengine/init.h):
|
||||
* 0 (OAKTIMELINE_OK) on success, a negative OAKTIMELINE_E_* error code on
|
||||
* failure. String getters return the required buffer size in bytes
|
||||
* (including the terminating NUL) as a non-negative value instead.
|
||||
*/
|
||||
#define OAKTIMELINE_OK 0 /**< Success. */
|
||||
#define OAKTIMELINE_E_INVALID (-1) /**< NULL handle or invalid argument. */
|
||||
#define OAKTIMELINE_E_STATE (-2) /**< Call not valid in the current state. */
|
||||
#define OAKTIMELINE_E_FAILED (-3) /**< The underlying operation failed. */
|
||||
#define OAKTIMELINE_E_NOT_FOUND (-4) /**< Index out of range / entry not found. */
|
||||
#define OAKTIMELINE_E_NOMEM (-5) /**< Allocation failed. */
|
||||
|
||||
#endif //OAK_EDITOR_TIMELINE_ERROR_H
|
||||
@@ -0,0 +1,108 @@
|
||||
/***
|
||||
|
||||
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_TIMELINE_MARKER_H
|
||||
#define OAK_EDITOR_TIMELINE_MARKER_H
|
||||
|
||||
#include "common/xmlutils.h"
|
||||
#include "node/node.h"
|
||||
#include "timeline/error.h"
|
||||
#include "undo/undocommand.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Borrowed handle to a timeline marker list
|
||||
* (olive::TimelineMarkerList), owned by a viewer node.
|
||||
*
|
||||
* Obtained via oaktimeline_marker_list_of(); never freed by the caller.
|
||||
*/
|
||||
typedef struct OakTimelineMarkerList OakTimelineMarkerList;
|
||||
|
||||
/**
|
||||
* @brief Borrowed marker list of a viewer node (sequence). NULL for NULL
|
||||
* or when the node is not a viewer.
|
||||
*/
|
||||
OakTimelineMarkerList *oaktimeline_marker_list_of(OakNodeNode *owner);
|
||||
|
||||
/**
|
||||
* @brief Number of markers. Out-param convention; OAKTIMELINE_E_INVALID
|
||||
* for NULL arguments.
|
||||
*/
|
||||
int oaktimeline_marker_count(const OakTimelineMarkerList *list,
|
||||
int *out_count);
|
||||
|
||||
/**
|
||||
* @brief Marker at index: time as num/den pairs, color and name
|
||||
* (two-stage string). OAKTIMELINE_E_NOT_FOUND when out of range.
|
||||
*/
|
||||
int oaktimeline_marker_at(const OakTimelineMarkerList *list, int index,
|
||||
int *in_num, int *in_den, int *out_num, int *out_den,
|
||||
int *color, char *name_buf, int buf_size);
|
||||
|
||||
/**
|
||||
* @brief Create a command that adds a marker (olive::MarkerAddCommand).
|
||||
*
|
||||
* Owned command; free with oakundo_command_free(). Redo it directly or
|
||||
* push it on an undo stack. Returns NULL on failure.
|
||||
*/
|
||||
OakUndoCommand *oaktimeline_marker_add_command(
|
||||
OakTimelineMarkerList *list, int in_num, int in_den, int out_num,
|
||||
int out_den, const char *name, int color);
|
||||
|
||||
/**
|
||||
* @brief Create a command that removes the marker at `index`.
|
||||
* OAKTIMELINE_E_NOT_FOUND (as NULL result documented by error) is
|
||||
* reported by returning NULL.
|
||||
*/
|
||||
OakUndoCommand *oaktimeline_marker_remove_at_command(
|
||||
OakTimelineMarkerList *list, int index);
|
||||
|
||||
/**
|
||||
* @brief Create a command that sets a marker's time range.
|
||||
*/
|
||||
OakUndoCommand *oaktimeline_marker_set_time_command(
|
||||
OakTimelineMarkerList *list, int index, int in_num, int in_den,
|
||||
int out_num, int out_den);
|
||||
|
||||
/**
|
||||
* @brief Create a command that sets a marker's color and/or name.
|
||||
* `name` may be NULL to leave the name unchanged (color still applies
|
||||
* when >= 0; both NULL-name and color < 0 is a no-op error).
|
||||
*/
|
||||
OakUndoCommand *oaktimeline_marker_set_props_command(
|
||||
OakTimelineMarkerList *list, int index, int color, const char *name);
|
||||
|
||||
/**
|
||||
* @brief Load/save the list through oakcommon XML handles. The reader
|
||||
* must be positioned on the wrapping element (e.g. "markers").
|
||||
*/
|
||||
int oaktimeline_marker_list_load(OakTimelineMarkerList *list,
|
||||
OakXmlReader reader);
|
||||
int oaktimeline_marker_list_save(const OakTimelineMarkerList *list,
|
||||
OakXmlWriter writer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //OAK_EDITOR_TIMELINE_MARKER_H
|
||||
@@ -0,0 +1,92 @@
|
||||
/***
|
||||
|
||||
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_TIMELINE_WORKAREA_H
|
||||
#define OAK_EDITOR_TIMELINE_WORKAREA_H
|
||||
|
||||
#include "common/xmlutils.h"
|
||||
#include "node/node.h"
|
||||
#include "timeline/error.h"
|
||||
#include "undo/undocommand.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Borrowed handle to a timeline work area
|
||||
* (olive::TimelineWorkArea), owned by a viewer node.
|
||||
*/
|
||||
typedef struct OakTimelineWorkArea OakTimelineWorkArea;
|
||||
|
||||
/**
|
||||
* @brief Borrowed work area of a viewer node (sequence). NULL for NULL
|
||||
* or when the node is not a viewer.
|
||||
*/
|
||||
OakTimelineWorkArea *oaktimeline_workarea_of(OakNodeNode *owner);
|
||||
|
||||
/**
|
||||
* @brief Read the work area state. Out params may individually be NULL.
|
||||
*/
|
||||
int oaktimeline_workarea_get(const OakTimelineWorkArea *w, int *in_num,
|
||||
int *in_den, int *out_num, int *out_den,
|
||||
int *enabled);
|
||||
|
||||
/**
|
||||
* @brief Set the range directly (live).
|
||||
*/
|
||||
int oaktimeline_workarea_set_range(OakTimelineWorkArea *w, int in_num,
|
||||
int in_den, int out_num, int out_den);
|
||||
|
||||
/**
|
||||
* @brief Create a set-range command (olive::WorkareaSetRangeCommand).
|
||||
* The old range must be supplied by the caller (facade knows what it
|
||||
* changed from). Owned; free with oakundo_command_free().
|
||||
*/
|
||||
OakUndoCommand *oaktimeline_workarea_set_range_command(
|
||||
OakTimelineWorkArea *w, int in_num, int in_den, int out_num,
|
||||
int out_den, int old_in_num, int old_in_den, int old_out_num,
|
||||
int old_out_den);
|
||||
|
||||
/**
|
||||
* @brief Create a set-enabled command (olive::WorkareaSetEnabledCommand).
|
||||
*/
|
||||
OakUndoCommand *oaktimeline_workarea_set_enabled_command(
|
||||
OakTimelineWorkArea *w, int enabled);
|
||||
|
||||
/**
|
||||
* @brief The reset sentinel range (TimelineWorkArea::k_reset_in/out).
|
||||
*/
|
||||
int oaktimeline_workarea_reset(int *in_num, int *in_den, int *out_num,
|
||||
int *out_den);
|
||||
|
||||
/**
|
||||
* @brief Load/save through oakcommon XML handles. The reader must be
|
||||
* positioned on the "workarea" element.
|
||||
*/
|
||||
int oaktimeline_workarea_load(OakTimelineWorkArea *w, OakXmlReader reader);
|
||||
int oaktimeline_workarea_save(const OakTimelineWorkArea *w,
|
||||
OakXmlWriter writer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //OAK_EDITOR_TIMELINE_WORKAREA_H
|
||||
Reference in New Issue
Block a user