2022-05-23 00:37:03 +00:00
|
|
|
use clap::Args;
|
2018-04-12 01:54:02 +00:00
|
|
|
|
2018-04-14 22:18:50 +00:00
|
|
|
use super::stdin_stream;
|
2018-04-12 01:54:02 +00:00
|
|
|
use webmetro::{
|
2018-04-15 02:34:46 +00:00
|
|
|
error::WebmetroError,
|
2018-04-12 01:54:02 +00:00
|
|
|
stream_parser::StreamEbml,
|
2022-05-23 00:37:03 +00:00
|
|
|
webm::{SimpleBlock, WebmElement::*},
|
2018-04-12 01:54:02 +00:00
|
|
|
};
|
|
|
|
|
2022-05-23 00:37:03 +00:00
|
|
|
/// Dumps WebM parsing events from parsing stdin
|
|
|
|
#[derive(Args, Debug)]
|
|
|
|
pub struct DumpArgs;
|
2018-04-12 01:54:02 +00:00
|
|
|
|
2020-05-08 03:14:43 +00:00
|
|
|
#[tokio::main]
|
2022-05-23 00:37:03 +00:00
|
|
|
pub async fn run(_args: DumpArgs) -> Result<(), WebmetroError> {
|
2018-04-14 22:18:50 +00:00
|
|
|
let mut events = stdin_stream().parse_ebml();
|
2018-04-12 01:54:02 +00:00
|
|
|
|
2020-05-08 03:14:43 +00:00
|
|
|
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),
|
2018-04-12 01:54:02 +00:00
|
|
|
}
|
2020-05-08 03:14:43 +00:00
|
|
|
}
|
|
|
|
Ok(())
|
2018-04-12 01:54:02 +00:00
|
|
|
}
|