OMX_ERRORTYPE UniaDecoder::AudioFilterCheckCodecConfig() { OMX_S32 ret = OMX_ErrorNone; if(IDecoder == NULL || uniaHandle == NULL) return OMX_ErrorUndefined; if (codecConfig.buf != NULL) { codecConfig.buf = (char *)FSL_REALLOC(codecConfig.buf, \ codecConfig.size + pInBufferHdr->nFilledLen); if (codecConfig.buf == NULL) { LOG_ERROR("Can't get memory.\n"); return OMX_ErrorInsufficientResources; } fsl_osal_memcpy(codecConfig.buf + codecConfig.size, pInBufferHdr->pBuffer, pInBufferHdr->nFilledLen); codecConfig.size += pInBufferHdr->nFilledLen; } else { codecConfig.buf = (char *)FSL_MALLOC(pInBufferHdr->nFilledLen); if (codecConfig.buf == NULL) { LOG_ERROR("Can't get memory.\n"); return OMX_ErrorInsufficientResources; } fsl_osal_memcpy(codecConfig.buf, pInBufferHdr->pBuffer, pInBufferHdr->nFilledLen); codecConfig.size = pInBufferHdr->nFilledLen; } ret = IDecoder->SetParameter(uniaHandle,UNIA_CODEC_DATA,(UniACodecParameter*)&codecConfig); LOG_DEBUG("UniaDec::AudioDecoderBaseCheckCodecConfig nFilledLen=%d,ret=%d",pInBufferHdr->nFilledLen,ret); pInBufferHdr->nFilledLen = 0; return (OMX_ERRORTYPE)ret; }
/***************************************************************************** * Function: appLocalReAlloc * * Description: Implements to Free the memory. * * Return: Void * ****************************************************************************/ static void * appLocalReAlloc (void *MemoryBlock, uint32 TotalSize) { void *PtrMalloc = NULL; if(0 == TotalSize) LOG_WARNING("\nWarning: ZERO size IN LOCAL REALLOC"); PtrMalloc = (void *)FSL_REALLOC(MemoryBlock, TotalSize); if (PtrMalloc == NULL) { LOG_ERROR("\nError: MEMORY FAILURE IN LOCAL REALLOC"); } return PtrMalloc; }
OMX_ERRORTYPE VideoFilter::ProcessInBufferFlags() { if(pInBufferHdr->nFlags & OMX_BUFFERFLAG_STARTTIME) bGetNewSegment = OMX_TRUE; if(bGetNewSegment == OMX_TRUE && (!(pInBufferHdr->nFlags & OMX_BUFFERFLAG_CODECCONFIG))) { LOG_DEBUG("Get New sement buffer, ts %lld\n", pInBufferHdr->nTimeStamp); bGetNewSegment = OMX_FALSE; bNewSegment = OMX_TRUE; bLastInput = OMX_FALSE; bLastOutput = OMX_FALSE; if(pInBufferHdr->nFlags & OMX_BUFFERFLAG_STARTTRICK) { LOG_DEBUG("Set ts manager to FIFO mode.\n"); tsmFlush(hTsHandle, pInBufferHdr->nTimeStamp, MODE_FIFO); } else { LOG_DEBUG("Set ts manager to AI mode.\n"); tsmFlush(hTsHandle, pInBufferHdr->nTimeStamp, MODE_AI); } } if(bLastInput != OMX_FALSE) { LOG_DEBUG("Filter drop input buffers in EOS state.\n"); ReturnInputBuffer(); return OMX_ErrorNoMore; } if(pInBufferHdr->nFlags & OMX_BUFFERFLAG_EOS) { bLastInput = OMX_TRUE; bNeedInputBuffer = OMX_FALSE; pInBufferHdr->nTimeStamp = -1; pInBufferHdr->nFilledLen = 0; return OMX_ErrorNone; } if(!(pInBufferHdr->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) && bFilterSupportPartilInput != OMX_TRUE) { ProcessPartialInput(); return OMX_ErrorNotReady; } if(PartialInputHdr.pBuffer != NULL) { ProcessPartialInput(); pInBufferHdr = &PartialInputHdr; } if(pInBufferHdr->nFlags & OMX_BUFFERFLAG_DECODEONLY) nDecodeOnly ++; if(pInBufferHdr->nFlags & OMX_BUFFERFLAG_CODECCONFIG && pInBufferHdr->nFilledLen > 0) { if(pCodecData == NULL) { pCodecData = FSL_MALLOC(pInBufferHdr->nFilledLen); if(pCodecData == NULL) { SendEvent(OMX_EventError, OMX_ErrorInsufficientResources, 0, NULL); return OMX_ErrorInsufficientResources; } } else { pCodecData = FSL_REALLOC(pCodecData, nCodecDataLen + pInBufferHdr->nFilledLen); if(pCodecData == NULL) { SendEvent(OMX_EventError, OMX_ErrorInsufficientResources, 0, NULL); return OMX_ErrorInsufficientResources; } } fsl_osal_memcpy((char *)pCodecData + nCodecDataLen, pInBufferHdr->pBuffer, pInBufferHdr->nFilledLen); nCodecDataLen += pInBufferHdr->nFilledLen; LOG_INFO("Get Codec configure data, len: %d\n", nCodecDataLen); ReturnInputBuffer(); return OMX_ErrorNotReady; } return OMX_ErrorNone; }