shim(ruopus): the Opus decoder seat edith consumes, over ec-opus
Browse files at this commit88cf2a7c0fd587d22213a5fe48d3d171c206f59aParent: 7a75a9b3 changed files +60 -0
- Cargo.lock +7 -0
- shims/ruopus/Cargo.toml +22 -0
- shims/ruopus/src/lib.rs +31 -0
Cargo.lockmodified+7 -0
| @@ -1143,6 +1143,13 @@ version = "0.8.53" | |||
| 1143 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1143 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1144 | checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" | 1144 | checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" |
| 1145 | 1145 | ||
| 1146 | +[[package]] | ||
| 1147 | +name = "ruopus" | ||
| 1148 | +version = "0.1.2" | ||
| 1149 | +dependencies = [ | ||
| 1150 | + "ec-opus", | ||
| 1151 | +] | ||
| 1152 | + | ||
| 1146 | [[package]] | 1153 | [[package]] |
| 1147 | name = "rustversion" | 1154 | name = "rustversion" |
| 1148 | version = "1.0.23" | 1155 | version = "1.0.23" |
shims/ruopus/Cargo.tomladded+22 -0
| @@ -0,0 +1,22 @@ | |||
| 1 | +[package] | ||
| 2 | +name = "ruopus" | ||
| 3 | +description = "Compatibility shim: the ruopus 0.1.2 surface edith consumes, served by ec-opus." | ||
| 4 | +version = "0.1.2" | ||
| 5 | +edition.workspace = true | ||
| 6 | +license.workspace = true | ||
| 7 | +authors.workspace = true | ||
| 8 | +publish = false | ||
| 9 | + | ||
| 10 | +[dependencies] | ||
| 11 | +ec-opus = { path = "../../crates/ec-opus", version = "0.1.0" } | ||
| 12 | + | ||
| 13 | +# The incumbent's feature names, all no-ops here. A `[patch.crates-io]` consumer | ||
| 14 | +# that names a feature the patch lacks fails to *resolve*, so the swap needs | ||
| 15 | +# them declared even though nothing behind them is optional in this crate: | ||
| 16 | +# `spectrograms` bought the incumbent an FFT-backed MDCT (fifteen crates), and | ||
| 17 | +# `ec-opus` has that path unconditionally through `ec-dsp`. | ||
| 18 | +[features] | ||
| 19 | +default = ["std", "spectrograms"] | ||
| 20 | +std = [] | ||
| 21 | +spectrograms = ["std"] | ||
| 22 | +libm = [] | ||
shims/ruopus/src/lib.rsadded+31 -0
| @@ -0,0 +1,31 @@ | |||
| 1 | +//! `ruopus` as edith consumes it, over [`ec_opus`]. | ||
| 2 | +//! | ||
| 3 | +//! A shim, not a port: it carries the incumbent's package name and version so | ||
| 4 | +//! the swap is a `[patch.crates-io]` line, and it exposes exactly the one item | ||
| 5 | +//! the replica names — [`MultistreamDecoder`], built with `with_rate` and fed | ||
| 6 | +//! one packet at a time with `decode_packet` (`audio.rs:1575`, `1694`; | ||
| 7 | +//! `export.rs:1950`, the fidelity gate's own decoder). | ||
| 8 | +//! | ||
| 9 | +//! A re-export is the whole adapter, and that is a claim about two things | ||
| 10 | +//! rather than about the names: | ||
| 11 | +//! | ||
| 12 | +//! * **Layout arguments.** `with_rate(rate, streams, coupled, &mapping)` means | ||
| 13 | +//! the same thing in both: the first `coupled` elementary streams are stereo, | ||
| 14 | +//! `mapping[c]` names the decoded channel output channel `c` reads (255 = | ||
| 15 | +//! silent), and an impossible layout panics rather than returning — which is | ||
| 16 | +//! why the replica checks the `OpusHead` it read from a file before it gets | ||
| 17 | +//! here (`audio.rs:opus_layout`). | ||
| 18 | +//! * **Channel order.** Both decoders emit the *mapping's* order, which for RFC | ||
| 19 | +//! 7845 family 1 is Vorbis order (FL, FC, FR, BL, BR, LFE for 5.1) and not | ||
| 20 | +//! the product's FL/FR/FC/LFE/BL/BR. The permutation stays where the | ||
| 21 | +//! incumbent's behaviour already put it, at the call site | ||
| 22 | +//! (`audio.rs:vorbis_to_film_order`); a shim that permuted here would fold | ||
| 23 | +//! surround twice. | ||
| 24 | +//! | ||
| 25 | +//! Errors differ in type and not in use: `ec_core::Error` where the incumbent | ||
| 26 | +//! had `PacketError`, both `Display` and both consumed as `{e}` or as a | ||
| 27 | +//! refused packet. | ||
| 28 | + | ||
| 29 | +#![forbid(unsafe_code)] | ||
| 30 | + | ||
| 31 | +pub use ec_opus::MultistreamDecoder; | ||