|
| Detail (uint32_t &bitRateKbps, apracucontext_sp &cuContext, uint32_t &gopLength, uint32_t &frameRate, H264EncoderNVCodecProps::H264CodecProfile profile, bool enableBFrames, uint32_t &bufferThres) |
|
bool | init (uint32_t width, uint32_t height, uint32_t pitch, ImageMetadata::ImageType imageType, std::function< frame_sp(size_t)> _makeFrame, std::function< void(frame_sp &, frame_sp &)> _send) |
|
bool | encode (frame_sp &frame) |
|
void | endEncode () |
|
bool | getSPSPPS (void *&buffer, size_t &size, int &width, int &height) |
|
| ~Detail () |
|
|
void | unload () |
|
void | createDefaultEncoderParams (NV_ENC_INITIALIZE_PARAMS *pIntializeParams) |
|
int | GetCapabilityValue (GUID guidCodec, NV_ENC_CAPS capsToQuery) |
|
void | initializeEncoder () |
|
NV_ENC_REGISTERED_PTR | RegisterResource (void *pBuffer, NV_ENC_INPUT_RESOURCE_TYPE eResourceType, int width, int height, int pitch, NV_ENC_BUFFER_FORMAT bufferFormat, NV_ENC_BUFFER_USAGE bufferUsage) |
|
void | processOutput () |
|
bool | is_not_empty () const |
| Checks if there are free output bitstreams available and allocates more if needed.
|
|
bool | is_output_available () const |
| Checks if there are any busy output bitstreams or if the encoder is not running.
|
|
void | doubleOutputBuffers (uint32_t bufferLength) const |
| Allocates additional output bitstream buffers.
|
|
◆ Detail()
H264EncoderNVCodecHelper::Detail::Detail |
( |
uint32_t & | bitRateKbps, |
|
|
apracucontext_sp & | cuContext, |
|
|
uint32_t & | gopLength, |
|
|
uint32_t & | frameRate, |
|
|
H264EncoderNVCodecProps::H264CodecProfile | profile, |
|
|
bool | enableBFrames, |
|
|
uint32_t & | bufferThres ) |
|
inline |
◆ ~Detail()
H264EncoderNVCodecHelper::Detail::~Detail |
( |
| ) |
|
|
inline |
◆ asNvidiaGUID()
◆ createDefaultEncoderParams()
void H264EncoderNVCodecHelper::Detail::createDefaultEncoderParams |
( |
NV_ENC_INITIALIZE_PARAMS * | pIntializeParams | ) |
|
|
inlineprivate |
◆ doubleOutputBuffers()
void H264EncoderNVCodecHelper::Detail::doubleOutputBuffers |
( |
uint32_t | bufferLength | ) |
const |
|
inlineprivate |
Allocates additional output bitstream buffers.
This function allocates a specified number of additional output bitstream buffers and adds them to the encoder buffer. It uses the NVIDIA Video Codec SDK to create the bitstream buffers and updates the internal queue of output bitstreams.
- Parameters
-
bufferLength | The number of additional output bitstream buffers to allocate. |
- Note
- This function is called internally by
is_not_empty
when more buffers are needed.
- Warning
- Ensure that the NVIDIA Video Codec SDK is properly initialized before calling this function.
◆ encode()
bool H264EncoderNVCodecHelper::Detail::encode |
( |
frame_sp & | frame | ) |
|
|
inline |
◆ endEncode()
void H264EncoderNVCodecHelper::Detail::endEncode |
( |
| ) |
|
|
inline |
◆ GetCapabilityValue()
int H264EncoderNVCodecHelper::Detail::GetCapabilityValue |
( |
GUID | guidCodec, |
|
|
NV_ENC_CAPS | capsToQuery ) |
|
inlineprivate |
◆ getSPSPPS()
bool H264EncoderNVCodecHelper::Detail::getSPSPPS |
( |
void *& | buffer, |
|
|
size_t & | size, |
|
|
int & | width, |
|
|
int & | height ) |
|
inline |
◆ init()
bool H264EncoderNVCodecHelper::Detail::init |
( |
uint32_t | width, |
|
|
uint32_t | height, |
|
|
uint32_t | pitch, |
|
|
ImageMetadata::ImageType | imageType, |
|
|
std::function< frame_sp(size_t)> | _makeFrame, |
|
|
std::function< void(frame_sp &, frame_sp &)> | _send ) |
|
inline |
◆ initializeEncoder()
void H264EncoderNVCodecHelper::Detail::initializeEncoder |
( |
| ) |
|
|
inlineprivate |
◆ is_not_empty()
bool H264EncoderNVCodecHelper::Detail::is_not_empty |
( |
| ) |
const |
|
inlineprivate |
Checks if there are free output bitstreams available and allocates more if needed.
This function checks the availability of free output bitstreams. If there are no free output bitstreams and the number of busy streams is below a predefined threshold, it allocates additional output bitstreams to the encoder buffer.
The function first checks the number of busy output bitstreams. If there are no free output bitstreams and the number of busy streams is below m_nBufferThres
, it calculates the buffer length to be allocated and doubles the output buffers by calling doubleOutputBuffers
. It then logs the allocation and increments the count of free output bitstreams. If there are free output bitstreams, it logs a message indicating the current state.
- Returns
- true if there are free output bitstreams available, false otherwise.
- Note
- This function modifies the state of
m_nvcodecResources->m_nFreeOutputBitstreams
.
- Warning
- Ensure thread safety when calling this function in a multi-threaded environment.
◆ is_output_available()
bool H264EncoderNVCodecHelper::Detail::is_output_available |
( |
| ) |
const |
|
inlineprivate |
Checks if there are any busy output bitstreams or if the encoder is not running.
This function returns true if there are any busy output bitstreams or if the encoder is not running. It helps determine if there are any output bitstreams currently being processed or if the encoding process has stopped.
- Returns
- true if there are busy output bitstreams or the encoder is not running, false otherwise.
- Note
- This function does not modify any state.
◆ processOutput()
void H264EncoderNVCodecHelper::Detail::processOutput |
( |
| ) |
|
|
inlineprivate |
◆ RegisterResource()
NV_ENC_REGISTERED_PTR H264EncoderNVCodecHelper::Detail::RegisterResource |
( |
void * | pBuffer, |
|
|
NV_ENC_INPUT_RESOURCE_TYPE | eResourceType, |
|
|
int | width, |
|
|
int | height, |
|
|
int | pitch, |
|
|
NV_ENC_BUFFER_FORMAT | bufferFormat, |
|
|
NV_ENC_BUFFER_USAGE | bufferUsage ) |
|
inlineprivate |
◆ unload()
void H264EncoderNVCodecHelper::Detail::unload |
( |
| ) |
|
|
inlineprivate |
◆ m_bEnableBFrames
bool H264EncoderNVCodecHelper::Detail::m_bEnableBFrames |
|
private |
◆ m_bRunning
bool H264EncoderNVCodecHelper::Detail::m_bRunning |
|
private |
◆ m_eBufferFormat
NV_ENC_BUFFER_FORMAT H264EncoderNVCodecHelper::Detail::m_eBufferFormat |
|
private |
◆ m_encodeConfig
NV_ENC_CONFIG H264EncoderNVCodecHelper::Detail::m_encodeConfig |
|
private |
◆ m_initializeParams
NV_ENC_INITIALIZE_PARAMS H264EncoderNVCodecHelper::Detail::m_initializeParams |
|
private |
◆ m_nBitRateKbps
uint32_t H264EncoderNVCodecHelper::Detail::m_nBitRateKbps |
|
private |
◆ m_nBufferThres
uint32_t H264EncoderNVCodecHelper::Detail::m_nBufferThres |
|
private |
◆ m_nencodeParam
NV_ENC_CAPS_PARAM H264EncoderNVCodecHelper::Detail::m_nencodeParam |
|
private |
◆ m_nEncoderBuffer
int32_t H264EncoderNVCodecHelper::Detail::m_nEncoderBuffer |
|
private |
◆ m_nFrameRate
uint32_t H264EncoderNVCodecHelper::Detail::m_nFrameRate |
|
private |
◆ m_nGopLength
uint32_t H264EncoderNVCodecHelper::Detail::m_nGopLength |
|
private |
◆ m_nHeight
uint32_t H264EncoderNVCodecHelper::Detail::m_nHeight |
|
private |
◆ m_nOutSPSPPSPayloadSize
uint32_t H264EncoderNVCodecHelper::Detail::m_nOutSPSPPSPayloadSize |
|
private |
◆ m_nPitch
uint32_t H264EncoderNVCodecHelper::Detail::m_nPitch |
|
private |
◆ m_nProfile
◆ m_nvcodecResources
boost::shared_ptr<NVCodecResources> H264EncoderNVCodecHelper::Detail::m_nvcodecResources |
|
private |
◆ m_nWidth
uint32_t H264EncoderNVCodecHelper::Detail::m_nWidth |
|
private |
◆ m_spsppsFrame
frame_sp H264EncoderNVCodecHelper::Detail::m_spsppsFrame |
|
private |
◆ m_spsppsPayload
NV_ENC_SEQUENCE_PARAM_PAYLOAD H264EncoderNVCodecHelper::Detail::m_spsppsPayload |
|
private |
◆ m_thread
std::thread H264EncoderNVCodecHelper::Detail::m_thread |
|
private |
◆ makeFrame
std::function<frame_sp(size_t)> H264EncoderNVCodecHelper::Detail::makeFrame |
|
private |
◆ mProps
◆ send
std::function<void(frame_sp&, frame_sp&)> H264EncoderNVCodecHelper::Detail::send |
|
private |
The documentation for this class was generated from the following file:
- base/src/H264EncoderNVCodecHelper.cpp