aboutsummaryrefslogtreecommitdiff
path: root/matroska/src/bin/experiment.rs
blob: 4a8c42058ea7312568a7d5e6c80ef4f37eb646b6 (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
25
26
27
28
29
30
31
32
33
/*
    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) 2023 metamuffin <metamuffin.org>
*/
use jellymatroska::{
    matroska::MatroskaTag, read::EbmlReader, unflatten::IterWithPos, write::EbmlWriter,
};
use std::{
    fs::File,
    io::{stdout, BufReader, BufWriter},
};

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()));
    let mut w = EbmlWriter::new(BufWriter::new(stdout()), 0);

    // r.seek(
    //     631147167 + 52,
    //     ebml::matroska::MatroskaTag::Cues(Master::Start),
    // )
    // .unwrap();

    while let Some(tag) = r.next() {
        let tag = tag.unwrap();
        if MatroskaTag::is_master(tag.id()).unwrap() {
            eprintln!("{tag:?}");
        }
        w.write_tag(&tag).unwrap();
    }
}