Lines Matching refs:pComponentPrivate

119      AACENC_COMPONENT_PRIVATE *pComponentPrivate = pHandle->pComponentPrivate;
126 OMX_PRINT1(pComponentPrivate->dbg, "%d :: UTIL: AACENCFill_LCMLInitParams\n ",__LINE__);
127 nIpBuf = pComponentPrivate->pInputBufferList->numBuffers;
128 pComponentPrivate->nRuntimeInputBuffers = nIpBuf;
129 nIpBufSize = pComponentPrivate->pPortDef[INPUT_PORT]->nBufferSize;
130 nOpBuf = pComponentPrivate->pOutputBufferList->numBuffers;
131 nOpBufSize = pComponentPrivate->pPortDef[OUTPUT_PORT]->nBufferSize;
133 pComponentPrivate->nRuntimeOutputBuffers = nOpBuf;
136 FramesPerOutBuf = (OMX_U16)pComponentPrivate->FramesPer_OutputBuffer;
137 OMX_PRBUFFER1(pComponentPrivate->dbg, "%d :: UTIL: Frames per output buffer = %d \n\n",__LINE__, FramesPerOutBuf);
140 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: ------ Buffer Details -----------\n",__LINE__);
141 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: Input Buffer Count = %ld \n",__LINE__,nIpBuf);
142 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: Input Buffer Size = %ld\n",__LINE__,nIpBufSize);
143 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: Output Buffer Count = %ld\n",__LINE__,nOpBuf);
144 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: Output Buffer Size = %ld\n",__LINE__,nOpBufSize);
145 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: ------ Buffer Details ------------\n",__LINE__);
175 OMX_PRINT1(pComponentPrivate->dbg, "%d :: Comp: OMX_AacEncUtils.c\n",__LINE__);
176 if(pComponentPrivate->dasfmode == 1) {
177 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: Codec is configuring to DASF mode\n",__LINE__);
179 OMX_PRINT1(pComponentPrivate->dbg, "strmAttr %p \n",strmAttr);
181 pComponentPrivate->strmAttr = strmAttr;
182 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: [ALLOC] %p\n",__LINE__,strmAttr);
203 pComponentPrivate->unNumChannels = (OMX_U16)pComponentPrivate->aacParams[OUTPUT_PORT]->nChannels; /*Number of Channels*/
205 pComponentPrivate->ulSamplingRate = (OMX_U16)pComponentPrivate->aacParams[OUTPUT_PORT]->nSampleRate; /*Sampling rate*/
206 HigherBitsSamplingRate =(OMX_U16)((pComponentPrivate->aacParams[OUTPUT_PORT]->nSampleRate >>16)& 0xFFFF);
207 pComponentPrivate->unBitrate = pComponentPrivate->aacParams[OUTPUT_PORT]->nBitRate; /*Bit rate 2bytes*/
208 pComponentPrivate->nObjectType = pComponentPrivate->aacParams[OUTPUT_PORT]->eAACProfile; /*Object Type */
212 if(pComponentPrivate->unNumChannels==2)
216 else if (pComponentPrivate->unNumChannels==1)
221 if (pComponentPrivate->aacParams[OUTPUT_PORT]->eAACStreamFormat == OMX_AUDIO_AACStreamFormatRAW ||
222 pComponentPrivate->aacParams[OUTPUT_PORT]->eAACStreamFormat == OMX_AUDIO_AACStreamFormatMP4FF){
223 pComponentPrivate->File_Format = 0;
224 OMX_PRDSP2(pComponentPrivate->dbg, "OMX_AUDIO_AACStreamFormatRAW \n");
226 else if (pComponentPrivate->aacParams[OUTPUT_PORT]->eAACStreamFormat == OMX_AUDIO_AACStreamFormatADIF) {
227 pComponentPrivate->File_Format = 1;
228 OMX_PRDSP2(pComponentPrivate->dbg, "OMX_AUDIO_AACStreamFormatADIF \n");
230 else if((pComponentPrivate->aacParams[OUTPUT_PORT]->eAACStreamFormat == OMX_AUDIO_AACStreamFormatMP4ADTS) ||
231 (pComponentPrivate->aacParams[OUTPUT_PORT]->eAACStreamFormat == OMX_AUDIO_AACStreamFormatMP2ADTS) )
233 pComponentPrivate->File_Format = 2;
234 OMX_PRDSP2(pComponentPrivate->dbg, "OMX_AUDIO_AACStreamFormatMP2ADTS \n");
237 if(pComponentPrivate->dasfmode == 1) {
238 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: AAC ENCODER RUNNING UNDER DASF MODE\n",__LINE__);
250 arr[10] = pComponentPrivate->ulSamplingRate; /*Sampling rate- Lower bits*/
252 arr[12] = (OMX_U16)(pComponentPrivate->unBitrate & 0xFFFF); /*Bit rate 2bytes*/
253 arr[13] = (OMX_U16)(pComponentPrivate->unBitrate >> 16); /*Bit rate 2bytes*/
254 arr[14] = (OMX_U16)pComponentPrivate->nObjectType; /*Object Type */
255 arr[15] = (OMX_U16)pComponentPrivate->bitRateMode; /*bitrateMode*/
256 arr[16] = (OMX_U16)pComponentPrivate->File_Format; /*FileFormat*/
262 if(pComponentPrivate->dasfmode == 0) {
263 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: AAC ENCODER RUNNING UNDER FILE MODE\n",__LINE__);
267 if (pComponentPrivate->pInputBufferList->numBuffers) {
268 arr[3] = (OMX_U16) pComponentPrivate->pInputBufferList->numBuffers; /*Number of buffers for Input Stream*/
269 OMX_PRBUFFER1(pComponentPrivate->dbg, "arr[3] InputBuffers %d \n",arr[3]);
276 if (pComponentPrivate->pOutputBufferList->numBuffers) {
277 arr[6] = (OMX_U16) pComponentPrivate->pOutputBufferList->numBuffers; /*Number of buffers for Output Stream*/
278 OMX_PRBUFFER1(pComponentPrivate->dbg, "arr[6] Output Buffers%d \n",arr[6]);
288 OMX_PRCOMM2(pComponentPrivate->dbg, "arr[9] Channels %d \n",arr[9]);
289 arr[10] = pComponentPrivate->ulSamplingRate; /*Sampling rate- Lower bits*/
291 arr[12] = (OMX_U16)(pComponentPrivate->unBitrate & 0xFFFF); /*Bit rate 2bytes*/
292 arr[13] = (OMX_U16)(pComponentPrivate->unBitrate >> 16); /*Bit rate 2bytes*/
293 arr[14] = (OMX_U16)pComponentPrivate->nObjectType; /*bitsperSample;*/
294 OMX_PRINT2(pComponentPrivate->dbg, "arr[14] Object Type %d \n",arr[14]);
295 arr[15] = (OMX_U16)pComponentPrivate->bitRateMode; /*bitrateMode*/
296 OMX_PRINT2(pComponentPrivate->dbg, "arr[15] Bit Rate %d \n",arr[15]);
297 arr[16] = pComponentPrivate->File_Format; /*FileFormat*/
298 OMX_PRINT2(pComponentPrivate->dbg, "arr[16] format type %d \n",arr[16]);
306 OMX_PRINT1(pComponentPrivate->dbg, "%d :: Comp: OMX_AacEncUtils.c\n",__LINE__);
310 pComponentPrivate->pLcmlBufHeader[INPUT_PORT] = pTemp_lcml;
313 pTemp = pComponentPrivate->pInputBufferList->pBufHdr[i];
319 pTemp->pPlatformPrivate = pHandle->pComponentPrivate;
327 OMX_PRDSP2(pComponentPrivate->dbg, "pTemp_lcml->pIpParam %p \n",pTemp_lcml->pIpParam);
342 pComponentPrivate->pLcmlBufHeader[OUTPUT_PORT] = pTemp_lcml;
345 pTemp = pComponentPrivate->pOutputBufferList->pBufHdr[i];
351 pComponentPrivate->nVersion = pTemp->nVersion.nVersion;
352 pTemp->pPlatformPrivate = pHandle->pComponentPrivate;
364 OMX_PRDSP1(pComponentPrivate->dbg, "%d :: UTIL: size of pOpParam: %d \n",__LINE__,sizeof(pTemp_lcml->pOpParam->unFrameSizes));
365 OMX_PRDSP1(pComponentPrivate->dbg, "%d :: UTIL: numframes of pOpParam: %d \n\n",__LINE__,sizeof(pTemp_lcml->pOpParam->unNumFramesEncoded)) ;
366 OMX_PRDSP1(pComponentPrivate->dbg, "UTIL: pTemp_lcml->pOpParam %p \n",pTemp_lcml->pOpParam);
372 pComponentPrivate->bPortDefsAllocated = 1;
373 pComponentPrivate->bBypassDSP = 0;
374 pComponentPrivate->bNoIdleOnStop= OMX_FALSE;
377 OMX_MALLOC_SIZE_DSPALIGN(pComponentPrivate->ptAlgDynParams,
381 OMX_PRINT2(pComponentPrivate->dbg, "UTIL: pComponentPrivate->ptAlgDynParams %p \n",pComponentPrivate->ptAlgDynParams);
384 pComponentPrivate->nLcml_nCntIp = 0;
385 pComponentPrivate->nLcml_nCntOpReceived = 0;
390 OMX_PRINT1(pComponentPrivate->dbg, "%d :: UTIL: Exiting Fill_LCMLInitParams\n",__LINE__);
391 OMX_PRINT1(pComponentPrivate->dbg, "%d :: UTIL: Returning = 0x%x\n",__LINE__,eError);
414 AACENC_COMPONENT_PRIVATE *pComponentPrivate = (AACENC_COMPONENT_PRIVATE *)pHandle->pComponentPrivate;
423 OMX_PRINT1(pComponentPrivate->dbg, "%d :: Entering AACENC_StartComponentThread\n", __LINE__);
425 pComponentPrivate->bIsStopping = 0;
426 pComponentPrivate->bIsThreadstop = 0;
427 pComponentPrivate->lcml_nOpBuf = 0;
428 pComponentPrivate->lcml_nIpBuf = 0; /* Initializing counter */
429 pComponentPrivate->app_nBuf = 0; /* Not Used */
430 pComponentPrivate->num_Op_Issued = 0;
431 pComponentPrivate->num_Sent_Ip_Buff = 0;
432 pComponentPrivate->num_Reclaimed_Op_Buff = 0; /* Not Used */
433 pComponentPrivate->bIsEOFSent = 0;
436 eError = pipe (pComponentPrivate->cmdDataPipe);
439 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Inside AACENC_StartComponentThread\n", __LINE__);
445 eError = pipe (pComponentPrivate->dataPipe);
448 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Inside AACENC_StartComponentThread\n", __LINE__);
454 eError = pipe (pComponentPrivate->cmdPipe);
456 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Inside AACENC_StartComponentThread\n", __LINE__);
463 eError = pthread_create (&(pComponentPrivate->ComponentThread), &attr, AACENC_ComponentThread, pComponentPrivate);
465 eError = pthread_create (&(pComponentPrivate->ComponentThread), NULL, AACENC_ComponentThread, pComponentPrivate);
467 if (eError || !pComponentPrivate->ComponentThread) {
468 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Inside AACENC_StartComponentThread\n", __LINE__);
473 OMX_PRDSP1(pComponentPrivate->dbg, "%d :: pComponent[%x] AACENC_StartComponentThread\n", __LINE__, (int)pComponent) ;
474 OMX_PRDSP1(pComponentPrivate->dbg, "%d :: pHandle[%x] AACENC_StartComponentThread\n", __LINE__, (int)pHandle) ;
475 pComponentPrivate->bCompThreadStarted = 1;
478 OMX_PRINT1(pComponentPrivate->dbg, "%d :: Exiting from AACENC_StartComponentThread\n", __LINE__);
479 OMX_PRINT1(pComponentPrivate->dbg, "%d :: Returning = 0x%x\n",__LINE__,eError);
501 AACENC_COMPONENT_PRIVATE *pComponentPrivate = (AACENC_COMPONENT_PRIVATE *)pHandle->pComponentPrivate;
508 OMX_PRINT1(pComponentPrivate->dbg, " %d :: Entering AACENC_FreeCompResources\n",__LINE__);
509 if (pComponentPrivate->bPortDefsAllocated) {
510 nIpBuf = pComponentPrivate->pPortDef[INPUT_PORT]->nBufferCountActual;
511 nOpBuf = pComponentPrivate->pPortDef[OUTPUT_PORT]->nBufferCountActual;
514 if (pComponentPrivate->bCompThreadStarted) {
515 OMX_CLOSE_PIPE(pComponentPrivate->dataPipe[0],err);
516 OMX_CLOSE_PIPE(pComponentPrivate->dataPipe[1],err);
517 OMX_CLOSE_PIPE(pComponentPrivate->cmdPipe[0],err);
518 OMX_CLOSE_PIPE(pComponentPrivate->cmdPipe[1],err);
519 OMX_CLOSE_PIPE(pComponentPrivate->cmdDataPipe[0],err);
520 OMX_CLOSE_PIPE(pComponentPrivate->cmdDataPipe[1],err);
523 if (pComponentPrivate->bPortDefsAllocated) {
524 OMX_MEMFREE_STRUCT(pComponentPrivate->pPortDef[INPUT_PORT]);
525 OMX_MEMFREE_STRUCT(pComponentPrivate->pPortDef[OUTPUT_PORT]);
526 OMX_MEMFREE_STRUCT(pComponentPrivate->aacParams[INPUT_PORT]);
527 OMX_MEMFREE_STRUCT(pComponentPrivate->aacParams[OUTPUT_PORT]);
528 OMX_MEMFREE_STRUCT(pComponentPrivate->pcmParam[INPUT_PORT]);
529 OMX_MEMFREE_STRUCT(pComponentPrivate->pcmParam[OUTPUT_PORT]);
531 pComponentPrivate->bPortDefsAllocated = 0;
534 OMX_PRDSP1(pComponentPrivate->dbg, "\n\n FreeCompResources: Destroying mutexes.\n\n");
535 pthread_mutex_destroy(&pComponentPrivate->InLoaded_mutex);
536 pthread_cond_destroy(&pComponentPrivate->InLoaded_threshold);
538 pthread_mutex_destroy(&pComponentPrivate->InIdle_mutex);
539 pthread_cond_destroy(&pComponentPrivate->InIdle_threshold);
541 pthread_mutex_destroy(&pComponentPrivate->AlloBuf_mutex);
542 pthread_cond_destroy(&pComponentPrivate->AlloBuf_threshold);
547 pComponentPrivate->bPortDefsAllocated = 0;
548 OMX_DestroyEvent(&(pComponentPrivate->InLoaded_event));
549 OMX_DestroyEvent(&(pComponentPrivate->InIdle_event));
550 OMX_DestroyEvent(&(pComponentPrivate->AlloBuf_event));
554 OMX_PRINT1(pComponentPrivate->dbg, "%d :: Exiting AACENC_FreeCompResources()\n",__LINE__);
555 OMX_PRINT1(pComponentPrivate->dbg, "%d :: Returning = 0x%x\n",__LINE__,eError);
577 AACENC_COMPONENT_PRIVATE *pComponentPrivate = (AACENC_COMPONENT_PRIVATE *)pHandle->pComponentPrivate;
584 OMX_PRINT1(pComponentPrivate->dbg, "%d :: Entering AACENC_CleanupInitParams()\n", __LINE__);
585 OMX_MEMFREE_STRUCT(pComponentPrivate->strmAttr);
587 pTemp_lcml = pComponentPrivate->pLcmlBufHeader[INPUT_PORT];
588 nIpBuf = pComponentPrivate->nRuntimeInputBuffers;
596 pTemp_lcml = pComponentPrivate->pLcmlBufHeader[OUTPUT_BUFFER];
597 nOpBuf = pComponentPrivate->nRuntimeOutputBuffers;
604 OMX_MEMFREE_STRUCT(pComponentPrivate->pLcmlBufHeader[INPUT_PORT]);
605 OMX_MEMFREE_STRUCT(pComponentPrivate->pLcmlBufHeader[OUTPUT_PORT]);
606 OMX_MEMFREE_STRUCT_DSPALIGN(pComponentPrivate->ptAlgDynParams, MPEG4AACENC_UALGParams);
607 if(pComponentPrivate->dasfmode == 1)
609 OMX_MEMFREE_STRUCT_DSPALIGN(pComponentPrivate->pParams, AACENC_AudioCodecParams);
612 OMX_PRINT1(pComponentPrivate->dbg, "%d :: Exiting Successfully AACENC_CleanupInitParams()\n",__LINE__);
613 OMX_PRINT1(pComponentPrivate->dbg, "%d :: Returning = 0x%x\n",__LINE__,eError);
635 AACENC_COMPONENT_PRIVATE *pComponentPrivate = (AACENC_COMPONENT_PRIVATE *)pHandle->pComponentPrivate;
641 OMX_PRINT1(pComponentPrivate->dbg, " %d :: UTIL: Entering AACENC_StopComponentThread\n",__LINE__);
643 pComponentPrivate->bIsThreadstop = 1;
644 write (pComponentPrivate->cmdPipe[1], &pComponentPrivate->bIsThreadstop, sizeof(OMX_U16));
645 OMX_PRSTATE1(pComponentPrivate->dbg, "UTIL: pComponentPrivate->bIsThreadstop = %ld \n",pComponentPrivate->bIsThreadstop);
646 pthreadError = pthread_join (pComponentPrivate->ComponentThread,(void*)&threadError);
650 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error closing ComponentThread - pthreadError = %d\n",__LINE__,pthreadError);
658 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error while closing Component Thread\n",__LINE__);
663 OMX_PRINT1(pComponentPrivate->dbg, " %d :: UTIL: Exiting AACENC_StopComponentThread\n",__LINE__);
673 * @param pComponentPrivate Component private data
683 OMX_U32 AACENCHandleCommand(AACENC_COMPONENT_PRIVATE *pComponentPrivate)
686 OMX_COMPONENTTYPE *pHandle = (OMX_COMPONENTTYPE *) pComponentPrivate->pHandle;
690 OMX_HANDLETYPE pLcmlHandle = pComponentPrivate->pLcmlHandle;
706 OMX_PRSTATE1(pComponentPrivate->dbg, "%d :: AACENC: Entering AACENCHandleCommand Function - curState = %d\n",__LINE__,pComponentPrivate->curState);
707 ret = read (pComponentPrivate->cmdPipe[0], &command, sizeof (command));
708 OMX_TRACE1(pComponentPrivate->dbg, "%d :: AACENC: Command pipe has been read = %ld \n",__LINE__,ret);
711 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error in Reading from the Data pipe\n", __LINE__);
715 ret = read (pComponentPrivate->cmdDataPipe[0], &commandData, sizeof (commandData));
716 OMX_TRACE1(pComponentPrivate->dbg, "%d :: AACENC: Command data pipe has been read = %ld \n",__LINE__,ret);
719 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error in Reading from the Data pipe\n", __LINE__);
725 PERF_ReceivedCommand(pComponentPrivate->pPERFcomp,command,commandData,PERF_ModuleLLMM);
728 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: AACENCHandleCommand :: Command is = %d\n",__LINE__,command);
732 if ( pComponentPrivate->curState==commandedState)
734 pComponentPrivate->cbInfo.EventHandler(pHandle,
740 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error: Same State Given by Application\n",__LINE__);
741 OMX_ERROR4(pComponentPrivate->dbg, "%d :: AACENC: State Given is: %d \n", __LINE__, commandedState);
748 OMX_PRDSP2(pComponentPrivate->dbg, "%d: AACENCHandleCommand: Cmd Idle \n",__LINE__);
749 OMX_PRDSP2(pComponentPrivate->dbg, "AACENC: curstate = %d\n",pComponentPrivate->curState);
750 if (pComponentPrivate->curState == OMX_StateLoaded)
754 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryStart | PERF_BoundarySetup);
756 if(pComponentPrivate->dasfmode == 1)
758 if (pComponentPrivate->dasfmode == 1)
760 pComponentPrivate->pPortDef[INPUT_PORT]->bEnabled= FALSE;
761 pComponentPrivate->pPortDef[INPUT_PORT]->bPopulated= FALSE;
763 if (pComponentPrivate->streamID==0)
766 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error: Insufficient resources\n", __LINE__);
768 OMX_ERROR4(pComponentPrivate->dbg, "AACENC: State changed to OMX_StateInvalid Line %d\n",__LINE__);
769 pComponentPrivate->curState = OMX_StateInvalid;
770 pComponentPrivate->cbInfo.EventHandler(pHandle,
780 OMX_PRCOMM2(pComponentPrivate->dbg, "%d :: OMX_StateLoaded [INPUT_PORT]->bPopulated %d \n",__LINE__,pComponentPrivate->pPortDef[INPUT_PORT]->bPopulated);
781 OMX_PRCOMM2(pComponentPrivate->dbg, "%d :: OMX_StateLoaded [INPUT_PORT]->bEnabled %d \n",__LINE__,pComponentPrivate->pPortDef[INPUT_PORT]->bEnabled);
782 OMX_PRCOMM2(pComponentPrivate->dbg, "%d :: OMX_StateLoaded [OUTPUT_PORT]->bPopulated %d \n",__LINE__,pComponentPrivate->pPortDef[OUTPUT_PORT]->bPopulated);
783 OMX_PRCOMM2(pComponentPrivate->dbg, "%d :: OMX_StateLoaded [OUTPUT_PORT]->bEnabled %d \n",__LINE__,pComponentPrivate->pPortDef[OUTPUT_PORT]->bEnabled);
785 if (pComponentPrivate->pPortDef[INPUT_PORT]->bPopulated && pComponentPrivate->pPortDef[INPUT_PORT]->bEnabled) {
789 if (!pComponentPrivate->pPortDef[INPUT_PORT]->bPopulated && !pComponentPrivate->pPortDef[INPUT_PORT]->bEnabled) {
793 if (pComponentPrivate->pPortDef[OUTPUT_PORT]->bPopulated && pComponentPrivate->pPortDef[OUTPUT_PORT]->bEnabled) {
797 if (!pComponentPrivate->pPortDef[OUTPUT_PORT]->bPopulated && !pComponentPrivate->pPortDef[OUTPUT_PORT]->bEnabled) {
801 OMX_PRCOMM2(pComponentPrivate->dbg, "inputPortFlag = %d\n",inputPortFlag);
802 OMX_PRCOMM2(pComponentPrivate->dbg, "outputPortFlag = %d\n",outputPortFlag);
806 pComponentPrivate->InLoaded_readytoidle = 1;
808 pthread_mutex_lock(&pComponentPrivate->InLoaded_mutex);
809 pthread_cond_wait(&pComponentPrivate->InLoaded_threshold, &pComponentPrivate->InLoaded_mutex);
810 pthread_mutex_unlock(&pComponentPrivate->InLoaded_mutex);
813 OMX_WaitForEvent(&(pComponentPrivate->InLoaded_event));
818 pLcmlHandle = (OMX_HANDLETYPE) AACENCGetLCMLHandle(pComponentPrivate);
822 OMX_ERROR4(pComponentPrivate->dbg, "%d :: AACENC: LCML Handle is NULL........exiting..\n",__LINE__);
824 pComponentPrivate->cbInfo.EventHandler (pHandle,
839 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error returned from AACENCFill_LCMLInitParams()\n",__LINE__);
840 pComponentPrivate->cbInfo.EventHandler (pHandle,
848 pComponentPrivate->pLcmlHandle = (LCML_DSP_INTERFACE *)pLcmlHandle;
851 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: AACENC: Calling LCML_InitMMCodec...\n",__LINE__);
854 p,&pLcmlHandle,(void *)p,&cb, (OMX_STRING)pComponentPrivate->sDeviceString);
855 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: AACENC: After Calling LCML_InitMMCodec...\n",__LINE__);
859 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error returned from LCML_Init()\n",__LINE__);
863 pComponentPrivate->cbInfo.EventHandler (pHandle,
877 OMX_ERROR4(pComponentPrivate->dbg, "Error: Failed to set Mapping State\n");
882 OMX_PRINT2(pComponentPrivate->dbg, "%d :: AACENC: About to call RMProxy_SendCommand\n", __LINE__);
886 OMX_PRDSP1(pComponentPrivate->dbg, "%d :: AACENC: Returned from RMProxy_SendCommand\n", __LINE__);
887 OMX_PRDSP1(pComponentPrivate->dbg, "%d :: AACENC: RMProxy_SendCommand returned %d\n", __LINE__,rm_error);
891 pComponentPrivate->curState = OMX_StateIdle;
894 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryComplete | PERF_BoundarySetup);
901 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error: Insufficient resources\n", __LINE__);
902 pComponentPrivate->curState = OMX_StateWaitForResources;
903 pComponentPrivate->cbInfo.EventHandler(pHandle,
907 pComponentPrivate->curState,
909 OMX_ERROR2(pComponentPrivate->dbg, "%d :: AACENC: OMX_ErrorInsufficientResources\n", __LINE__);
911 pComponentPrivate->curState = OMX_StateIdle;
914 if(RemoveStateTransition(pComponentPrivate, OMX_TRUE) != OMX_ErrorNone) {
918 pComponentPrivate->cbInfo.EventHandler(pHandle,
922 pComponentPrivate->curState,
925 pComponentPrivate->curState = OMX_StateIdle;
928 if(RemoveStateTransition(pComponentPrivate, OMX_TRUE) != OMX_ErrorNone) {
932 pComponentPrivate->cbInfo.EventHandler( pHandle,
936 pComponentPrivate->curState,
942 else if (pComponentPrivate->curState == OMX_StateExecuting)
946 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryComplete | PERF_BoundarySteadyState);
949 OMX_PRSTATE2(pComponentPrivate->dbg, "%d :: AACENC: Setting Component to OMX_StateIdle\n",__LINE__);
950 OMX_PRSTATE2(pComponentPrivate->dbg, "%d :: AACENC: About to Call MMCodecControlStop\n", __LINE__);
952 pComponentPrivate->bIsStopping = 1;
957 pthread_mutex_lock(&pComponentPrivate->codecStop_mutex);
958 while (pComponentPrivate->codecStop_waitingsignal == 0){
959 pthread_cond_wait(&pComponentPrivate->codecStop_threshold, &pComponentPrivate->codecStop_mutex);
961 pComponentPrivate->codecStop_waitingsignal = 0;
962 pthread_mutex_unlock(&pComponentPrivate->codecStop_mutex);
966 OMX_ERROR4(pComponentPrivate->dbg, "%d: Error Occurred in Codec Stop..\n",__LINE__);
967 pComponentPrivate->cbInfo.EventHandler (pHandle,
975 OMX_PRSTATE2(pComponentPrivate->dbg, "%d :: AACENC: After MMCodecControlStop\n", __LINE__);
976 pComponentPrivate->nNumOutputBufPending=0;
980 pLcmlHandle = (LCML_DSP_INTERFACE*)pComponentPrivate->pLcmlHandle;
984 OMX_ERROR4(pComponentPrivate->dbg, "Error occurred in Codec mapping flush!\n");
992 else if(pComponentPrivate->curState == OMX_StatePause)
996 pLcmlHandle = (LCML_DSP_INTERFACE*)pComponentPrivate->pLcmlHandle;
1000 OMX_ERROR4(pComponentPrivate->dbg, "Error occurred in Codec mapping flush!\n");
1006 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryComplete | PERF_BoundarySteadyState);
1008 pComponentPrivate->curState = OMX_StateIdle;
1016 if(RemoveStateTransition(pComponentPrivate, OMX_TRUE) != OMX_ErrorNone) {
1020 pComponentPrivate->cbInfo.EventHandler(pHandle,
1024 pComponentPrivate->curState,
1030 OMX_ERROR4(pComponentPrivate->dbg, "%d :: AACENC: OMX_ErrorIncorrectStateTransition\n",__LINE__);
1031 pComponentPrivate->cbInfo.EventHandler(pHandle,
1042 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: AACENCHandleCommand: Cmd Executing \n",__LINE__);
1043 if(pComponentPrivate->curState == OMX_StateIdle)
1046 pComponentPrivate->bIsStopping = 0;
1047 if(pComponentPrivate->dasfmode == 1)
1049 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: ---- Comp: DASF Functionality is ON ---\n",__LINE__);
1051 OMX_MALLOC_SIZE_DSPALIGN(pComponentPrivate->pParams,
1055 OMX_PRDSP2(pComponentPrivate->dbg, "AACENC: pComponentPrivate->pParams %p \n",pComponentPrivate->pParams);
1056 if(pComponentPrivate->unNumChannels == 1) /*MONO*/
1057 pComponentPrivate->pParams->iAudioFormat = 0x0001;
1059 pComponentPrivate->pParams->iAudioFormat = 0x0002;
1061 pComponentPrivate->pParams->iStrmId = pComponentPrivate->streamID;
1062 pComponentPrivate->pParams->iSamplingRate = pComponentPrivate->ulSamplingRate;
1065 pValues[1] = (OMX_U32)pComponentPrivate->pParams;
1072 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error: Occurred in Codec StreamControl..\n",__LINE__);
1073 pComponentPrivate->cbInfo.EventHandler (pHandle,
1083 pComponentPrivate->ptAlgDynParams->audenc_dynamicparams.size = sizeof(MPEG4AACENC_UALGParams);
1084 pComponentPrivate->ptAlgDynParams->audenc_dynamicparams.bitRate = pComponentPrivate->unBitrate;
1085 pComponentPrivate->ptAlgDynParams->audenc_dynamicparams.sampleRate = pComponentPrivate->ulSamplingRate;
1086 pComponentPrivate->ptAlgDynParams->audenc_dynamicparams.numChannels = (pComponentPrivate->unNumChannels==2)?1:0; /* Reduced */
1087 pComponentPrivate->ptAlgDynParams->useTns = 1;
1088 pComponentPrivate->ptAlgDynParams->usePns = 1;
1089 pComponentPrivate->ptAlgDynParams->outObjectType = pComponentPrivate->nObjectType;
1090 pComponentPrivate->ptAlgDynParams->outFileFormat = pComponentPrivate->File_Format;
1092 OMX_PRDSP1(pComponentPrivate->dbg, "AACENC: dynamicparams.bitRate %d \n", (int)pComponentPrivate->unBitrate);
1093 OMX_PRDSP1(pComponentPrivate->dbg, "AACENC: dynamicparams.sampleRate %d \n ",pComponentPrivate->ulSamplingRate);
1094 OMX_PRDSP1(pComponentPrivate->dbg, "AACENC: dynamicparams.numChannels %d \n", pComponentPrivate->unNumChannels);
1095 OMX_PRDSP1(pComponentPrivate->dbg, "AACENC: ptAlgDynParams->outFileFormat %d \n",pComponentPrivate->File_Format);
1098 pValues1[1] = (OMX_U32)pComponentPrivate->ptAlgDynParams;
1105 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error: Occurred in Codec StreamControl..\n",__LINE__);
1106 pComponentPrivate->cbInfo.EventHandler (pHandle,
1114 OMX_PRDSP1(pComponentPrivate->dbg, "%d :: AACENC: Algcontrol has been sent to DSP\n",__LINE__);
1120 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error: Occurred in Codec Start..\n", __LINE__);
1121 pComponentPrivate->cbInfo.EventHandler (pHandle,
1130 else if (pComponentPrivate->curState == OMX_StatePause)
1136 OMX_ERROR4(pComponentPrivate->dbg, "%d:: Error: While Resuming the codec\n",__LINE__);
1137 pComponentPrivate->cbInfo.EventHandler (pHandle,
1145 for (i=0; i < pComponentPrivate->nNumInputBufPending; i++)
1147 if (pComponentPrivate->pInputBufHdrPending[i]!= NULL)
1149 OMX_PRINT2(pComponentPrivate->dbg, "i: %d \n",(int)i);
1150 AACENCGetCorresponding_LCMLHeader(pComponentPrivate, pComponentPrivate->pInputBufHdrPending[i]->pBuffer, OMX_DirInput, &pLcmlHdr);
1151 AACENC_SetPending(pComponentPrivate,pComponentPrivate->pInputBufHdrPending[i],OMX_DirInput,__LINE__);
1156 pComponentPrivate->pInputBufHdrPending[i]->pBuffer,
1157 pComponentPrivate->pInputBufHdrPending[i]->nAllocLen,
1158 pComponentPrivate->pInputBufHdrPending[i]->nFilledLen,
1163 OMX_ERROR4(pComponentPrivate->dbg, "%d:: Error: LCML QUEUE BUFFER\n",__LINE__);
1164 pComponentPrivate->cbInfo.EventHandler (pHandle,
1174 pComponentPrivate->nNumInputBufPending =0;
1176 for (i=0; i < pComponentPrivate->nNumOutputBufPending; i++)
1180 if (pComponentPrivate->pOutputBufHdrPending[i]!= NULL)
1182 AACENCGetCorresponding_LCMLHeader(pComponentPrivate, pComponentPrivate->pOutputBufHdrPending[i]->pBuffer, OMX_DirOutput, &pLcmlHdr);
1183 AACENC_SetPending(pComponentPrivate,pComponentPrivate->pOutputBufHdrPending[i],OMX_DirOutput,__LINE__);
1189 pComponentPrivate->pOutputBufHdrPending[i]->pBuffer,
1190 pComponentPrivate->pOutputBufHdrPending[i]->nAllocLen,
1196 OMX_ERROR4(pComponentPrivate->dbg, "%d:: Error: LCML QUEUE BUFFER\n",__LINE__);
1197 pComponentPrivate->cbInfo.EventHandler (pHandle,
1207 pComponentPrivate->nNumOutputBufPending = 0;
1213 pComponentPrivate->cbInfo.EventHandler(pHandle,
1219 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error: Invalid State Given by Application\n",__LINE__);
1228 pComponentPrivate->curState = OMX_StateExecuting;
1231 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryStart | PERF_BoundarySteadyState);
1235 if(RemoveStateTransition(pComponentPrivate, OMX_TRUE) != OMX_ErrorNone) {
1240 pComponentPrivate->cbInfo.EventHandler(pHandle,
1244 pComponentPrivate->curState,
1250 OMX_PRSTATE1(pComponentPrivate->dbg, "%d :: AACENC: AACENCHandleCommand: Cmd Loaded - curState = %d\n",__LINE__,pComponentPrivate->curState);
1251 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: AACENC: pComponentPrivate->pInputBufferList->numBuffers = %d \n",__LINE__,pComponentPrivate->pInputBufferList->numBuffers);
1252 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: AACENC: pComponentPrivate->pOutputBufferList->numBuffers = %d \n",__LINE__,pComponentPrivate->pOutputBufferList->numBuffers);
1253 if (pComponentPrivate->curState == OMX_StateWaitForResources)
1255 OMX_PRDSP1(pComponentPrivate->dbg, "%d :: AACENC: AACENCHandleCommand: Cmd Loaded\n",__LINE__);
1258 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryStart | PERF_BoundaryCleanup);
1260 pComponentPrivate->curState = OMX_StateLoaded;
1263 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryComplete | PERF_BoundaryCleanup);
1267 if(RemoveStateTransition(pComponentPrivate, OMX_TRUE) != OMX_ErrorNone) {
1271 pComponentPrivate->cbInfo.EventHandler(pHandle,
1275 pComponentPrivate->curState,
1277 pComponentPrivate->bLoadedCommandPending = OMX_FALSE;
1280 OMX_PRSTATE1(pComponentPrivate->dbg, "%d :: AACENC: Inside OMX_StateLoaded State: \n",__LINE__);
1281 if (pComponentPrivate->curState != OMX_StateIdle &&
1282 pComponentPrivate->curState != OMX_StateWaitForResources)
1284 pComponentPrivate->cbInfo.EventHandler(pHandle,
1290 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error: Invalid State Given by Application\n",__LINE__);
1295 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryStart | PERF_BoundaryCleanup);
1297 OMX_PRBUFFER2(pComponentPrivate->dbg, "AACENC: pComponentPrivate->pInputBufferList->numBuffers = %d \n",pComponentPrivate->pInputBufferList->numBuffers);
1298 OMX_PRBUFFER2(pComponentPrivate->dbg, "AACENC: pComponentPrivate->pOutputBufferList->numBuffers = %d \n",pComponentPrivate->pOutputBufferList->numBuffers);
1300 if (pComponentPrivate->pInputBufferList->numBuffers ||
1301 pComponentPrivate->pOutputBufferList->numBuffers)
1303 pComponentPrivate->InIdle_goingtoloaded = 1;
1306 pthread_mutex_lock(&pComponentPrivate->InIdle_mutex);
1307 pthread_cond_wait(&pComponentPrivate->InIdle_threshold, &pComponentPrivate->InIdle_mutex);
1308 pthread_mutex_unlock(&pComponentPrivate->InIdle_mutex);
1311 OMX_WaitForEvent(&(pComponentPrivate->InIdle_event));
1316 OMX_PRSTATE2(pComponentPrivate->dbg, "%d :: AACENC: Before CodecControlDestroy \n",__LINE__);
1320 PERF_SendingCommand(pComponentPrivate->pPERF, -1, 0, PERF_ModuleComponent);
1323 OMX_PRSTATE2(pComponentPrivate->dbg, "%d :: AACENC: After CodecControlDestroy \n",__LINE__);
1326 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error: LCML_ControlCodec EMMCodecControlDestroy: no. %x\n",__LINE__, eError);
1329 OMX_PRDSP1(pComponentPrivate->dbg, "%d :: AACENCHandleCommand: Cmd Loaded\n",__LINE__);
1333 pComponentPrivate->bCodecDestroyed = OMX_TRUE;
1334 if (pComponentPrivate->ptrLibLCML != NULL)
1336 OMX_PRDSP1(pComponentPrivate->dbg, "AAC: About to Close LCML %p \n",pComponentPrivate->ptrLibLCML);
1337 OMX_PRDSP1(pComponentPrivate->dbg, "AAC: Closed LCML \n");
1338 dlclose( pComponentPrivate->ptrLibLCML );
1339 pComponentPrivate->ptrLibLCML = NULL;
1340 OMX_PRDSP1(pComponentPrivate->dbg, "AAC: Closed LCML \n");
1344 OMX_PRSTATE2(pComponentPrivate->dbg, "%d :: AACENC: After CodecControlDestroy \n",__LINE__);
1347 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error: LCML_ControlCodec EMMCodecControlDestroy: no. %x\n",__LINE__, eError);
1350 OMX_PRSTATE2(pComponentPrivate->dbg, "%d :: AACENCHandleCommand: Cmd Loaded\n",__LINE__);
1357 if (pComponentPrivate->curState != OMX_StateExecuting &&
1358 pComponentPrivate->curState != OMX_StateIdle)
1360 pComponentPrivate->cbInfo.EventHandler(pHandle,
1366 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error: Invalid State Given by Application\n",__LINE__);
1369 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: AACENC: about to call LCML_ControlCodec for PAUSE \n",__LINE__);
1373 OMX_ERROR4(pComponentPrivate->dbg, "%d :: Error: in Pausing the codec\n",__LINE__);
1377 PERF_Boundary(pComponentPrivate->pPERFcomp,PERF_BoundaryComplete | PERF_BoundarySteadyState);
1383 if (pComponentPrivate->curState == OMX_StateLoaded)
1390 pComponentPrivate->curState = OMX_StateWaitForResources;
1391 pComponentPrivate->cbInfo.EventHandler(pHandle,
1395 pComponentPrivate->curState,
1400 pComponentPrivate->cbInfo.EventHandler(pHandle,
1411 OMX_PRSTATE2(pComponentPrivate->dbg, "%d: HandleCommand: Cmd OMX_StateInvalid:\n",__LINE__);
1412 if (pComponentPrivate->curState != OMX_StateWaitForResources &&
1413 pComponentPrivate->curState != OMX_StateInvalid &&
1414 pComponentPrivate->curState != OMX_StateLoaded)
1420 pComponentPrivate->curState = OMX_StateInvalid;
1421 pComponentPrivate->cbInfo.EventHandler( pHandle,
1432 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: AACENCHandleCommand: Cmd OMX_StateMax::\n",__LINE__);
1441 OMX_PRDSP2(pComponentPrivate->dbg, "AACENC: command OMX_CommandMarkBuffer received %d\n",__LINE__);
1442 if(!pComponentPrivate->pMarkBuf)
1444 OMX_PRDSP1(pComponentPrivate->dbg, "AACENC: command OMX_CommandMarkBuffer received %d\n",__LINE__);
1446 pComponentPrivate->pMarkBuf = (OMX_MARKTYPE *)(commandData);
1451 if (!pComponentPrivate->bDisableCommandPending)
1456 pComponentPrivate->pPortDef[INPUT_PORT]->bEnabled = OMX_FALSE;
1461 pComponentPrivate->pPortDef[OUTPUT_PORT]->bEnabled = OMX_FALSE;
1463 if (pComponentPrivate->curState == OMX_StateExecuting)
1465 pComponentPrivate->bNoIdleOnStop = OMX_TRUE;
1466 OMX_PRINT2(pComponentPrivate->dbg, "AACENC: About to stop socket node line %d\n",__LINE__);
1468 pComponentPrivate->bIsStopping = 1;
1471 pthread_mutex_lock(&pComponentPrivate->codecStop_mutex);
1472 while (pComponentPrivate->codecStop_waitingsignal == 0){
1473 pthread_cond_wait(&pComponentPrivate->codecStop_threshold, &pComponentPrivate->codecStop_mutex);
1475 pComponentPrivate->codecStop_waitingsignal = 0;
1476 pthread_mutex_unlock(&pComponentPrivate->codecStop_mutex);
1483 if(!pComponentPrivate->pPortDef[INPUT_PORT]->bPopulated)
1486 pComponentPrivate->cbInfo.EventHandler( pHandle,
1490 pComponentPrivate->bDisableCommandPending = 0;
1494 pComponentPrivate->bDisableCommandPending = 1;
1495 pComponentPrivate->bDisableCommandParam = commandData;
1501 if (!pComponentPrivate->pPortDef[OUTPUT_PORT]->bPopulated)
1504 pComponentPrivate->cbInfo.EventHandler( pHandle,
1508 pComponentPrivate->bDisableCommandPending = 0;
1512 pComponentPrivate->bDisableCommandPending = 1;
1513 pComponentPrivate->bDisableCommandParam = commandData;
1519 if (!pComponentPrivate->pPortDef[INPUT_PORT]->bPopulated &&
1520 !pComponentPrivate->pPortDef[OUTPUT_PORT]->bPopulated)
1524 pComponentPrivate->cbInfo.EventHandler( pHandle,
1529 pComponentPrivate->cbInfo.EventHandler( pHandle,
1533 pComponentPrivate->bDisableCommandPending = 0;
1537 pComponentPrivate->bDisableCommandPending = 1;
1538 pComponentPrivate->bDisableCommandParam = commandData;
1545 if (!pComponentPrivate->bEnableCommandPending)
1550 OMX_PRCOMM2(pComponentPrivate->dbg, "AACENC: setting input port to enabled\n");
1551 pComponentPrivate->pPortDef[INPUT_PORT]->bEnabled = OMX_TRUE;
1552 OMX_PRCOMM2(pComponentPrivate->dbg, "WAKE UP!! HandleCommand: In utils setting output port to enabled. \n");
1553 if(pComponentPrivate->AlloBuf_waitingsignal)
1555 pComponentPrivate->AlloBuf_waitingsignal = 0;
1557 OMX_PRCOMM2(pComponentPrivate->dbg, "AACENC: pComponentPrivate->pPortDef[INPUT_PORT]->bEnabled = %d\n",pComponentPrivate->pPortDef[INPUT_PORT]->bEnabled);
1563 if(pComponentPrivate->AlloBuf_waitingsignal)
1565 pComponentPrivate->AlloBuf_waitingsignal = 0;
1567 pthread_mutex_lock(&pComponentPrivate->AlloBuf_mutex);
1568 pthread_cond_signal(&pComponentPrivate->AlloBuf_threshold);
1569 pthread_mutex_unlock(&pComponentPrivate->AlloBuf_mutex);
1571 OMX_SignalEvent(&(pComponentPrivate->AlloBuf_event));
1574 if (pComponentPrivate->curState == OMX_StateExecuting)
1577 pComponentPrivate->bDspStoppedWhileExecuting = OMX_FALSE;
1579 OMX_PRCOMM1(pComponentPrivate->dbg, "AACENC: About to start socket node line %d\n",__LINE__);
1583 OMX_PRCOMM1(pComponentPrivate->dbg, "AACENC: setting output port to enabled\n");
1584 pComponentPrivate->pPortDef[OUTPUT_PORT]->bEnabled = OMX_TRUE;
1585 OMX_PRCOMM1(pComponentPrivate->dbg, "AACENC: pComponentPrivate->pPortDef[OUTPUT_PORT]->bEnabled = %d\n",pComponentPrivate->pPortDef[OUTPUT_PORT]->bEnabled);
1591 if (pComponentPrivate->curState == OMX_StateLoaded || pComponentPrivate->pPortDef[INPUT_PORT]->bPopulated)
1593 pComponentPrivate->cbInfo.EventHandler(pHandle,
1599 pComponentPrivate->bEnableCommandPending = 0;
1603 pComponentPrivate->bEnableCommandPending = 1;
1604 pComponentPrivate->nEnableCommandParam = commandData;
1610 if (pComponentPrivate->curState == OMX_StateLoaded || pComponentPrivate->pPortDef[OUTPUT_PORT]->bPopulated)
1612 pComponentPrivate->cbInfo.EventHandler( pHandle,
1618 pComponentPrivate->bEnableCommandPending = 0;
1622 pComponentPrivate->bEnableCommandPending = 1;
1623 pComponentPrivate->nEnableCommandParam = commandData;
1629 if (pComponentPrivate->curState == OMX_StateLoaded ||
1630 (pComponentPrivate->pPortDef[INPUT_PORT]->bPopulated
1631 && pComponentPrivate->pPortDef[OUTPUT_PORT]->bPopulated))
1633 pComponentPrivate->cbInfo.EventHandler(pHandle,
1639 pComponentPrivate->cbInfo.EventHandler(pHandle,
1645 pComponentPrivate->bEnableCommandPending = 0;
1647 OMX_PRDSP1(pComponentPrivate->dbg, "\nAACENC: calling fillexparams \n");
1651 pComponentPrivate->bEnableCommandPending = 1;
1652 pComponentPrivate->nEnableCommandParam = commandData;
1657 pthread_mutex_lock(&pComponentPrivate->AlloBuf_mutex);
1658 pthread_cond_signal(&pComponentPrivate->AlloBuf_threshold);
1659 pthread_mutex_unlock(&pComponentPrivate->AlloBuf_mutex);
1661 OMX_SignalEvent(&(pComponentPrivate->AlloBuf_event));
1675 if(pComponentPrivate->nUnhandledEmptyThisBuffers ==0) {
1677 OMX_PRCOMM2(pComponentPrivate->dbg, "%d :: UTIL: Flushing input port \n",__LINE__);
1678 pComponentPrivate->nOutStandingEmptyDones = 0;
1681 pComponentPrivate->pInputBufHdrPending[i] = NULL;
1683 pComponentPrivate->nNumInputBufPending=0;
1684 for (i=0; i < pComponentPrivate->pInputBufferList->numBuffers; i++)
1687 pComponentPrivate->cbInfo.EmptyBufferDone (
1688 pComponentPrivate->pHandle,
1689 pComponentPrivate->pHandle->pApplicationPrivate,
1690 pComponentPrivate->pInputBufferList->pBufHdr[i]
1693 pComponentPrivate->cbInfo.EventHandler(pHandle,
1699 pComponentPrivate->bFlushInputPortCommandPending = OMX_TRUE;
1705 if (pComponentPrivate->nUnhandledFillThisBuffers == 0) {
1706 OMX_PRCOMM2(pComponentPrivate->dbg, "%d :: UTIL: Flushing output port \n",__LINE__);
1707 pComponentPrivate->nOutStandingFillDones = 0;
1710 pComponentPrivate->pOutputBufHdrPending[i] = NULL;
1712 pComponentPrivate->nNumOutputBufPending=0;
1713 for (i=0; i < pComponentPrivate->pOutputBufferList->numBuffers; i++)
1716 pComponentPrivate->cbInfo.FillBufferDone (
1717 pComponentPrivate->pHandle,
1718 pComponentPrivate->pHandle->pApplicationPrivate,
1719 pComponentPrivate->pOutputBufferList->pBufHdr[i]
1722 pComponentPrivate->cbInfo.EventHandler(
1727 pComponentPrivate->bFlushOutputPortCommandPending = OMX_TRUE;
1733 if (pComponentPrivate->nNumInputBufPending)
1736 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: AACENC: Inside OMX_CommandFlush Command \n",__LINE__);
1739 if (pComponentPrivate->nUnhandledEmptyThisBuffers == 0) {
1740 pComponentPrivate->bFlushInputPortCommandPending = OMX_FALSE;
1741 pComponentPrivate->nOutStandingFillDones = 0;
1745 OMX_PRCOMM1(pComponentPrivate->dbg, "%d :: AACENCHandleCommand::Flushing input port \n",__LINE__);
1753 pComponentPrivate->bFlushInputPortCommandPending = OMX_TRUE;
1759 OMX_PRCOMM1(pComponentPrivate->dbg, "%d :: UTIL: Flushing input port \n",__LINE__);
1760 pComponentPrivate->nOutStandingEmptyDones = 0;
1763 pComponentPrivate->pInputBufHdrPending[i] = NULL;
1765 pComponentPrivate->nNumInputBufPending=0;
1766 for (i=0; i < pComponentPrivate->pInputBufferList->numBuffers; i++)
1769 pComponentPrivate->cbInfo.EmptyBufferDone (
1770 pComponentPrivate->pHandle,
1771 pComponentPrivate->pHandle->pApplicationPrivate,
1772 pComponentPrivate->pInputBufferList->pBufHdr[i]
1774 AACENC_IncrementBufferCounterByOne(&bufferReturned_mutex, &pComponentPrivate->EmptybufferdoneCount);
1775 SignalIfAllBuffersAreReturned(pComponentPrivate);
1777 pComponentPrivate->cbInfo.EventHandler(pHandle,
1786 if (pComponentPrivate->nNumOutputBufPending)
1790 if (pComponentPrivate->nUnhandledFillThisBuffers == 0) {
1791 pComponentPrivate->bFlushOutputPortCommandPending = OMX_FALSE;
1792 pComponentPrivate->nOutStandingEmptyDones=0;
1793 OMX_PRCOMM1(pComponentPrivate->dbg, "%d :: AACENCHandleCommand::Flushing ouput queue \n",__LINE__);
1798 OMX_PRCOMM1(pComponentPrivate->dbg, "%d :: AACENCHandleCommand::Flushing ouput port \n",__LINE__);
1806 pComponentPrivate->bFlushOutputPortCommandPending = OMX_TRUE;
1812 OMX_PRCOMM1(pComponentPrivate->dbg, "%d :: UTIL: Flushing output port \n",__LINE__);
1813 pComponentPrivate->nOutStandingFillDones = 0;
1816 pComponentPrivate->pOutputBufHdrPending[i] = NULL;
1818 pComponentPrivate->nNumOutputBufPending=0;
1819 for (i=0; i < pComponentPrivate->pOutputBufferList->numBuffers; i++)
1822 pComponentPrivate->cbInfo.FillBufferDone (
1823 pComponentPrivate->pHandle,
1824 pComponentPrivate->pHandle->pApplicationPrivate,
1825 pComponentPrivate->pOutputBufferList->pBufHdr[i]
1827 AACENC_IncrementBufferCounterByOne(&bufferReturned_mutex, &pComponentPrivate->FillbufferdoneCount);
1828 SignalIfAllBuffersAreReturned(pComponentPrivate);
1830 pComponentPrivate->cbInfo.EventHandler( pHandle,
1840 OMX_PRINT1(pComponentPrivate->dbg, "%d :: AACENC: Exiting AACENCHandleCommand Function\n",__LINE__);
1841 OMX_PRINT1(pComponentPrivate->dbg, "%d :: AACENC: Returning %d\n",__LINE__,eError);
1844 OMX_ERROR4(pComponentPrivate->dbg, "%d:: Error: LCML QUEUE BUFFER\n",__LINE__);
1845 pComponentPrivate->cbInfo.EventHandler (pHandle,
1862 * @param pComponentPrivate Component private data
1872 OMX_ERRORTYPE AACENCHandleDataBuf_FromApp(OMX_BUFFERHEADERTYPE* pBufHeader, AACENC_COMPONENT_PRIVATE *pComponentPrivate)
1877 LCML_DSP_INTERFACE *pLcmlHandle = (LCML_DSP_INTERFACE *)pComponentPrivate->pLcmlHandle;
1880 OMX_PRINT1(pComponentPrivate->dbg, "%d :: UTIL: Entering AACENCHandleDataBuf_FromApp - curState = %d\n",__LINE__,pComponentPrivate->curState);
1886 OMX_ERROR4(pComponentPrivate->dbg, "%d :: UTIL: The pBufHeader is not found in the list\n",__LINE__);
1892 pComponentPrivate->nUnhandledEmptyThisBuffers--;
1893 OMX_PRBUFFER1(pComponentPrivate->dbg, "%d :: UTIL: Buffer Dir = input\n",__LINE__);
1894 pPortDefIn = pComponentPrivate->pPortDef[OMX_DirInput];
1897 pComponentPrivate->bBypassDSP = 0; /* flag for buffers with data */
1898 eError = AACENCGetCorresponding_LCMLHeader(pComponentPrivate, pBufHeader->pBuffer, OMX_DirInput, &pLcmlHdr);
1901 OMX_ERROR4(pComponentPrivate->dbg, "%d :: UTIL: Error: Invalid INPUT Buffer Came ...\n",__LINE__);
1909 if ((pComponentPrivate->nLcml_nCntIp == 1)) {
1910 PERF_Boundary(pComponentPrivate->pPERFcomp,
1914 PERF_SendingFrame(pComponentPrivate->pPERFcomp,
1922 OMX_PRCOMM1(pComponentPrivate->dbg, "%d :: UTIL: End of Stream has been reached \n",__LINE__);
1924 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: pLcmlHdr->pIpParam->bLastBuffer = %d \n",__LINE__,(int)pLcmlHdr->pIpParam->bLastBuffer);
1928 pComponentPrivate->timestampBufIndex[pComponentPrivate->IpBufindex] = pBufHeader->nTimeStamp;
1929 pComponentPrivate->tickcountBufIndex[pComponentPrivate->IpBufindex] = pBufHeader->nTickCount;
1930 pComponentPrivate->IpBufindex++;
1931 pComponentPrivate->IpBufindex %= pComponentPrivate->pPortDef[OMX_DirOutput]->nBufferCountActual;
1933 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: Sending input buffer header to Codec = %p to LCML\n",__LINE__,pBufHeader);
1934 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: Sending INPUT BUFFER to Codec = %p\n",__LINE__,pBufHeader->pBuffer);
1935 OMX_PRSTATE2(pComponentPrivate->dbg, "%d :: [HandleData_FromApp] pComponentPrivate->curState = %d\n",__LINE__,pComponentPrivate->curState);
1936 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: [HandleData_FromApp] pComponentPrivate->bDspStoppedWhileExecuting = %ld\n",__LINE__,pComponentPrivate->bDspStoppedWhileExecuting);
1938 if (pComponentPrivate->curState == OMX_StateExecuting)
1940 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: [HandleData_FromApp] The current state while sending the buffer = %d \n",__LINE__,pComponentPrivate->curState);
1941 if(!pComponentPrivate->bDspStoppedWhileExecuting)
1943 if (!AACENC_IsPending(pComponentPrivate,pBufHeader,OMX_DirInput))
1945 AACENC_SetPending(pComponentPrivate,pBufHeader,OMX_DirInput,__LINE__);
1956 OMX_ERROR4(pComponentPrivate->dbg, "%d :: UTIL: SetBuff: IP: Error Occurred\n",__LINE__);
1960 pComponentPrivate->lcml_nIpBuf++;
1961 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: [HandleData_FromApp] lcml_nIpBuf count : %d\n",__LINE__, (int)pComponentPrivate->lcml_nIpBuf);
1967 PERF_SendingFrame(pComponentPrivate->pPERFcomp,
1972 pComponentPrivate->cbInfo.EmptyBufferDone (
1973 pComponentPrivate->pHandle,
1974 pComponentPrivate->pHandle->pApplicationPrivate,
1977 pComponentPrivate->nOutStandingEmptyDones--;
1978 AACENC_IncrementBufferCounterByOne(&bufferReturned_mutex, &pComponentPrivate->EmptybufferdoneCount);
1979 SignalIfAllBuffersAreReturned(pComponentPrivate);
1985 pComponentPrivate->pInputBufHdrPending[pComponentPrivate->nNumInputBufPending++] = pBufHeader;
1991 pComponentPrivate->bBypassDSP = 1; /* flag : empty buffer */
1992 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: [HandleData_FromApp] setting pComponentPrivate->bBypassDSP = 1 \n", __LINE__);
1993 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: [HandleData_FromApp] Calling FillBufferDone\n", __LINE__);
1996 PERF_SendingFrame(pComponentPrivate->pPERFcomp,
1997 PREF(pComponentPrivate->pOutputBufferList->pBufHdr[0],pBuffer),
1998 PREF(pComponentPrivate->pOutputBufferList->pBufHdr[0],nFilledLen),
2002 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: [HandleData_FromApp] (filled <0 or EOS )Calling FillBufferDone \n",__LINE__);
2003 pComponentPrivate->cbInfo.FillBufferDone(pComponentPrivate->pHandle,
2004 pComponentPrivate->pHandle->pApplicationPrivate,
2005 pComponentPrivate->pOutputBufferList->pBufHdr[0]
2007 pComponentPrivate->nOutStandingFillDones--;
2008 AACENC_IncrementBufferCounterByOne(&bufferReturned_mutex, &pComponentPrivate->FillbufferdoneCount);
2009 SignalIfAllBuffersAreReturned(pComponentPrivate);
2010 OMX_PRBUFFER1(pComponentPrivate->dbg, "%d :: UTIL: pComponentPrivate->FillbufferdoneCount = %ld \n",__LINE__,pComponentPrivate->FillbufferdoneCount);
2011 OMX_PRBUFFER1(pComponentPrivate->dbg, "%d :: UTIL: pComponentPrivate->FillthisbufferCount = %ld \n",__LINE__,pComponentPrivate->FillthisbufferCount);
2015 PERF_SendingFrame(pComponentPrivate->pPERFcomp,
2016 PREF(pComponentPrivate->pInputBufferList->pBufHdr[0], pBuffer),
2021 OMX_PRINT1(pComponentPrivate->dbg, "%d :: [HandleData_FromApp] (filled <0 or EOS )Calling EmptyBufferDone \n",__LINE__);
2022 pComponentPrivate->cbInfo.EmptyBufferDone ( pComponentPrivate->pHandle,
2023 pComponentPrivate->pHandle->pApplicationPrivate,
2024 pComponentPrivate->pInputBufferList->pBufHdr[0]
2026 pComponentPrivate->nOutStandingEmptyDones--;
2027 AACENC_IncrementBufferCounterByOne(&bufferReturned_mutex, &pComponentPrivate->EmptybufferdoneCount);
2028 SignalIfAllBuffersAreReturned(pComponentPrivate);
2029 OMX_PRBUFFER1(pComponentPrivate->dbg, "%d :: UTIL: pComponentPrivate->EmptybufferdoneCount = %ld \n",__LINE__,pComponentPrivate->EmptybufferdoneCount);
2030 OMX_PRBUFFER1(pComponentPrivate->dbg, "%d :: UTIL: pComponentPrivate->EmptythisbufferCount = %ld \n",__LINE__,pComponentPrivate->EmptythisbufferCount);
2035 OMX_PRINT2(pComponentPrivate->dbg, "%d :: UTIL: Component Detected EOS\n",__LINE__);
2036 if(pComponentPrivate->dasfmode == 0)
2038 pComponentPrivate->pOutputBufferList->pBufHdr[0]->nFlags |= OMX_BUFFERFLAG_EOS;
2039 OMX_PRBUFFER1(pComponentPrivate->dbg, "%d :: UTIL: pComponentPrivate->pOutputBufferList->pBufHdr[0]->nFlags = %d \n",__LINE__,(int)pComponentPrivate->pOutputBufferList->pBufHdr[0]->nFlags);
2040 pComponentPrivate->cbInfo.EventHandler(pComponentPrivate->pHandle,
2041 pComponentPrivate->pHandle->pApplicationPrivate,
2043 pComponentPrivate->pOutputBufferList->pBufHdr[0]->nOutputPortIndex,
2044 pComponentPrivate->pOutputBufferList->pBufHdr[0]->nFlags, NULL);
2050 OMX_PRSTATE1(pComponentPrivate->dbg, "%d :: UTIL: pComponentPrivate->curState = %d\n",__LINE__,pComponentPrivate->curState);
2053 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: Detected pBufHeader->pMarkData\n",__LINE__);
2055 OMX_PRSTATE2(pComponentPrivate->dbg, "UTIL: pComponentPrivate->curState = %d\n",pComponentPrivate->curState);
2056 pComponentPrivate->pOutputBufferList->pBufHdr[0]->pMarkData = pBufHeader->pMarkData;
2057 OMX_PRSTATE2(pComponentPrivate->dbg, "UTIL: pComponentPrivate->curState = %d\n",pComponentPrivate->curState);
2058 pComponentPrivate->pOutputBufferList->pBufHdr[0]->hMarkTargetComponent = pBufHeader->hMarkTargetComponent;
2059 OMX_PRSTATE2(pComponentPrivate->dbg, "UTIL: pComponentPrivate->curState = %d\n",pComponentPrivate->curState);
2061 if(pBufHeader->hMarkTargetComponent == pComponentPrivate->pHandle && pBufHeader->pMarkData)
2063 OMX_PRSTATE1(pComponentPrivate->dbg, "UTIL: pComponentPrivate->curState = %d\n",pComponentPrivate->curState);
2064 pComponentPrivate->cbInfo.EventHandler(pComponentPrivate->pHandle,
2065 pComponentPrivate->pHandle->pApplicationPrivate,
2073 if (pComponentPrivate->bFlushInputPortCommandPending) {
2074 OMX_SendCommand(pComponentPrivate->pHandle,OMX_CommandFlush,0,NULL);
2085 OMX_PRBUFFER1(pComponentPrivate->dbg, "%d :: UTIL: Buffer Dir = output\n",__LINE__);
2086 OMX_PRINT1(pComponentPrivate->dbg, "%d :: UTIL: pComponentPrivate->bIsStopping = %ld\n",__LINE__, pComponentPrivate->bIsStopping);
2087 OMX_PRDSP1(pComponentPrivate->dbg, "%d :: UTIL: pComponentPrivate->bBypassDSP = %ld\n",__LINE__, pComponentPrivate->bBypassDSP);
2088 OMX_PRSTATE1(pComponentPrivate->dbg, "%d :: UTIL: pComponentPrivate->curState = %d\n",__LINE__,pComponentPrivate->curState);
2090 pComponentPrivate->nUnhandledFillThisBuffers--;
2093 if (pComponentPrivate->bFirstOutputBuffer){
2095 AACENCWriteConfigHeader(pComponentPrivate, pBufHeader);
2096 OMX_PRINT2(pComponentPrivate->dbg, "%d :: UTIL: AACENCWriteConfigHeader = %p\n",__LINE__, pBufHeader->pBuffer);
2097 pComponentPrivate->cbInfo.FillBufferDone (
2098 pComponentPrivate->pHandle,
2099 pComponentPrivate->pHandle->pApplicationPrivate,
2102 pComponentPrivate->bFirstOutputBuffer = 0;
2103 AACENC_IncrementBufferCounterByOne(&bufferReturned_mutex, &pComponentPrivate->FillbufferdoneCount);
2104 SignalIfAllBuffersAreReturned(pComponentPrivate);
2109 if (!(pComponentPrivate->bIsStopping))
2111 if (pComponentPrivate->bBypassDSP == 0)
2113 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: Sending Output buffer header to Codec= %p to LCML\n",__LINE__,pBufHeader);
2114 OMX_PRBUFFER1(pComponentPrivate->dbg, "%d :: UTIL: Sending OUTPUT BUFFER to Codec = %p\n",__LINE__,pBufHeader->pBuffer);
2116 PERF_SendingFrame(pComponentPrivate->pPERFcomp,
2122 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: pComponentPrivate = %p\n",__LINE__,pComponentPrivate);
2123 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: pBufHeader = %p\n",__LINE__,pBufHeader);
2124 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: pBufHeader->pBuffer = %p\n",__LINE__,pBufHeader->pBuffer);
2125 eError = AACENCGetCorresponding_LCMLHeader(pComponentPrivate, pBufHeader->pBuffer, OMX_DirOutput, &pLcmlHdr);
2126 OMX_PRSTATE2(pComponentPrivate->dbg, "%d :: UTIL: pComponentPrivate->curState = %d\n",__LINE__,pComponentPrivate->curState);
2128 if (pComponentPrivate->bBypassDSP == 0)
2130 OMX_PRSTATE2(pComponentPrivate->dbg, "%d :: [HandleData_FromApp]pComponentPrivate->curState = %d\n",__LINE__,pComponentPrivate->curState);
2131 OMX_PRINT2(pComponentPrivate->dbg, "%d :: [HandleData_FromApp]pComponentPrivate->bDspStoppedWhileExecuting = %ld\n",__LINE__,pComponentPrivate->bDspStoppedWhileExecuting);
2133 if (pComponentPrivate->curState == OMX_StateExecuting)
2135 if (!AACENC_IsPending(pComponentPrivate,pBufHeader,OMX_DirOutput))
2137 AACENC_SetPending(pComponentPrivate,pBufHeader,OMX_DirOutput,__LINE__);
2138 pComponentPrivate->LastOutputBufferHdrQueued = pBufHeader;
2148 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: Queuing Ouput buffer buffer \n",__LINE__);
2151 OMX_ERROR4(pComponentPrivate->dbg, "%d :: UTIL: Issuing DSP OP: Error Occurred\n",__LINE__);
2155 pComponentPrivate->lcml_nOpBuf++;
2156 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: tlcml_nOpBuf count : %d\n",__LINE__, (int)pComponentPrivate->lcml_nOpBuf);
2159 else if (pComponentPrivate->curState == OMX_StatePause)
2161 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: pComponentPrivate->nNumOutputBufPending++ = %d \n",__LINE__,(int)pComponentPrivate->nNumOutputBufPending++);
2162 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: pBufHeader = %p \n",__LINE__, pBufHeader);
2163 pComponentPrivate->pOutputBufHdrPending[pComponentPrivate->nNumOutputBufPending++] = pBufHeader;
2169 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: [HandleData_FromApp] OMX_DirOutput - bBypassDSP = %d \n", __LINE__, (int)pComponentPrivate->bBypassDSP);
2170 OMX_PRSTATE2(pComponentPrivate->dbg, "%d :: [HandleData_FromApp]pComponentPrivate->curState = %d\n",__LINE__,pComponentPrivate->curState);
2171 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: [HandleData_FromApp]pComponentPrivate->bDspStoppedWhileExecuting = %ld\n",__LINE__,pComponentPrivate->bDspStoppedWhileExecuting);
2173 if (pComponentPrivate->curState == OMX_StateExecuting)
2175 if (!AACENC_IsPending(pComponentPrivate,pBufHeader,OMX_DirOutput))
2177 AACENC_SetPending(pComponentPrivate,pBufHeader,OMX_DirOutput,__LINE__);
2178 pComponentPrivate->LastOutputBufferHdrQueued = pBufHeader;
2192 OMX_ERROR4(pComponentPrivate->dbg, "%d :: UTIL: Issuing DSP OP: Error Occurred\n",__LINE__);
2196 pComponentPrivate->lcml_nOpBuf++;
2197 OMX_PRDSP2(pComponentPrivate->dbg, "%d :: UTIL: lcml_nOpBuf count : %d\n",__LINE__, (int)pComponentPrivate->lcml_nOpBuf);
2202 pComponentPrivate->pOutputBufHdrPending[pComponentPrivate->nNumOutputBufPending++] = pBufHeader;
2207 if (pComponentPrivate->bFlushOutputPortCommandPending) {
2208 OMX_SendCommand( pComponentPrivate->pHandle,
2215 OMX_ERROR4(pComponentPrivate->dbg, "%d :: UTIL: BufferHeader = %p, Buffer = %p Unknown\n",__LINE__,pBufHeader, pBufHeader->pBuffer);
2219 OMX_PRINT1(pComponentPrivate->dbg, "%d :: UTIL:Exiting from HandleDataBuf_FromApp ..........>>>>>\n",__LINE__);
2222 OMX_ERROR4(pComponentPrivate->dbg, "%d:: Error: LCML QUEUE BUFFER\n",__LINE__);
2223 pComponentPrivate->cbInfo.EventHandler (pComponentPrivate->pHandle,
2224 pComponentPrivate->pHandle->pApplicationPrivate,
2250 AACENC_COMPONENT_PRIVATE *pComponentPrivate = pBufHeader->pPlatformPrivate;
2256 OMX_PRINT1(pComponentPrivate->dbg, "%d :: UTIL: Entering AACENCGetBufferDirection Function\n",__LINE__);
2259 nBuf = pComponentPrivate->pInputBufferList->numBuffers;
2262 pBuf = pComponentPrivate->pInputBufferList->pBufHdr[i];
2266 OMX_PRINT1(pComponentPrivate->dbg, "%d :: UTIL: Buffer %p is INPUT BUFFER\n",__LINE__, pBufHeader);
2273 nBuf = pComponentPrivate->pOutputBufferList->numBuffers;
2277 pBuf = pComponentPrivate->pOutputBufferList->pBufHdr[i];
2281 OMX_PRINT1(pComponentPrivate->dbg, "%d :: UTIL: Buffer %p is OUTPUT BUFFER\n",__LINE__, pBufHeader);
2289 OMX_ERROR4(pComponentPrivate->dbg, "%d :: UTIL: Buffer %p is Not Found in the List\n",__LINE__,pBufHeader);
2294 OMX_PRINT1(pComponentPrivate->dbg, "%d :: UTIL: Exiting AACENCGetBufferDirection Function\n",__LINE__);
2330 pComponentPrivate_CC = (AACENC_COMPONENT_PRIVATE*)((LCML_DSP_INTERFACE *)args[6])->pComponentPrivate;
2331 OMX_PRINT1(pComponentPrivate_CC->dbg, "%d:pComponentPrivate->curState = %d\n",__LINE__,pComponentPrivate_CC->curState);
2444 OMX_ERROR4(pComponentPrivate_CC->dbg, "UTIL: Couldn't calling EmptyBufferDone() because pComponentPrivate->curState = %d\n",pComponentPrivate_CC->curState);
2450 OMX_PRINT2(pComponentPrivate_CC->dbg, "%d :: pComponentPrivate->nOutStandingEmptyDones = %ld\n",__LINE__,pComponentPrivate_CC->nOutStandingEmptyDones);
2526 OMX_ERROR4(pComponentPrivate_CC->dbg, "UTIL: Couldn't calling fillBufferDone() because pComponentPrivate->curState = %d\n",pComponentPrivate_CC->curState);
2795 OMX_PRINT1(pComponentPrivate_CC->dbg, "%d:pComponentPrivate->curState = %d\n",__LINE__,pComponentPrivate_CC->curState);
2821 OMX_ERRORTYPE AACENCGetCorresponding_LCMLHeader(AACENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U8 *pBuffer, OMX_DIRTYPE eDir, LCML_AACENC_BUFHEADERTYPE **ppLcmlHdr)
2831 pComponentPrivate_CC = pComponentPrivate;
2836 OMX_PRINT1(pComponentPrivate->dbg, "%d :: UTIL: Entering AACENCGetCorresponding_LCMLHeader..\n",__LINE__);
2839 OMX_PRDSP1(pComponentPrivate->dbg, "%d :: UTIL: AACENCGetCorresponding_LCMLHeader -- eDir = %d \n",__LINE__,eDir);
2841 OMX_PRDSP1(pComponentPrivate->dbg, "%d :: UTIL: Before corresponding LCML Header is Found \n",__LINE__);
2845 OMX_PRDSP2(pComponentPrivate->dbg, "%d:: UTIL: Corresponding LCML Header Found\n",__LINE__);
2846 OMX_PRBUFFER2(pComponentPrivate->dbg, ":: UTIL: pBuffer = %p\n",pBuffer);
2847 OMX_PRBUFFER2(pComponentPrivate->dbg, ":: UTIL: pLcmlBufHeader->buffer = %p\n",pLcmlBufHeader->buffer);
2848 OMX_PRBUFFER2(pComponentPrivate->dbg, ":: UTIL: pLcmlBufHeader->buffer->pBuffer = %p\n",pLcmlBufHeader->buffer->pBuffer);
2856 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: AACENCGetCorresponding_LCMLHeader -- eDir = %d \n",__LINE__,eDir);
2858 OMX_PRINT2(pComponentPrivate->dbg, "%d :: UTIL: Before corresponding LCML Header is Found \n",__LINE__);
2859 OMX_PRBUFFER2(pComponentPrivate->dbg, "nOpBuf = %d\n",nOpBuf);
2862 OMX_PRBUFFER2(pComponentPrivate->dbg, "pBuffer = %p\n",pBuffer);
2863 OMX_PRBUFFER2(pComponentPrivate->dbg, "pLcmlBufHeader = %p\n",pLcmlBufHeader);
2864 OMX_PRBUFFER2(pComponentPrivate->dbg, "pLcmlBufHeader->buffer = %p\n",pLcmlBufHeader->buffer);
2865 OMX_PRBUFFER2(pComponentPrivate->dbg, " pLcmlBufHeader->buffer->pBuffer = %p\n", pLcmlBufHeader->buffer->pBuffer);
2866 OMX_PRBUFFER2(pComponentPrivate->dbg, "pBuffer = %p\n",pBuffer);
2867 OMX_PRBUFFER2(pComponentPrivate->dbg, "pLcmlBufHeader = %p\n",pLcmlBufHeader);
2868 OMX_PRBUFFER2(pComponentPrivate->dbg, "pLcmlBufHeader->buffer = %p\n",pLcmlBufHeader->buffer);
2869 OMX_PRBUFFER2(pComponentPrivate->dbg, "pLcmlBufHeader->buffer->pBuffer = %p\n",pLcmlBufHeader->buffer->pBuffer);
2873 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d:: UTIL: Corresponding LCML Header Found\n",__LINE__);
2874 OMX_PRBUFFER2(pComponentPrivate->dbg, ":: UTIL: pBuffer = %p\n",pBuffer);
2875 OMX_PRBUFFER2(pComponentPrivate->dbg, ":: UTIL: pLcmlBufHeader->buffer = %p\n",pLcmlBufHeader->buffer);
2876 OMX_PRBUFFER2(pComponentPrivate->dbg, ":: UTIL: pLcmlBufHeader->buffer->pBuffer = %p\n",pLcmlBufHeader->buffer->pBuffer);
2884 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d:: UTIL: Invalid Buffer Type :: exiting...\n",__LINE__);
2888 OMX_PRINT1(pComponentPrivate->dbg, "%d :: UTIL: Exiting AACENCGetCorresponding_LCMLHeader..\n",__LINE__);
2900 OMX_HANDLETYPE AACENCGetLCMLHandle(AACENC_COMPONENT_PRIVATE *pComponentPrivate)
2909 OMX_PRINT1(pComponentPrivate->dbg, "%d :: Entering AACENCGetLCMLHandle..\n",__LINE__);
2926 OMX_PRINT1(pComponentPrivate->dbg, "%d :: Entering AACENCGetLCMLHandle..\n",__LINE__);
2930 OMX_ERROR4(pComponentPrivate->dbg, "BML Load Failed!!!\n");
2939 OMX_ERROR4(pComponentPrivate->dbg, "BML GetProcAddress Failed!!!\n");
2947 OMX_ERROR4(pComponentPrivate->dbg, "eError != OMX_ErrorNone...\n");
2952 OMX_ERROR4(pComponentPrivate->dbg, "AAC: [AACENCGetLCMLHandle] closing LCML \n");
2958 ((LCML_DSP_INTERFACE*)pHandle)->pComponentPrivate= pComponentPrivate;
2959 pComponentPrivate->ptrLibLCML=handle; /* saving LCML lib pointer */
2960 OMX_PRDSP2(pComponentPrivate->dbg, "AAC: ptrLibLCML = %p\n",pComponentPrivate->ptrLibLCML);
2961 pComponentPrivate->bGotLCML = OMX_TRUE;
2964 OMX_PRINT1(pComponentPrivate->dbg, "%d :: Exiting AACENCGetLCMLHandle..\n",__LINE__);
2982 void AACENC_SetPending(AACENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir, OMX_U32 lineNumber)
2987 for (i=0; i < pComponentPrivate->pInputBufferList->numBuffers; i++) {
2988 if (pBufHdr == pComponentPrivate->pInputBufferList->pBufHdr[i]) {
2989 pComponentPrivate->pInputBufferList->bBufferPending[i] = 1;
2990 OMX_PRBUFFER2(pComponentPrivate->dbg, "*******************INPUT BUFFER %d IS PENDING Line %ld******************************\n",i,lineNumber);
2995 for (i=0; i < pComponentPrivate->pOutputBufferList->numBuffers; i++) {
2996 if (pBufHdr == pComponentPrivate->pOutputBufferList->pBufHdr[i]) {
2997 pComponentPrivate->pOutputBufferList->bBufferPending[i] = 1;
2998 OMX_PRBUFFER2(pComponentPrivate->dbg, "*******************OUTPUT BUFFER %d IS PENDING Line %ld******************************\n",i,lineNumber);
3018 void AACENC_ClearPending(AACENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir, OMX_U32 lineNumber)
3022 OMX_PRINT1(pComponentPrivate->dbg, "pComponentPrivate = %p\n",pComponentPrivate);
3023 OMX_PRBUFFER1(pComponentPrivate->dbg, "pBufHdr = %p\n",pBufHdr);
3024 OMX_PRINT2(pComponentPrivate->dbg, "eDir = %d\n",eDir);
3027 for (i=0; i < pComponentPrivate->pInputBufferList->numBuffers; i++) {
3028 if (pBufHdr == pComponentPrivate->pInputBufferList->pBufHdr[i]) {
3029 pComponentPrivate->pInputBufferList->bBufferPending[i] = 0;
3030 OMX_PRBUFFER2(pComponentPrivate->dbg, "*******************INPUT BUFFER %d IS RECLAIMED Line %ld******************************\n",i,lineNumber);
3035 for (i=0; i < pComponentPrivate->pOutputBufferList->numBuffers; i++) {
3036 if (pBufHdr == pComponentPrivate->pOutputBufferList->pBufHdr[i]) {
3037 pComponentPrivate->pOutputBufferList->bBufferPending[i] = 0;
3038 OMX_PRBUFFER2(pComponentPrivate->dbg, "*******************OUTPUT BUFFER %d IS RECLAIMED Line %ld******************************\n",i,lineNumber);
3058 OMX_U32 AACENC_IsPending(AACENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir)
3063 for (i=0; i < pComponentPrivate->pInputBufferList->numBuffers; i++) {
3064 if (pBufHdr == pComponentPrivate->pInputBufferList->pBufHdr[i]) {
3065 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: Buffer pending: pBufHdr = %p \n",__LINE__,pBufHdr);
3066 return pComponentPrivate->pInputBufferList->bBufferPending[i];
3071 for (i=0; i < pComponentPrivate->pOutputBufferList->numBuffers; i++) {
3072 if (pBufHdr == pComponentPrivate->pOutputBufferList->pBufHdr[i]) {
3073 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: UTIL: Buffer pending: pBufHdr = %p \n",__LINE__,pBufHdr);
3074 return pComponentPrivate->pOutputBufferList->bBufferPending[i];
3081 OMX_ERRORTYPE AACENC_TransitionToPause(AACENC_COMPONENT_PRIVATE *pComponentPrivate)
3085 OMX_PRINT1(pComponentPrivate->dbg, "AACENC_TransitionToPause:::pComponentPrivate->nOutStandingFillDones = %ld\n",pComponentPrivate->nOutStandingFillDones );
3086 OMX_PRINT1(pComponentPrivate->dbg, "AACENC_TransitionToPause:::pComponentPrivate->nOutStandingEmptyDones = %ld\n",pComponentPrivate->nOutStandingEmptyDones );
3087 if (pComponentPrivate->nOutStandingFillDones <= 0 && pComponentPrivate->nOutStandingEmptyDones <= 0)
3089 pComponentPrivate->curState = OMX_StatePause;
3092 if(RemoveStateTransition(pComponentPrivate, OMX_TRUE) != OMX_ErrorNone) {
3096 pComponentPrivate->cbInfo.EventHandler(pComponentPrivate->pHandle,
3097 pComponentPrivate->pHandle->pApplicationPrivate,
3100 pComponentPrivate->curState,
3102 pComponentPrivate->bPauseCommandPending = OMX_FALSE;
3133 AACENC_COMPONENT_PRIVATE *pComponentPrivate = pHandle->pComponentPrivate;
3135 OMX_PRINT1(pComponentPrivate->dbg, "%d :: AACENCFill_LCMLInitParams\n ",__LINE__);
3136 nIpBuf = pComponentPrivate->pInputBufferList->numBuffers;
3137 nIpBufSize = pComponentPrivate->pPortDef[INPUT_PORT]->nBufferSize;
3138 nOpBuf = pComponentPrivate->pOutputBufferList->numBuffers;
3139 nOpBufSize = pComponentPrivate->pPortDef[OUTPUT_PORT]->nBufferSize;
3141 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: ------ Buffer Details -----------\n",__LINE__);
3142 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: Input Buffer Count = %ld \n",__LINE__,nIpBuf);
3143 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: Input Buffer Size = %ld\n",__LINE__,nIpBufSize);
3144 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: Output Buffer Count = %ld\n",__LINE__,nOpBuf);
3145 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: Output Buffer Size = %ld\n",__LINE__,nOpBufSize);
3146 OMX_PRBUFFER2(pComponentPrivate->dbg, "%d :: ------ Buffer Details ------------\n",__LINE__);
3150 OMX_PRDSP2(pComponentPrivate->dbg, "pTemp_lcml %p to %p \n",pTemp_lcml,(pTemp_lcml + sizeof(pTemp_lcml) ));
3152 pComponentPrivate->pLcmlBufHeader[INPUT_PORT] = pTemp_lcml;
3155 pTemp = pComponentPrivate->pInputBufferList->pBufHdr[i];
3161 pTemp->pPlatformPrivate = pHandle->pComponentPrivate;
3167 OMX_PRDSP2(pComponentPrivate->dbg, "pTemp_lcml %p to %p \n",pTemp_lcml,(pTemp_lcml + sizeof(pTemp_lcml) ));
3180 OMX_PRDSP2(pComponentPrivate->dbg, "size_lcml %d to %lx \n", (int)size_lcml,(size_lcml + sizeof(size_lcml) ));
3182 pComponentPrivate->pLcmlBufHeader[OUTPUT_PORT] = pTemp_lcml;
3186 OMX_PRBUFFER2(pComponentPrivate->dbg, "[AACENCFill_LCMLInitParamsEx] nOpBuf = %d\n", (int)nOpBuf);
3187 OMX_PRBUFFER2(pComponentPrivate->dbg, "[AACENCFill_LCMLInitParamsEx] pComponentPrivate->pOutputBufferList->numBuffers = %d\n",pComponentPrivate->pOutputBufferList->numBuffers);
3189 OMX_PRDSP2(pComponentPrivate->dbg, "[AACENCFill_LCMLInitParamsEx] pTemp_lcml = %p\n",pTemp_lcml);
3190 pTemp = pComponentPrivate->pOutputBufferList->pBufHdr[i];
3196 pComponentPrivate->nVersion = pTemp->nVersion.nVersion;
3197 pTemp->pPlatformPrivate = pHandle->pComponentPrivate;
3206 OMX_PRINT2(pComponentPrivate->dbg, "\n pTemp_lcml->pOpParam %p \n",pTemp_lcml->pOpParam);
3211 pComponentPrivate->bPortDefsAllocated = 1;
3212 pComponentPrivate->bBypassDSP = 0;
3215 OMX_PRINT1(pComponentPrivate->dbg, "%d :: Exiting Fill_LCMLInitParams\n",__LINE__);
3216 OMX_PRINT1(pComponentPrivate->dbg, "%d :: Returning = 0x%x\n",__LINE__,eError);
3221 OMX_ERRORTYPE AACENCWriteConfigHeader(AACENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr){
3239 OMX_PRINT2(pComponentPrivate->dbg, "profile is %d\n", pComponentPrivate->aacParams[OUTPUT_PORT]->eAACProfile);
3240 if (pComponentPrivate->aacParams[OUTPUT_PORT]->eAACProfile == OMX_AUDIO_AACObjectLC)
3243 OMX_PRINT2(pComponentPrivate->dbg, "profile is LC, tempData = 2 << (32-5) = %ld\n", tempData);
3245 else if (pComponentPrivate->aacParams[OUTPUT_PORT]->eAACProfile == OMX_AUDIO_AACObjectHE)
3249 else if (pComponentPrivate->aacParams[OUTPUT_PORT]->eAACProfile == OMX_AUDIO_AACObjectHE_PS)
3257 rateIndex = AACEnc_GetSampleRateIndexL(pComponentPrivate->aacParams[OUTPUT_PORT]->nSampleRate);
3260 OMX_PRBUFFER2(pComponentPrivate->dbg, "CONFIG BUFFER = %d\n\n", nBuf);
3264 tempData = pComponentPrivate->aacParams[OUTPUT_PORT]->nChannels << (16-nPosition);
3271 OMX_PRBUFFER2(pComponentPrivate->dbg, "CONFIG BUFFER = %d\n\n", nBuf2);
3349 void AACENC_HandleUSNError (AACENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U32 arg)
3360 OMX_ERROR4(pComponentPrivate->dbg, "Algorithm Error" );
3367 OMX_PRINT2(pComponentPrivate->dbg, "%d :: UTIL: IUALG_WARN_PLAYCOMPLETED/USN_ERR_WARNING event received\n", __LINE__);
3368 pComponentPrivate->bPlayCompleteFlag = 1;
3370 pComponentPrivate->cbInfo.EventHandler(pComponentPrivate->pHandle,
3371 pComponentPrivate->pHandle->pApplicationPrivate,
3376 pComponentPrivate->pLcmlBufHeader[0]->pIpParam->bLastBuffer = 0;
3379 pComponentPrivate->cbInfo.EventHandler(pComponentPrivate->pHandle,
3380 pComponentPrivate->pHandle->pApplicationPrivate,
3400 OMX_ERROR4(pComponentPrivate->dbg, "Algorithm Error, cannot recover" );
3401 pComponentPrivate->bIsInvalidState=OMX_TRUE;
3402 pComponentPrivate->curState = OMX_StateInvalid;
3403 pHandle = pComponentPrivate->pHandle;
3404 pComponentPrivate->cbInfo.EventHandler(pHandle,
3427 pCompPrivate = (AACENC_COMPONENT_PRIVATE *)pHandle->pComponentPrivate;
3450 OMX_ERRORTYPE AddStateTransition(AACENC_COMPONENT_PRIVATE* pComponentPrivate) {
3453 if(pthread_mutex_lock(&pComponentPrivate->mutexStateChangeRequest)) {
3457 pComponentPrivate->nPendingStateChangeRequests++;
3458 ALOGI("addstatetranstion: %ld @ %d", pComponentPrivate->nPendingStateChangeRequests, pComponentPrivate->curState);
3460 if(pthread_mutex_unlock(&pComponentPrivate->mutexStateChangeRequest)) {
3466 OMX_ERRORTYPE RemoveStateTransition(AACENC_COMPONENT_PRIVATE* pComponentPrivate, OMX_BOOL bEnableSignal) {
3470 if(pthread_mutex_lock(&pComponentPrivate->mutexStateChangeRequest)) {
3473 pComponentPrivate->nPendingStateChangeRequests--;
3474 ALOGI("removestatetranstion: %ld @ %d", pComponentPrivate->nPendingStateChangeRequests, pComponentPrivate->curState);
3477 if(!pComponentPrivate->nPendingStateChangeRequests && bEnableSignal) {
3478 pthread_cond_signal(&(pComponentPrivate->StateChangeCondition));
3480 if(pthread_mutex_unlock(&pComponentPrivate->mutexStateChangeRequest)) {
3491 * @param AACENC_COMPONENT_PRIVATE *pComponentPrivate
3500 void SignalIfAllBuffersAreReturned(AACENC_COMPONENT_PRIVATE *pComponentPrivate)
3503 if ((pComponentPrivate->EmptythisbufferCount == pComponentPrivate->EmptybufferdoneCount) &&
3504 (pComponentPrivate->FillthisbufferCount == pComponentPrivate->FillbufferdoneCount)) {