Skip to main content

probe_format

Function probe_format 

Source
pub fn probe_format(data: &[u8]) -> Result<ProbeResult, OxiError>
Expand description

Container layer: probing, demuxing, packets, stream descriptors. Probe the container format from raw bytes.

Analyzes the first few bytes of media data to detect the container format. Returns the detected format and a confidence score.

§Arguments

  • data - At least the first 12 bytes of the file (more bytes improve detection)

§Errors

Returns OxiError::UnknownFormat if the format cannot be detected.

§Example

use oximedia_container::{probe_format, ContainerFormat};

// WebM/Matroska header
let data = [0x1A, 0x45, 0xDF, 0xA3, 0x01, 0x00, 0x00, 0x00];
let result = probe_format(&data).expect("valid header");
assert_eq!(result.format, ContainerFormat::Matroska);