diff --git a/Cargo.toml b/Cargo.toml index e4224c8..2dbc721 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,22 +19,41 @@ exclude = [ [workspace] members = [ "core", - "decode_wav", + "decode_symphonia", "encode_wav", "demos/player", "demos/writer", ] [features] -default = ["decode-wav-only", "encode-wav"] -decode-wav-only = ["creek-decode-wav"] +default = ["decode", "encode-wav"] +decode = [ "creek-decode-symphonia" ] +# Not yet working https://github.com/RustyDAW/creek/pull/6#issuecomment-988491582 +#decode-aac = [ "creek-decode-symphonia/aac" ] +decode-flac = [ "creek-decode-symphonia/flac" ] +decode-mp3 = [ "creek-decode-symphonia/mp3" ] +decode-pcm = [ "creek-decode-symphonia/pcm" ] +# Not yet working https://github.com/RustyDAW/creek/pull/6#issuecomment-988491582 +#decode-isomp4 = [ "creek-decode-symphonia/isomp4" ] +decode-ogg = [ "creek-decode-symphonia/ogg" ] +decode-vorbis = [ "creek-decode-symphonia/vorbis" ] +decode-wav = [ "creek-decode-symphonia/wav" ] decode-open-source = [] -decode-all = [] +decode-all = [ + #"decode-aac", + "decode-flac", + "decode-mp3", + "decode-pcm", + #"decode-isomp4", + "decode-ogg", + "decode-vorbis", + "decode-wav" +] encode-wav = ["creek-encode-wav"] [dependencies] creek-core = { version = "0.1", path = "core" } -creek-decode-wav = { version = "0.1.0", path = "decode_wav", optional = true } +creek-decode-symphonia = { version = "0.1.0", path = "decode_symphonia", optional = true } creek-encode-wav = { version = "0.1.0", path = "encode_wav", optional = true } # Unoptimized builds result in prominent gaps of silence after cache misses in the demo player. diff --git a/README.md b/README.md index b30bf3b..e5585ca 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,7 @@ [![Crates.io](https://img.shields.io/crates/v/creek.svg)](https://crates.io/crates/creek) [![License](https://img.shields.io/crates/l/creek.svg)](https://github.com/RustyDAW/creek/blob/main/COPYRIGHT) -Realtime-safe disk streaming to/from audio files - -This crate is currently incomplete. So far only uncompressed WAV files are functional. - +Realtime-safe disk streaming to/from audio files using [Symphonia](https://github.com/pdeljanov/Symphonia) to support a variety of codecs. Refer to [Symphonia's documentation](https://docs.rs/symphonia/latest/symphonia/#support) for supported codecs. Symphonia's Cargo features are exposed with the prefix `decode-`, except `aac` and `isomp4` which creek does not work with yet. For example, to enable MP3 decoding in creek, enable the `decode-mp3` feature. # How the Read Stream Works @@ -28,38 +25,6 @@ This stream automatically spawns an "IO server" that handles the non-realtime sa The write stream works how you would expect. Once a block is filled with data, it is sent to the IO server to be written. This block is also recycled back to the stream after writing is done. -# Format and Codec Support Roadmap - -Default decoding of files is provided by the [`Symphonia`] crate. (So far only wav is verified to work). - -In addition to the default decoders, you may define your own using the `Decoder` trait. - -### Formats (Demux) - -| Format | Status | Default | -|----------|------------------------------|---------| -| Wav | :heavy_check_mark: Compliant | Yes | -| ISO/MP4 | :x: | No | -| MKV/WebM | :x: | Yes | -| OGG | :x: | Yes | - -### Codecs (Decode) - -| Codec | Status | Default | -|------------------------------|------------------------------|---------| -| Wav | :heavy_check_mark: Compliant | Yes | -| AAC-LC | :x: | No | -| HE-AAC (AAC+, aacPlus) | :x: | No | -| HE-AACv2 (eAAC+, aacPlus v2) | :x: | No | -| FLAC | :x: | Yes | -| MP1 | :x: | No | -| MP2 | :x: | No | -| MP3 | :x: | No | -| Opus | :x: | Yes | -| PCM | :x: | Yes | -| Vorbis | :x: | Yes | -| WavPack | :x: | Yes | - ### Codecs (Encode) | Codec | Status | Default | |------------------------------|-------------------------------------------------|---------| diff --git a/decode_wav/Cargo.toml b/decode_symphonia/Cargo.toml similarity index 58% rename from decode_wav/Cargo.toml rename to decode_symphonia/Cargo.toml index cb1afca..318c79a 100644 --- a/decode_wav/Cargo.toml +++ b/decode_symphonia/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "creek-decode-wav" +name = "creek-decode-symphonia" version = "0.1.0" authors = ["Billy Messenger "] edition = "2018" license = "MIT OR Apache-2.0" keywords = ["audio", "io", "disk", "stream"] categories = ["multimedia::audio"] -description = "WAV file decoding for creek" +description = "Audio file decoding for creek" documentation = "https://docs.rs/creek-decode-wav" repository = "https://github.com/RustyDAW/creek" @@ -15,4 +15,14 @@ repository = "https://github.com/RustyDAW/creek" [dependencies] creek-core = { version = "0.1", path = "../core" } -symphonia = { version = "0.4", default-features = false, features=["wav", "pcm"] } \ No newline at end of file +symphonia = "0.4" + +[features] +#aac = [ "symphonia/aac" ] +flac = [ "symphonia/flac" ] +mp3 = [ "symphonia/mp3" ] +pcm = [ "symphonia/pcm" ] +#isomp4 = [ "symphonia/isomp4" ] +ogg = [ "symphonia/ogg" ] +vorbis = [ "symphonia/vorbis" ] +wav = [ "symphonia/wav" ] diff --git a/decode_wav/src/error.rs b/decode_symphonia/src/error.rs similarity index 100% rename from decode_wav/src/error.rs rename to decode_symphonia/src/error.rs diff --git a/decode_wav/src/lib.rs b/decode_symphonia/src/lib.rs similarity index 100% rename from decode_wav/src/lib.rs rename to decode_symphonia/src/lib.rs diff --git a/src/lib.rs b/src/lib.rs index ce5fe43..b33d698 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,7 @@ pub use creek_core::*; -#[cfg(feature = "decode-wav-only")] -pub use creek_decode_wav::*; +#[cfg(feature = "decode")] +pub use creek_decode_symphonia::*; #[cfg(feature = "encode-wav")] pub use creek_encode_wav::*;