aboutsummaryrefslogtreecommitdiff
path: root/matroska/src/bin/mkvdump.rs
blob: 27b48498b1d7e2a153443f8a8c5a3b981d140c70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
    This file is part of jellything (https://codeberg.org/metamuffin/jellything)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2024 metamuffin <metamuffin.org>
*/
use jellymatroska::{block::Block, matroska::MatroskaTag, read::EbmlReader};
use std::{fs::File, io::BufReader};

fn main() {
    env_logger::init_from_env("LOG");
    let path = std::env::args().nth(1).unwrap();
    let mut r = EbmlReader::new(BufReader::new(File::open(path).unwrap()));

    while let Some(tag) = r.next() {
        let (position, tag) = tag.unwrap();
        match tag {
            MatroskaTag::SimpleBlock(b) | MatroskaTag::Block(b) => {
                let b = Block::parse(&b).unwrap();
                println!("block kf={} ts_off={}", b.keyframe, b.timestamp_off)
            }
            _ => println!("{} {tag:?}", position.unwrap_or(0)),
        }
    }
}