Creating a Channel

Ascend 310 aclvenc API

Ascend 310P hi_mpi API

What You Need to Do

Create the struct of the channel description:

aclvencCreateChannelDesc

No corresponding API. Use the hi_venc_chn_attr struct directly.

Declare the variables of the hi_venc_chn_attr struct in your code.

Set the parameters of the channel description:

aclvencSetChannelDescEnType

aclvencSetChannelDescPicWidth

aclvencSetChannelDescPicHeight

aclvencSetChannelDescKeyFrameInterval

aclvencSetChannelDescThreadId (specific to acl APIs)

aclvencSetChannelDescCallback (specific to acl APIs)

aclvencSetChannelDescRcMode

aclvencSetChannelDescSrcRate

aclvencSetChannelDescMaxBitRate

aclvencSetChannelDescPicFormat (specific to acl APIs)

No corresponding API. Assign values to the members of hi_venc_chn_attr struct:

hi_venc_chn_attr.venc_attr.type

hi_venc_chn_attr.venc_attr.pic_width

hi_venc_chn_attr.venc_attr.pic_height

hi_venc_chn_attr.rc_attr.h26x_xbr.gop

hi_venc_chn_attr.rc_attr.rc_mode

hi_venc_chn_attr.rc_attr.h26x_xbr.src_frame_rate

hi_venc_chn_attr.rc_attr.h26x_xbr.bit_rate

Modify your code to configure the parameters of the channel description by assigning values to the members of the hi_venc_chn_attr struct.

Note that for the parameters specific to acl APIs, there are corresponding hi_mpi APIs.

  • The thread ID and callback (related to the callback function) are not specified in the hi_venc_chn_attr struct, because no callback function needs to be set when hi_mpi APIs are used. In this case, start another thread and call hi_mpi_venc_get_stream to obtain the encoding result.
  • The format of the input image is not specified in the hi_venc_chn_attr struct. It is specified by the hi_video_frame_info.v_frame.pixel_format parameter when you send the data frames to be encoded using the hi_mpi_venc_send_frame API.

Create a channel:

aclvencCreateChannel

Create a channel:

hi_mpi_venc_create_chn

Modify your code to create a channel using the hi_mpi_venc_create_chn API.