This document establishes the ubiquitous domain language and architectural aggregates for LosslessCut.
The central domain aggregate managing an active NLE editing workspace for one or more media clips.
- Interface: Exposes atomic state mutations (
splitSegment,updateSegmentBounds,toggleDiscard,undo,redo,save,restore) and reactive state flows (EditingSessionState). - Invariants: Enforces minimum segment duration (100ms), single-clip discard restrictions, undo stack limits (30 states), and dirty tracking.
- Scope & Seam: Placed in
:core:domainas a pure JVM module. In-memory workspace state only; downstream export (ExportUseCase) and snapshot extraction (ExtractSnapshotUseCase) consumeEditingSessionStatesnapshots.
- MediaClip: Represents an open video or audio file with metadata (URI, duration, stream tracks, sync keyframes).
- TrimSegment: A bounded timestamp interval (
startMs..endMs) within a clip associated with aSegmentAction(KEEPvsDISCARD).
- SilenceCutConfig: Parameterized value object defining silence threshold (dB), minimum silence duration (ms), and padding bounds for automated section removal.
- VisualDetectionConfig: Configuration object driving frame analysis: frame sampling step (
sampleIntervalFrames), pHash difference threshold, SAD luminance delta, and contrast-normalized Laplacian variance threshold.
- FrameAnalysis: Single-pass computed frame quality metrics (perceptual hash, luminance delta/sec, and contrast-normalized Laplacian blur score with edge-density gating).
- WaveformResult: Decoded PCM audio amplitude vector with true RMS energy and perceptual scaling for timeline waveform rendering. Supports multi-track targeting by audio stream index.
The internal :engine processing pipeline hiding keyframe seeking, sample copying, PTS timestamp shifting, track validation, and MediaMuxer lifecycle management behind a clean internal engine seam while satisfying the ILosslessEngine domain interface.
- IAnalysisCache: Pure JVM domain interface defining cache read/write contracts for extractor-track-ID waveforms (
getWaveform(clip, trackId)) and strategy-agnostic visual frame metrics (getVisualAnalysis(clip, sampleInterval)). Visual frame detection is currently Beta. - AnalysisCacheImpl: Android file-backed binary cache implementation in
:core:datausing versioned binary headers (_v2.bin), track-keyed waveform files (_t${trackIndex}_v2.bin), LRU byte cap eviction, and age-based retention expiry in app-private storage.
- IMediaFinalizer: Domain interface handling storage destination registration (
IS_PENDING = 0lifecycle on Android 10+ MediaStore vs SAF DocumentFile SAF tree targets). - StorageUtils: Android helper module executing Storage Access Framework tree operations and MediaStore collection queries.
Timestamp-to-pixel mapping helpers inside CustomVideoSeeker (:app/customviews, View-coupled: read the View's width): timestamp↔pixel translations, zoom factor constraints (1x..20x), scroll panning offsets, and hit-testing.