Crate media_infer[][src]

Expand description

Small Crate to infer various media containers by magic bytes. More about Magic bytes can be found here:


Get Container type from starting bytes

let buf = [0x1a, 0x45, 0xdf, 0xa3, 0, 1];
let kind = media_infer::ContainerType::from_bytes(&buf);

assert_eq!(kind, Ok(media_infer::ContainerType::MKV));

Get Container type from path to file

use std::path::PathBuf;

let file_path = PathBuf::from("");
let kind = media_infer::ContainerType::from_file_path(&file_path);

Get Container type from open file

use std::fs::File;

let mut file = File::open("").unwrap();
let kind = media_infer::ContainerType::from_file(&mut file);



Enum of the vairous Container Types. Does not contain Unknown. Methods throw error if container cannot be identified.