Documentation
¶
Overview ¶
Package nvenc drives NVIDIA's hardware encoder through nvEncodeAPI64.dll's function table, with no cgo and no NVIDIA SDK at build time.
Index ¶
- func Adapters() ([]gpu.Adapter, error)
- func MaxAPIVersion() (major, minor uint32, err error)
- func Probe(adapter gpu.Adapter) (encode.Caps, error)
- type Encoder
- func (e *Encoder) Caps() encode.Caps
- func (e *Encoder) Close() error
- func (e *Encoder) Encode(f capture.Frame, forceKey bool, dst []byte) (encode.Packet, error)
- func (e *Encoder) EncodeSlices(f capture.Frame, forceKey bool, dst []byte, emit func(int, []byte, bool) error) (encode.Packet, error)
- func (e *Encoder) FirstSlice() time.Duration
- func (e *Encoder) InvalidateRefs(pts int64) error
- func (e *Encoder) SetBitrate(kbps int) error
- type Error
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Adapters ¶
Adapters lists the CUDA devices NVENC can encode on. An adapter's LUID is its DRM render node's device number where the GPU has one, as pkg/gpu names Linux adapters; under WSL, where it has none, it is the CUDA ordinal plus one.
func MaxAPIVersion ¶
MaxAPIVersion reports the NVENC API version the installed driver supports.
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
func Open ¶
Open starts an encoder on adapter's CUDA device. Encode takes Linux frames (capture.DMABuf surfaces) with their planes in memory, or in a linear DMA-BUF it maps, and uploads each to the GPU.
func (*Encoder) EncodeSlices ¶
func (e *Encoder) EncodeSlices(f capture.Frame, forceKey bool, dst []byte, emit func(int, []byte, bool) error) (encode.Packet, error)
EncodeSlices emits slices as they finish when the encoder was opened with Config.SubFrame; otherwise it emits nothing and is Encode.
func (*Encoder) FirstSlice ¶
FirstSlice is how long after submission the first slice of the last sub-frame encode became readable, and Submitted is when Encode submitted it.
func (*Encoder) InvalidateRefs ¶
InvalidateRefs stops the encoder predicting from the picture with this PTS and later ones, so the next picture references an older one that the receiver still holds.