我要评分
获取效率
正确性
完整性
易理解

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, // Enables the format conversion capability.
    CAP_VA_ENCODE_H264, // Enables the H.264 encoding capability.
    CAP_VA_ENCODE_HEVC, // Enables the H.265 encoding capability.
};
enum DeviceNode : uint32_t {
    DEV_DRI_RENDERD128 = 128, // Rendering node 128
    DEV_DRI_RENDERD129 = 129, // Rendering node 129
    DEV_DRI_RENDERD130 = 130, // Rendering node 130
    DEV_DRI_RENDERD131 = 131, // Rendering node 131
};
struct FrameSize {
    uint32_t width; // Image width
    uint32_t height; // Image height
    uint32_t widthAligned; // Image width after alignment
    uint32_t heightAligned; // Image height after alignment
}
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.