case OMX_StateLoaded:
for (i = 0; i < pExynosComponent->portParam.nPorts; i++) {
pExynosPort = (pExynosComponent->pExynosPort + i);
- if (pExynosPort == NULL) {
- ret = OMX_ErrorBadParameter;
- goto EXIT;
- }
+
if (CHECK_PORT_TUNNELED(pExynosPort) && CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) {
if (CHECK_PORT_ENABLED(pExynosPort)) {
ret = pExynosComponent->exynos_AllocateTunnelBuffer(pExynosPort, i);
}
EXIT:
- if ((ret != OMX_ErrorNone) && (pOMXComponent != NULL) && (pExynosComponent != NULL)) {
+ if (ret != OMX_ErrorNone) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR,"%s : %d", __FUNCTION__, __LINE__);
- pExynosComponent->pCallbacks->EventHandler(pOMXComponent,
- pExynosComponent->callbackData,
- OMX_EventError,
- ret, 0, NULL);
+
+ if ((pOMXComponent != NULL) &&
+ (pExynosComponent != NULL)) {
+ pExynosComponent->pCallbacks->EventHandler(pOMXComponent,
+ pExynosComponent->callbackData,
+ OMX_EventError,
+ ret, 0, NULL);
+ }
}
FunctionOut();
EXYNOS_OMX_VIDEODEC_COMPONENT *pVideoDec = (EXYNOS_OMX_VIDEODEC_COMPONENT *)pExynosComponent->hComponentHandle;
CODEC_DEC_BUFFER **ppCodecBuffer = NULL;
- OMX_U32 nPlaneCnt = 0;
+ OMX_U32 nBufferCnt = 0, nPlaneCnt = 0;
int i, j;
FunctionIn();
if (nPortIndex == INPUT_PORT_INDEX) {
ppCodecBuffer = &(pVideoDec->pMFCDecInputBuffer[0]);
+ nBufferCnt = MFC_INPUT_BUFFER_NUM_MAX;
nPlaneCnt = MFC_INPUT_BUFFER_PLANE;
} else {
ppCodecBuffer = &(pVideoDec->pMFCDecOutputBuffer[0]);
+ nBufferCnt = MFC_OUTPUT_BUFFER_NUM_MAX;
nPlaneCnt = MFC_OUTPUT_BUFFER_PLANE;
}
- for (i = 0; i < MFC_OUTPUT_BUFFER_NUM_MAX; i++) {
+ for (i = 0; i < nBufferCnt; i++) {
if (ppCodecBuffer[i] != NULL) {
for (j = 0; j < nPlaneCnt; j++) {
if (ppCodecBuffer[i]->pVirAddr[j] != NULL)
outputUseBuffer = &(pExynosPort->way.port2WayDataBuffer.outputDataBuffer);
} else if (pExynosPort->bufferProcessType & BUFFER_SHARE) {
outputUseBuffer = &(pExynosPort->way.port2WayDataBuffer.inputDataBuffer);
+ } else {
+ ret = OMX_ErrorUndefined;
+ goto EXIT;
}
if (pExynosComponent->currentState != OMX_StateExecuting) {
pSrcOutputData->allocSize = pVideoBuffer->planes[0].allocSize;
if (pExynosInputPort->bufferProcessType & BUFFER_COPY) {
- int i = 0;
- while (pSrcOutputData->buffer.singlePlaneBuffer.dataBuffer != pVideoDec->pMFCDecInputBuffer[i]->pVirAddr[0]) {
- if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Can not find buffer");
- ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode;
- goto EXIT;
+ int i;
+ for (i = 0; i < MFC_INPUT_BUFFER_NUM_MAX; i++) {
+ if (pSrcOutputData->buffer.singlePlaneBuffer.dataBuffer ==
+ pVideoDec->pMFCDecInputBuffer[i]->pVirAddr[0]) {
+ pVideoDec->pMFCDecInputBuffer[i]->dataSize = 0;
+ pSrcOutputData->pPrivate = pVideoDec->pMFCDecInputBuffer[i];
+ break;
}
- i++;
}
- pVideoDec->pMFCDecInputBuffer[i]->dataSize = 0;
- pSrcOutputData->pPrivate = pVideoDec->pMFCDecInputBuffer[i];
+
+ if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
+ Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Can not find buffer");
+ ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode;
+ goto EXIT;
+ }
}
/* For Share Buffer */
pSrcOutputData->allocSize = pVideoBuffer->planes[0].allocSize;
if (pExynosInputPort->bufferProcessType & BUFFER_COPY) {
- int i = 0;
- while (pSrcOutputData->buffer.singlePlaneBuffer.dataBuffer != pVideoDec->pMFCDecInputBuffer[i]->pVirAddr[0]) {
- if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Can not find buffer");
- ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode;
- goto EXIT;
+ int i;
+ for (i = 0; i < MFC_INPUT_BUFFER_NUM_MAX; i++) {
+ if (pSrcOutputData->buffer.singlePlaneBuffer.dataBuffer ==
+ pVideoDec->pMFCDecInputBuffer[i]->pVirAddr[0]) {
+ pVideoDec->pMFCDecInputBuffer[i]->dataSize = 0;
+ pSrcOutputData->pPrivate = pVideoDec->pMFCDecInputBuffer[i];
+ break;
}
- i++;
}
- pVideoDec->pMFCDecInputBuffer[i]->dataSize = 0;
- pSrcOutputData->pPrivate = pVideoDec->pMFCDecInputBuffer[i];
+
+ if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
+ Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Can not find buffer");
+ ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode;
+ goto EXIT;
+ }
}
/* For Share Buffer */
pSrcOutputData->allocSize = pVideoBuffer->planes[0].allocSize;
if (pExynosInputPort->bufferProcessType & BUFFER_COPY) {
- int i = 0;
- while (pSrcOutputData->buffer.singlePlaneBuffer.dataBuffer != pVideoDec->pMFCDecInputBuffer[i]->pVirAddr[0]) {
- if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Can not find buffer");
- ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode;
- goto EXIT;
+ int i;
+ for (i = 0; i < MFC_INPUT_BUFFER_NUM_MAX; i++) {
+ if (pSrcOutputData->buffer.singlePlaneBuffer.dataBuffer ==
+ pVideoDec->pMFCDecInputBuffer[i]->pVirAddr[0]) {
+ pVideoDec->pMFCDecInputBuffer[i]->dataSize = 0;
+ pSrcOutputData->pPrivate = pVideoDec->pMFCDecInputBuffer[i];
+ break;
}
- i++;
}
- pVideoDec->pMFCDecInputBuffer[i]->dataSize = 0;
- pSrcOutputData->pPrivate = pVideoDec->pMFCDecInputBuffer[i];
+
+ if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
+ Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Can not find buffer");
+ ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode;
+ goto EXIT;
+ }
}
/* For Share Buffer */
if (pDstWmvParam->nPortIndex > OUTPUT_PORT_INDEX) {
ret = OMX_ErrorBadPortIndex;
+ goto EXIT;
}
pWmvDec = (EXYNOS_WMVDEC_HANDLE *)((EXYNOS_OMX_VIDEODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
pSrcOutputData->allocSize = pVideoBuffer->planes[0].allocSize;
if (pExynosInputPort->bufferProcessType & BUFFER_COPY) {
- int i = 0;
- while (pSrcOutputData->buffer.singlePlaneBuffer.dataBuffer != pVideoDec->pMFCDecInputBuffer[i]->pVirAddr[0]) {
- if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Can not find buffer");
- ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode;
- goto EXIT;
+ int i;
+ for (i = 0; i < MFC_INPUT_BUFFER_NUM_MAX; i++) {
+ if (pSrcOutputData->buffer.singlePlaneBuffer.dataBuffer ==
+ pVideoDec->pMFCDecInputBuffer[i]->pVirAddr[0]) {
+ pVideoDec->pMFCDecInputBuffer[i]->dataSize = 0;
+ pSrcOutputData->pPrivate = pVideoDec->pMFCDecInputBuffer[i];
+ break;
}
- i++;
}
- pVideoDec->pMFCDecInputBuffer[i]->dataSize = 0;
- pSrcOutputData->pPrivate = pVideoDec->pMFCDecInputBuffer[i];
+
+ if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
+ Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Can not find buffer");
+ ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode;
+ goto EXIT;
+ }
}
/* For Share Buffer */
pSrcOutputData->allocSize = pVideoBuffer->planes[0].allocSize;
if (pExynosInputPort->bufferProcessType & BUFFER_COPY) {
- int i = 0;
- while (pSrcOutputData->buffer.singlePlaneBuffer.dataBuffer != pVideoDec->pMFCDecInputBuffer[i]->pVirAddr[0]) {
- if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Can not find buffer");
- ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode;
- goto EXIT;
+ int i;
+ for (i = 0; i < MFC_INPUT_BUFFER_NUM_MAX; i++) {
+ if (pSrcOutputData->buffer.singlePlaneBuffer.dataBuffer ==
+ pVideoDec->pMFCDecInputBuffer[i]->pVirAddr[0]) {
+ pVideoDec->pMFCDecInputBuffer[i]->dataSize = 0;
+ pSrcOutputData->pPrivate = pVideoDec->pMFCDecInputBuffer[i];
+ break;
}
- i++;
}
- pVideoDec->pMFCDecInputBuffer[i]->dataSize = 0;
- pSrcOutputData->pPrivate = pVideoDec->pMFCDecInputBuffer[i];
+
+ if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
+ Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Can not find buffer");
+ ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode;
+ goto EXIT;
+ }
}
/* For Share Buffer */
EXYNOS_OMX_VIDEOENC_COMPONENT *pVideoEnc = (EXYNOS_OMX_VIDEOENC_COMPONENT *)pExynosComponent->hComponentHandle;
CODEC_ENC_BUFFER **ppCodecBuffer = NULL;
- OMX_U32 nPlaneCnt = 0;
+ OMX_U32 nBufferCnt = 0, nPlaneCnt = 0;
int i, j;
FunctionIn();
if (nPortIndex == INPUT_PORT_INDEX) {
ppCodecBuffer = &(pVideoEnc->pMFCEncInputBuffer[0]);
+ nBufferCnt = MFC_INPUT_BUFFER_NUM_MAX;
nPlaneCnt = MFC_INPUT_BUFFER_PLANE;
} else {
ppCodecBuffer = &(pVideoEnc->pMFCEncOutputBuffer[0]);
+ nBufferCnt = MFC_OUTPUT_BUFFER_NUM_MAX;
nPlaneCnt = MFC_OUTPUT_BUFFER_PLANE;
}
- for (i = 0; i < MFC_OUTPUT_BUFFER_NUM_MAX; i++) {
+ for (i = 0; i < nBufferCnt; i++) {
if (ppCodecBuffer[i] != NULL) {
for (j = 0; j < nPlaneCnt; j++) {
if (ppCodecBuffer[i]->pVirAddr[j] != NULL)
pDataBuffer = &(pExynosPort->way.port2WayDataBuffer.outputDataBuffer);
} else if (pExynosPort->bufferProcessType & BUFFER_SHARE) {
pDataBuffer = &(pExynosPort->way.port2WayDataBuffer.inputDataBuffer);
+ } else {
+ ret = OMX_ErrorUndefined;
+ goto EXIT;
}
if (pExynosComponent->currentState != OMX_StateExecuting) {
} else if ((pExynosComponent->transientState != EXYNOS_OMX_TransStateExecutingToIdle) &&
(!CHECK_PORT_BEING_FLUSHED(pExynosPort))) {
Exynos_OSAL_SemaphoreWait(pExynosPort->bufferSemID);
- if ((pDataBuffer != NULL) &&
- (pDataBuffer->dataValid != OMX_TRUE)) {
+ if (pDataBuffer->dataValid != OMX_TRUE) {
pMessage = (EXYNOS_OMX_MESSAGE *)Exynos_OSAL_Dequeue(&pExynosPort->bufferQ);
if (pMessage == NULL) {
ret = OMX_ErrorUndefined;
pVideoBuffer->planes[2].allocSize;
if (pExynosInputPort->bufferProcessType & BUFFER_COPY) {
- int i = 0;
- while (pSrcOutputData->buffer.multiPlaneBuffer.dataBuffer[0] != pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[0]) {
- if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: %d: Failed - Lost buffer", __FUNCTION__, __LINE__);
- ret = (OMX_ERRORTYPE)OMX_ErrorCodecEncode;
- goto EXIT;
+ int i;
+ for (i = 0; i < MFC_INPUT_BUFFER_NUM_MAX; i++) {
+ if (pSrcOutputData->buffer.multiPlaneBuffer.dataBuffer[0] ==
+ pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[0]) {
+ pVideoEnc->pMFCEncInputBuffer[i]->dataSize = 0;
+ pSrcOutputData->pPrivate = pVideoEnc->pMFCEncInputBuffer[i];
+ break;
}
- i++;
}
- pVideoEnc->pMFCEncInputBuffer[i]->dataSize = 0;
- pSrcOutputData->pPrivate = pVideoEnc->pMFCEncInputBuffer[i];
+
+ if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
+ Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: %d: Failed - Lost buffer", __FUNCTION__, __LINE__);
+ ret = (OMX_ERRORTYPE)OMX_ErrorCodecEncode;
+ goto EXIT;
+ }
}
/* For Share Buffer */
pVideoBuffer->planes[2].allocSize;
if (pExynosInputPort->bufferProcessType & BUFFER_COPY) {
- int i = 0;
- while (pSrcOutputData->buffer.multiPlaneBuffer.dataBuffer[0] != pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[0]) {
- if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: %d: Failed - Lost buffer", __FUNCTION__, __LINE__);
- ret = (OMX_ERRORTYPE)OMX_ErrorCodecEncode;
- goto EXIT;
+ int i;
+ for (i = 0; i < MFC_INPUT_BUFFER_NUM_MAX; i++) {
+ if (pSrcOutputData->buffer.multiPlaneBuffer.dataBuffer[0] ==
+ pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[0]) {
+ pVideoEnc->pMFCEncInputBuffer[i]->dataSize = 0;
+ pSrcOutputData->pPrivate = pVideoEnc->pMFCEncInputBuffer[i];
+ break;
}
- i++;
}
- pVideoEnc->pMFCEncInputBuffer[i]->dataSize = 0;
- pSrcOutputData->pPrivate = pVideoEnc->pMFCEncInputBuffer[i];
+
+ if (i >= MFC_INPUT_BUFFER_NUM_MAX) {
+ Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: %d: Failed - Lost buffer", __FUNCTION__, __LINE__);
+ ret = (OMX_ERRORTYPE)OMX_ErrorCodecEncode;
+ goto EXIT;
+ }
}
/* For Share Buffer */