xref: /aosp_15_r20/external/virtio-media/device/src/devices.rs (revision 1b4853f54772485c5dd4001ae33a7a958bcc97a1)
1*1b4853f5SAndroid Build Coastguard Worker // Copyright 2024 The ChromiumOS Authors
2*1b4853f5SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*1b4853f5SAndroid Build Coastguard Worker // found in the LICENSE file.
4*1b4853f5SAndroid Build Coastguard Worker 
5*1b4853f5SAndroid Build Coastguard Worker //! Virtio-media host devices.
6*1b4853f5SAndroid Build Coastguard Worker //!
7*1b4853f5SAndroid Build Coastguard Worker //! This module contains some host-side devices implementations that any VMM can use as long as it
8*1b4853f5SAndroid Build Coastguard Worker //! provides implementations of the required traits.
9*1b4853f5SAndroid Build Coastguard Worker //!
10*1b4853f5SAndroid Build Coastguard Worker //! The conditions for using these devices are as follows:
11*1b4853f5SAndroid Build Coastguard Worker //!
12*1b4853f5SAndroid Build Coastguard Worker //! * [`std::io::Read`] and [`std::io::Write`] implementations for the device-readable and
13*1b4853f5SAndroid Build Coastguard Worker //!   device-writable sections of the descriptor chain,
14*1b4853f5SAndroid Build Coastguard Worker //! * An implementation of [`crate::VirtioMediaEventQueue`], so devices can send events to the guest,
15*1b4853f5SAndroid Build Coastguard Worker //! * For devices that need to access guest memory linearly, an implementation of
16*1b4853f5SAndroid Build Coastguard Worker //!   [`crate::VirtioMediaGuestMemoryMapper`].
17*1b4853f5SAndroid Build Coastguard Worker //! * For devices that need to map host memory into the guest, an implementation of
18*1b4853f5SAndroid Build Coastguard Worker //!   [`crate::VirtioMediaHostMemoryMapper`].
19*1b4853f5SAndroid Build Coastguard Worker //!
20*1b4853f5SAndroid Build Coastguard Worker //! [simple_device] implements a simple capture device that generates frames in software. It can be
21*1b4853f5SAndroid Build Coastguard Worker //! used as a reference for how to write devices, or as a way to test the guest without any
22*1b4853f5SAndroid Build Coastguard Worker //! specific hardware on the host.
23*1b4853f5SAndroid Build Coastguard Worker //!
24*1b4853f5SAndroid Build Coastguard Worker //! [v4l2_device_proxy] proxies any host V4L2 device to the guest, making its functionality
25*1b4853f5SAndroid Build Coastguard Worker //! available to the guest with minimal overhead.
26*1b4853f5SAndroid Build Coastguard Worker 
27*1b4853f5SAndroid Build Coastguard Worker #[cfg(feature = "simple-device")]
28*1b4853f5SAndroid Build Coastguard Worker pub mod simple_device;
29*1b4853f5SAndroid Build Coastguard Worker #[cfg(feature = "simple-device")]
30*1b4853f5SAndroid Build Coastguard Worker pub use simple_device::SimpleCaptureDevice;
31*1b4853f5SAndroid Build Coastguard Worker 
32*1b4853f5SAndroid Build Coastguard Worker pub mod v4l2_device_proxy;
33*1b4853f5SAndroid Build Coastguard Worker pub use v4l2_device_proxy::V4l2ProxyDevice;
34*1b4853f5SAndroid Build Coastguard Worker 
35*1b4853f5SAndroid Build Coastguard Worker pub mod video_decoder;
36