devices/virtio/video/
event.rs1use std::io;
8
9use data_model::Le32;
10use enumn::N;
11
12use crate::virtio::video::protocol::*;
13use crate::virtio::video::response::Response;
14use crate::virtio::Writer;
15
16#[derive(Debug, Copy, Clone, N)]
17pub enum EvtType {
18 Error = VIRTIO_VIDEO_EVENT_ERROR as isize,
19 #[cfg(feature = "video-decoder")]
20 DecResChanged = VIRTIO_VIDEO_EVENT_DECODER_RESOLUTION_CHANGED as isize,
21}
22
23#[derive(Debug, Clone)]
24pub struct VideoEvt {
25 pub typ: EvtType,
26 pub stream_id: u32,
27}
28
29impl Response for VideoEvt {
30 fn write(&self, w: &mut Writer) -> Result<(), io::Error> {
31 w.write_obj(virtio_video_event {
32 event_type: Le32::from(self.typ as u32),
33 stream_id: Le32::from(self.stream_id),
34 })
35 }
36}