dump_frames/
dump_frames.rs1use oxideav_h265::sequence::SequenceDecoder;
3use oxideav_h265::NalIter;
4
5fn main() {
6 let path = std::env::args().nth(1).unwrap();
7 let data = std::fs::read(path).unwrap();
8 let mut dec = SequenceDecoder::new();
9 let mut n = 0;
10 for unit in NalIter::new(&data) {
11 let unit = unit.unwrap();
12 let t = unit.header.nal_unit_type;
13 let first = t < 32 && unit.rbsp.first().is_some_and(|b| b & 0x80 != 0);
14 if first {
15 n += 1;
16 }
17 if let Err(e) = dec.push_nal_unit(unit) {
18 eprintln!("error while pushing NAL type {t} (picture #{n}): {e}");
19 return;
20 }
21 }
22 match dec.finish() {
23 Ok(frames) => {
24 for f in &frames {
25 eprintln!("cvs={} poc={} out={}", f.cvs_index, f.poc, f.output);
26 }
27 }
28 Err(e) => eprintln!("finish error: {e}"),
29 }
30}