use rsmp4decrypt::Mp4Decryptor;
use std::io::{self, Write};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let decryptor = Mp4Decryptor::builder()
.track_key(1, "100b6c20940f779a4589152b57d2dacb")?
.build()?;
let mut progress = |step: u32, total: u32| {
print!("\r{step}/{total}");
let _ = io::stdout().flush();
};
decryptor.decrypt_file_with_progress(
"encrypted-track.mp4",
"clear-track.mp4",
None::<&str>,
&mut progress,
)?;
println!();
Ok(())
}