Skip to main content

mjpeg_to_rgb

Function mjpeg_to_rgb 

Source
pub fn mjpeg_to_rgb(data: &[u8], rgba: bool) -> Result<Vec<u8>, NokhwaError>
Expand description

Converts a MJPEG stream of &[u8] into a Vec<u8> of RGB888. (R,G,B,R,G,B,…)

§Errors

If mozjpeg fails to read scanlines or setup the decompressor, this will error.

§Safety

This function uses unsafe. The caller must ensure that:

  • The input data is of the right size, does not exceed bounds, and/or the final size matches with the initial size.