hi_mpi_venc_set_chn_attr
The
The
Description
Set the attributes of an encoding channel.
Restrictions
- Only H.264/H.265 encoding channels support this API.
- It is recommended that hi_mpi_venc_get_chn_attr be called before this API to obtain the attributes of the current encoding channel.
- Encoding channel attributes include the encoder attribute, frame structure GOP attribute, and RC attribute. These attributes are classified into dynamic attributes and static attributes. Static attributes are configured when a channel is created and cannot be modified after the channel is created. Dynamic attributes are configured when a channel is created and some settings cannot be modified, and others can be modified before the channel is destroyed. Error codes are returned if you set static attributes or modify parameters that cannot be modified. For details about static attributes, whether they are modifiable, and attribute value ranges, see hi_venc_chn_attr.
- If gop_mode is not changed when configuring encoding channel attributes, the channel attributes take effect immediately. If gop_mode is changed, the channel attributes will take effect after a delay. The following table lists the maximum delays (the HI_VENC_GOP_MODE_LOW_DELAY_B mode is not supported currently).
Before gop_mode Is Changed
After gop_mode Is Changed
Maximum Delay Time (by encoded frame count)
HI_VENC_GOP_MODE_LOW_DELAY_B
Non-HI_VENC_GOP_MODE_LOW_DELAY_B
1+b_frame_num
Non-HI_VENC_GOP_MODE_LOW_DELAY_B
Any GOP mode different from that before the change.
1
- When changing the gop_mode, the I-slice refreshing for P-frames, frame skipping reference attributes (H.264/H.265), and pic_order_cnt_type (H.264) of the channel are restored to the default values. You need to re-configure them for further use.
- If either the GOP or RC attribute is modified, the RC module is reinitialized, and all advanced RC parameters are restored to default values. If advanced parameters of the RC are adjusted in the client program, you need to set the parameters again. For details about the advanced parameters of the RC, see hi_mpi_venc_set_rc_param.
- If gop_mode and rc_mode are modified at the same time, the modification may take effect with a delay (see the preceding table). It is recommended that you do not perform any operation until the parameters take effect after the delay. Otherwise the RC parameter value obtained by calling hi_mpi_venc_get_rc_param may be inaccurate.
- By calling this API, you can change the channel width (pic_width) and height (pic_height) during video encoding. However, you need to note the following:
- When you change the width and height by calling this API, the system discards the video data that is not completely encoded. As a result, part of the video data is lost.
- After this API is called to change the width and height, the values of width and height delivered by hi_mpi_venc_send_frame must be the same as the values of pic_width and pic_height.
- If you change the width and height between an hi_mpi_venc_get_stream call and an hi_mpi_venc_release_stream call, the HI_ERR_VENC_ILLEGAL_PARAM error code will be returned when hi_mpi_venc_release_stream releases the received stream.
Prototype
hi_s32 hi_mpi_venc_set_chn_attr(hi_venc_chn chn, const hi_venc_chn_attr *chn_attr)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
chn |
Input |
Encoding channel ID. |
chn_attr |
Input |
Pointer to the encoding channel attributes. |
Returns
- 0: success
- Other values: failure. For details, see VENC/JPEGE Return Codes.
Parent topic: VENC/JPEGE