Skip to main content

rave_nvcodec/
config.rs

1//! Shared encoder configuration types used by both the real and stub NVENC backends.
2
3/// Encoder configuration parameters.
4///
5/// Passed to [`NvEncoder::new`](crate::nvenc::NvEncoder::new) to configure the
6/// NVENC session before the first frame is encoded.
7#[derive(Clone, Debug)]
8pub struct NvEncConfig {
9    /// Target frame width in pixels.
10    pub width: u32,
11    /// Target frame height in pixels.
12    pub height: u32,
13    /// Framerate numerator.
14    pub fps_num: u32,
15    /// Framerate denominator.
16    pub fps_den: u32,
17    /// Average bitrate in bits/sec (`0` = CQP mode).
18    pub bitrate: u32,
19    /// Peak bitrate in bits/sec (VBR mode; `0` = unconstrained).
20    pub max_bitrate: u32,
21    /// GOP length — number of frames between IDR pictures.
22    pub gop_length: u32,
23    /// B-frame interval (`0` = no B-frames).
24    pub b_frames: u32,
25    /// NV12 row pitch in bytes. Must match the pitch of incoming
26    /// [`GpuTexture`](rave_core::types::GpuTexture) frames exactly.
27    pub nv12_pitch: u32,
28}