8#include <ffnvcodec/nvEncodeAPI.h>
122 NV_ENC_BUFFER_FORMAT buffer_format = NV_ENC_BUFFER_FORMAT_UNDEFINED;
123 uint32_t ref_frames_in_dpb = 0;
132 std::shared_ptr<NV_ENCODE_API_FUNCTION_LIST>
nvenc;
140 NV_ENC_OUTPUT_PTR output_bitstream =
nullptr;
143 uint64_t last_encoded_frame_index = 0;
144 bool rfi_needs_confirmation =
false;
145 std::pair<uint64_t, uint64_t> last_rfi_range;
A helper class for tracking and logging numerical values across a period of time.
Definition logging.h:114
Abstract platform-agnostic base of standalone NVENC encoder. Derived classes perform platform-specifi...
Definition nvenc_base.h:26
std::string last_nvenc_error_string
Last NVENC error string.
Definition nvenc_base.h:127
struct nvenc::nvenc_base::@8 encoder_params
Current encoder dimensions, pixel format, and reference-frame settings.
bool invalidate_ref_frames(uint64_t first_frame, uint64_t last_frame)
Perform reference frame invalidation (RFI) procedure.
Definition nvenc_base.cpp:622
nvenc_encoded_frame encode_frame(uint64_t frame_index, bool force_idr)
Encode the next frame using platform-specific input surface.
Definition nvenc_base.cpp:538
const NV_ENC_DEVICE_TYPE device_type
NVENC device backend used by this encoder instance.
Definition nvenc_base.h:115
NV_ENC_REGISTERED_PTR registered_input_buffer
Definition nvenc_base.h:134
bool nvenc_failed(NVENCSTATUS status)
Check whether an NVENC API status represents failure.
Definition nvenc_base.cpp:659
bool create_encoder(const nvenc_config &config, const video::config_t &client_config, const nvenc_colorspace_t &colorspace, NV_ENC_BUFFER_FORMAT buffer_format)
Create the encoder.
Definition nvenc_base.cpp:104
virtual bool create_and_register_input_buffer()=0
Required. Used for creating outside-facing input surface, registering this surface with nvenc->nvEncR...
std::shared_ptr< NV_ENCODE_API_FUNCTION_LIST > nvenc
Definition nvenc_base.h:132
void * encoder
Opaque NVENC encoder session handle returned by the driver.
Definition nvenc_base.h:117
virtual bool wait_for_async_event(uint32_t timeout_ms)
Optional. Override if you want to create encoder in async mode. In this case must also set async_even...
Definition nvenc_base.h:103
void * async_event_handle
Definition nvenc_base.h:136
void destroy_encoder()
Destroy the encoder. Derived classes classes call it in the destructor.
Definition nvenc_base.cpp:507
void * device
Definition nvenc_base.h:130
virtual bool init_library()=0
Required. Used for loading NvEnc library and setting nvenc variable with NvEncodeAPICreateInstance()....
nvenc_base(NV_ENC_DEVICE_TYPE device_type)
Definition nvenc_base.cpp:96
virtual bool synchronize_input_buffer()
Optional. Override if you must perform additional operations on the registered input surface in the b...
Definition nvenc_base.h:93
bl::sources::severity_logger< int > debug
Follow what is happening.
Definition logging.cpp:41
Declarations for logging related functions.
Standalone NVENC encoder.
Definition nvenc_base.cpp:94
Declarations for NVENC YUV colorspace.
Declarations for NVENC encoder configuration.
Declarations for NVENC encoded frame.
YUV colorspace and color range.
Definition nvenc_colorspace.h:15
NVENC encoder configuration.
Definition nvenc_config.h:30
Encoded NVENC output frame and metadata needed by the packetizer.
Definition nvenc_encoded_frame.h:16
Encoding configuration requested by a remote client.
Definition video.h:28