summaryrefslogtreecommitdiff
path: root/rust/crates/scene/src/track.rs
diff options
context:
space:
mode:
authorcashmere <cashmere@autistici.org>2026-07-28 19:41:16 +0200
committercashmere <cashmere@autistici.org>2026-07-28 19:41:16 +0200
commitf5a82152394fde4d8f740f664ab7737b82861618 (patch)
tree5a51b181abead1ce03d2dbfc12b77918d3be0e1b /rust/crates/scene/src/track.rs
parente837e7504379e100ff3b56282577ec67bb88bec9 (diff)
downloadopencut-f5a82152394fde4d8f740f664ab7737b82861618.tar.gz
feat: GPUI desktop port foundation
- scene crate: full project/scene/element model, serde round-trip proven against the web SerializedProject shape - transfer crate: .ocp zip container, cross-compat with web fflate archives proven in both directions - storage crate: filesystem project store replacing IndexedDB, .ocp import/export - media crate: ffmpeg-next 8 decoder (frames, audio, thumbnails, waveform summaries) - playback crate: wall-clock anchored, frame-rounded playback clock - gpu crate: native texture readback; compositor renders headless offscreen on Vulkan (spike test) - flake devshell: rust toolchain, GPUI native deps, ffmpeg dev, bindgen clang args; GPUI hello-world builds - port plan in notes/gpui-port.md
Diffstat (limited to 'rust/crates/scene/src/track.rs')
-rw-r--r--rust/crates/scene/src/track.rs88
1 files changed, 88 insertions, 0 deletions
diff --git a/rust/crates/scene/src/track.rs b/rust/crates/scene/src/track.rs
new file mode 100644
index 00000000..b35a7b25
--- /dev/null
+++ b/rust/crates/scene/src/track.rs
@@ -0,0 +1,88 @@
+use serde::{Deserialize, Serialize};
+
+use crate::element::Element;
+
+#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
+#[serde(tag = "type", rename_all = "camelCase")]
+pub enum Track {
+ Video {
+ id: String,
+ name: String,
+ elements: Vec<Element>,
+ muted: bool,
+ hidden: bool,
+ },
+ Text {
+ id: String,
+ name: String,
+ elements: Vec<Element>,
+ hidden: bool,
+ },
+ Audio {
+ id: String,
+ name: String,
+ elements: Vec<Element>,
+ muted: bool,
+ },
+ Graphic {
+ id: String,
+ name: String,
+ elements: Vec<Element>,
+ hidden: bool,
+ },
+ Effect {
+ id: String,
+ name: String,
+ elements: Vec<Element>,
+ hidden: bool,
+ },
+}
+
+impl Track {
+ pub fn id(&self) -> &str {
+ match self {
+ Track::Video { id, .. }
+ | Track::Text { id, .. }
+ | Track::Audio { id, .. }
+ | Track::Graphic { id, .. }
+ | Track::Effect { id, .. } => id,
+ }
+ }
+
+ pub fn name(&self) -> &str {
+ match self {
+ Track::Video { name, .. }
+ | Track::Text { name, .. }
+ | Track::Audio { name, .. }
+ | Track::Graphic { name, .. }
+ | Track::Effect { name, .. } => name,
+ }
+ }
+
+ pub fn elements(&self) -> &[Element] {
+ match self {
+ Track::Video { elements, .. }
+ | Track::Text { elements, .. }
+ | Track::Audio { elements, .. }
+ | Track::Graphic { elements, .. }
+ | Track::Effect { elements, .. } => elements,
+ }
+ }
+
+ pub fn elements_mut(&mut self) -> &mut Vec<Element> {
+ match self {
+ Track::Video { elements, .. }
+ | Track::Text { elements, .. }
+ | Track::Audio { elements, .. }
+ | Track::Graphic { elements, .. }
+ | Track::Effect { elements, .. } => elements,
+ }
+ }
+}
+
+#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
+pub struct SceneTracks {
+ pub overlay: Vec<Track>,
+ pub main: Track,
+ pub audio: Vec<Track>,
+}