1mod image;
7mod video;
8mod wxgf;
9
10pub use image::ImageInspection;
11pub use video::inspect_video_container;
12pub use wxgf::wxgf_preview;
13
14pub const MAX_IMAGE_BYTES: usize = 16 * 1024 * 1024;
15pub const MAX_FILE_BYTES: usize = 512 * 1024 * 1024;
17pub const MAX_VIDEO_SOURCE_BYTES: usize = 50 * 1024 * 1024;
19
20#[derive(Debug)]
21pub struct DecodedImage {
22 pub bytes: Vec<u8>,
23 pub inspection: ImageInspection,
24}
25
26pub fn inspect_image(bytes: &[u8]) -> anyhow::Result<ImageInspection> {
29 if bytes.starts_with(b"wxgf") {
30 let mut inspection = wxgf_preview(bytes)?.inspection;
31 inspection.content_type = "image/x-wxgf".into();
32 inspection.animation_preserved = false;
33 return Ok(inspection);
34 }
35 image::inspect_standard_image(bytes)
36}