Rate This Document
Findability
Accuracy
Completeness
Readability

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:

1
2
3
4
5
6
7
enum EncoderCapability : uint32_t {
    CAP_NONE,
    CAP_FORMAT_CONVERT,
    CAP_VA_ENCODE_H264,
    CAP_VA_ENCODE_HEVC,
    CAP_MAX,
};
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;
    }
};
1
2
3
4
5
6
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.