Skip to content

redwheelbarrow/rebml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rebml

A library to support writing and reading EBML files in dynamic environments.

Goals

  1. Read and write simultaneously using the same in memory data structure
  2. Leave file/IO management to the client code
  3. Minimal memory footprint
  4. Leave schema adherence to higher level libraries
  5. Enable low level control of bytes

Read Example

fn main() -> Result<(), EbmlError> {
  let file = File::open("test.mkv").unwrap();
  let data = unsafe { Mmap::map(&file).unwrap() };
  let mut cursor = Cursor::new(&data[..]);

  let header = EbmlHeader::try_from(&mut cursor)?;
  println!("{header:#?}");
  
  let body = EbmlElement::try_from(&mut cursor)?;
  println!("{:X}, {}", body.id, body.size.value);
  match body.id {
    0x18538067 => {
      println!("This is a matroska segment");
      let data = body.get_child(&mut cursor)?;
      println!("First child: {:X}", data.id);
    },
    _ => println!("{:X}", body.id),
  }
}

About

Rust EBML

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages