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