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:
@@ -772,15 +772,15 @@ mod tests {
|
||||
use oak_codec::footagedescription::{FootageDescription, StreamEntry};
|
||||
|
||||
fn video_entry(stream_index: i32, duration: i64) -> StreamEntry {
|
||||
let mut vp = oak_common::videoparams::VideoParams::new_basic(
|
||||
1920,
|
||||
1080,
|
||||
oak_common::ocioutils::PixelFormat::F32,
|
||||
4,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
let mut vp = oak_core::videoparams::VideoParams::new_basic(
|
||||
1920,
|
||||
1080,
|
||||
oak_core::ocioutils::PixelFormat::F32,
|
||||
4,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
);
|
||||
vp.set_stream_index(stream_index);
|
||||
vp.set_frame_rate(30000, 1001);
|
||||
@@ -826,7 +826,7 @@ mod tests {
|
||||
assert_eq!(v.width, 1920);
|
||||
assert_eq!(v.height, 1080);
|
||||
assert_eq!(v.frame_rate, oak_core::Rational::new(30000, 1001));
|
||||
assert_eq!(v.pixel_format, oak_common::ocioutils::PixelFormat::F32.code());
|
||||
assert_eq!(v.pixel_format, oak_core::ocioutils::PixelFormat::F32.code());
|
||||
// 300000 ticks at 1/30000 = 10 seconds.
|
||||
assert_eq!(video.duration, oak_core::Rational::new(10, 1));
|
||||
}
|
||||
@@ -835,7 +835,7 @@ mod tests {
|
||||
fn conversion_skips_subtitles_and_unusable_durations() {
|
||||
let mut desc = FootageDescription::new("ffmpeg");
|
||||
desc.push_stream(video_entry(0, i64::MIN)); // AV_NOPTS_VALUE
|
||||
desc.push_stream(StreamEntry::Subtitle(oak_common::subtitleparams::SubtitleParams::new()));
|
||||
desc.push_stream(StreamEntry::Subtitle(oak_core::subtitleparams::SubtitleParams::new()));
|
||||
|
||||
let streams = streams_from_description(&desc);
|
||||
assert_eq!(streams.len(), 1, "the subtitle stream is skipped");
|
||||
|
||||
@@ -110,7 +110,7 @@ impl DisplayTransformNode {
|
||||
fn generate_processor(&mut self, core: &mut NodeCore) {
|
||||
let _ = core;
|
||||
// The C++ wraps the color manager, builds a display transform
|
||||
// (`oakcommon_colortransform_init_display`) for the selected
|
||||
// (`oak_core_colortransform_init_display`) for the selected
|
||||
// display/view, resolves the reference color space and creates
|
||||
// the processor via `oakrender_color_processor_create_transform`,
|
||||
// storing it with OcioBase::set_processor. Without a manager (the
|
||||
|
||||
@@ -20,11 +20,21 @@
|
||||
//! ([`crate::traverser::RenderHooks::resolve`]).
|
||||
//! `// CPP-PARITY: app/render/job/footagejob.h, shaderjob.h`.
|
||||
|
||||
use oak_core::color::ColorProcessor;
|
||||
use oak_core::Rational;
|
||||
|
||||
use crate::id::NodeId;
|
||||
use crate::nodes::plugin::PluginJobPayload;
|
||||
use crate::value::NodeValueRow;
|
||||
|
||||
/// Job types
|
||||
|
||||
pub enum Job{
|
||||
FootageJob(FootageJobPayload),
|
||||
ShaderJob(ShaderJobPayload),
|
||||
PluginJob(PluginJobPayload),
|
||||
ColorTransformJob
|
||||
}
|
||||
|
||||
/// C++ `FootageJob` payload: the decode request a footage node emits at
|
||||
/// its output instead of a texture. The render hooks decode it at the
|
||||
/// request time and replace it with the resulting frame.
|
||||
@@ -67,6 +77,11 @@ pub struct ShaderJobPayload {
|
||||
pub iterative_input: String,
|
||||
}
|
||||
|
||||
pub struct ColorTransformJobPayload{
|
||||
pub color_processor: ColorProcessor,
|
||||
|
||||
}
|
||||
|
||||
impl Default for FootageJobPayload {
|
||||
fn default() -> Self {
|
||||
FootageJobPayload {
|
||||
|
||||
@@ -140,29 +140,29 @@ impl Project {
|
||||
|
||||
/// The pipeline working colorspace (project property; ACEScg when the
|
||||
/// setting is absent).
|
||||
pub fn working_color_space(&self) -> oak_common::colormath::WorkingColorSpace {
|
||||
oak_common::colormath::WorkingColorSpace::from_setting(
|
||||
pub fn working_color_space(&self) -> oak_core::colormath::WorkingColorSpace {
|
||||
oak_core::colormath::WorkingColorSpace::from_setting(
|
||||
self.settings.get(SETTING_WORKING_COLOR_SPACE).map(String::as_str).unwrap_or(""),
|
||||
)
|
||||
}
|
||||
|
||||
/// The output/delivery colorspace (project property; sRGB when the
|
||||
/// settings are absent).
|
||||
pub fn output_color_spec(&self) -> oak_common::colormath::OutputColorSpec {
|
||||
oak_common::colormath::OutputColorSpec::from_settings(
|
||||
pub fn output_color_spec(&self) -> oak_core::colormath::OutputColorSpec {
|
||||
oak_core::colormath::OutputColorSpec::from_settings(
|
||||
self.settings.get(SETTING_OUTPUT_GAMUT).map(String::as_str).unwrap_or(""),
|
||||
self.settings.get(SETTING_OUTPUT_TRANSFER).map(String::as_str).unwrap_or(""),
|
||||
)
|
||||
}
|
||||
|
||||
/// Set the pipeline working colorspace property.
|
||||
pub fn set_working_color_space(&mut self, space: oak_common::colormath::WorkingColorSpace) {
|
||||
pub fn set_working_color_space(&mut self, space: oak_core::colormath::WorkingColorSpace) {
|
||||
self.settings
|
||||
.insert(SETTING_WORKING_COLOR_SPACE.to_string(), space.as_setting().to_string());
|
||||
}
|
||||
|
||||
/// Set the output/delivery colorspace properties.
|
||||
pub fn set_output_color_spec(&mut self, spec: oak_common::colormath::OutputColorSpec) {
|
||||
pub fn set_output_color_spec(&mut self, spec: oak_core::colormath::OutputColorSpec) {
|
||||
self.settings
|
||||
.insert(SETTING_OUTPUT_GAMUT.to_string(), spec.gamut.as_setting().to_string());
|
||||
self.settings
|
||||
@@ -357,8 +357,8 @@ impl Project {
|
||||
_ => {}
|
||||
}
|
||||
// Default location: the shared disk-cache directory (single-lib:
|
||||
// lives in oakcommon, used by oaknode and oakrender alike).
|
||||
oak_common::filefunctions::default_disk_cache_path()
|
||||
// lives in oak_core, used by oaknode and oakrender alike).
|
||||
oak_core::filefunctions::default_disk_cache_path()
|
||||
}
|
||||
|
||||
/// Copy all settings from `src` into `self` (C++
|
||||
|
||||
@@ -123,9 +123,9 @@ impl SequenceBehavior {
|
||||
|
||||
/// Apply the default video/audio parameters (C++
|
||||
/// `ViewerOutput::set_default_parameters()`; the config lookups read
|
||||
/// the oakcommon config store directly).
|
||||
/// the oak_core config store directly).
|
||||
pub fn set_default_parameters(&mut self) {
|
||||
let config = oak_common::configstore::ConfigStore::instance();
|
||||
let config = oak_core::configstore::ConfigStore::instance();
|
||||
let width = config.get_int(None, "DefaultSequenceWidth", 1920);
|
||||
let height = config.get_int(None, "DefaultSequenceHeight", 1080);
|
||||
let sample_rate = config.get_int(None, "DefaultSequenceAudioFrequency", 48000);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Project (de)serialization: the C++ `ProjectSerializer` family.
|
||||
//!
|
||||
//! XML I/O goes through oakcommon's [`XmlReader`]/[`XmlWriter`] (direct
|
||||
//! XML I/O goes through oak_core's [`XmlReader`]/[`XmlWriter`] (direct
|
||||
//! Rust calls, single-lib unification). The XML shape mirrors
|
||||
//! the C++ `Node::save`/`Project::save` writers (`// CPP-PARITY:
|
||||
//! src/node/src/node.cpp:node::save`, `// CPP-PARITY:
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use oak_common::xmlutils::{XmlReader, XmlWriter};
|
||||
use oak_core::xmlutils::{XmlReader, XmlWriter};
|
||||
use oak_core::Rational;
|
||||
|
||||
use crate::graph::Graph;
|
||||
@@ -43,7 +43,7 @@ use crate::project::{NodeRef, Project};
|
||||
use crate::value::{NodeValue, ValueType};
|
||||
|
||||
/// Minimal XML reader surface the serializer needs (implemented over
|
||||
/// oakcommon's `xmlutils`).
|
||||
/// oak_core's `xmlutils`).
|
||||
pub trait XmlRead {
|
||||
/// Advance to the next start element; false at end/close.
|
||||
fn next_start_element(&mut self) -> bool;
|
||||
@@ -73,17 +73,17 @@ pub trait XmlWrite {
|
||||
fn characters(&mut self, _text: &str) {}
|
||||
}
|
||||
|
||||
/// Reader over oakcommon's [`XmlReader`].
|
||||
/// Reader over oak_core's [`XmlReader`].
|
||||
pub struct XmlReaderBridge {
|
||||
/// The oakcommon reader.
|
||||
/// The oak_core reader.
|
||||
reader: XmlReader,
|
||||
/// Current element name (cached).
|
||||
name: String,
|
||||
}
|
||||
|
||||
/// Writer over oakcommon's [`XmlWriter`].
|
||||
/// Writer over oak_core's [`XmlWriter`].
|
||||
pub struct XmlWriterBridge {
|
||||
/// The oakcommon writer.
|
||||
/// The oak_core writer.
|
||||
writer: XmlWriter,
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ pub fn parse_node_ref(text: &str) -> Option<NodeId> {
|
||||
pub fn save(project: &Project) -> crate::error::Result<String> {
|
||||
use crate::error::Error;
|
||||
let mut writer = XmlWriterBridge::new().ok_or(Error::Failed(
|
||||
"oakcommon XML writer unavailable".to_string(),
|
||||
"oak_core XML writer unavailable".to_string(),
|
||||
))?;
|
||||
|
||||
writer.start_element("project");
|
||||
@@ -510,7 +510,7 @@ pub fn load_with_id_map(
|
||||
) -> crate::error::Result<(Arc<Mutex<Project>>, std::collections::HashMap<u64, NodeId>)> {
|
||||
use crate::error::Error;
|
||||
let mut reader = XmlReaderBridge::new(xml).ok_or(Error::Failed(
|
||||
"oakcommon XML reader unavailable".to_string(),
|
||||
"oak_core XML reader unavailable".to_string(),
|
||||
))?;
|
||||
|
||||
// Detect the root element.
|
||||
|
||||
@@ -570,7 +570,7 @@ fn lerp_arr4(a: &[f64; 4], b: &[f64; 4], t: f64) -> [f64; 4] {
|
||||
]
|
||||
}
|
||||
|
||||
/// Video parameters (plain data; mirrors oakcommon `VideoParams` C++
|
||||
/// Video parameters (plain data; mirrors oak_core `VideoParams` C++
|
||||
/// fields — the C ABI marshals field-by-field).
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
pub struct VideoParams {
|
||||
|
||||
Reference in New Issue
Block a user