static Media_Status pcmStrmMFClose( MHdl *hdl ) { pcmStrmMediaHdl *ihdl = (pcmStrmMediaHdl *)hdl; if (ihdl->pcmStrm.isPlayback) { ASSERT( hdl != 0 && hdl->state != WAV_STATE_PLAYING); mhdlFinalize( hdl, 0 ); } else { ASSERT( hdl != 0 && hdl->state != WAV_STATE_RECORDING); mhdlFinalize( hdl, 0 ); } L1SP_PCMPlayback_ClearFlag(); free_ctrl_buffer( hdl ); kal_trace( TRACE_FUNC, L1AUDIO_CLOSE, MEDIA_FORMAT_PCM_8K ); return MEDIA_SUCCESS; }
static Media_Status GenCompRecClose( MHdl *hdl ) { MHPB_Internal *ihdl = (MHPB_Internal *)hdl; kal_trace( TRACE_GROUP_AUD_PLAYBACK, L1AUDIO_GENERAL_INFO, AUDIO_TRACE_CLOSE, hdl->mediaType, hdl, hdl->state,0,0,0,0,0); ASSERT( hdl != 0 ); if (hdl->state == COMPONENT_STATE_PLAY) { hdl->Stop(hdl); } // Deinit component { AcHdlNode *pNode = ihdl->pNodeStart; while (pNode) { pNode->curHdl->Deinit( pNode->curHdl ); if (pNode->pAllocBuf) { audio_free_mem( (void **) &pNode->pAllocBuf); } pNode = pNode->pNextNode; } } // Wav only if (ihdl->pPublicInfo) { free_ctrl_buffer( ihdl->pPublicInfo ); } // Free memory if (ihdl->pAllocBuf) { if (ihdl->fIspAllocBufOnMED) { audio_free_mem( (void **) &ihdl->pAllocBuf); } else { free_ctrl_buffer(ihdl->pAllocBuf); ihdl->pAllocBuf = NULL; } } mhdlFinalize(hdl, NULL); free_ctrl_buffer( hdl ); return MEDIA_SUCCESS; }
static Media_Status GenCompClose( MHdl *hdl ) { MHPB_Internal *ihdl = (MHPB_Internal *)hdl; kal_int32 I; kal_trace( TRACE_GROUP_AUD_PLAYBACK, L1AUDIO_GENERAL_INFO, AUDIO_TRACE_CLOSE, hdl->mediaType, hdl, hdl->state,0,0,0,0,0); ASSERT( hdl != 0 ); if(hdl->state == COMPONENT_STATE_PLAY) { hdl->Stop(hdl); } // Deinit component for (I=ihdl->numComp-1; I>=0; I--) { ihdl->NodeArray[I].curHdl->Deinit(ihdl->NodeArray[I].curHdl); } // Wav only if (ihdl->pPublicInfo) { free_ctrl_buffer( ihdl->pPublicInfo ); } // Free memory if (ihdl->pAllocBuf) { if (ihdl->fIspAllocBufOnMED) { audio_free_mem( (void **) &ihdl->pAllocBuf); } else { free_ctrl_buffer(ihdl->pAllocBuf); ihdl->pAllocBuf = NULL; } } mhdlFinalize(hdl, NULL); free_ctrl_buffer( hdl ); return MEDIA_SUCCESS; }