/****************************************************************************** * function : Stop Aenc ******************************************************************************/ HI_S32 SAMPLE_COMM_AUDIO_StopAenc(HI_S32 s32AencChnCnt) { HI_S32 i; for (i = 0; i < s32AencChnCnt; i++) { HI_MPI_AENC_DestroyChn(i); } return HI_SUCCESS; }
bool HimppAencChan::enableObject() { HI_S32 s32Ret; AENC_CHN_ATTR_S attr; union { AENC_ATTR_ADPCM_S adpcm; AENC_ATTR_G711_S g711; AENC_ATTR_G726_S g726; AENC_ATTR_LPCM_S lpcm; } enc_attr; attr.u32BufSize = 30; attr.pValue = &enc_attr; switch (_encoding) { case IAudioEncoder::ADPCM: attr.enType = PT_ADPCMA; enc_attr.adpcm.enADPCMType = AUDIO_ADPCM_TYPE; break; case IAudioEncoder::G711A: attr.enType = PT_G711A; enc_attr.g711.resv = 0; break; case IAudioEncoder::G711U: attr.enType = PT_G711U; enc_attr.g711.resv = 0; break; case IAudioEncoder::G726: attr.enType = PT_G726; enc_attr.g726.enG726bps = G726_BPS; break; case IAudioEncoder::LPCM: attr.enType = PT_LPCM; enc_attr.lpcm.resv = 0; break; } s32Ret = HI_MPI_AENC_CreateChn(_chnid, &attr); if (s32Ret != HI_SUCCESS) { fprintf(stderr, "failed to create VENC chn%d\n", _chnid); return false; } MPP_CHN_S dst_chn; dst_chn.enModId = HI_ID_AENC; dst_chn.s32DevId = 0; dst_chn.s32ChnId = _chnid; s32Ret = HI_MPI_SYS_Bind(*source(), &dst_chn); if (s32Ret != HI_SUCCESS) { fprintf(stderr, "HI_MPI_SYS_Bind AENC chn%d failed [%#x]\n", _chnid, s32Ret); goto err_destroy_chn; } return true; err_destroy_chn: HI_MPI_AENC_DestroyChn(_chnid); return false; }
static int avenc_AEncDestroy() { int i = 0; for(i = 0; i < AVENC_AUDIO_MAX_CH; ++i){ // unbind AENC DVR_ASSERT(HI_MPI_AENC_UnBindAi(i, AIN_DEV, i)); // destroy aenc chn DVR_ASSERT(HI_MPI_AENC_DestroyChn(i)); if(AUDIO_IsCapLiveLoop()){ DVR_ASSERT(HI_MPI_AI_DisableChn(AIN_DEV, i)); } } return 0; }
static int aenc_stop(HI_S32 s32AencChnCnt) { HI_S32 i = 0; HI_S32 s32Ret = HI_FAILURE; for (i=0; i<s32AencChnCnt; i++) { s32Ret = HI_MPI_AENC_DestroyChn(i); CHECK(s32Ret == HI_SUCCESS, HI_FAILURE, "Error with %#x.\n", s32Ret); DBG("AENC DestroyChn[%d] done.\n", i); } return HI_SUCCESS; }
bool HimppAencChan::disableObject() { HI_S32 s32Ret; MPP_CHN_S dst_chn; dst_chn.enModId = HI_ID_AENC; dst_chn.s32DevId = 0; dst_chn.s32ChnId = _chnid; s32Ret = HI_MPI_SYS_UnBind(*source(), &dst_chn); if (s32Ret != HI_SUCCESS) { fprintf(stderr, "HI_MPI_SYS_UnBind AENC chn%d failed [%#x]\n", _chnid, s32Ret); } s32Ret = HI_MPI_AENC_DestroyChn(_chnid); if (s32Ret != HI_SUCCESS) { fprintf(stderr, "failed to destroy VENC chn%d\n", _chnid); } return true; }