1
2extern crate mpegts;
3
4use std::io::BufReader;
5use std::fs::File;
6use std::process;
7use std::env;
8
9use mpegts::parser::packet::parse_next_packets;
10
11fn main() {
12
13 if env::args().count() != 2 {
14 println!("ERROR: missing filepath argument.");
15 println!("usage:");
16 println!(" dump [filepath.ts]");
17 process::exit(0x0f00);
18 }
19
20 let path = env::args().last().unwrap();
21
22 let file = File::open(path).unwrap();
23 let mut stream = BufReader::new(file);
24
25 loop {
26 let packets = parse_next_packets(&mut stream).unwrap();
27
28 for packet in packets {
29 println!("{:?}", packet);
31 }
32 }
33}