aclvencSetChannelDesc Series

Description

Sets the description of a video encoding channel. This API is synchronous.

The Ascend 910 AI Processor does not support this API.

Prototype

aclError aclvencSetChannelDescThreadId(aclvencChannelDesc *channelDesc, uint64_t threadId);

aclError aclvencSetChannelDescCallback(aclvencChannelDesc *channelDesc, aclvencCallback callback);

aclError aclvencSetChannelDescEnType(aclvencChannelDesc *channelDesc, acldvppStreamFormat enType);

aclError aclvencSetChannelDescPicFormat(aclvencChannelDesc *channelDesc, acldvppPixelFormat picFormat);

aclError aclvencSetChannelDescPicWidth(aclvencChannelDesc *channelDesc, uint32_t picWidth);

aclError aclvencSetChannelDescPicHeight(aclvencChannelDesc *channelDesc, uint32_t picHeight);

aclError aclvencSetChannelDescKeyFrameInterval(aclvencChannelDesc *channelDesc, uint32_t keyFrameInterval);

aclError aclvencSetChannelDescBufAddr(aclvencChannelDesc *channelDesc, void *bufAddr);

aclError aclvencSetChannelDescBufSize(aclvencChannelDesc *channelDesc, uint32_t bufSize);

aclError aclvencSetChannelDescRcMode(aclvencChannelDesc *channelDesc, uint32_t rcMode);

aclError aclvencSetChannelDescSrcRate(aclvencChannelDesc *channelDesc, uint32_t srcRate);

aclError aclvencSetChannelDescMaxBitRate(aclvencChannelDesc *channelDesc, uint32_t maxBitRate)

Parameters

Parameter

Input/Output

Description

channelDesc

Output

Pointer to the description of a video encoding channel.

Call aclvencCreateChannelDesc to create data of the aclvencChannelDesc type in advance.

threadId

Input

Callback thread ID.
NOTE:

Do not pass the same thread ID for subscribing to VENC callback functions on different devices in the same process.

callback

Input

Encoding callback function.

enType

Input

Video coding protocol.

picFormat

Input

Image format.
  • PIXEL_FORMAT_YUV_SEMIPLANAR_420
  • PIXEL_FORMAT_YVU_SEMIPLANAR_420

picWidth

Input

Image width.

picHeight

Input

Image height.

keyFrameInterval

Input

Key frame interval. Must be in the range of [1, 65536].

bufAddr

Input

Pointer to the buffer address of the encoding output.
NOTE:

In the current version of the Ascend 310 AI Processor of the Ascend 910 AI Processor, this parameter is unconfigurable. VENC manages the buffer address internally.

bufSize

Input

Size of the encoding output buffer, in bytes.
NOTE:

For the Ascend 310 AI Processor, it is not allowed to set this parameter in the current version. It defaults to 3686400 bytes.

For the Ascend 910 AI Processor, it is not allowed to set this parameter in the current version. It defaults to 3686400 bytes.

For the Ascend 310P AI Processor, if this parameter is not specified, the default value 8 MB is used. The minimum value is 5 MB.

rcMode

Input

Bit rate control mode.
  • 0: default mode.
  • 1: variable bit rate (VBR) mode
  • 2: constant bit rate (CBR) mode
NOTE:

If this parameter is not set, the default value 0 is used.

For the Ascend 310 AI Processor, the default value 0 indicates the CBR mode.

For the Ascend 310 AI Processor, the default value 0 indicates the CBR mode.

For the Ascend 610 AI Processor, the default value 0 indicates the VBR mode.

srcRate

Input

Frame rate of the input stream (FPS).

For the Ascend 310 AI Processor, the value is 0 or in the range of [1, 120].

For the Ascend 310 AI Processor, the value is 0 or in the range of [1, 120].

For the Ascend 610 AI Processor, the value is 0 or in the range of [1, 240].

If it is not set or set to 0, the default value 30 is used. If the difference between the value of this parameter and the actual frame rate of the input stream is too large, the output bit rate is affected.

maxBitRate

Input

Output bit rate (kbit/s).

For the Ascend 310 AI Processor, the value is 0 or in the range of [10, 30000]. The default value is 300. If it is set to 0, the default value 300 is used.

For the Ascend 910 AI Processor, the value is 0 or in the range of [10, 30000]. The default value is 300. If it is set to 0, the default value 300 is used.

For the Ascend 610 AI Processor, the value range is [2, 614400]. The default value is 2000. If it is set to 0, the default value 2000 is used.

Returns

0 on success; else, failure.