corevm_host/
video.rs

1use codec::{ConstEncodedLen, Decode, Encode, MaxEncodedLen};
2
3#[derive(Encode, Decode, MaxEncodedLen, Debug)]
4pub struct VideoMode {
5	pub mode: u32,
6	pub width: u32,
7	pub height: u32,
8	pub refresh_rate: u16,
9}
10
11impl VideoMode {
12	/// Get frame length in bytes.
13	pub const fn frame_len(&self) -> u32 {
14		match self.mode {
15			0 => 0,
16			1 => self.width * self.height + 256 * 3,
17			_ => 0,
18		}
19	}
20
21	/// No video output.
22	pub const fn no_video_output() -> Self {
23		Self { mode: 0, refresh_rate: 0, width: 0, height: 0 }
24	}
25}
26
27impl ConstEncodedLen for VideoMode {}