hi_mpi_ai_enable_resample
The
The
Description
Enables AI resampling.
Restrictions
- After enabling an AI channel by calling hi_mpi_ai_enable_chn and before binding the VENC channel to the AI channel by calling hi_mpi_sys_bind, call this API to enable resampling.
- After an AI channel is disabled by calling hi_mpi_ai_disable_chn, if you want to enable the AI channel again and use the resampling function, you need to call this API to enable resampling again.
- Due to the limitation of the Nyquist sampling theorem, when the audio sampling rate is 8 kHz, the supported audio frequency is less than 4 kHz.
- The AI sampling rate is fixed at 48 kHz. The G.711a and G.711u protocols only support the sampling rate of 8 kHz, and when either protocol is used, resampling needs to be enabled. However, the AAC protocol supports the sampling rate of 48 kHz, and when it is used, AI resampling is not required.
Prototype
hi_s32 hi_mpi_ai_enable_resample(hi_audio_dev ai_dev, hi_ai_chn ai_chn, hi_audio_sample_rate out_sample_rate);
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
ai_dev |
Input |
Audio device ID. The value range is [0, 2]. In the network video recorder (NVR) scenario, only dev2 is involved. |
ai_chn |
Input |
AI channel ID. Only the mono audio channel (audio-left channel) is supported. The value of ai_chn is fixed at 0. |
out_sample_rate |
Input |
Output sampling rate for audio resampling. Only 8 kHz is supported. |
Returns
- 0: success
- Other values: failure. For details, see Audio Return Codes.
Parent topic: AI/AO