Skip to content

Commit

Permalink
fixup! refactor and impl mjpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
payload committed Aug 19, 2023
1 parent 6c356b2 commit 2cc5d7a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/linux_v4l2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl InnerCamera for Camera {
let data = match &format.fourcc.repr {
b"RGB3" => buf.to_vec(),
b"YUYV" => yuyv_to_rgb32(buf, size.0, size.1),
b"MJPG" => mjpeg_to_rgb32(buf, size.0, size.1),
b"MJPG" => mjpeg_to_rgb32(buf),
_ => panic!("invalid buffer pixelformat"),
};

Expand Down Expand Up @@ -210,7 +210,7 @@ fn yuyv_to_rgb32(buf: &[u8], w: u32, h: u32) -> Vec<u8> {
rgba.into_buf()
}

fn mjpeg_to_rgb32(buf: &[u8], w: u32, h: u32) -> Vec<u8> {
fn mjpeg_to_rgb32(buf: &[u8]) -> Vec<u8> {
let jpeg = mozjpeg::Decompress::new_mem(buf).unwrap();
let mut decompress = jpeg.rgba().unwrap();
decompress.read_scanlines_flat().unwrap()
Expand Down

0 comments on commit 2cc5d7a

Please sign in to comment.