webmetro/src/commands/dump.rs

28 lines
743 B
Rust
Raw Permalink Normal View History

2022-05-23 00:37:03 +00:00
use clap::Args;
use super::stdin_stream;
use webmetro::{
error::WebmetroError,
stream_parser::StreamEbml,
2022-05-23 00:37:03 +00:00
webm::{SimpleBlock, WebmElement::*},
};
2022-05-23 00:37:03 +00:00
/// Dumps WebM parsing events from parsing stdin
#[derive(Args, Debug)]
pub struct DumpArgs;
#[tokio::main]
2022-05-23 00:37:03 +00:00
pub async fn run(_args: DumpArgs) -> Result<(), WebmetroError> {
let mut events = stdin_stream().parse_ebml();
while let Some(element) = events.next().await? {
match element {
// suppress printing byte arrays
Tracks(slice) => println!("Tracks[{}]", slice.len()),
2022-05-23 00:37:03 +00:00
SimpleBlock(SimpleBlock { timecode, .. }) => println!("SimpleBlock@{}", timecode),
other => println!("{:?}", other),
}
}
Ok(())
}