1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! This library contains a safe FFI for [NVFBC](https://developer.nvidia.com/capture-sdk) from NVIDIA.
//!
//! # Supported GPUs
//! As this uses a proprietary NVIDIA API, the supported devices are limited to NVIDIA GPUs.
//! Officially the NVFBC API is only supported on GRID, Tesla, or Quadro X2000+ GPUs.
//! Unofficial support is provided for GeForce GPUs by setting magic private data,
//! similar to https://github.com/keylase/nvidia-patch/blob/master/win/nvfbcwrp/nvfbcwrp_main.cpp.
//!
//! # Supported capture types
//! Currently only CUDA and system (RAM) capture types are supported.
//!
//! # Example: Saving an image.
//! ```no_run
//! use nvfbc::{SystemCapturer, BufferFormat};
//! use nvfbc::system::CaptureMethod;
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let mut capturer = SystemCapturer::new()?;
//!
//! let status = capturer.status()?;
//! println!("{:#?}", capturer.status()?);
//! if !status.can_create_now {
//! panic!("Can't create a system capture session.");
//! }
//!
//! capturer.start(BufferFormat::Rgb, 30)?;
//!
//! let frame_info = capturer.next_frame(CaptureMethod::Blocking)?;
//! println!("{:#?}", frame_info);
//!
//! let image = image::ImageBuffer::<image::Rgb<u8>, &[u8]>::from_raw(
//! frame_info.width,
//! frame_info.height,
//! frame_info.buffer,
//! ).unwrap();
//! image.save("frame.png")?;
//! println!("Saved frame to 'frame.png'.");
//!
//! capturer.stop()?;
//!
//! Ok(())
//! }
//! ```
//!
//! # Future work
//! Support for configuration is currently limited, to keep the code simple and concise.
//! Future releases will add more configuration options.
pub use *;
pub use Error;
pub use CudaCapturer;
pub use SystemCapturer;