Crates.io | media_infer |
lib.rs | media_infer |
version | 1.0.1 |
source | src |
created_at | 2021-05-29 20:23:42.608148 |
updated_at | 2021-05-29 21:33:12.030324 |
description | Small Crate to infer various media containers. Works by reading Magic Bytes. |
homepage | |
repository | https://github.com/Ayush1325/media_infer |
max_upload_size | |
id | 403630 |
size | 19,710 |
Small Crate to infer various media containers. Works by reading Magic 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));
#+end_src
** Get Container type from path to file
#+begin_src rust
use std::path::PathBuf;
let file_path = PathBuf::from("some.abc");
let kind = media_infer::ContainerType::from_file_path(&file_path);
use std::fs::File;
let mut file = File::open("some.abc").unwrap();
let kind = media_infer::ContainerType::from_file(&mut file);