SetEncodeParam
Function Usage
Calls the GPU for video encoding. It encodes the data in the input buffer, and writes it to the output buffer.
Restrictions
N/A
Prototype
int32_t SetEncodeParam(EncodeParamT params[], uint32_t num) = 0
Parameters
Field Name |
Input/Output |
Field Type |
Description |
|---|---|---|---|
params |
Input |
EncodeParamT[] |
List of the encoding parameters to be configured. |
num |
Input |
uint32_t |
Number of the encoding parameters to be configured. |
The definition of EncodeParamT is as follows:
enum EncodeParamIndex : uint32_t {
ENCODE_PARAM_NONE,
ENCODE_PARAM_RATE_CONTROL, // Sets the bit rate control mode.
ENCODE_PARAM_BITRATE, // Sets the bit rate.
ENCODE_PARAM_FRAMERATE, // Sets the frame rate.
ENCODE_PARAM_GOPSIZE, // Sets gopsize.
ENCODE_PARAM_PROFILE, // Sets profile.
ENCODE_PARAM_KEYFRAME, // Sets the key frame.
ENCODE_PARAM_MAX
};
struct EncodeParamBase {
explicit EncodeParamBase(EncodeParamIndex index) : id(index) {}
EncodeParamIndex id;
};
struct EncodeParamRateControl : public EncodeParamBase {
EncodeParamRateControl() : EncodeParamBase(ENCODE_PARAM_RATE_CONTROL) {}
uint32_t rateControl = 0;
};
struct EncodeParamBitRate : public EncodeParamBase {
EncodeParamBitRate() : EncodeParamBase(ENCODE_PARAM_BITRATE) {}
uint32_t bitRate = 0;
};
struct EncodeParamFrameRate : public EncodeParamBase {
EncodeParamFrameRate() : EncodeParamBase(ENCODE_PARAM_FRAMERATE) {}
uint32_t frameRate;
};
struct EncodeParamGopsize : public EncodeParamBase {
EncodeParamGopsize() : EncodeParamBase(ENCODE_PARAM_GOPSIZE) {}
uint32_t gopSize;
};
struct EncodeParamProfile : public EncodeParamBase {
EncodeParamProfile() : EncodeParamBase(ENCODE_PARAM_PROFILE) {}
uint32_t profile;
};
struct EncodeParamKeyframe : public EncodeParamBase {
EncodeParamKeyframe() : EncodeParamBase(ENCODE_PARAM_KEYFRAME) {}
uint32_t n;
};
using EncodeParamT = EncodeParamBase *;
Returns
Data type: GpuEncoderErrorCode
The value can be:
- OK: The encoding parameters are set successfully.
- ERR_NEED_RESET: The encoding parameters take effect only after the Reset interface is called.
- Other values: The encoding parameters fail to be set.