mirror of
https://github.com/storytold/deckcraft.git
synced 2026-10-31 05:56:55 -06:00
- crates/media: probe (duration, rate/channels, size/fps; WMA/WMV recognised), audio decode to f32 PCM (MP3, AAC M4A/ADTS, ALAC, WAV, AIFF, CAF, FLAC, Vorbis via symphonia; Opus with our decoder in Ogg/WebM/MKV), video decode (MP4/MOV/WebM/MKV) with YUV->RGBA, poster frames, trim/fade/volume, Player mixer + per-voice clock (device-clocked or wall-clocked), VideoFeed. - Codec crates ported from FilmCraft: bitstream, h264, hevc, vp9, av1, isobmff, matroska, ogg, opus. - insert.audio/insert.video probe and store duration/size and a poster frame; unplayable media is embedded with a warning. New media.play/pause/toggle/stop/seek/info/posterFrame. - UI: MediaHost (cpal output injected by the desktop app), control bar under media, video frames on canvas and in the show; autoplay, click to play, loop, rewind, across slides, hide, full screen. - Tests with in-code WAV/AIFF and CC0 self-generated fixtures (make.sh, ATTRIBUTION.md rows). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.2 KiB
Rust
39 lines
1.2 KiB
Rust
use std::io;
|
|
|
|
/// Errors produced by the demuxer and muxer.
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum Error {
|
|
#[error("I/O error: {0}")]
|
|
Io(#[from] io::Error),
|
|
/// A box or structure ended before all required fields were read.
|
|
#[error("truncated data while reading {0}")]
|
|
Truncated(&'static str),
|
|
/// Structurally invalid data.
|
|
#[error("invalid data: {0}")]
|
|
Invalid(String),
|
|
/// Valid but unsupported feature (e.g. compressed `cmov` movie header).
|
|
#[error("unsupported: {0}")]
|
|
Unsupported(String),
|
|
/// A count or size exceeds sanity limits relative to the file size.
|
|
#[error("size limit exceeded: {0}")]
|
|
TooLarge(&'static str),
|
|
/// No `moov` box was found.
|
|
#[error("no moov box found")]
|
|
NoMoov,
|
|
/// A track index was out of range.
|
|
#[error("track index {0} out of range")]
|
|
NoSuchTrack(usize),
|
|
/// A sample index was out of range.
|
|
#[error("sample index {0} out of range")]
|
|
NoSuchSample(usize),
|
|
/// Muxer usage error (e.g. invalid track config, bad sample).
|
|
#[error("muxer: {0}")]
|
|
Mux(String),
|
|
}
|
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|
|
|
|
pub(crate) fn invalid<T>(msg: impl Into<String>) -> Result<T> {
|
|
Err(Error::Invalid(msg.into()))
|
|
}
|