Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust-native audio transcoding #317

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: randomly generate ogg stream serial
  • Loading branch information
marceline-cramer committed Apr 17, 2023
commit 2145b176104723e190ae1f44c0a7cbb765874159
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ dyn-clonable = { workspace = true }
cargo_toml = { workspace = true }
symphonia = { workspace = true }
vorbis_rs = { workspace = true }
rand = { workspace = true }
3 changes: 2 additions & 1 deletion crates/build/src/pipelines/audio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,13 @@ where
let dec_opts = DecoderOptions::default();
let mut decoder = symphonia::default::get_codecs().make(&track.codec_params, &dec_opts).expect("unsupported codec");

let stream_serial: i32 = rand::random();
let sampling_rate = decoder.codec_params().sample_rate.unwrap();
let channels: u8 = decoder.codec_params().channels.unwrap().bits().try_into().unwrap();
let bitrate = VorbisBitrateManagementStrategy::QualityVbr { target_quality: 0.9 };

let mut encoder = VorbisEncoder::new(
0, // TODO randomly generate this
stream_serial,
[("", ""); 0], // no tags,
NonZeroU32::new(sampling_rate).unwrap(),
NonZeroU8::new(channels).unwrap(),
Expand Down