Skip to content

Commit

Permalink
Add document for component submodules.
Browse files Browse the repository at this point in the history
This commit also introduces a new feature for publishing "test_helper"
from the crate.
  • Loading branch information
yotarok committed Oct 8, 2023
1 parent d2aa313 commit a812b9d
Show file tree
Hide file tree
Showing 7 changed files with 389 additions and 26 deletions.
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ experimental = ["dep:nalgebra"]
par = ["dep:crossbeam-channel"]
fakesimd = []
mimalloc = ["dep:mimalloc"]
test_helper = ["dep:claxon", "dep:once_cell", "dep:rand", "dep:tempfile"]

[dependencies]
crc = "2.1"
Expand All @@ -32,6 +33,15 @@ seq-macro = "0.3"
serde = { version = "1.0", features = ["derive"] }
toml = "0.5"

# Followings are pasted from "dev-dependencies" for "test_helper" feature,
# that enables "test_helper" submodule in a release build. This is done for
# doctest where "cargo test --doc" build the crate to be tested with a normal
# config flags. There must be a better way to avoid this issue.
claxon = { version = "0.4.3", optional = true }
once_cell = { version = "1.10.0", optional = true }
rand = { version = "0.8.5", optional = true }
tempfile = { version = "3", optional = true }

[dev-dependencies]
bitvec = "1.0.0"
claxon = "0.4.3"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ std::fs::write("/dev/null", sink.as_byte_slice());

// or you can only get a specific frame.
let mut sink = flacenc::bitsink::ByteSink::new();
flac_stream.frame(0).write(&mut sink);
flac_stream.frame(0).unwrap().write(&mut sink);
```

`samples` here is an interleaved sequence, e.g. in the caes with stereo inputs,
Expand Down
4 changes: 2 additions & 2 deletions codehealth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -e
rustup default nightly
cargo rustc --release -- -D warnings
cargo build --release
cargo test
cargo test --features test_helper,experimental,par
cargo fmt --check
cargo clippy --tests -- -D warnings
cargo doc
Expand All @@ -33,5 +33,5 @@ rustup default stable
cargo rustc --release --features "fakesimd" -- -D warnings
cargo build --release --features "fakesimd"
cargo clippy --tests --features "fakesimd"
cargo test --features "fakesimd"
cargo test --features "fakesimd,test_helper,experimental,par"
rustup default nightly
10 changes: 5 additions & 5 deletions src/coding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,10 @@ impl StereoCodingHelper {
);

let (bits_l, bits_r, bits_m, bits_s) = (
indep.subframe(0).count_bits(),
indep.subframe(1).count_bits(),
ms_frame.subframe(0).count_bits(),
ms_frame.subframe(1).count_bits(),
indep.subframe(0).unwrap().count_bits(),
indep.subframe(1).unwrap().count_bits(),
ms_frame.subframe(0).unwrap().count_bits(),
ms_frame.subframe(1).unwrap().count_bits(),
);

let combinations = [
Expand Down Expand Up @@ -550,7 +550,7 @@ pub fn encode_fixed_size_frame(
// A bit awkward, but this function is implemented by overwriting relevant
// fields of `Frame` generated by `encode_frame`.
let mut ret = encode_frame(config, framebuf, 0, stream_info);
ret.header_mut().enter_fixed_size_mode(frame_number as u32);
ret.header_mut().set_frame_number(frame_number as u32);
ret
}

Expand Down
Loading

0 comments on commit a812b9d

Please sign in to comment.