Skip to content

Commit

Permalink
Add Raspberry Pi compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Zhiming Wang <i@zhimingwang.org>
  • Loading branch information
tim-hellhake authored and zmwangx committed Jul 24, 2020
1 parent d4c6445 commit 65be233
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ postprocessing = ["ffmpeg-sys-next/postproc"]
software-resampling = ["ffmpeg-sys-next/swresample"]
software-scaling = ["ffmpeg-sys-next/swscale", "codec"]

# platforms
rpi = []

[dependencies]
libc = "0.2"
bitflags = "1.2"
Expand Down
38 changes: 38 additions & 0 deletions src/util/format/pixel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,18 @@ pub enum Pixel {
Y210BE,
#[cfg(feature = "ffmpeg43")]
Y210LE,
#[cfg(feature = "rpi")]
RPI,
#[cfg(feature = "rpi")]
SAND128,
#[cfg(feature = "rpi")]
SAND64_10,
#[cfg(feature = "rpi")]
SAND64_16,
#[cfg(feature = "rpi")]
RPI4_8,
#[cfg(feature = "rpi")]
RPI4_10,
}

#[derive(Clone, Copy, PartialEq, Eq)]
Expand Down Expand Up @@ -662,6 +674,19 @@ impl From<AVPixelFormat> for Pixel {
AV_PIX_FMT_Y210BE => Pixel::Y210BE,
#[cfg(feature = "ffmpeg43")]
AV_PIX_FMT_Y210LE => Pixel::Y210LE,

#[cfg(feature = "rpi")]
AV_PIX_FMT_RPI => Pixel::RPI,
#[cfg(feature = "rpi")]
AV_PIX_FMT_SAND128 => Pixel::SAND128,
#[cfg(feature = "rpi")]
AV_PIX_FMT_SAND64_10 => Pixel::SAND64_10,
#[cfg(feature = "rpi")]
AV_PIX_FMT_SAND64_16 => Pixel::SAND64_16,
#[cfg(feature = "rpi")]
AV_PIX_FMT_RPI4_8 => Pixel::RPI4_8,
#[cfg(feature = "rpi")]
AV_PIX_FMT_RPI4_10 => Pixel::RPI4_10,
}
}
}
Expand Down Expand Up @@ -1003,6 +1028,19 @@ impl Into<AVPixelFormat> for Pixel {
Pixel::Y210BE => AV_PIX_FMT_Y210BE,
#[cfg(feature = "ffmpeg43")]
Pixel::Y210LE => AV_PIX_FMT_Y210LE,

#[cfg(feature = "rpi")]
Pixel::RPI => AV_PIX_FMT_RPI,
#[cfg(feature = "rpi")]
Pixel::SAND128 => AV_PIX_FMT_SAND128,
#[cfg(feature = "rpi")]
Pixel::SAND64_10 => AV_PIX_FMT_SAND64_10,
#[cfg(feature = "rpi")]
Pixel::SAND64_16 => AV_PIX_FMT_SAND64_16,
#[cfg(feature = "rpi")]
Pixel::RPI4_8 => AV_PIX_FMT_RPI4_8,
#[cfg(feature = "rpi")]
Pixel::RPI4_10 => AV_PIX_FMT_RPI4_10,
}
}
}
Expand Down

0 comments on commit 65be233

Please sign in to comment.