Add block info.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
0acca198be
commit
02bc9cff60
|
@ -4,9 +4,9 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e579a7752471abc2a8268df8b20005e3eadd975f585398f17efcfd8d4927371"
|
||||
checksum = "6342bd4f5a1205d7f41e94a41a901f5647c938cdfa96036338e8533c9d6c2450"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
|
@ -43,9 +43,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4bcd8291a340dd8ac70e18878bc4501dd7b4ff970cfa21c207d36ece51ea88fd"
|
||||
checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys",
|
||||
|
@ -65,18 +65,18 @@ checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
|
|||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.2.4"
|
||||
version = "4.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "956ac1f6381d8d82ab4684768f89c0ea3afe66925ceadb4eeb3fc452ffc55d62"
|
||||
checksum = "8a1f23fa97e1d1641371b51f35535cb26959b8e27ab50d167a8b996b5bada819"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.2.4"
|
||||
version = "4.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84080e799e54cff944f4b4a4b0e71630b0e0443b25b985175c7dddc1a859b749"
|
||||
checksum = "0fdc5d93c358224b4d6867ef1356d740de2303e9892edc06c5340daeccd96bab"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
|
@ -156,9 +156,9 @@ checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317"
|
|||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.3.4"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36eb31c1778188ae1e64398743890d0877fef36d11521ac60406b42016e8c2cf"
|
||||
checksum = "b64f40e5e03e0d54f03845c8197d0291253cdbedfb1cb46b13c2c117554a9f4c"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
|
@ -190,9 +190,9 @@ checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
|
|||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.37.14"
|
||||
version = "0.37.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b864d3c18a5785a05953adeed93e2dca37ed30f18e69bba9f30079d51f363f"
|
||||
checksum = "8bbfc1d1c7c40c01715f47d71444744a81669ca84e8b63e25a55e169b1f86433"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
|
@ -217,7 +217,7 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
|||
[[package]]
|
||||
name = "vocnom"
|
||||
version = "0.1.0"
|
||||
source = "git+https://git.deadbsd.org/falso/vocnom.git#4b0e58bb2c5d0465b78f80653edbe5b194d59d22"
|
||||
source = "git+https://git.deadbsd.org/falso/vocnom.git#f596a68e27a544711f146fe7a2d0abbfde690181"
|
||||
dependencies = [
|
||||
"nom",
|
||||
]
|
||||
|
|
64
src/main.rs
64
src/main.rs
|
@ -1,5 +1,6 @@
|
|||
use std::fs;
|
||||
use vocnom::reader::parse_voc;
|
||||
use vocnom::types::BlockType;
|
||||
|
||||
fn main() {
|
||||
let cmd = clap::Command::new(env!("CARGO_CRATE_NAME"))
|
||||
|
@ -39,11 +40,70 @@ fn main() {
|
|||
"Version {}.{} - Checksum: {}",
|
||||
voc.version.major,
|
||||
voc.version.minor,
|
||||
if voc.checksum.valid { "Valid!" } else { "Invalid!" }
|
||||
if voc.checksum.valid {
|
||||
"Valid!"
|
||||
} else {
|
||||
"Invalid!"
|
||||
}
|
||||
);
|
||||
for (n, block) in voc.blocks.into_iter().enumerate() {
|
||||
print!("Block #{} - ", n);
|
||||
block.info();
|
||||
match block {
|
||||
BlockType::Terminator => println!("Terminator"),
|
||||
BlockType::SoundData {
|
||||
sample_rate,
|
||||
codec,
|
||||
data,
|
||||
} => {
|
||||
println!(
|
||||
"Sound data: sample rate = {}, codec = {:?}, size = {}",
|
||||
sample_rate,
|
||||
codec,
|
||||
data.len()
|
||||
)
|
||||
}
|
||||
BlockType::SoundDataContinuation { data } => {
|
||||
println!("Sound data continuation: size = {}", data.len())
|
||||
}
|
||||
BlockType::Silence {
|
||||
length,
|
||||
sample_rate,
|
||||
} => {
|
||||
println!(
|
||||
"Silence: length = {}, sample rate = {}",
|
||||
length, sample_rate
|
||||
)
|
||||
}
|
||||
BlockType::Marker { value } => {
|
||||
println!("Marker: value = {}", value)
|
||||
}
|
||||
BlockType::Text { data } => {
|
||||
println!("Text: size = {}", data.len())
|
||||
}
|
||||
BlockType::RepeatStart { count } => {
|
||||
println!("Repeat: repetitions = {}", count)
|
||||
}
|
||||
BlockType::RepeatEnd => {
|
||||
println!("End repeat")
|
||||
}
|
||||
BlockType::ExtraInformation { sample_rate, codec, channels } => println!(
|
||||
"Extra information: sample rate = {}, channels = {}, codec = {:?}",
|
||||
sample_rate,
|
||||
channels,
|
||||
codec,
|
||||
),
|
||||
BlockType::SoundDataNew {
|
||||
sample_rate, bits, channels, codec, reserved, data
|
||||
} => println!(
|
||||
"Sound data (NEW): sample rate = {}, bits = {}, channels = {}, codec = {:?}, reserved: {}, size = {}",
|
||||
sample_rate,
|
||||
bits,
|
||||
channels,
|
||||
codec,
|
||||
reserved,
|
||||
data.len()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(("extract", _arguments)) => {
|
||||
|
|
Loading…
Reference in New Issue