Pure `no_std` (no alloc) support for every codec except Opus, which now
requires the opt-in `opus` feature and pulls in `std`. Built on top of the
newly-released `g729-sys` 0.2.0 (also `no_std`-compatible).
API changes
-----------
- Add `Encoder::encode_into(&[Sample], &mut [u8]) -> Result<usize, CodecError>`
and `Decoder::decode_into(&[u8], &mut [Sample]) -> Result<usize, CodecError>`
as the primary, always-available methods (work in `no_std`).
- Add `Encoder::max_encode_bytes(n)` / `Decoder::max_decode_samples(n)` so
callers can size caller-provided buffers.
- The legacy `encode(...) -> Vec<u8>` / `decode(...) -> PcmBuf` methods are
preserved as `std`-gated default trait impls; existing std users see no
behavior change except where noted below.
- Replace `anyhow::Error` with a new `CodecError` enum (defined in
`src/error.rs`). `TryFrom<u8>` / `TryFrom<&str>` for `CodecType` now
return `CodecError`.
- Add slice helpers `samples_to_bytes_into` / `bytes_to_samples_into`
(always available) alongside the existing `Vec` versions (std-only).
Features (`Cargo.toml`)
-----------------------
- `default = ["std"]`
- `std` (default) enables `anyhow` and the `Box<dyn Encoder/Decoder>`
factories.
- `opus` is now off by default and implies `std` (because `opus-rs`
needs it). Opt in with `features = ["opus"]`.
`no_std`-compatible codecs
--------------------------
- G.711 (PCMA/PCMU), G.722, G.729, Telephone Event — fully supported.
- `Resampler` borrows a caller-provided coefficient buffer (~24 KB);
float math goes through `libm` when `std` is off, SIMD intrinsics are
taken from `core::arch`. New API: `Resampler::new(in, out, &mut [f32])`
and `Resampler::resample_into(&[i16], &mut [i16]) -> Result<usize, _>`.
Verified
--------
- `cargo build` (default)
- `cargo build --features opus`
- `cargo build --no-default-features` (host)
- `cargo build --no-default-features --target thumbv7em-none-eabi`
- `cargo test --features opus` (23 tests, including 12 new slice-API tests)
- `cargo clippy --features opus` (no errors)
BREAKING CHANGE: Opus is now opt-in (`features = ["opus"]`) instead of
default. Codecs' trait method shape changed (`encode`/`decode` are no
longer required to implement; implement `encode_into`/`decode_into` and
the `max_*` methods instead). `Resampler::new` now takes a `&mut [f32]`
coeffs buffer. `TryFrom` error type changed to `CodecError`.