Init
Function Usage
Initializes the GPU acceleration class instance.
Restrictions
N/A
Prototype
int32_t Init(EncoderConfig &config) = 0
Parameter Description
Field Name |
Input/Output |
Field Type |
Description |
|---|---|---|---|
config |
Input |
EncoderConfig & |
GPU encoding configuration item of the EncoderConfig structure reference type. |
The EncoderConfig structure and its enumeration are defined as follows:
enum EncoderCapability : uint32_t {
CAP_NONE,
CAP_FORMAT_CONVERT,
CAP_VA_ENCODE_H264,
CAP_VA_ENCODE_HEVC,
CAP_MAX,
};
enum DeviceNode : uint32_t {
DEV_DRI_RENDERD128 = 128,
DEV_DRI_RENDERD129 = 129,
DEV_DRI_RENDERD130 = 130,
DEV_DRI_RENDERD131 = 131,
DEV_DRI_OTHER = 132
};
struct FrameSize {
uint32_t width = 0;
uint32_t height = 0;
uint32_t widthAligned = 0;
uint32_t heightAligned = 0;
bool operator==(const FrameSize &other)
{
return this->width == other.width &&
this->height == other.height &&
this->widthAligned == other.widthAligned &&
this->heightAligned == other.heightAligned;
}
bool operator!=(const FrameSize &other)
{
return this->width != other.width ||
this->height != other.height ||
this->widthAligned != other.widthAligned ||
this->heightAligned != other.heightAligned;
}
};
struct EncoderConfig {
EncoderCapability capability = CAP_NONE;
DeviceNode deviceNode = DEV_DRI_OTHER;
FrameSize inSize = {};
FrameSize outSize = {};
};
Return Value Description
Data type: GpuEncoderErrorCode
The value can be any of the following:
- OK: The GPU acceleration class instance is successfully initialized.
- Other: Failed to initialize the GPU acceleration class instance.
Parent topic: GPU Acceleration APIs (C and C++)