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
59
60
61
62
63
use ;
/// What a CUDA surface on this crate's path actually holds — the
/// `sw_format` half of a hardware frame, as opposed to
/// [`ffmpeg::format::Pixel::CUDA`], which only says the pixels live in CUDA
/// memory at all.
///
/// Every CUDA element has to agree on this: [`crate::elements::CudaUpload`]
/// allocates surfaces in it, [`crate::elements::CudaEncoder`] configures
/// NVENC for it, and [`crate::elements::CudaScaler`] and
/// [`crate::elements::CudaDownload`] refuse a frame that carries something
/// else rather than reading it as if it were this.
///
/// # Why exactly these two
///
/// `Nv12` is what NVDEC produces and what
/// [`crate::elements::CudaRenderer`] presents. `Bgra` is what every screen
/// capture in this crate emits
/// ([`crate::elements::PipeWireScreenCaptureSource`],
/// [`crate::elements::DxgiCaptureSource`]), and NVENC ingests it directly,
/// converting to YUV in hardware — so a capture-to-recording pipeline never
/// needs a colorspace conversion at all. That matters because the one thing
/// the GPU path *cannot* do is convert between them:
/// [`crate::elements::CudaScaler`]'s `scale_cuda` has no RGB-to-YUV kernel.
/// Pick the format the source already produces and keep it to the encoder.