mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-03 16:01:28 +03:00
linux x11 rgb565 capture (#8580)
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -59,6 +59,7 @@ pub enum ImageFormat {
|
||||
ABGR,
|
||||
ARGB,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct ImageRgb {
|
||||
pub raw: Vec<u8>,
|
||||
@@ -208,11 +209,27 @@ impl<'a> EncodeInput<'a> {
|
||||
pub enum Pixfmt {
|
||||
BGRA,
|
||||
RGBA,
|
||||
RGB565LE,
|
||||
I420,
|
||||
NV12,
|
||||
I444,
|
||||
}
|
||||
|
||||
impl Pixfmt {
|
||||
pub fn bpp(&self) -> usize {
|
||||
match self {
|
||||
Pixfmt::BGRA | Pixfmt::RGBA => 32,
|
||||
Pixfmt::RGB565LE => 16,
|
||||
Pixfmt::I420 | Pixfmt::NV12 => 12,
|
||||
Pixfmt::I444 => 24,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bytes_per_pixel(&self) -> usize {
|
||||
(self.bpp() + 7) / 8
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EncodeYuvFormat {
|
||||
pub pixfmt: Pixfmt,
|
||||
|
||||
Reference in New Issue
Block a user