mirror of
https://github.com/storytold/craft-libs.git
synced 2026-12-01 02:36:54 +01:00
Corrects round 1: - A multi-block ADTS frame after the stream has started is concealed at its whole length; round 1's filter skipped it, shifting the audio after it. - Sample durations only trim an MP4's last packet: wrong ones (some count a HE-AAC packet's core frames) were cutting audio. Durations of 0 with an edit use the edit. Raw ADTS packets now keep their headers, so TrackDecoder alone handles format changes, multi-block frames and concealment, for apps as for files, and nested ADTS payloads are not split again. Headers come from the frame scan's reads, not one read per frame. The stream's format is the one most of its first frames share, so one damaged header does not silence the file. The ID3 walk and a packet's ADTS split are bounded. AAC: - HE-AAC is delayed by the SBR filterbanks' 481 core samples; it played 19.5 ms early against ffmpeg in every container. - A failed access unit leaves the decoder's state as it was, so the next packet decodes as if it had not been there. - reset restarts the noise generator, so a seek into PNS repeats. - A signalled rate that is not twice the core's plays the core; it reported the signalled rate with the core's samples. The decoder oracle's tolerance tightens from 1e-3 to 1e-5. Tests cover HE-AAC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
76 lines
2.4 KiB
TOML
76 lines
2.4 KiB
TOML
[package]
|
|
name = "craft-audio"
|
|
description = "Audio file I/O and codecs: WAV/AIFF read and write, FLAC encoder, AAC decoder."
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
rust-version.workspace = true
|
|
repository.workspace = true
|
|
|
|
[package.metadata.docs.rs]
|
|
all-features = true
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[features]
|
|
# Probe and decode files: WAV and AIFF natively; AAC and PCM through craft-media's demuxers and
|
|
# this crate's decoders; MP1/MP2/MP3, FLAC, ALAC, Vorbis, CAF, ADPCM, A-law and µ-law through
|
|
# symphonia.
|
|
decode = ["decode-native", "symphonia"]
|
|
# `decode` without symphonia: only the formats with a native decoder (others are Unsupported).
|
|
decode-native = ["aac-decode", "craft-media/isobmff", "craft-media/matroska", "craft-media/ogg", "dep:log"]
|
|
# The symphonia fallback for the formats with no native decoder yet.
|
|
symphonia = ["decode-native", "dep:symphonia"]
|
|
# Every encoder: the lossless file writers.
|
|
encode = ["lossless-encode"]
|
|
# Encode WAV/BWF/RF64, AIFF/AIFF-C and FLAC files.
|
|
lossless-encode = ["pcm-encode", "flac-encode"]
|
|
# Encode WAV/BWF/RF64 and AIFF/AIFF-C files.
|
|
pcm-encode = []
|
|
# Encode FLAC files.
|
|
flac-encode = ["craft-media/bitstream"]
|
|
# Codec modules on their own, for packet-level use.
|
|
aac-decode = ["craft-media/bitstream"]
|
|
# Multi-resolution waveform overviews (`peaks`).
|
|
peaks = []
|
|
# Serialize and Deserialize for the shared types.
|
|
serde = ["dep:serde", "craft-media/serde"]
|
|
|
|
[dependencies]
|
|
craft-media = { workspace = true }
|
|
thiserror = { workspace = true }
|
|
serde = { workspace = true, optional = true }
|
|
log = { version = "0.4", optional = true }
|
|
# symphonia keeps its AAC decoder for AAC in CAF, a container craft-media does not read.
|
|
symphonia = { version = "0.6.1", optional = true, default-features = false, features = ["mp1", "mp2", "mp3", "flac", "vorbis", "ogg", "wav", "pcm", "aiff", "isomp4", "aac", "alac", "adpcm", "caf", "mkv"] }
|
|
|
|
[dev-dependencies]
|
|
craft-media-testkit = { workspace = true }
|
|
proptest = { workspace = true }
|
|
serde_json = { workspace = true }
|
|
|
|
[[test]]
|
|
name = "audio"
|
|
required-features = ["decode", "lossless-encode", "peaks"]
|
|
|
|
[[test]]
|
|
name = "codecs"
|
|
required-features = ["decode", "encode"]
|
|
|
|
[[example]]
|
|
name = "info"
|
|
required-features = ["decode"]
|
|
|
|
[[example]]
|
|
name = "stream"
|
|
required-features = ["decode"]
|
|
|
|
[[example]]
|
|
name = "packets"
|
|
required-features = ["decode"]
|
|
|
|
[[example]]
|
|
name = "encode"
|
|
required-features = ["lossless-encode"]
|