Lines Matching refs:pComponentPrivate

117     WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate;
120 pComponentPrivate = pHandle->pComponentPrivate;
121 OMX_PRINT1(pComponentPrivate->dbg, "WBAMR_DEC_Fill_LCMLInitParams\n ");
122 OMX_PRDSP1(pComponentPrivate->dbg, "pHandle = %p\n",pHandle);
123 OMX_PRDSP1(pComponentPrivate->dbg, "pHandle->pComponentPrivate = %p\n",pHandle->pComponentPrivate);
125 nIpBuf = pComponentPrivate->pInputBufferList->numBuffers;
126 pComponentPrivate->nRuntimeInputBuffers = nIpBuf;
127 if(pComponentPrivate->mimemode == 1)
131 else if (pComponentPrivate->mimemode == 2)
137 if (OMX_AUDIO_AMRDTXasEFR == pComponentPrivate->iAmrMode){
145 nOpBuf = pComponentPrivate->pOutputBufferList->numBuffers;
146 pComponentPrivate->nRuntimeOutputBuffers = nOpBuf;
180 if(pComponentPrivate->dasfmode == 1) {
181 OMX_PRINT1(pComponentPrivate->dbg, "pComponentPrivate->dasfmode = %ld\n",pComponentPrivate->dasfmode);
184 pComponentPrivate->strmAttr = strmAttr;
195 if(pComponentPrivate->acdnmode == 1)
208 pComponentPrivate->strmAttr = NULL;
220 pComponentPrivate->iAmrSamplingFrequeny = WBAMR_DEC_SAMPLING_FREQUENCY;
225 pComponentPrivate->iAmrChannels =
226 pComponentPrivate->wbamrParams[WBAMR_DEC_OUTPUT_PORT]->nChannels;
228 pComponentPrivate->iAmrMode =
229 pComponentPrivate->wbamrParams[WBAMR_DEC_INPUT_PORT]->eAMRDTXMode;
231 if(pComponentPrivate->mimemode == 1)
233 pComponentPrivate->iAmrMimeFlag = WBAMR_DEC_MODE_MIME;
235 pComponentPrivate->iAmrMimeFlag = WBAMR_DEC_MODE_NONMIME;
243 if (pComponentPrivate->pInputBufferList->numBuffers) {
244 arr[3] = pComponentPrivate->pInputBufferList->numBuffers;
252 if(pComponentPrivate->dasfmode == 1) {
253 OMX_PRDSP2(pComponentPrivate->dbg, "Setting up create phase params for DASF mode\n");
259 OMX_PRDSP2(pComponentPrivate->dbg, "Setting up create phase params for FILE mode\n");
261 if (pComponentPrivate->pOutputBufferList->numBuffers) {
262 arr[6] = pComponentPrivate->pOutputBufferList->numBuffers;
270 if(pComponentPrivate->iAmrMode == OMX_AUDIO_AMRDTXasEFR) {
277 arr[8] = pComponentPrivate->mimemode; /*MIME, IF2 or FORMATCONFORMANCE*/
282 OMX_PRINT1(pComponentPrivate->dbg, "Comp: OMX_AmrDecUtils.c\n");
286 pComponentPrivate->pLcmlBufHeader[WBAMR_DEC_INPUT_PORT] = pTemp_lcml;
289 pTemp = pComponentPrivate->pInputBufferList->pBufHdr[i];
294 pTemp->pPlatformPrivate = pHandle->pComponentPrivate;
319 pComponentPrivate->pLcmlBufHeader[WBAMR_DEC_OUTPUT_PORT] = pTemp_lcml;
322 pTemp = pComponentPrivate->pOutputBufferList->pBufHdr[i];
327 pComponentPrivate->nVersion = pTemp->nVersion.nVersion;
328 pTemp->pPlatformPrivate = pHandle->pComponentPrivate;
345 OMX_PRDSP1(pComponentPrivate->dbg, "pTemp_lcml = %p\n",pTemp_lcml);
346 OMX_PRBUFFER1(pComponentPrivate->dbg, "pTemp_lcml->buffer = %p\n",pTemp_lcml->buffer);
353 pComponentPrivate->bPortDefsAllocated = 1;
355 pComponentPrivate->nLcml_nCntIp = 0;
356 pComponentPrivate->nLcml_nCntOpReceived = 0;
359 OMX_PRINT1(pComponentPrivate->dbg, "Exiting WBAMR_DEC_Fill_LCMLInitParams");
361 pComponentPrivate->bInitParamsInitialized = 1;
386 WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate =
387 (WBAMR_DEC_COMPONENT_PRIVATE *)pHandle->pComponentPrivate;
395 OMX_PRINT1(pComponentPrivate->dbg, "Inside WBAMR_DEC_StartComponentThread\n");
398 pComponentPrivate->bIsStopping = 0;
399 pComponentPrivate->lcml_nOpBuf = 0;
400 pComponentPrivate->lcml_nIpBuf = 0;
401 pComponentPrivate->app_nBuf = 0;
402 pComponentPrivate->num_Reclaimed_Op_Buff = 0;
405 eError = pipe (pComponentPrivate->cmdDataPipe);
412 eError = pipe (pComponentPrivate->dataPipe);
419 eError = pipe (pComponentPrivate->cmdPipe);
428 eError = pthread_create (&(pComponentPrivate->WBAMR_DEC_ComponentThread), &attr, WBAMR_DEC_ComponentThread, pComponentPrivate);
430 eError = pthread_create (&(pComponentPrivate->WBAMR_DEC_ComponentThread), NULL, WBAMR_DEC_ComponentThread, pComponentPrivate);
432 if (eError || !pComponentPrivate->WBAMR_DEC_ComponentThread) {
437 pComponentPrivate->bCompThreadStarted = 1;
460 WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate = (WBAMR_DEC_COMPONENT_PRIVATE *)
461 pHandle->pComponentPrivate;
468 OMX_PRINT1(pComponentPrivate->dbg, "WBAMR_DEC_FreeCompResources\n");
470 if (pComponentPrivate->bPortDefsAllocated) {
471 nIpBuf = pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->nBufferCountActual;
472 nOpBuf = pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]->nBufferCountActual;
475 if (pComponentPrivate->bCompThreadStarted) {
476 err = close (pComponentPrivate->dataPipe[0]);
482 err = close (pComponentPrivate->dataPipe[1]);
487 err = close (pComponentPrivate->cmdPipe[0]);
492 err = close (pComponentPrivate->cmdPipe[1]);
497 err = close (pComponentPrivate->cmdDataPipe[0]);
502 err = close (pComponentPrivate->cmdDataPipe[1]);
508 OMX_MEMFREE_STRUCT (pComponentPrivate->pPriorityMgmt);
509 OMX_MEMFREE_STRUCT (pComponentPrivate->pHoldBuffer);
510 OMX_MEMFREE_STRUCT(pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]);
511 OMX_MEMFREE_STRUCT (pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]);
512 OMX_MEMFREE_STRUCT(pComponentPrivate->wbamrParams[WBAMR_DEC_INPUT_PORT]);
513 OMX_MEMFREE_STRUCT (pComponentPrivate->wbamrParams[WBAMR_DEC_OUTPUT_PORT]);
514 pComponentPrivate->bPortDefsAllocated = 0;
516 OMX_PRDSP1(pComponentPrivate->dbg, "\n\n FreeCompResources: Destroying mutexes.\n\n");
517 pthread_mutex_destroy(&pComponentPrivate->InLoaded_mutex);
518 pthread_cond_destroy(&pComponentPrivate->InLoaded_threshold);
520 pthread_mutex_destroy(&pComponentPrivate->InIdle_mutex);
521 pthread_cond_destroy(&pComponentPrivate->InIdle_threshold);
523 pthread_mutex_destroy(&pComponentPrivate->AlloBuf_mutex);
524 pthread_cond_destroy(&pComponentPrivate->AlloBuf_threshold);
526 pComponentPrivate->bPortDefsAllocated = 0;
527 OMX_DestroyEvent(&(pComponentPrivate->InLoaded_event));
528 OMX_DestroyEvent(&(pComponentPrivate->InIdle_event));
529 OMX_DestroyEvent(&(pComponentPrivate->AlloBuf_event));
539 WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate = (WBAMR_DEC_COMPONENT_PRIVATE *)
540 pHandle->pComponentPrivate;
549 OMX_PRINT1(pComponentPrivate->dbg, "WBAMR_DEC_CleanupInitParams()\n");
551 OMX_MEMFREE_STRUCT(pComponentPrivate->strmAttr);
553 OMX_MEMFREE_STRUCT_DSPALIGN(pComponentPrivate->pParams, WBAMR_DEC_AudioCodecParams);
555 nIpBuf = pComponentPrivate->nRuntimeInputBuffers;
556 pTemp_lcml = pComponentPrivate->pLcmlBufHeader[WBAMR_DEC_INPUT_PORT];
561 pLcmlHandle = (LCML_DSP_INTERFACE *)pComponentPrivate->pLcmlHandle;
565 pTemp_lcml->pDmmBuf->pReserved, pComponentPrivate->dbg);
574 pTemp_lcml = pComponentPrivate->pLcmlBufHeader[WBAMR_DEC_OUTPUT_PORT];
575 for(i=0; i<pComponentPrivate->nRuntimeOutputBuffers; i++){
579 pLcmlHandle = (LCML_DSP_INTERFACE *)pComponentPrivate->pLcmlHandle;
583 pTemp_lcml->pDmmBuf->pReserved, pComponentPrivate->dbg);
591 OMX_MEMFREE_STRUCT(pComponentPrivate->pLcmlBufHeader[WBAMR_DEC_INPUT_PORT]);
592 OMX_MEMFREE_STRUCT(pComponentPrivate->pLcmlBufHeader[WBAMR_DEC_OUTPUT_PORT]);
614 WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate = (WBAMR_DEC_COMPONENT_PRIVATE *)
615 pHandle->pComponentPrivate;
622 pComponentPrivate->bIsStopping = 1;
623 write (pComponentPrivate->cmdPipe[1], &pComponentPrivate->bIsStopping, sizeof(OMX_U16));
624 pthreadError = pthread_join (pComponentPrivate->WBAMR_DEC_ComponentThread,
633 OMX_ERROR4(pComponentPrivate->dbg, "Error while closing Component Thread\n");
644 * @param pComponentPrivate Component private data
654 OMX_U32 WBAMR_DEC_HandleCommand (WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate)
661 OMX_HANDLETYPE pLcmlHandle = pComponentPrivate->pLcmlHandle;
681 pHandle = (OMX_COMPONENTTYPE *) pComponentPrivate->pHandle;
683 OMX_PRINT1(pComponentPrivate->dbg, "Entering WBAMR_DEC_HandleCommand Function - curState = %d\n",pComponentPrivate->curState);
684 OMX_PRINT1(pComponentPrivate->dbg, "pComponentPrivate = %p\n",pComponentPrivate);
685 OMX_PRDSP1(pComponentPrivate->dbg, "pHandle = %p\n",pHandle);
686 ret = read (pComponentPrivate->cmdPipe[0], &command, sizeof (command));
688 OMX_ERROR4(pComponentPrivate->dbg, "Error While reading from the Pipe\n");
690 pComponentPrivate->cbInfo.EventHandler (pHandle,
699 ret = read (pComponentPrivate->cmdDataPipe[0], &commandData, sizeof (commandData));
701 OMX_ERROR4(pComponentPrivate->dbg, "Error While reading from the Pipe\n");
703 pComponentPrivate->cbInfo.EventHandler (pHandle,
712 PERF_ReceivedCommand(pComponentPrivate->pPERFcomp,
722 if (pComponentPrivate->curState == commandedState){
723 pComponentPrivate->cbInfo.EventHandler (pHandle,
730 else if (pComponentPrivate->curState == OMX_StateLoaded || pComponentPrivate->curState == OMX_StateWaitForResources) {
732 /* if (pComponentPrivate->dasfmode == 1) {
733 if(pComponentPrivate->streamID == 0)
739 pComponentPrivate->curState = OMX_StateInvalid;
740 pComponentPrivate->cbInfo.EventHandler(
749 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryStart | PERF_BoundarySetup);
751 if (pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->bPopulated && pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->bEnabled) {
755 if (!pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->bPopulated && !pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->bEnabled) {
759 if (pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]->bPopulated && pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]->bEnabled) {
763 if (!pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]->bPopulated && !pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]->bEnabled) {
768 OMX_PRSTATE2(pComponentPrivate->dbg, "\n\n HandleCommand: In Loaded state. It does not go to sleep.\n\n");
769 pComponentPrivate->InLoaded_readytoidle = 1;
771 pthread_mutex_lock(&pComponentPrivate->InLoaded_mutex);
772 pthread_cond_wait(&pComponentPrivate->InLoaded_threshold, &pComponentPrivate->InLoaded_mutex);
773 pthread_mutex_unlock(&pComponentPrivate->InLoaded_mutex);
775 OMX_WaitForEvent(&(pComponentPrivate->InLoaded_event));
780 OMX_PRINT1(pComponentPrivate->dbg, "Inside WBAMR_DEC_HandleCommand\n");
782 pLcmlHandle = (OMX_HANDLETYPE) WBAMR_DEC_GetLCMLHandle(pComponentPrivate);
783 OMX_PRINT1(pComponentPrivate->dbg, "Inside WBAMR_DEC_HandleCommand\n");
786 OMX_ERROR4(pComponentPrivate->dbg, "LCML Handle is NULL........exiting..\n");
787 pComponentPrivate->curState = OMX_StateInvalid;
789 pComponentPrivate->cbInfo.EventHandler(pHandle,
797 OMX_PRINT1(pComponentPrivate->dbg, "WBAMR_DEC_HandleCommand\n");
798 OMX_PRDSP1(pComponentPrivate->dbg, "pLcmlHandle = %p\n",pLcmlHandle);
803 OMX_PRDSP1(pComponentPrivate->dbg, "pLcmlDsp = %p\n",pLcmlDsp);
805 OMX_PRINT1(pComponentPrivate->dbg, "WBAMR_DEC_HandleCommand\n");
808 OMX_ERROR4(pComponentPrivate->dbg, "Error returned from\
810 pComponentPrivate->curState = OMX_StateInvalid;
811 pComponentPrivate->cbInfo.EventHandler(pHandle,
820 OMX_PRINT2(pComponentPrivate->dbg, "Comp: OMX_AmrDecUtils.c\n");
821 pComponentPrivate->pLcmlHandle = (LCML_DSP_INTERFACE *)pLcmlHandle;
823 OMX_PRDSP2(pComponentPrivate->dbg, "Calling LCML_InitMMCodec...\n");
826 OMX_PRINT2(pComponentPrivate->dbg, "WBAMR decoder support TeeDN\n");
828 p,&pLcmlHandle,(void *)p,&cb, (OMX_STRING)pComponentPrivate->sDeviceString);
838 OMX_ERROR4(pComponentPrivate->dbg, "Error returned from\
848 pComponentPrivate->rmproxyCallback.RMPROXY_Callback = (void *) WBAMRDEC_ResourceManagerCallback;
849 if (pComponentPrivate->curState != OMX_StateWaitForResources) {
850 OMX_PRDSP2(pComponentPrivate->dbg, "AMRDEC: About to call RMProxy_SendCommand\n");
856 &(pComponentPrivate->rmproxyCallback));
857 OMX_PRINT2(pComponentPrivate->dbg, "AMRDEC: RMProxy_SendCommand returned %d\n",rm_error);
860 pComponentPrivate->curState = OMX_StateIdle;
861 pComponentPrivate->cbInfo.EventHandler(pHandle,
865 pComponentPrivate->curState,
875 pComponentPrivate->curState = OMX_StateWaitForResources;
876 pComponentPrivate->cbInfo.EventHandler(pHandle,
880 pComponentPrivate->curState,
882 OMX_ERROR4(pComponentPrivate->dbg, "AMRDEC: Error - insufficient resources\n");
885 pComponentPrivate->curState = OMX_StateIdle;
886 pComponentPrivate->cbInfo.EventHandler(pHandle,
890 pComponentPrivate->curState,
900 pComponentPrivate->curState = OMX_StateIdle;
901 pComponentPrivate->cbInfo.EventHandler(pHandle,
905 pComponentPrivate->curState,
909 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryComplete | PERF_BoundarySetup);
911 OMX_PRSTATE2(pComponentPrivate->dbg, "AMRDEC: State has been Set to Idle\n");
913 if(pComponentPrivate->dasfmode == 1) {
915 OMX_PRDSP2(pComponentPrivate->dbg, "---- Comp: DASF Functionality is ON ---\n");
916 if(pComponentPrivate->streamID == 0)
918 OMX_ERROR4(pComponentPrivate->dbg, "**************************************\n");
919 OMX_ERROR4(pComponentPrivate->dbg, ":: Error = OMX_ErrorInsufficientResources\n");
920 OMX_ERROR4(pComponentPrivate->dbg, "**************************************\n");
922 pComponentPrivate->curState = OMX_StateInvalid;
923 pComponentPrivate->cbInfo.EventHandler(pHandle,
932 OMX_MALLOC_SIZE_DSPALIGN(pComponentPrivate->pParams, sizeof(WBAMR_DEC_AudioCodecParams),WBAMR_DEC_AudioCodecParams);
933 pParams = pComponentPrivate->pParams;
938 pParams->iStrmId = pComponentPrivate->streamID;
947 OMX_ERROR4(pComponentPrivate->dbg, "Error Occurred in Codec StreamControl..\n");
948 pComponentPrivate->curState = OMX_StateInvalid;
949 pComponentPrivate->cbInfo.EventHandler(pHandle,
959 else if (pComponentPrivate->curState == OMX_StateExecuting) {
962 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryComplete | PERF_BoundarySteadyState);
965 OMX_PRDSP2(pComponentPrivate->dbg, "AMRDEC: About to set bIsStopping bit\n");
967 OMX_PRDSP2(pComponentPrivate->dbg, "About to call LCML_ControlCodec(STOP)\n");
969 if (pComponentPrivate->codecStop_waitingsignal == 0){
970 pthread_mutex_lock(&pComponentPrivate->codecStop_mutex);
975 if (pComponentPrivate->codecStop_waitingsignal == 0){
976 pthread_cond_wait(&pComponentPrivate->codecStop_threshold, &pComponentPrivate->codecStop_mutex);
977 pComponentPrivate->codecStop_waitingsignal = 0;
978 pthread_mutex_unlock(&pComponentPrivate->codecStop_mutex);
981 OMX_ERROR4(pComponentPrivate->dbg, "Error Occurred in Codec Stop..\n");
982 pComponentPrivate->curState = OMX_StateInvalid;
983 pComponentPrivate->cbInfo.EventHandler(pHandle,
991 pComponentPrivate->bStopSent=1;
992 OMX_MEMFREE_STRUCT(pComponentPrivate->pHoldBuffer);
993 pComponentPrivate->nHoldLength = 0;
996 else if(pComponentPrivate->curState == OMX_StatePause) {
998 if (pComponentPrivate->codecStop_waitingsignal == 0){
999 pthread_mutex_lock(&pComponentPrivate->codecStop_mutex);
1004 if (pComponentPrivate->codecStop_waitingsignal == 0){
1005 pthread_cond_wait(&pComponentPrivate->codecStop_threshold, &pComponentPrivate->codecStop_mutex);
1006 pComponentPrivate->codecStop_waitingsignal = 0;
1007 pthread_mutex_unlock(&pComponentPrivate->codecStop_mutex);
1010 OMX_ERROR4(pComponentPrivate->dbg, "Error Occurred in Codec Stop..\n");
1011 pComponentPrivate->curState = OMX_StateInvalid;
1012 pComponentPrivate->cbInfo.EventHandler(pHandle,
1022 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryComplete | PERF_BoundarySteadyState);
1024 OMX_PRINT1(pComponentPrivate->dbg, "Comp: Stop Command Received\n");
1025 pComponentPrivate->curState = OMX_StateIdle;
1029 OMX_PRINT2(pComponentPrivate->dbg, "OMX_AmrDec_Utils.c :: The component is stopped\n");
1030 pComponentPrivate->cbInfo.EventHandler (
1032 OMX_EventCmdComplete,OMX_CommandStateSet,pComponentPrivate->curState,
1037 OMX_PRINT2(pComponentPrivate->dbg, "Comp: OMX_AmrDecUtils.c\n");
1038 pComponentPrivate->cbInfo.EventHandler(pHandle,
1048 OMX_PRDSP2(pComponentPrivate->dbg, "WBAMR_DEC_HandleCommand: Cmd Executing \n");
1049 if (pComponentPrivate->curState == commandedState){
1050 pComponentPrivate->cbInfo.EventHandler (pHandle,
1056 OMX_ERROR4(pComponentPrivate->dbg, "Error: Same State Given by \
1061 else if (pComponentPrivate->curState == OMX_StateIdle) {
1062 OMX_PRINT2(pComponentPrivate->dbg, "Comp: OMX_AmrDecUtils.c\n");
1064 pComponentPrivate->nFillThisBufferCount = 0;
1065 pComponentPrivate->nFillBufferDoneCount = 0;
1066 pComponentPrivate->bStopSent=0;
1068 pComponentPrivate->nEmptyBufferDoneCount = 0;
1069 pComponentPrivate->nEmptyThisBufferCount = 0;
1078 OMX_ERROR4(pComponentPrivate->dbg, "Error Occurred in Codec Start..\n");
1079 pComponentPrivate->curState = OMX_StateInvalid;
1080 pComponentPrivate->cbInfo.EventHandler(pHandle,
1089 nBuf = pComponentPrivate->pInputBufferList->numBuffers;
1091 OMX_PRBUFFER2(pComponentPrivate->dbg, "nBuf = %ld\n",nBuf);
1094 else if (pComponentPrivate->curState == OMX_StatePause) {
1095 OMX_PRINT2(pComponentPrivate->dbg, "Comp: OMX_AmrDecUtils.c\n");
1099 OMX_ERROR4(pComponentPrivate->dbg, "Error While Resuming the codec\n");
1100 pComponentPrivate->curState = OMX_StateInvalid;
1101 pComponentPrivate->cbInfo.EventHandler(pHandle,
1110 for (i=0; i < pComponentPrivate->nNumInputBufPending; i++) {
1111 if (pComponentPrivate->pInputBufHdrPending[i]) {
1112 WBAMR_DEC_GetCorresponding_LCMLHeader(pComponentPrivate,pComponentPrivate->pInputBufHdrPending[i]->pBuffer, OMX_DirInput, &pLcmlHdr);
1113 WBAMR_DEC_SetPending(pComponentPrivate,pComponentPrivate->pInputBufHdrPending[i],OMX_DirInput,__LINE__);
1117 pComponentPrivate->pInputBufHdrPending[i]->pBuffer,
1118 pComponentPrivate->pInputBufHdrPending[i]->nAllocLen,
1119 pComponentPrivate->pInputBufHdrPending[i]->nFilledLen,
1125 pComponentPrivate->nNumInputBufPending = 0;
1127 /* if (pComponentPrivate->nNumOutputBufPending < pComponentPrivate->pOutputBufferList->numBuffers) {
1128 pComponentPrivate->nNumOutputBufPending = pComponentPrivate->pOutputBufferList->numBuffers;
1131 for (i=0; i < pComponentPrivate->nNumOutputBufPending; i++) {
1132 if (pComponentPrivate->pOutputBufHdrPending[i]) {
1133 WBAMR_DEC_GetCorresponding_LCMLHeader(pComponentPrivate,pComponentPrivate->pOutputBufHdrPending[i]->pBuffer, OMX_DirOutput, &pLcmlHdr);
1134 WBAMR_DEC_SetPending(pComponentPrivate,pComponentPrivate->pOutputBufHdrPending[i],OMX_DirOutput,__LINE__);
1137 pComponentPrivate->pOutputBufHdrPending[i]->pBuffer,
1138 pComponentPrivate->pOutputBufHdrPending[i]->nAllocLen,
1139 pComponentPrivate->pOutputBufHdrPending[i]->nFilledLen,
1146 pComponentPrivate->nNumOutputBufPending = 0;
1149 OMX_PRINT2(pComponentPrivate->dbg, "Comp: OMX_AmrDecUtils.c\n");
1150 pComponentPrivate->cbInfo.EventHandler (pHandle,
1156 OMX_ERROR4(pComponentPrivate->dbg, "Error: Invalid State Given by \
1165 pComponentPrivate->curState = OMX_StateExecuting;
1167 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryStart | PERF_BoundarySteadyState);
1170 pComponentPrivate->cbInfo.EventHandler(pHandle,
1174 pComponentPrivate->curState,
1179 OMX_PRSTATE2(pComponentPrivate->dbg, "WBAMR_DEC_HandleCommand: Cmd Loaded - curState = %d\n",pComponentPrivate->curState);
1180 if (pComponentPrivate->curState == commandedState){
1181 pComponentPrivate->cbInfo.EventHandler (pHandle,
1187 OMX_ERROR2(pComponentPrivate->dbg, "Error: Same State Given by \
1191 OMX_PRBUFFER2(pComponentPrivate->dbg, "pComponentPrivate->pInputBufferList->numBuffers = %d\n",pComponentPrivate->pInputBufferList->numBuffers);
1192 OMX_PRBUFFER2(pComponentPrivate->dbg, "pComponentPrivate->pOutputBufferList->numBuffers = %d\n",pComponentPrivate->pOutputBufferList->numBuffers);
1194 if (pComponentPrivate->curState == OMX_StateWaitForResources){
1195 OMX_PRDSP2(pComponentPrivate->dbg, "WBAMR_DEC_HandleCommand: Cmd Loaded\n");
1197 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryStart | PERF_BoundaryCleanup);
1199 pComponentPrivate->curState = OMX_StateLoaded;
1201 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryComplete | PERF_BoundaryCleanup);
1203 pComponentPrivate->cbInfo.EventHandler (
1205 OMX_EventCmdComplete, OMX_CommandStateSet,pComponentPrivate->curState,
1210 OMX_PRSTATE2(pComponentPrivate->dbg, "In side OMX_StateLoaded State: \n");
1211 if (pComponentPrivate->curState != OMX_StateIdle &&
1212 pComponentPrivate->curState != OMX_StateWaitForResources) {
1213 OMX_PRINT2(pComponentPrivate->dbg, "Comp: OMX_AmrDecUtils.c\n");
1214 pComponentPrivate->cbInfo.EventHandler (pHandle,
1220 OMX_ERROR4(pComponentPrivate->dbg, "Error: Invalid State Given by \
1225 OMX_PRBUFFER2(pComponentPrivate->dbg, "pComponentPrivate->pInputBufferList->numBuffers = %d\n",pComponentPrivate->pInputBufferList->numBuffers);
1226 OMX_PRBUFFER2(pComponentPrivate->dbg, "pComponentPrivate->pOutputBufferList->numBuffers = %d\n",pComponentPrivate->pOutputBufferList->numBuffers);
1228 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryStart | PERF_BoundaryCleanup);
1230 if (pComponentPrivate->pInputBufferList->numBuffers ||
1231 pComponentPrivate->pOutputBufferList->numBuffers) {
1232 OMX_ERROR2(pComponentPrivate->dbg, "Wait for InIdle_mutex\n");
1233 pComponentPrivate->InIdle_goingtoloaded = 1;
1235 pthread_mutex_lock(&pComponentPrivate->InIdle_mutex);
1236 pthread_cond_wait(&pComponentPrivate->InIdle_threshold, &pComponentPrivate->InIdle_mutex);
1237 pthread_mutex_unlock(&pComponentPrivate->InIdle_mutex);
1239 OMX_WaitForEvent(&(pComponentPrivate->InIdle_event));
1245 OMX_PRSTATE2(pComponentPrivate->dbg, "In side OMX_StateLoaded State: \n");
1246 WBAMR_DEC_CleanupInitParams(pComponentPrivate->pHandle);
1252 if (pComponentPrivate->ptrLibLCML != NULL)
1254 OMX_PRDSP2(pComponentPrivate->dbg, "OMX_WbAmrDecoder.c Closing LCML library\n");
1255 dlclose( pComponentPrivate->ptrLibLCML );
1256 pComponentPrivate->ptrLibLCML = NULL;
1260 PERF_SendingCommand(pComponentPrivate->pPERF, -1, 0, PERF_ModuleComponent);
1262 OMX_PRINT2(pComponentPrivate->dbg, "In side OMX_StateLoaded State: \n");
1264 OMX_ERROR4(pComponentPrivate->dbg, "Error: in Destroying the codec: no. %x\n", eError);
1267 OMX_PRDSP1(pComponentPrivate->dbg, "WBAMR_DEC_HandleCommand: Cmd Loaded\n");
1269 pComponentPrivate->bInitParamsInitialized = 0;
1270 pComponentPrivate->bLoadedCommandPending = OMX_FALSE;
1275 OMX_PRSTATE2(pComponentPrivate->dbg, "WBAMR_DEC_HandleCommand: Cmd Pause\n");
1276 if (pComponentPrivate->curState == commandedState){
1277 pComponentPrivate->cbInfo.EventHandler (pHandle,
1283 OMX_ERROR4(pComponentPrivate->dbg, "Error: Same State Given by \
1287 if (pComponentPrivate->curState != OMX_StateExecuting &&
1288 pComponentPrivate->curState != OMX_StateIdle) {
1289 OMX_PRINT2(pComponentPrivate->dbg, "Comp: OMX_AmrDecUtils.c\n");
1290 pComponentPrivate->cbInfo.EventHandler (pHandle,
1296 OMX_ERROR4(pComponentPrivate->dbg, "Error: Invalid State Given by \
1301 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryComplete | PERF_BoundarySteadyState);
1307 OMX_ERROR4(pComponentPrivate->dbg, "Error: in Pausing the codec\n");
1308 pComponentPrivate->curState = OMX_StateInvalid;
1309 pComponentPrivate->cbInfo.EventHandler(pHandle,
1326 OMX_PRINT2(pComponentPrivate->dbg, "Comp: OMX_AmrDecUtils.c\n");
1331 if (pComponentPrivate->curState == commandedState){
1332 OMX_PRINT2(pComponentPrivate->dbg, "Comp: OMX_AmrDecUtils.c\n");
1333 pComponentPrivate->cbInfo.EventHandler (pHandle,
1339 OMX_ERROR4(pComponentPrivate->dbg, "Error: Same State Given by \
1342 else if (pComponentPrivate->curState == OMX_StateLoaded) {
1343 OMX_PRINT2(pComponentPrivate->dbg, "Comp: OMX_AmrDecUtils.c\n");
1354 pComponentPrivate->curState = OMX_StateWaitForResources;
1355 pComponentPrivate->cbInfo.EventHandler(
1357 OMX_EventCmdComplete, OMX_CommandStateSet,pComponentPrivate->curState,NULL);
1360 OMX_PRINT2(pComponentPrivate->dbg, "Comp: OMX_AmrDecUtils.c\n");
1361 pComponentPrivate->cbInfo.EventHandler(pHandle,
1371 OMX_PRSTATE2(pComponentPrivate->dbg, "WBAMR_DEC_HandleCommand: Cmd OMX_StateInvalid:\n");
1372 if (pComponentPrivate->curState == commandedState){
1373 pComponentPrivate->cbInfo.EventHandler (pHandle,
1379 OMX_ERROR4(pComponentPrivate->dbg, "Error: Same State Given by \
1383 OMX_PRINT2(pComponentPrivate->dbg, "Comp: OMX_AmrDecUtils.c\n");
1384 if (pComponentPrivate->curState != OMX_StateWaitForResources &&
1385 pComponentPrivate->curState != OMX_StateLoaded) {
1392 pComponentPrivate->curState = OMX_StateInvalid;
1393 pComponentPrivate->cbInfo.EventHandler(pHandle,
1404 OMX_PRSTATE2(pComponentPrivate->dbg, "WBAMR_DEC_HandleCommand: Cmd OMX_StateMax::\n");
1411 OMX_PRCOMM1(pComponentPrivate->dbg, "command OMX_CommandMarkBuffer received\n");
1412 if(!pComponentPrivate->pMarkBuf){
1413 OMX_PRCOMM1(pComponentPrivate->dbg, "command OMX_CommandMarkBuffer received\n");
1415 pComponentPrivate->pMarkBuf = (OMX_MARKTYPE *)(commandData);
1419 if (!pComponentPrivate->bDisableCommandPending) {
1422 pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->bEnabled = OMX_FALSE;
1423 for (i=0; i < pComponentPrivate->pInputBufferList->numBuffers; i++) {
1424 if (WBAMR_DEC_IsPending(pComponentPrivate,pComponentPrivate->pInputBufferList->pBufHdr[i],OMX_DirInput)) {
1428 PERF_SendingFrame(pComponentPrivate->pPERFcomp,
1429 PREF(pComponentPrivate->pInputBufferList->pBufHdr[i], pBuffer),
1433 WBAMR_DEC_ClearPending(pComponentPrivate,pComponentPrivate->pInputBufferList->pBufHdr[i],OMX_DirInput,__LINE__);
1434 pComponentPrivate->nEmptyBufferDoneCount++;
1435 pComponentPrivate->cbInfo.EmptyBufferDone (
1436 pComponentPrivate->pHandle,
1437 pComponentPrivate->pHandle->pApplicationPrivate,
1438 pComponentPrivate->pInputBufferList->pBufHdr[i]
1440 SignalIfAllBuffersAreReturned(pComponentPrivate);
1446 pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]->bEnabled = OMX_FALSE;
1447 if (pComponentPrivate->curState == OMX_StateExecuting) {
1448 pComponentPrivate->bNoIdleOnStop = OMX_TRUE;
1449 OMX_PRINT1(pComponentPrivate->dbg, "OMX_WBAmrDec_Utils.c :: Calling LCML_ControlCodec()\n");
1451 if (pComponentPrivate->codecStop_waitingsignal == 0){
1452 pthread_mutex_lock(&pComponentPrivate->codecStop_mutex);
1457 if (pComponentPrivate->codecStop_waitingsignal == 0){
1458 pthread_cond_wait(&pComponentPrivate->codecStop_threshold, &pComponentPrivate->codecStop_mutex);
1459 pComponentPrivate->codecStop_waitingsignal = 0;
1460 pthread_mutex_unlock(&pComponentPrivate->codecStop_mutex);
1466 OMX_PRCOMM2(pComponentPrivate->dbg, "commandData = %ld\n",commandData);
1467 OMX_PRCOMM2(pComponentPrivate->dbg, "pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->bPopulated = %d\n",pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->bPopulated);
1468 OMX_PRCOMM2(pComponentPrivate->dbg, "pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]->bPopulated = %d\n",pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]->bPopulated);
1470 if(!pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->bPopulated){
1472 pComponentPrivate->cbInfo.EventHandler(pHandle,
1478 OMX_PRCOMM1(pComponentPrivate->dbg, "OMX_WBAmrDec_Utils.c :: Clearing bDisableCommandPending\n");
1479 pComponentPrivate->bDisableCommandPending = 0;
1482 pComponentPrivate->bDisableCommandPending = 1;
1483 pComponentPrivate->bDisableCommandParam = commandData;
1488 if (!pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]->bPopulated){
1490 pComponentPrivate->cbInfo.EventHandler(pHandle,
1496 OMX_PRCOMM1(pComponentPrivate->dbg, "OMX_WBAmrDec_Utils.c :: Clearing bDisableCommandPending\n");
1497 pComponentPrivate->bDisableCommandPending = 0;
1500 pComponentPrivate->bDisableCommandPending = 1;
1501 pComponentPrivate->bDisableCommandParam = commandData;
1506 if (!pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->bPopulated &&
1507 !pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]->bPopulated){
1510 pComponentPrivate->cbInfo.EventHandler(pHandle,
1517 pComponentPrivate->cbInfo.EventHandler(pHandle,
1523 OMX_PRCOMM1(pComponentPrivate->dbg, "OMX_WBAmrDec_Utils.c :: Clearing bDisableCommandPending\n");
1524 pComponentPrivate->bDisableCommandPending = 0;
1527 pComponentPrivate->bDisableCommandPending = 1;
1528 pComponentPrivate->bDisableCommandParam = commandData;
1534 if(!pComponentPrivate->bEnableCommandPending) {
1537 OMX_PRCOMM2(pComponentPrivate->dbg, "setting input port to enabled\n");
1538 pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->bEnabled = OMX_TRUE;
1539 OMX_PRCOMM2(pComponentPrivate->dbg, "pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->bEnabled = %d\n",
1540 pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->bEnabled);
1542 if(pComponentPrivate->AlloBuf_waitingsignal)
1544 pComponentPrivate->AlloBuf_waitingsignal = 0;
1550 if(pComponentPrivate->AlloBuf_waitingsignal)
1552 pComponentPrivate->AlloBuf_waitingsignal = 0;
1554 pthread_mutex_lock(&pComponentPrivate->AlloBuf_mutex);
1555 pthread_cond_signal(&pComponentPrivate->AlloBuf_threshold);
1556 pthread_mutex_unlock(&pComponentPrivate->AlloBuf_mutex);
1558 OMX_SignalEvent(&(pComponentPrivate->AlloBuf_event));
1561 if (pComponentPrivate->curState == OMX_StateExecuting) {
1563 pComponentPrivate->bDspStoppedWhileExecuting = OMX_FALSE;
1568 OMX_PRCOMM2(pComponentPrivate->dbg, "setting output port to enabled\n");
1569 pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]->bEnabled = OMX_TRUE;
1570 OMX_PRCOMM2(pComponentPrivate->dbg, "pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]->bEnabled = %d\n",pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]->bEnabled);
1575 if (pComponentPrivate->curState == OMX_StateLoaded ||
1576 pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->bPopulated){
1578 pComponentPrivate->cbInfo.EventHandler(pHandle,
1584 pComponentPrivate->bEnableCommandPending = 0;
1587 pComponentPrivate->bEnableCommandPending = 1;
1588 pComponentPrivate->bEnableCommandParam = commandData;
1592 if (pComponentPrivate->curState == OMX_StateLoaded ||
1593 pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]->bPopulated){
1595 pComponentPrivate->cbInfo.EventHandler(pHandle,
1601 pComponentPrivate->bEnableCommandPending = 0;
1604 pComponentPrivate->bEnableCommandPending = 1;
1605 pComponentPrivate->bEnableCommandParam = commandData;
1610 if (pComponentPrivate->curState == OMX_StateLoaded ||
1611 (pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->bPopulated
1612 && pComponentPrivate->pPortDef[WBAMR_DEC_OUTPUT_PORT]->bPopulated)){
1614 pComponentPrivate->cbInfo.EventHandler(pHandle,
1621 pComponentPrivate->cbInfo.EventHandler(pHandle,
1628 pComponentPrivate->bEnableCommandPending = 0;
1629 WBAMR_DEC_Fill_LCMLInitParamsEx(pComponentPrivate->pHandle);
1632 pComponentPrivate->bEnableCommandPending = 1;
1633 pComponentPrivate->bEnableCommandParam = commandData;
1637 pthread_mutex_lock(&pComponentPrivate->AlloBuf_mutex);
1638 pthread_cond_signal(&pComponentPrivate->AlloBuf_threshold);
1639 pthread_mutex_unlock(&pComponentPrivate->AlloBuf_mutex);
1641 OMX_SignalEvent(&(pComponentPrivate->AlloBuf_event));
1647 OMX_PRCOMM2(pComponentPrivate->dbg, "Flushing input port %d\n",pComponentPrivate->nUnhandledEmptyThisBuffers);
1649 if(pComponentPrivate->nUnhandledEmptyThisBuffers == 0) {
1650 pComponentPrivate->bFlushInputPortCommandPending = OMX_FALSE;
1656 OMX_PRCOMM2(pComponentPrivate->dbg, "Flushing input port\n");
1664 pComponentPrivate->bFlushInputPortCommandPending = OMX_TRUE;
1668 OMX_PRCOMM2(pComponentPrivate->dbg, "Flushing out port %d\n",pComponentPrivate->nUnhandledFillThisBuffers);
1669 if (pComponentPrivate->nUnhandledFillThisBuffers == 0) {
1670 pComponentPrivate->bFlushOutputPortCommandPending = OMX_FALSE;
1676 OMX_PRCOMM2(pComponentPrivate->dbg, "Flushing output port\n");
1684 pComponentPrivate->bFlushOutputPortCommandPending = OMX_TRUE;
1689 OMX_PRINT1(pComponentPrivate->dbg, "Exiting WBAMR_DEC_HandleCommand Function\n");
1690 OMX_PRINT1(pComponentPrivate->dbg, "Returning %d\n",eError);
1692 pComponentPrivate->cbInfo.EventHandler(pComponentPrivate->pHandle,
1693 pComponentPrivate->pHandle->pApplicationPrivate,
1708 * @param pComponentPrivate Component private data
1719 WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate)
1725 pComponentPrivate->pLcmlHandle;
1746 OMX_PRINT1(pComponentPrivate->dbg, "Entering WBAMR_DEC_HandleDataBuf_FromApp Function\n");
1748 holdBufferSize = INPUT_WBAMRDEC_BUFFER_SIZE * (pComponentPrivate->pInputBufferList->numBuffers + 1);
1752 OMX_ERROR4(pComponentPrivate->dbg, "The PBufHeader is not found in the list\n");
1761 pComponentPrivate->nUnhandledEmptyThisBuffers--;
1762 if (pComponentPrivate->curState == OMX_StateIdle){
1763 pComponentPrivate->cbInfo.EmptyBufferDone (pComponentPrivate->pHandle,
1764 pComponentPrivate->pHandle->pApplicationPrivate,
1766 pComponentPrivate->nEmptyBufferDoneCount++;
1767 SignalIfAllBuffersAreReturned(pComponentPrivate);
1768 OMX_PRBUFFER2(pComponentPrivate->dbg, ":: %d %s In idle state return input buffers\n", __LINE__, __FUNCTION__);
1771 pPortDefIn = pComponentPrivate->pPortDef[OMX_DirInput];
1774 if ( pComponentPrivate->nHoldLength == 0 )
1776 if (pComponentPrivate->mimemode == WBAMRDEC_MIMEMODE)
1778 OMX_PRBUFFER2(pComponentPrivate->dbg, "WBAMR_DEC_HandleDataBuf_FromApp - reading WBAMR_DEC_MIMEMODE\n");
1779 if(pComponentPrivate->using_rtsp==1){ /* formating data */
1786 OMX_ERROR4(pComponentPrivate->dbg, "%d :WBAMR_DEC_HandleDataBuf_FromApp ERROR: Couldn't realloc memory!",__LINE__);
1802 OMX_ERROR4(pComponentPrivate->dbg, "%d :: WBAMR_DEC_HandleDataBuf_FromApp :: ERROR: Trying to write beyond buffer boundaries!",__LINE__);
1809 offset+=pComponentPrivate->wbamrMimeBytes[index];
1811 OMX_ERROR4(pComponentPrivate->dbg, "%d :: WBAMR_DEC_HandleDataBuf_FromApp :: ERROR: Trying to write beyond buffer boundaries!",__LINE__);
1819 if (pComponentPrivate->wbamrMimeBytes[index] > nFilledLenLocal){
1822 nFilledLenLocal -= pComponentPrivate->wbamrMimeBytes[index];
1840 OMX_ERROR4(pComponentPrivate->dbg, "%d :: OMX_WbAmrDec_Utils.c :: ERROR: Trying to write beyond buffer boundaries!",__LINE__);
1849 (pComponentPrivate->wbamrMimeBytes[index] == 0))) {
1850 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: OMX_WbAmrDec_Utils.c :: no more frames index=%d", __LINE__, (int)index);
1852 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: OMX_WbAmrDec_Utils.c :: no more frames mimebytes=%d", __LINE__, (int) pComponentPrivate->wbamrMimeBytes[index]);
1855 pBufHeader->nFilledLen -= pComponentPrivate->wbamrMimeBytes[index];
1856 i = (nFrames*INPUT_WBAMRDEC_BUFFER_SIZE_MIME) + (OMX_U16)pComponentPrivate->wbamrMimeBytes[index];
1861 else if (pComponentPrivate->mimemode == WBAMRDEC_IF2)
1863 OMX_PRINT2(pComponentPrivate->dbg, "WBAMR_DEC_HandleDataBuf_FromApp - reading WBAMRDEC_IF2\n");
1875 OMX_ERROR4(pComponentPrivate->dbg, "%d :: OMX_WbAmrDec_Utils.c :: ERROR: Trying to write beyond buffer boundaries!",__LINE__);
1884 (pComponentPrivate->wbamrIf2Bytes[index] == 0))) {
1885 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: OMX_WbAmrDec_Utils.c :: no more frames index=%d", __LINE__, (int)index);
1887 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: OMX_WbAmrDec_Utils.c :: no more frames mimebytes=%d", __LINE__, (int)pComponentPrivate->wbamrIf2Bytes[index]);
1890 pBufHeader->nFilledLen -= pComponentPrivate->wbamrIf2Bytes[index];
1891 i = (nFrames *INPUT_WBAMRDEC_BUFFER_SIZE_IF2) + (OMX_U16)pComponentPrivate->wbamrIf2Bytes[index];
1899 OMX_PRBUFFER2(pComponentPrivate->dbg, "WBAMR_DEC_HandleDataBuf_FromApp - reading WBAMR_DEC_NONMIMEMODE\n");
1904 if ( nFrames>=1 && (WBAMRDEC_FORMATCONFORMANCE == pComponentPrivate->mimemode))
1907 pComponentPrivate->nHoldLength = pBufHeader->nFilledLen - frameLength*nFrames;
1908 if ( pComponentPrivate->nHoldLength > 0 ) {/* something need to be hold in iHoldBuffer */
1909 if (pComponentPrivate->pHoldBuffer == NULL) {
1910 OMX_MALLOC_SIZE(pComponentPrivate->pHoldBuffer, (INPUT_WBAMRDEC_BUFFER_SIZE * (pComponentPrivate->pInputBufferList->numBuffers + 3)),void);
1915 if (pComponentPrivate->nHoldLength >
1916 (INPUT_WBAMRDEC_BUFFER_SIZE * (pComponentPrivate->pInputBufferList->numBuffers + 3)))
1918 OMX_ERROR4(pComponentPrivate->dbg, "%d :: OMX_WbAmrDec_Utils.c :: ERROR: Trying to write beyond buffer boundaries!",__LINE__);
1921 memcpy (pComponentPrivate->pHoldBuffer, pExtraData, pComponentPrivate->nHoldLength);
1926 if (pComponentPrivate->mimemode == WBAMRDEC_FORMATCONFORMANCE)
1929 pComponentPrivate->nHoldLength = pBufHeader->nFilledLen;
1931 if (pComponentPrivate->pHoldBuffer == NULL) {
1932 OMX_MALLOC_SIZE(pComponentPrivate->pHoldBuffer, (INPUT_WBAMRDEC_BUFFER_SIZE * (pComponentPrivate->pInputBufferList->numBuffers + 3)),void);
1936 memset (pComponentPrivate->pHoldBuffer,
1938 INPUT_WBAMRDEC_BUFFER_SIZE * (pComponentPrivate->pInputBufferList->numBuffers + 1));
1939 memcpy (pComponentPrivate->pHoldBuffer, pBufHeader->pBuffer, pComponentPrivate->nHoldLength);
1941 OMX_PRBUFFER2(pComponentPrivate->dbg, "Calling EmptyBufferDone\n");
1942 if (pComponentPrivate->curState != OMX_StatePause) {
1943 pComponentPrivate->nEmptyBufferDoneCount++;
1945 PERF_SendingFrame(pComponentPrivate->pPERFcomp,
1950 pComponentPrivate->cbInfo.EmptyBufferDone (pComponentPrivate->pHandle,
1951 pComponentPrivate->pHandle->pApplicationPrivate,
1953 SignalIfAllBuffersAreReturned(pComponentPrivate);
1956 pComponentPrivate->pInputBufHdrPending[pComponentPrivate->nNumInputBufPending++] = pBufHeader;
1966 pExtraData = pComponentPrivate->pHoldBuffer + pComponentPrivate->nHoldLength;
1968 pComponentPrivate->nHoldLength += pBufHeader->nFilledLen;
1971 if (pComponentPrivate->mimemode == WBAMRDEC_MIMEMODE)
1973 frameType = pComponentPrivate->pHoldBuffer[0];
1975 frameLength = pComponentPrivate->wbamrMimeBytes[index];
1977 else if(pComponentPrivate->mimemode == WBAMRDEC_IF2)
1979 frameType = pComponentPrivate->pHoldBuffer[0];
1981 frameLength = pComponentPrivate->wbamrIf2Bytes[index];
1987 nFrames = (OMX_U8)(pComponentPrivate->nHoldLength / frameLength);
1989 /* Copy the data from pComponentPrivate->pHoldBuffer to pBufHeader->pBuffer*/
1993 OMX_ERROR4(pComponentPrivate->dbg, "%d :: OMX_WbAmrDec_Utils.c :: ERROR: Trying to write beyond buffer boundaries!",__LINE__);
1996 memcpy(pBufHeader->pBuffer,pComponentPrivate->pHoldBuffer,nFrames*frameLength);
1999 pComponentPrivate->nHoldLength = pComponentPrivate->nHoldLength - pBufHeader->nFilledLen;
2001 pExtraData = pComponentPrivate->pHoldBuffer + pBufHeader->nFilledLen;
2002 if (pComponentPrivate->nHoldLength < pBufHeader->nFilledLen)
2003 memcpy(pComponentPrivate->pHoldBuffer,pExtraData,pComponentPrivate->nHoldLength);
2005 memmove(pComponentPrivate->pHoldBuffer,pExtraData,pComponentPrivate->nHoldLength);
2007 /*pExtraData = pComponentPrivate->pHoldBuffer + pComponentPrivate->nHoldLength;*/
2008 /*mset(pExtraData,0,holdBufferSize - pComponentPrivate->nHoldLength);*/
2011 if (pComponentPrivate->curState != OMX_StatePause) {
2012 OMX_PRBUFFER2(pComponentPrivate->dbg, "Calling EmptyBufferDone\n");
2013 pComponentPrivate->nEmptyBufferDoneCount++;
2015 PERF_SendingFrame(pComponentPrivate->pPERFcomp,
2020 pComponentPrivate->cbInfo.EmptyBufferDone (
2021 pComponentPrivate->pHandle,
2022 pComponentPrivate->pHandle->pApplicationPrivate,
2024 SignalIfAllBuffersAreReturned(pComponentPrivate);
2028 pComponentPrivate->pInputBufHdrPending[pComponentPrivate->nNumInputBufPending++] = pBufHeader;
2034 pComponentPrivate->nEmptyBufferDoneCount++;
2036 PERF_SendingFrame(pComponentPrivate->pPERFcomp,
2037 pComponentPrivate->pInputBufferList->pBufHdr[0]->pBuffer,0,PERF_ModuleHLMM);
2039 pComponentPrivate->cbInfo.EmptyBufferDone( pComponentPrivate->pHandle,
2040 pComponentPrivate->pHandle->pApplicationPrivate,
2041 pComponentPrivate->pInputBufferList->pBufHdr[0]);
2042 SignalIfAllBuffersAreReturned(pComponentPrivate);
2050 eError = WBAMR_DEC_GetCorresponding_LCMLHeader(pComponentPrivate,pBufHeader->pBuffer, OMX_DirInput, &pLcmlHdr);
2052 OMX_ERROR4(pComponentPrivate->dbg, "Error: Invalid WBAMR_DEC_Buffer Came ...\n");
2059 if ((pComponentPrivate->nLcml_nCntIp == 1)) {
2060 PERF_Boundary(pComponentPrivate->pPERFcomp,
2064 PERF_SendingFrame(pComponentPrivate->pPERFcomp,
2066 pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->nBufferSize,
2077 pLcmlHdr->pDmmBuf->pReserved, pComponentPrivate->dbg);
2086 (pLcmlHdr->pDmmBuf), pComponentPrivate->dbg);
2089 OMX_ERROR4(pComponentPrivate->dbg, "OMX_DmmMap ERRROR!!!!\n\n");
2105 if (pComponentPrivate->bFrameLost == 1)
2109 pComponentPrivate->bFrameLost = OMX_FALSE;
2115 if(pComponentPrivate->SendAfterEOS == 1){
2116 OMX_PRINT2(pComponentPrivate->dbg, "reconfiguring SN\n");
2117 if(pComponentPrivate->dasfmode == 1) {
2119 OMX_PRDSP2(pComponentPrivate->dbg, "---- Comp: DASF Functionality is ON ---\n");
2120 if(pComponentPrivate->streamID == 0)
2122 OMX_ERROR4(pComponentPrivate->dbg, "**************************************\n");
2123 OMX_ERROR4(pComponentPrivate->dbg, ":: Error = OMX_ErrorInsufficientResources\n");
2124 OMX_ERROR4(pComponentPrivate->dbg, "**************************************\n");
2126 pComponentPrivate->curState = OMX_StateInvalid;
2127 pComponentPrivate->cbInfo.EventHandler(pComponentPrivate->pHandle,
2128 pComponentPrivate->pHandle->pApplicationPrivate,
2135 OMX_MALLOC_SIZE_DSPALIGN(pComponentPrivate->pParams, sizeof(WBAMR_DEC_AudioCodecParams),WBAMR_DEC_AudioCodecParams);
2136 pParams = pComponentPrivate->pParams;
2141 pParams->iStrmId = pComponentPrivate->streamID;
2150 OMX_ERROR4(pComponentPrivate->dbg, "Error Occurred in Codec StreamControl..\n");
2151 pComponentPrivate->curState = OMX_StateInvalid;
2152 pComponentPrivate->cbInfo.EventHandler(pComponentPrivate->pHandle,
2153 pComponentPrivate->pHandle->pApplicationPrivate,
2166 OMX_ERROR4(pComponentPrivate->dbg, "Error Occurred in Codec Start..\n");
2167 pComponentPrivate->curState = OMX_StateInvalid;
2168 pComponentPrivate->cbInfo.EventHandler(pComponentPrivate->pHandle,
2169 pComponentPrivate->pHandle->pApplicationPrivate,
2176 pComponentPrivate->SendAfterEOS = 0;
2183 if(!pComponentPrivate->dasfmode){
2185 pComponentPrivate->pOutputBufferList->pBufHdr[0]->nFlags |= OMX_BUFFERFLAG_EOS;
2187 pComponentPrivate->cbInfo.EventHandler( pComponentPrivate->pHandle,
2188 pComponentPrivate->pHandle->pApplicationPrivate,
2190 pComponentPrivate->pOutputBufferList->pBufHdr[0]->nOutputPortIndex,
2191 pComponentPrivate->pOutputBufferList->pBufHdr[0]->nFlags, NULL);
2193 pComponentPrivate->SendAfterEOS = 1;
2194 OMX_PRINT1(pComponentPrivate->dbg, "OMX_WbAmrDec_Utils.c : pComponentPrivate->SendAfterEOS %d\n",pComponentPrivate->SendAfterEOS);
2200 OMX_PRINT1(pComponentPrivate->dbg, "OMX_WbAmrDec_Utils.c : flushing pFrameParam\n");
2211 pComponentPrivate->arrBufIndex[pComponentPrivate->IpBufindex] = pBufHeader->nTimeStamp;
2213 pComponentPrivate->arrTickCount[pComponentPrivate->IpBufindex] = pBufHeader->nTickCount;
2214 pComponentPrivate->IpBufindex++;
2215 pComponentPrivate->IpBufindex %= pPortDefIn->nBufferCountActual;
2220 OMX_PRBUFFER2(pComponentPrivate->dbg, "Queueing pBufHeader->pBuffer[%d] = %x\n",i,pBufHeader->pBuffer[i]);
2222 if (pComponentPrivate->curState == OMX_StateExecuting)
2224 if (!WBAMR_DEC_IsPending(pComponentPrivate,pBufHeader,OMX_DirInput))
2226 WBAMR_DEC_SetPending(pComponentPrivate,pBufHeader,OMX_DirInput,__LINE__);
2227 if (pComponentPrivate->mimemode == WBAMRDEC_MIMEMODE)
2236 else if (pComponentPrivate->mimemode == WBAMRDEC_IF2)
2258 pComponentPrivate->lcml_nIpBuf++;
2260 }else if(pComponentPrivate->curState == OMX_StatePause){
2261 pComponentPrivate->pInputBufHdrPending[pComponentPrivate->nNumInputBufPending++] = pBufHeader;
2264 if(pComponentPrivate->pOutputBufferList->pBufHdr[0]!=NULL){
2266 pComponentPrivate->pOutputBufferList->pBufHdr[0]->pMarkData = pBufHeader->pMarkData;
2267 pComponentPrivate->pOutputBufferList->pBufHdr[0]->hMarkTargetComponent = pBufHeader->hMarkTargetComponent;
2270 if(pBufHeader->hMarkTargetComponent == pComponentPrivate->pHandle && pBufHeader->pMarkData){
2271 pComponentPrivate->cbInfo.EventHandler(pComponentPrivate->pHandle,
2272 pComponentPrivate->pHandle->pApplicationPrivate,
2282 OMX_PRBUFFER2(pComponentPrivate->dbg, "line %d:: No Frames in Buffer, calling EmptyBufferDone\n",__LINE__);
2283 pComponentPrivate->nEmptyBufferDoneCount++;
2285 PERF_SendingFrame(pComponentPrivate->pPERFcomp,
2290 pComponentPrivate->cbInfo.EmptyBufferDone( pComponentPrivate->pHandle,
2291 pComponentPrivate->pHandle->pApplicationPrivate,
2293 SignalIfAllBuffersAreReturned(pComponentPrivate);
2296 if (pComponentPrivate->bFlushInputPortCommandPending) {
2297 OMX_SendCommand(pComponentPrivate->pHandle,OMX_CommandFlush,0,NULL);
2307 pComponentPrivate->nUnhandledFillThisBuffers--;
2308 if (pComponentPrivate->curState == OMX_StateIdle){
2309 pComponentPrivate->cbInfo.FillBufferDone (pComponentPrivate->pHandle,
2310 pComponentPrivate->pHandle->pApplicationPrivate,
2312 pComponentPrivate->nFillBufferDoneCount++;
2313 SignalIfAllBuffersAreReturned(pComponentPrivate);
2314 OMX_PRBUFFER2(pComponentPrivate->dbg, ":: %d %s In idle state return output buffers\n", __LINE__, __FUNCTION__);
2317 eError = WBAMR_DEC_GetCorresponding_LCMLHeader(pComponentPrivate, pBufHeader->pBuffer, OMX_DirOutput, &pLcmlHdr);
2322 PERF_SendingFrame(pComponentPrivate->pPERFcomp,
2335 pLcmlHdr->pDmmBuf->pReserved, pComponentPrivate->dbg);
2345 pComponentPrivate->dbg);
2349 OMX_ERROR4(pComponentPrivate->dbg, "OMX_DmmMap ERRROR!!!!\n");
2364 OMX_PRINT1(pComponentPrivate->dbg, "OMX_WbAmrDec_Utils.c : flushing pFrameParam output\n");
2372 if (pComponentPrivate->curState == OMX_StateExecuting) {
2373 if (!WBAMR_DEC_IsPending(pComponentPrivate,pBufHeader,OMX_DirOutput)) {
2374 WBAMR_DEC_SetPending(pComponentPrivate,pBufHeader,OMX_DirOutput,__LINE__);
2385 OMX_ERROR4(pComponentPrivate->dbg, "IssuingDSP OP: Error Occurred\n");
2389 pComponentPrivate->lcml_nOpBuf++;
2392 else if (pComponentPrivate->curState == OMX_StatePause) {
2393 pComponentPrivate->pOutputBufHdrPending[pComponentPrivate->nNumOutputBufPending++] = pBufHeader;
2396 if (pComponentPrivate->bFlushOutputPortCommandPending) {
2397 OMX_SendCommand( pComponentPrivate->pHandle,
2410 OMX_PRINT1(pComponentPrivate->dbg, "Exiting from WBAMR_DEC_HandleDataBuf_FromApp \n");
2411 OMX_PRINT1(pComponentPrivate->dbg, "Returning error %d\n",eError);
2413 pComponentPrivate->cbInfo.EventHandler(pComponentPrivate->pHandle,
2414 pComponentPrivate->pHandle->pApplicationPrivate,
2441 WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate = pBufHeader->pPlatformPrivate;
2446 OMX_PRINT1(pComponentPrivate->dbg, "Entering WBAMR_DEC_GetBufferDirection Function\n");
2449 nBuf = pComponentPrivate->pInputBufferList->numBuffers;
2452 pBuf = pComponentPrivate->pInputBufferList->pBufHdr[i];
2456 OMX_PRBUFFER2(pComponentPrivate->dbg, "WBAMR_DEC_Buffer %p is INPUT BUFFER\n", pBufHeader);
2463 nBuf = pComponentPrivate->pOutputBufferList->numBuffers;
2467 pBuf = pComponentPrivate->pOutputBufferList->pBufHdr[i];
2471 OMX_PRBUFFER2(pComponentPrivate->dbg, "WBAMR_DEC_Buffer %p is OUTPUT BUFFER\n", pBufHeader);
2479 OMX_ERROR4(pComponentPrivate->dbg, "WBAMR_DEC_Buffer %p is Not Found in the List\n",pBufHeader);
2484 OMX_PRINT1(pComponentPrivate->dbg, "Exiting WBAMR_DEC_GetBufferDirection Function\n");
2520 WBAMR_DEC_COMPONENT_PRIVATE* pComponentPrivate = NULL;
2521 pComponentPrivate = (WBAMR_DEC_COMPONENT_PRIVATE*)((LCML_DSP_INTERFACE*)args[6])->pComponentPrivate;
2523 pHandle = pComponentPrivate->pHandle;
2525 OMX_PRINT1(pComponentPrivate->dbg, "Entering the WBAMR_DEC_LCML_Callback Function\n");
2526 OMX_PRINT2(pComponentPrivate->dbg, "args = %p ",args[0]);
2527 OMX_PRINT2(pComponentPrivate->dbg, "event = %d\n",event);
2532 OMX_PRDSP2(pComponentPrivate->dbg, "[LCML CALLBACK EVENT] EMMCodecDspError\n");
2536 OMX_ERROR4(pComponentPrivate->dbg, "[LCML CALLBACK EVENT] EMMCodecInternalError\n");
2540 OMX_ERROR4(pComponentPrivate->dbg, "[LCML CALLBACK EVENT] EMMCodecInitError\n");
2544 OMX_PRDSP2(pComponentPrivate->dbg, "[LCML CALLBACK EVENT] EMMCodecDspMessageRecieved\n");
2548 OMX_PRDSP2(pComponentPrivate->dbg, "[LCML CALLBACK EVENT] EMMCodecBufferProcessed\n");
2552 OMX_PRDSP2(pComponentPrivate->dbg, "[LCML CALLBACK EVENT] EMMCodecProcessingStarted\n");
2556 OMX_PRDSP2(pComponentPrivate->dbg, "[LCML CALLBACK EVENT] EMMCodecProcessingPaused\n");
2560 OMX_PRDSP2(pComponentPrivate->dbg, "[LCML CALLBACK EVENT] EMMCodecProcessingStoped\n");
2564 OMX_PRDSP2(pComponentPrivate->dbg, "[LCML CALLBACK EVENT] EMMCodecProcessingEof\n");
2568 OMX_PRDSP2(pComponentPrivate->dbg, "[LCML CALLBACK EVENT] EMMCodecBufferNotProcessed\n");
2572 OMX_PRDSP2(pComponentPrivate->dbg, "[LCML CALLBACK EVENT] EMMCodecAlgCtrlAck\n");
2576 OMX_PRDSP2(pComponentPrivate->dbg, "[LCML CALLBACK EVENT] EMMCodecStrmCtrlAck\n");
2584 (pComponentPrivate->pPortDef[WBAMR_DEC_INPUT_PORT]->bEnabled)) {
2585 OMX_PRBUFFER2(pComponentPrivate->dbg, "Input: pBuffer = %p\n", pBuffer);
2587 eError = WBAMR_DEC_GetCorresponding_LCMLHeader(pComponentPrivate,pBuffer, OMX_DirInput, &pLcmlHdr);
2589 PERF_ReceivedFrame(pComponentPrivate->pPERFcomp,
2595 OMX_ERROR4(pComponentPrivate->dbg, "Error: Invalid WBAMR_DEC_Buffer Came ...\n");
2598 WBAMR_DEC_ClearPending(pComponentPrivate,pLcmlHdr->buffer,OMX_DirInput,__LINE__);
2600 OMX_PRBUFFER2(pComponentPrivate->dbg, "Calling EmptyBufferDone\n");
2601 OMX_PRBUFFER1(pComponentPrivate->dbg, "pComponentPrivate->nHoldLength = %ld\n",pComponentPrivate->nHoldLength);
2602 pComponentPrivate->nEmptyBufferDoneCount++;
2604 PERF_SendingFrame(pComponentPrivate->pPERFcomp,
2609 pComponentPrivate->cbInfo.EmptyBufferDone (pHandle,
2612 SignalIfAllBuffersAreReturned(pComponentPrivate);
2613 pComponentPrivate->lcml_nIpBuf--;
2614 pComponentPrivate->app_nBuf++;
2617 OMX_PRBUFFER2(pComponentPrivate->dbg, "Output: pBufferr = %p\n", pBuffer);
2619 eError = WBAMR_DEC_GetCorresponding_LCMLHeader(pComponentPrivate,pBuffer, OMX_DirOutput, &pLcmlHdr);
2621 OMX_ERROR4(pComponentPrivate->dbg, "Error: Invalid WBAMR_DEC_Buffer Came ...\n");
2624 if (!pComponentPrivate->bStopSent)
2631 OMX_PRDSP2(pComponentPrivate->dbg, "WBAMR_DEC_LCML_Callback::: pLcmlHdr->buffer->nFilledLen = %ld\n",pLcmlHdr->buffer->nFilledLen);
2636 PERF_ReceivedFrame(pComponentPrivate->pPERFcomp,
2640 pComponentPrivate->nLcml_nCntOpReceived++;
2641 if ((pComponentPrivate->nLcml_nCntIp >= 1) && (pComponentPrivate->nLcml_nCntOpReceived == 1)) {
2642 PERF_Boundary(pComponentPrivate->pPERFcomp,
2647 WBAMR_DEC_ClearPending(pComponentPrivate,pLcmlHdr->buffer,OMX_DirOutput,__LINE__);
2648 pComponentPrivate->nOutStandingFillDones++;
2649 OMX_PRINT2(pComponentPrivate->dbg, "Incremented pComponentPrivate->nOutStandingFillDones = %ld\n",pComponentPrivate->nOutStandingFillDones);
2654 OMX_PRCOMM2(pComponentPrivate->dbg, "On Component receiving OMX_BUFFERFLAG_EOS on output\n");
2656 OMX_PRINT1(pComponentPrivate->dbg, "OMX_WbAmrDec_Utils.c : flushing pFrameParam2\n");
2667 pLcmlHdr->buffer->nTimeStamp = (OMX_TICKS)pComponentPrivate->arrBufIndex[pComponentPrivate->OpBufindex];
2669 pLcmlHdr->buffer->nTickCount = pComponentPrivate->arrTickCount[pComponentPrivate->OpBufindex];
2670 pComponentPrivate->OpBufindex++;
2671 pComponentPrivate->OpBufindex %= pComponentPrivate->pPortDef[OMX_DirInput]->nBufferCountActual;
2673 pComponentPrivate->LastOutbuf = pLcmlHdr->buffer;
2674 pComponentPrivate->num_Reclaimed_Op_Buff++;
2675 OMX_PRBUFFER2(pComponentPrivate->dbg, "Calling FillBufferDone From Line\n");
2677 PERF_SendingBuffer(pComponentPrivate->pPERFcomp,
2682 pComponentPrivate->cbInfo.FillBufferDone (pHandle,
2685 SignalIfAllBuffersAreReturned(pComponentPrivate);
2686 pComponentPrivate->lcml_nOpBuf--;
2687 pComponentPrivate->app_nBuf++;
2688 pComponentPrivate->nFillBufferDoneCount++;
2689 pComponentPrivate->nOutStandingFillDones--;
2690 OMX_PRBUFFER2(pComponentPrivate->dbg, "Incrementing app_nBuf = %ld\n",pComponentPrivate->app_nBuf);
2693 OMX_PRINT1(pComponentPrivate->dbg, "GOT MESSAGE USN_DSPACK_STRMCTRL ----\n");
2695 pHandle = pComponentPrivate->pHandle;
2698 OMX_PRCOMM2(pComponentPrivate->dbg, "Flushing input port\n");
2699 for (i=0; i < pComponentPrivate->nNumInputBufPending; i++) {
2700 pComponentPrivate->cbInfo.EmptyBufferDone (pHandle,
2702 pComponentPrivate->pInputBufHdrPending[i]);
2703 pComponentPrivate->pInputBufHdrPending[i] = NULL;
2704 SignalIfAllBuffersAreReturned(pComponentPrivate);
2706 pComponentPrivate->nNumInputBufPending=0;
2707 pComponentPrivate->cbInfo.EventHandler(pHandle,
2714 OMX_ERROR4(pComponentPrivate->dbg, "LCML reported error while flushing input port\n");
2720 OMX_PRCOMM1(pComponentPrivate->dbg, "Flushing output port\n");
2721 for (i=0; i < pComponentPrivate->nNumOutputBufPending; i++) {
2722 pComponentPrivate->cbInfo.FillBufferDone (pHandle,
2724 pComponentPrivate->pOutputBufHdrPending[i]);
2725 pComponentPrivate->pOutputBufHdrPending[i] = NULL;
2726 pComponentPrivate->nFillBufferDoneCount++;
2727 SignalIfAllBuffersAreReturned(pComponentPrivate);
2729 pComponentPrivate->nNumOutputBufPending=0;
2730 pComponentPrivate->cbInfo.EventHandler(pHandle,
2737 OMX_ERROR4(pComponentPrivate->dbg, "LCML reported error while flushing output port\n");
2744 for (i = 0; i < pComponentPrivate->nNumInputBufPending; i++) {
2745 pComponentPrivate->cbInfo.EmptyBufferDone (pComponentPrivate->pHandle,
2746 pComponentPrivate->pHandle->pApplicationPrivate,
2747 pComponentPrivate->pInputBufHdrPending[i]);
2748 pComponentPrivate->pInputBufHdrPending[i] = NULL;
2749 pComponentPrivate->nEmptyBufferDoneCount++;
2750 SignalIfAllBuffersAreReturned(pComponentPrivate);
2752 pComponentPrivate->nNumInputBufPending = 0;
2753 for (i=0; i < pComponentPrivate->nNumOutputBufPending; i++) {
2754 pComponentPrivate->cbInfo.FillBufferDone (pComponentPrivate->pHandle,
2755 pComponentPrivate->pHandle->pApplicationPrivate,
2756 pComponentPrivate->pOutputBufHdrPending[i]);
2757 pComponentPrivate->nFillBufferDoneCount++;
2758 SignalIfAllBuffersAreReturned(pComponentPrivate);
2759 pComponentPrivate->nOutStandingFillDones--;
2760 pComponentPrivate->pOutputBufHdrPending[i] = NULL;
2762 pComponentPrivate->nNumOutputBufPending=0;
2763 pthread_mutex_lock(&pComponentPrivate->codecStop_mutex);
2764 if(pComponentPrivate->codecStop_waitingsignal == 0){
2765 pComponentPrivate->codecStop_waitingsignal = 1;
2766 pthread_cond_signal(&pComponentPrivate->codecStop_threshold);
2767 OMX_PRINT2(pComponentPrivate->dbg, "stop ack. received. stop waiting for sending disable command completed\n");
2769 pthread_mutex_unlock(&pComponentPrivate->codecStop_mutex);
2771 OMX_PRINT2(pComponentPrivate->dbg, "pComponentPrivate->bNoIdleOnStop = %ld\n",pComponentPrivate->bNoIdleOnStop);
2772 if (!pComponentPrivate->bNoIdleOnStop) {
2773 pComponentPrivate->nNumOutputBufPending=0;
2774 /* pComponentPrivate->ProcessingInputBuf=0;
2775 pComponentPrivate->ProcessingOutputBuf=0; */
2776 pComponentPrivate->nHoldLength = 0;
2777 /* pComponentPrivate->InBuf_Eos_alreadysent =0; */
2778 /* OMX_NBMEMFREE_STRUCT(pComponentPrivate->pHoldBuffer); */
2779 /* OMX_NBMEMFREE_STRUCT(pComponentPrivate->iMMFDataLastBuffer); */
2780 pComponentPrivate->curState = OMX_StateIdle;
2789 if((pComponentPrivate->nEmptyThisBufferCount != pComponentPrivate->nEmptyBufferDoneCount) || (pComponentPrivate->nFillThisBufferCount != pComponentPrivate->nFillBufferDoneCount)) {
2792 OMX_ERROR4(pComponentPrivate->dbg, "%d :: UTIL: bufferReturned_mutex mutex lock error\n",__LINE__);
2794 OMX_PRINT2(pComponentPrivate->dbg, ":: pthread_cond_waiting for OMX to return all input and outbut buffers\n");
2796 OMX_PRINT2(pComponentPrivate->dbg, ":: OMX has returned all input and output buffers\n");
2799 OMX_ERROR4(pComponentPrivate->dbg, "%d :: UTIL: bufferReturned_mutex mutex unlock error\n",__LINE__);
2807 if (pComponentPrivate->bPreempted == 0) {
2808 pComponentPrivate->cbInfo.EventHandler(pHandle,
2812 pComponentPrivate->curState,
2816 pComponentPrivate->cbInfo.EventHandler(pHandle,
2825 pComponentPrivate->bNoIdleOnStop = OMX_FALSE;
2826 pComponentPrivate->bDspStoppedWhileExecuting = OMX_TRUE;
2830 pComponentPrivate->curState = OMX_StatePause;
2832 pComponentPrivate->cbInfo.EventHandler(pComponentPrivate->pHandle,
2833 pComponentPrivate->pHandle->pApplicationPrivate,
2836 pComponentPrivate->curState,
2860 pComponentPrivate->bIsInvalidState=OMX_TRUE;
2861 pComponentPrivate->curState = OMX_StateInvalid;
2862 pHandle = pComponentPrivate->pHandle;
2863 pComponentPrivate->cbInfo.EventHandler(pHandle,
2875 WBAMRDEC_HandleUSNError (pComponentPrivate, (OMX_U32)args[5]);
2884 OMX_PRSTATE2(pComponentPrivate->dbg, "commandedState = %p\n",args[0]);
2885 OMX_PRINT2(pComponentPrivate->dbg, "arg1 = %p\n",args[1]);
2886 OMX_PRINT2(pComponentPrivate->dbg, "arg2 = %p\n",args[2]);
2894 pComponentPrivate->bIsInvalidState=OMX_TRUE;
2895 pComponentPrivate->curState = OMX_StateInvalid;
2896 pHandle = pComponentPrivate->pHandle;
2897 pComponentPrivate->cbInfo.EventHandler(pHandle,
2908 pComponentPrivate->bIsInvalidState=OMX_TRUE;
2909 pComponentPrivate->curState = OMX_StateInvalid;
2910 pHandle = pComponentPrivate->pHandle;
2911 pComponentPrivate->cbInfo.EventHandler(pHandle,
2922 OMX_PRINT1(pComponentPrivate->dbg, "Exiting the WBAMR_DEC_LCML_Callback Function\n");
2938 OMX_ERRORTYPE WBAMR_DEC_GetCorresponding_LCMLHeader(WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate,
2949 pComponentPrivate = (WBAMR_DEC_COMPONENT_PRIVATE*) pComponentPrivate;
2950 nIpBuf = pComponentPrivate->pInputBufferList->numBuffers;
2951 nOpBuf = pComponentPrivate->pOutputBufferList->numBuffers;
2953 while (!pComponentPrivate->bInitParamsInitialized) {
2954 OMX_PRINT1(pComponentPrivate->dbg, "Waiting for init to complete\n");
2962 OMX_PRINT2(pComponentPrivate->dbg, "eDir = %d\n",eDir);
2964 pLcmlBufHeader = pComponentPrivate->pLcmlBufHeader[WBAMR_DEC_INPUT_PORT];
2968 OMX_PRDSP2(pComponentPrivate->dbg, "Corresponding LCML Header Found\n");
2974 pLcmlBufHeader = pComponentPrivate->pLcmlBufHeader[WBAMR_DEC_OUTPUT_PORT];
2980 OMX_PRDSP2(pComponentPrivate->dbg, "Corresponding LCML Header Found\n");
2986 OMX_PRINT1(pComponentPrivate->dbg, " Invalid WBAMR_DEC_Buffer Type :: exiting...\n");
3002 OMX_HANDLETYPE WBAMR_DEC_GetLCMLHandle(WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate)
3010 OMX_PRINT1(pComponentPrivate->dbg, "WBAMR_DEC_GetLCMLHandle\n");
3026 OMX_ERROR4(pComponentPrivate->dbg, "eError != OMX_ErrorNone...\n");
3032 pComponentPrivate->bLcmlHandleOpened = 1;
3033 ((LCML_DSP_INTERFACE*)pHandle)->pComponentPrivate = pComponentPrivate;
3035 pComponentPrivate->ptrLibLCML=handle; /* saving LCML lib pointer */
3037 OMX_PRINT1(pComponentPrivate->dbg, "WBAMR_DEC_GetLCMLHandle returning %p\n",pHandle);
3045 OMX_HANDLETYPE WBAMR_DEC_GetLCMLHandle(WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate)
3057 OMX_ERROR4(pComponentPrivate->dbg, "BML Load Failed!!!\n");
3074 OMX_ERROR4(pComponentPrivate->dbg, "eError != OMX_ErrorNone...\n");
3081 ((LCML_DSP_INTERFACE*)pHandle)->pComponentPrivate = pComponentPrivate;
3090 OMX_ERRORTYPE WBAMR_DEC_FreeLCMLHandle(WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate)
3096 if (pComponentPrivate->bLcmlHandleOpened) {
3097 retValue = dlclose(pComponentPrivate->pLcmlHandle);
3102 pComponentPrivate->bLcmlHandleOpened = 0;
3110 OMX_ERRORTYPE WBAMR_DEC_FreeLCMLHandle(WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate)
3116 if (pComponentPrivate->bLcmlHandleOpened) {
3118 retValue = FreeLibrary(pComponentPrivate->pLcmlHandle);
3122 pComponentPrivate->bLcmlHandleOpened = 0;
3146 void WBAMR_DEC_SetPending(WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir, OMX_U32 lineNumber)
3151 for (i=0; i < pComponentPrivate->pInputBufferList->numBuffers; i++) {
3152 if (pBufHdr == pComponentPrivate->pInputBufferList->pBufHdr[i]) {
3153 pComponentPrivate->pInputBufferList->bBufferPending[i] = 1;
3154 OMX_PRBUFFER2(pComponentPrivate->dbg, "*******************INPUT BUFFER %d IS PENDING Line %ld******************************\n",i,lineNumber);
3159 for (i=0; i < pComponentPrivate->pOutputBufferList->numBuffers; i++) {
3160 if (pBufHdr == pComponentPrivate->pOutputBufferList->pBufHdr[i]) {
3161 pComponentPrivate->pOutputBufferList->bBufferPending[i] = 1;
3162 OMX_PRBUFFER2(pComponentPrivate->dbg, "*******************OUTPUT BUFFER %d IS PENDING Line %ld******************************\n",i,lineNumber);
3182 void WBAMR_DEC_ClearPending(WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir, OMX_U32 lineNumber)
3187 for (i=0; i < pComponentPrivate->pInputBufferList->numBuffers; i++) {
3188 if (pBufHdr == pComponentPrivate->pInputBufferList->pBufHdr[i]) {
3189 pComponentPrivate->pInputBufferList->bBufferPending[i] = 0;
3190 OMX_PRBUFFER2(pComponentPrivate->dbg, "*******************INPUT BUFFER %d IS RECLAIMED Line %ld******************************\n",i,lineNumber);
3195 for (i=0; i < pComponentPrivate->pOutputBufferList->numBuffers; i++) {
3196 if (pBufHdr == pComponentPrivate->pOutputBufferList->pBufHdr[i]) {
3197 pComponentPrivate->pOutputBufferList->bBufferPending[i] = 0;
3198 OMX_PRBUFFER2(pComponentPrivate->dbg, "*******************OUTPUT BUFFER %d IS RECLAIMED Line %ld******************************\n",i,lineNumber);
3218 OMX_U32 WBAMR_DEC_IsPending(WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir)
3223 for (i=0; i < pComponentPrivate->pInputBufferList->numBuffers; i++) {
3224 if (pBufHdr == pComponentPrivate->pInputBufferList->pBufHdr[i]) {
3225 return pComponentPrivate->pInputBufferList->bBufferPending[i];
3230 for (i=0; i < pComponentPrivate->pOutputBufferList->numBuffers; i++) {
3231 if (pBufHdr == pComponentPrivate->pOutputBufferList->pBufHdr[i]) {
3232 return pComponentPrivate->pOutputBufferList->bBufferPending[i];
3254 OMX_U32 WBAMR_DEC_IsValid(WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U8 *pBuffer, OMX_DIRTYPE eDir)
3260 for (i=0; i < pComponentPrivate->pInputBufferList->numBuffers; i++) {
3261 if (pBuffer == pComponentPrivate->pInputBufferList->pBufHdr[i]->pBuffer) {
3267 for (i=0; i < pComponentPrivate->pOutputBufferList->numBuffers; i++) {
3268 if (pBuffer == pComponentPrivate->pOutputBufferList->pBufHdr[i]->pBuffer) {
3300 WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate;
3305 OMXDBG_PRINT(stderr, DSP, 1, 0, "pHandle->pComponentPrivate = %p\n",pHandle->pComponentPrivate);
3306 pComponentPrivate = pHandle->pComponentPrivate;
3308 nIpBuf = pComponentPrivate->pInputBufferList->numBuffers;
3310 if(pComponentPrivate->mimemode == 1)
3312 else if (pComponentPrivate->mimemode == 2)
3320 nOpBuf = pComponentPrivate->pOutputBufferList->numBuffers;
3326 pComponentPrivate->pLcmlBufHeader[WBAMR_DEC_INPUT_PORT] = pTemp_lcml;
3329 pTemp = pComponentPrivate->pInputBufferList->pBufHdr[i];
3334 pTemp->pPlatformPrivate = pHandle->pComponentPrivate;
3360 pComponentPrivate->pLcmlBufHeader[WBAMR_DEC_OUTPUT_PORT] = pTemp_lcml;
3363 pTemp = pComponentPrivate->pOutputBufferList->pBufHdr[i];
3368 pComponentPrivate->nVersion = pTemp->nVersion.nVersion;
3369 pTemp->pPlatformPrivate = pHandle->pComponentPrivate;
3383 OMX_PRDSP1(pComponentPrivate->dbg, "pTemp_lcml = %p\n",pTemp_lcml);
3384 OMX_PRBUFFER2(pComponentPrivate->dbg, "pTemp_lcml->buffer = %p\n",pTemp_lcml->buffer);
3391 pComponentPrivate->bPortDefsAllocated = 1;
3394 OMX_PRINT1(pComponentPrivate->dbg, "Exiting WBAMR_DEC_Fill_LCMLInitParams");
3396 pComponentPrivate->bInitParamsInitialized = 1;
3585 * @param WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate
3594 void SignalIfAllBuffersAreReturned(WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate)
3596 if((pComponentPrivate->nEmptyThisBufferCount == pComponentPrivate->nEmptyBufferDoneCount) && (pComponentPrivate->nFillThisBufferCount == pComponentPrivate->nFillBufferDoneCount))
3600 OMX_ERROR4(pComponentPrivate->dbg, "%d :: bufferReturned_mutex mutex lock error\n",__LINE__);
3603 OMX_PRINT1(pComponentPrivate->dbg, "Sending pthread signal that OMX has returned all buffers to app");
3606 OMX_ERROR4(pComponentPrivate->dbg, "%d :: bufferReturned_mutex mutex unlock error\n",__LINE__);
3620 pCompPrivate = (WBAMR_DEC_COMPONENT_PRIVATE *)pHandle->pComponentPrivate;
3643 void WBAMRDEC_HandleUSNError (WBAMR_DEC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U32 arg)
3660 pHandle = pComponentPrivate->pHandle;
3661 OMX_PRDSP1(pComponentPrivate->dbg, "%d :: GOT MESSAGE IUALG_WARN_PLAYCOMPLETED\n",__LINE__);
3662 if(pComponentPrivate->LastOutbuf!=NULL && !pComponentPrivate->dasfmode){
3663 pComponentPrivate->LastOutbuf->nFlags |= OMX_BUFFERFLAG_EOS;
3667 pComponentPrivate->cbInfo.EventHandler(pComponentPrivate->pHandle,
3668 pComponentPrivate->pHandle->pApplicationPrivate,
3686 pComponentPrivate->bIsInvalidState=OMX_TRUE;
3687 pComponentPrivate->curState = OMX_StateInvalid;
3688 pHandle = pComponentPrivate->pHandle;
3689 pComponentPrivate->cbInfo.EventHandler(pHandle,