summaryrefslogtreecommitdiffstats
path: root/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c')
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c107
1 files changed, 77 insertions, 30 deletions
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c b/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c
index 580d821..9586a26 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c
@@ -33,6 +33,7 @@
#include "SEC_OSAL_Event.h"
#include "SEC_OMX_Vdec.h"
#include "SEC_OMX_Basecomponent.h"
+#include "SEC_OSAL_Thread.h"
#undef SEC_LOG_TAG
#define SEC_LOG_TAG "SEC_VIDEO_DEC"
@@ -492,6 +493,7 @@ OMX_ERRORTYPE SEC_InputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent)
dataBuffer->dataValid = OMX_TRUE;
dataBuffer->nFlags = dataBuffer->bufferHeader->nFlags;
dataBuffer->timeStamp = dataBuffer->bufferHeader->nTimeStamp;
+
SEC_OSAL_Free(message);
if (dataBuffer->allocSize <= dataBuffer->dataLen)
@@ -630,7 +632,7 @@ static OMX_ERRORTYPE SEC_BufferReset(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 p
return ret;
}
-static OMX_ERRORTYPE SEC_DataDrop(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 portIndex)
+static OMX_ERRORTYPE SEC_DataReset(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 portIndex)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
@@ -639,15 +641,11 @@ static OMX_ERRORTYPE SEC_DataDrop(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 port
/* OMX_BUFFERHEADERTYPE *bufferHeader = dataBuffer->bufferHeader; */
SEC_OMX_DATA *processData = &pSECComponent->processData[portIndex];
- if (portIndex == 0) {
- processData->dataLen = 0;
- processData->remainDataLen = 0;
- processData->usedDataLen = 0;
- processData->nFlags = 0;
- processData->timeStamp = 0;
- } else {
- /* TBD */
- }
+ processData->dataLen = 0;
+ processData->remainDataLen = 0;
+ processData->usedDataLen = 0;
+ processData->nFlags = 0;
+ processData->timeStamp = 0;
return ret;
}
@@ -665,6 +663,8 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
OMX_BOOL flagEOF = OMX_FALSE;
OMX_BOOL previousFrameEOF = OMX_FALSE;
+ FunctionIn();
+
if (inputUseBuffer->dataValid == OMX_TRUE) {
checkInputStream = inputUseBuffer->bufferHeader->pBuffer + inputUseBuffer->usedDataLen;
checkInputStreamLen = inputUseBuffer->remainDataLen;
@@ -705,15 +705,18 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
inputData->dataLen += copySize;
inputData->remainDataLen += copySize;
- if (previousFrameEOF == OMX_TRUE)
+ if (previousFrameEOF == OMX_TRUE) {
inputData->timeStamp = inputUseBuffer->timeStamp;
+ inputData->nFlags = inputUseBuffer->nFlags;
+ }
if (pSECComponent->bUseFlagEOF == OMX_TRUE) {
- inputData->nFlags = inputUseBuffer->nFlags;
if (pSECComponent->bSaveFlagEOS == OMX_TRUE) {
inputData->nFlags |= OMX_BUFFERFLAG_EOS;
flagEOF = OMX_TRUE;
pSECComponent->bSaveFlagEOS = OMX_FALSE;
+ } else {
+ inputData->nFlags = (inputData->nFlags & (~OMX_BUFFERFLAG_EOS));
}
} else {
if ((checkedSize == checkInputStreamLen) && (pSECComponent->bSaveFlagEOS == OMX_TRUE)) {
@@ -721,12 +724,19 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
flagEOF = OMX_TRUE;
pSECComponent->bSaveFlagEOS = OMX_FALSE;
} else {
- inputData->nFlags = inputUseBuffer->nFlags & (~OMX_BUFFERFLAG_EOS);
+ inputData->nFlags = (inputUseBuffer->nFlags & (~OMX_BUFFERFLAG_EOS));
}
}
+
+ if(((inputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+ (inputData->dataLen <= 0) && (flagEOF == OMX_TRUE)) {
+ inputData->dataLen += inputData->previousDataLen;
+ inputData->remainDataLen += inputData->previousDataLen;
+ }
} else {
/*????????????????????????????????? Error ?????????????????????????????????*/
- SEC_DataDrop(pOMXComponent, INPUT_PORT_INDEX);
+ SEC_DataReset(pOMXComponent, INPUT_PORT_INDEX);
+ flagEOF = OMX_FALSE;
}
if (inputUseBuffer->remainDataLen == 0)
@@ -735,10 +745,20 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
inputUseBuffer->dataValid = OMX_TRUE;
}
- if (flagEOF == OMX_TRUE)
+ if (flagEOF == OMX_TRUE) {
+ if (pSECComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) {
+ pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_TRUE;
+ pSECComponent->checkTimeStamp.startTimeStamp = inputData->timeStamp;
+ pSECComponent->checkTimeStamp.nStartFlags = inputData->nFlags;
+ pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE;
+ }
+
ret = OMX_TRUE;
- else
+ } else {
ret = OMX_FALSE;
+ }
+
+ FunctionOut();
return ret;
}
@@ -751,7 +771,29 @@ OMX_BOOL SEC_Postprocess_OutputData(OMX_COMPONENTTYPE *pOMXComponent)
SEC_OMX_DATA *outputData = &pSECComponent->processData[OUTPUT_PORT_INDEX];
OMX_U32 copySize = 0;
+ FunctionIn();
+
if (outputUseBuffer->dataValid == OMX_TRUE) {
+ if (pSECComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE) {
+ if ((pSECComponent->checkTimeStamp.startTimeStamp == outputData->timeStamp) &&
+ (pSECComponent->checkTimeStamp.nStartFlags == outputData->nFlags)){
+ pSECComponent->checkTimeStamp.startTimeStamp = -19761123;
+ pSECComponent->checkTimeStamp.nStartFlags = 0x0;
+ pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE;
+ pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE;
+ } else {
+ SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
+
+ ret = OMX_TRUE;
+ goto EXIT;
+ }
+ } else if (pSECComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) {
+ SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
+
+ ret = OMX_TRUE;
+ goto EXIT;
+ }
+
if (outputData->remainDataLen <= (outputUseBuffer->allocSize - outputUseBuffer->dataLen)) {
copySize = outputData->remainDataLen;
#ifndef S5PC110_DECODE_OUT_DATA_BUFFER
@@ -769,14 +811,12 @@ OMX_BOOL SEC_Postprocess_OutputData(OMX_COMPONENTTYPE *pOMXComponent)
ret = OMX_TRUE;
/* reset outputData */
- outputData->dataLen = 0;
- outputData->remainDataLen = 0;
- outputData->usedDataLen = 0;
- outputData->nFlags = 0;
- outputData->timeStamp = 0;
+ SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
#ifdef ONE_FRAME_OUTPUT /* only one frame output for Android */
- SEC_OutputBufferReturn(pOMXComponent);
+ if ((outputUseBuffer->remainDataLen > 0) ||
+ (outputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS))
+ SEC_OutputBufferReturn(pOMXComponent);
#else
if ((outputUseBuffer->remainDataLen > 0) ||
((outputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) {
@@ -811,6 +851,9 @@ OMX_BOOL SEC_Postprocess_OutputData(OMX_COMPONENTTYPE *pOMXComponent)
ret = OMX_FALSE;
}
+EXIT:
+ FunctionOut();
+
return ret;
}
@@ -826,8 +869,9 @@ OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent)
SEC_OMX_DATA *inputData = &pSECComponent->processData[INPUT_PORT_INDEX];
SEC_OMX_DATA *outputData = &pSECComponent->processData[OUTPUT_PORT_INDEX];
OMX_U32 copySize = 0;
- OMX_BOOL remainOutputData = OMX_FALSE;
- OMX_BOOL redecodeInputData = OMX_FALSE;
+
+ pSECComponent->remainOutputData = OMX_FALSE;
+ pSECComponent->reInputData = OMX_FALSE;
FunctionIn();
@@ -855,8 +899,8 @@ OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent)
break;
}
}
- if (remainOutputData == OMX_FALSE) {
- if (redecodeInputData == OMX_FALSE) {
+ if (pSECComponent->remainOutputData == OMX_FALSE) {
+ if (pSECComponent->reInputData == OMX_FALSE) {
SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex);
if (SEC_Preprocessor_InputData(pOMXComponent) == OMX_FALSE) {
SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
@@ -867,19 +911,22 @@ OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent)
SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
}
+ SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex);
ret = pSECComponent->sec_mfc_bufferProcess(pOMXComponent, inputData, outputData);
+ SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+
if (ret == OMX_ErrorInputDataDecodeYet)
- redecodeInputData = OMX_TRUE;
+ pSECComponent->reInputData = OMX_TRUE;
else
- redecodeInputData = OMX_FALSE;
+ pSECComponent->reInputData = OMX_FALSE;
}
SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
if (SEC_Postprocess_OutputData(pOMXComponent) == OMX_FALSE)
- remainOutputData = OMX_TRUE;
+ pSECComponent->remainOutputData = OMX_TRUE;
else
- remainOutputData = OMX_FALSE;
+ pSECComponent->remainOutputData = OMX_FALSE;
SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
}