core: merge oak-common into oak-core
oak-common is gone; its modules (configstore, xmlutils, ocioutils,
oiioutils, colormath, colortransform, videoparams, ffmpegutils, ...)
now live in oak-core alongside the value types. The render value/GPU
types moved too: backend (wgpu context + DisplayRenderer), color
(ColorProcessor over ocio-rs), texture, frame, and the commonutil
config helpers.
Fix-ups to make the merged tree build and pass tests:
- oak-core Cargo.toml: wgpu back to 25 (the moved backend code is
written against that API generation); add the toml/quick-xml/image
deps oak-common carried.
- lib.rs: drop the duplicate 'pub mod error;'.
- error.rs: unified OAKCORE_* codes; restore Error::new() and
From<OcioError> from oak-common's error type.
- backend.rs/color.rs: oak_core::/oak_render:: self-references
rewritten to crate::; the shaderfx-dependent GPU effect test moved
to oak-render's shaderfx tests (shaderfx depends on oak-node and
cannot live in oak-core).
- oak-render's error module re-exports oak_core::error::{Error,
Result}; the OAKRENDER_* codes stay as the public-code contract.
- oak-node jobs.rs: ColorProcessor imported from oak_core::color.
- Integration tests repointed at oak_core::{texture, frame, backend,
color, colormath}.
- the display-ICC regression test treats an empty OAK_DISPLAY_ICC as
unset, matching displayicc::env_override_icc.
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
|
||||
use std::sync::{Arc, Condvar, Mutex};
|
||||
|
||||
use oak_common::cancelatom::CancelAtom;
|
||||
use oak_core::cancelatom::CancelAtom;
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
use crate::task::{Task, TaskBehavior};
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
//! replaced by a single [`crate::nodeops::NodeRef`] viewer (the color
|
||||
//! manager no longer crosses into the render tickets — the direct ticket
|
||||
//! arena performs no color management). Rendered frames arrive as
|
||||
//! `oak_render::texture::Texture` values and are converted to
|
||||
//! `oak_core::texture::Texture` values and are converted to
|
||||
//! `oak_codec::frame::Frame` values for the encoder.
|
||||
//!
|
||||
//! **Simplifications over the C++**: no temporary-file rename dance (the
|
||||
@@ -42,8 +42,8 @@ use std::sync::Arc;
|
||||
|
||||
use oak_codec::encoder::{create_from_params, Encoder};
|
||||
use oak_codec::encodingparams::EncodingParams as CodecEncodingParams;
|
||||
use oak_common::videoparams::VideoParams as CommonVideoParams;
|
||||
use oak_render::texture::Texture;
|
||||
use oak_core::videoparams::VideoParams as CommonVideoParams;
|
||||
use oak_core::texture::Texture;
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
use crate::nodeops::{self, NodeRef};
|
||||
@@ -232,8 +232,8 @@ impl ExportTask {
|
||||
/// delivery output spec) read off the exported node's project — the
|
||||
/// export renders to the project's delivery target, not to the display.
|
||||
fn delivery_color(&self) -> (
|
||||
oak_common::colormath::WorkingColorSpace,
|
||||
oak_common::colormath::OutputColorSpec,
|
||||
oak_core::colormath::WorkingColorSpace,
|
||||
oak_core::colormath::OutputColorSpec,
|
||||
) {
|
||||
let guard = self
|
||||
.viewer_node
|
||||
@@ -253,7 +253,7 @@ impl ExportTask {
|
||||
return;
|
||||
}
|
||||
let (working, spec) = self.delivery_color();
|
||||
if working == oak_common::colormath::WorkingColorSpace::SrgbLegacy {
|
||||
if working == oak_core::colormath::WorkingColorSpace::SrgbLegacy {
|
||||
return;
|
||||
}
|
||||
let w = frame.width().max(0) as usize;
|
||||
@@ -271,7 +271,7 @@ impl ExportTask {
|
||||
if start + row_bytes > data.len() {
|
||||
break;
|
||||
}
|
||||
oak_common::colormath::acescg_to_output_bytes(
|
||||
oak_core::colormath::acescg_to_output_bytes(
|
||||
&mut data[start..start + row_bytes],
|
||||
w,
|
||||
spec,
|
||||
@@ -290,14 +290,14 @@ impl ExportTask {
|
||||
));
|
||||
};
|
||||
let params = CommonVideoParams::new_basic(
|
||||
frame.width,
|
||||
frame.height,
|
||||
oak_common::ocioutils::PixelFormat::from_code(frame.format as i32),
|
||||
4,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
frame.width,
|
||||
frame.height,
|
||||
oak_core::ocioutils::PixelFormat::from_code(frame.format as i32),
|
||||
4,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
);
|
||||
let mut out = oak_codec::frame::Frame::with_params(params);
|
||||
out.set_timestamp(frame.timestamp);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
//!
|
||||
//! Reimplements the C++ task module (`src/task/src`) as direct Rust
|
||||
//! (single-lib unification): inheritance → one module per class + trait
|
||||
//! objects, cancellation via `oak_common::cancelatom::CancelAtom`, events
|
||||
//! objects, cancellation via `oak_core::cancelatom::CancelAtom`, events
|
||||
//! as boxed callbacks. All node-graph, timeline and render work goes
|
||||
//! through the direct `oaknode` / `oakrender` Rust APIs
|
||||
//! ([`nodeops`] holds the graph operations the tasks share).
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
use std::sync::{Arc, Mutex, MutexGuard};
|
||||
|
||||
use oak_common::videoparams::VideoParams as CommonVideoParams;
|
||||
use oak_core::videoparams::VideoParams as CommonVideoParams;
|
||||
use oak_core::Rational;
|
||||
use oak_node::block::{BlockCore, ClipBlockBehavior, GapBlockBehavior, TransitionBlockBehavior};
|
||||
use oak_node::folder::FolderBehavior;
|
||||
@@ -288,25 +288,25 @@ impl TrackRange for GraphTrackRange<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert an oaknode video-params value to the oakcommon `VideoParams`
|
||||
/// Convert an oaknode video-params value to the oak_core `VideoParams`
|
||||
/// value type the task code works with (the C ABI marshalled the same
|
||||
/// fields).
|
||||
fn common_from_node_video(v: oak_node::value::VideoParams) -> CommonVideoParams {
|
||||
let mut p = CommonVideoParams::new_basic(
|
||||
v.width,
|
||||
v.height,
|
||||
oak_common::ocioutils::PixelFormat::from_code(v.pixel_format),
|
||||
v.channels,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
v.width,
|
||||
v.height,
|
||||
oak_core::ocioutils::PixelFormat::from_code(v.pixel_format),
|
||||
v.channels,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
);
|
||||
p.set_frame_rate(v.frame_rate.numerator() as i32, v.frame_rate.denominator() as i32);
|
||||
p
|
||||
}
|
||||
|
||||
/// Convert an oakcommon video-params value back to the oaknode value type
|
||||
/// Convert an oak_core video-params value back to the oaknode value type
|
||||
/// (the fields that survive the C ABI marshalling; `video_type`,
|
||||
/// `start_time`/`duration` and color fields have no oaknode counterpart).
|
||||
fn node_video_from_common(v: &CommonVideoParams) -> oak_node::value::VideoParams {
|
||||
@@ -320,7 +320,7 @@ fn node_video_from_common(v: &CommonVideoParams) -> oak_node::value::VideoParams
|
||||
}
|
||||
}
|
||||
|
||||
/// The sequence's `index`th video parameter stream as the oakcommon value
|
||||
/// The sequence's `index`th video parameter stream as the oak_core value
|
||||
/// type (`oaknode_sequence_get_video_params`).
|
||||
pub fn sequence_video_params(
|
||||
project: &ProjectRef,
|
||||
@@ -455,7 +455,7 @@ pub fn footage_total_stream_count(project: &ProjectRef, footage: NodeId) -> usiz
|
||||
.unwrap_or(0)
|
||||
}
|
||||
|
||||
/// The footage's `index`th video parameter stream as the oakcommon value
|
||||
/// The footage's `index`th video parameter stream as the oak_core value
|
||||
/// type (`oaknode_footage_get_video_params`).
|
||||
pub fn footage_video_params(
|
||||
project: &ProjectRef,
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
//!
|
||||
//! CPP-PARITY: src/task/src/precache/precachetask.h
|
||||
|
||||
use oak_common::videoparams::VideoParams;
|
||||
use oak_core::videoparams::VideoParams;
|
||||
|
||||
use crate::error::Result;
|
||||
use crate::nodeops::{self, NodeRef};
|
||||
@@ -114,7 +114,7 @@ impl TaskBehavior for PreCacheTask {
|
||||
}
|
||||
|
||||
impl RenderTaskBehavior for PreCacheTask {
|
||||
fn frame_downloaded(&mut self, task: &mut Task, frame: &oak_render::texture::Texture) -> Result<()> {
|
||||
fn frame_downloaded(&mut self, task: &mut Task, frame: &oak_core::texture::Texture) -> Result<()> {
|
||||
// Do nothing: pre-cache just fills the frame cache (the direct
|
||||
// ticket arena records the render through the ticket's cache
|
||||
// identity; see the module docs).
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
use oak_common::configstore::ConfigStore;
|
||||
use oak_common::videoparams::VideoType;
|
||||
use oak_core::configstore::ConfigStore;
|
||||
use oak_core::videoparams::VideoType;
|
||||
use oak_undo::undocommand::UndoCommand;
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
|
||||
@@ -353,7 +353,7 @@ impl ProxyTask {
|
||||
|
||||
/// 配置的代理转码并发上限([1, 16])。
|
||||
pub fn proxy_max_concurrent() -> i32 {
|
||||
oak_common::configstore::ConfigStore::instance()
|
||||
oak_core::configstore::ConfigStore::instance()
|
||||
.get_int(None, Self::CONFIG_KEY_PROXY_MAX_CONCURRENT, 1)
|
||||
.clamp(1, 16)
|
||||
}
|
||||
@@ -411,7 +411,7 @@ impl TaskBehavior for ProxyTask {
|
||||
// unification: the old two-stage C ABI getter is gone; an empty
|
||||
// string means "not found"). The `FFmpegPath` config takes
|
||||
// precedence when set (C++ `OAK_CONFIG("FFmpegPath")`).
|
||||
let configured = oak_common::configstore::ConfigStore::instance()
|
||||
let configured = oak_core::configstore::ConfigStore::instance()
|
||||
.get(None, "FFmpegPath")
|
||||
.unwrap_or_default();
|
||||
let ffmpeg_path = ProxyManager::find_ffmpeg(&configured);
|
||||
|
||||
@@ -53,22 +53,22 @@ use std::collections::{HashMap, VecDeque};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::{Arc, Condvar, Mutex};
|
||||
|
||||
use oak_common::videoparams::VideoParams;
|
||||
use oak_core::videoparams::VideoParams;
|
||||
use oak_node::footage::FootageBehavior;
|
||||
use oak_node::sequence::SequenceBehavior;
|
||||
use oak_node::track::{TrackBehavior, TrackListBehavior, TrackType};
|
||||
use oak_render::procpool::{
|
||||
bgra8_to_f32_rgba, DispatcherConfig, ProcessDispatcher, ShmAudioRef, ShmFrameRef,
|
||||
bgra8_to_f32_rgba, DispatcherConfig, ProcessDispatcher, ShmFrameRef,
|
||||
};
|
||||
use oak_render::ticket::{
|
||||
ticket_kind, AudioTicketParams, MontageClip, MontageEffect, TicketArena, TicketId, TicketPayload,
|
||||
TicketResult, VideoTicketParams,
|
||||
ticket_kind, AudioTicketParams, MontageClip, MontageEffect, TicketArena, TicketId, TicketPayload,
|
||||
TicketResult, VideoTicketParams,
|
||||
};
|
||||
use oak_render::worker::JobDispatch;
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
use crate::nodeops::{
|
||||
find_input_footage, pixel_format_from_code, NodeRef, ProjectRef,
|
||||
find_input_footage, pixel_format_from_code, NodeRef, ProjectRef,
|
||||
};
|
||||
use crate::task::Task;
|
||||
use oak_core::{Rational, TimeRange};
|
||||
@@ -112,9 +112,9 @@ pub struct ForceParams {
|
||||
pub trait RenderTaskBehavior {
|
||||
/// Called for each rendered video frame.
|
||||
fn frame_downloaded(
|
||||
&mut self,
|
||||
task: &mut Task,
|
||||
frame: &oak_render::texture::Texture,
|
||||
&mut self,
|
||||
task: &mut Task,
|
||||
frame: &oak_core::texture::Texture,
|
||||
) -> Result<()>;
|
||||
/// Called for each rendered audio buffer.
|
||||
fn audio_downloaded(&mut self, task: &mut Task, samples: &oak_render::ticket::AudioSamples) -> Result<()>;
|
||||
@@ -1162,7 +1162,7 @@ fn push_finished(id: TicketId, result: TicketResult, dispatch: DispatchPtr) {
|
||||
/// are read straight out — their bytes are already f32 RGBA little-endian,
|
||||
/// no conversion; BGRA8 slots (the default preview path) convert once with
|
||||
/// [`bgra8_to_f32_rgba`].
|
||||
fn shm_frame_to_texture(frame: &ShmFrameRef) -> oak_render::texture::Texture {
|
||||
fn shm_frame_to_texture(frame: &ShmFrameRef) -> oak_core::texture::Texture {
|
||||
let meta = &frame.meta;
|
||||
let pixels = frame
|
||||
.shm
|
||||
@@ -1171,17 +1171,17 @@ fn shm_frame_to_texture(frame: &ShmFrameRef) -> oak_render::texture::Texture {
|
||||
.unwrap_or_default();
|
||||
if meta.format == oak_core::PixelFormat::F32 as i32 {
|
||||
// F32 slot: the encoder gets the pipeline samples with no round trip.
|
||||
let mut f = oak_render::texture::Frame::new();
|
||||
let mut f = oak_core::texture::Frame::new();
|
||||
f.width = meta.width;
|
||||
f.height = meta.height;
|
||||
f.format = oak_core::PixelFormat::F32;
|
||||
f.channels = 4;
|
||||
f.timestamp = oak_core::Rational::new(meta.time_num, meta.time_den);
|
||||
f.data = pixels.to_vec();
|
||||
return oak_render::texture::Texture::wrap_frame(f);
|
||||
return oak_core::texture::Texture::wrap_frame(f);
|
||||
}
|
||||
let samples = bgra8_to_f32_rgba(pixels);
|
||||
let mut f = oak_render::texture::Frame::new();
|
||||
let mut f = oak_core::texture::Frame::new();
|
||||
f.width = meta.width;
|
||||
f.height = meta.height;
|
||||
f.format = oak_core::PixelFormat::F32;
|
||||
@@ -1197,5 +1197,5 @@ fn shm_frame_to_texture(frame: &ShmFrameRef) -> oak_render::texture::Texture {
|
||||
bytes
|
||||
})
|
||||
.collect();
|
||||
oak_render::texture::Texture::wrap_frame(f)
|
||||
oak_core::texture::Texture::wrap_frame(f)
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
//! shared lifecycle lives here; the per-task work is supplied through
|
||||
//! [`TaskBehavior`] (a trait object, per architectural decision #1 in
|
||||
//! README.md). Cancellation rides on a shared
|
||||
//! `oak_common::cancelatom::CancelAtom` (single-lib unification: the old
|
||||
//! `oak_core::cancelatom::CancelAtom` (single-lib unification: the old
|
||||
//! oakrender cancelatom C ABI is gone).
|
||||
//!
|
||||
//! CPP-PARITY: src/task/src/task.h
|
||||
@@ -39,7 +39,7 @@
|
||||
use std::sync::atomic::{AtomicI64, Ordering};
|
||||
use std::sync::{Arc, Condvar, Mutex};
|
||||
|
||||
use oak_common::cancelatom::CancelAtom;
|
||||
use oak_core::cancelatom::CancelAtom;
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user