makepad_platform/event/
video_decoding.rs1use makepad_shader_compiler::makepad_live_tokenizer::LiveId;
2
3#[derive(Clone, Debug)]
4pub struct VideoStreamEvent {
5 pub video_id: LiveId,
6 pub frame_group: Vec<u8>,
7}
8
9#[derive(Clone, Debug)]
10pub struct VideoDecodingInitializedEvent {
11 pub video_id: LiveId,
12 pub frame_rate: usize,
13 pub video_width: u32,
14 pub video_height: u32,
15 pub color_format: VideoColorFormat,
16 pub duration: u128,
17}
18
19#[derive(Clone, Debug)]
20pub struct VideoDecodingErrorEvent {
21 pub video_id: LiveId,
22 pub error: String,
23}
24
25#[derive(Default, Clone, Copy, Debug)]
26pub enum VideoColorFormat {
27 YUV420Planar,
28 YUV420SemiPlanar,
29 YUV420Flexible,
30 #[default]
31 Unknown,
32}
33
34impl VideoColorFormat {
35 pub fn from_str(s: &str) -> Self {
36 match s {
37 "YUV420Flexible" => VideoColorFormat::YUV420Flexible,
38 "YUV420Planar" => VideoColorFormat::YUV420Planar,
39 "YUV420SemiPlanar" => VideoColorFormat::YUV420SemiPlanar,
40 _ => VideoColorFormat::Unknown,
41 }
42 }
43}