summaryrefslogtreecommitdiffstats
path: root/sec_mm/sec_omx/sec_omx_component
diff options
context:
space:
mode:
Diffstat (limited to 'sec_mm/sec_omx/sec_omx_component')
-rw-r--r--sec_mm/sec_omx/sec_omx_component/common/Android.mk2
-rw-r--r--sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Basecomponent.h21
-rw-r--r--sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.c44
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c107
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.h8
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c113
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.h3
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c73
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.h3
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c103
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.h8
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c23
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.h2
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c22
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.h3
15 files changed, 347 insertions, 188 deletions
diff --git a/sec_mm/sec_omx/sec_omx_component/common/Android.mk b/sec_mm/sec_omx/sec_omx_component/common/Android.mk
index 824dd16..b4d5ca0 100644
--- a/sec_mm/sec_omx/sec_omx_component/common/Android.mk
+++ b/sec_mm/sec_omx/sec_omx_component/common/Android.mk
@@ -13,7 +13,7 @@ LOCAL_MODULE := libsecbasecomponent
LOCAL_CFLAGS :=
-LOCAL_STATIC_LIBRARIES :=
+LOCAL_STATIC_LIBRARIES := libsecosal
LOCAL_SHARED_LIBRARIES := libcutils libutils
LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
diff --git a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Basecomponent.h b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Basecomponent.h
index ac9872b..d413257 100644
--- a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Basecomponent.h
+++ b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Basecomponent.h
@@ -70,11 +70,21 @@ typedef struct _SEC_OMX_DATA
OMX_U32 dataLen;
OMX_U32 usedDataLen;
OMX_U32 remainDataLen;
+ OMX_U32 previousDataLen;
OMX_U32 nFlags;
OMX_TICKS timeStamp;
SEC_BUFFER_HEADER specificBufferHeader;
} SEC_OMX_DATA;
+/* for Check TimeStamp after Seek */
+typedef struct _SEC_OMX_TIMESTAPM
+{
+ OMX_BOOL needSetStartTimeStamp;
+ OMX_BOOL needCheckStartTimeStamp;
+ OMX_TICKS startTimeStamp;
+ OMX_U32 nStartFlags;
+} SEC_OMX_TIMESTAMP;
+
typedef struct _SEC_OMX_BASECOMPONENT
{
OMX_STRING componentName;
@@ -117,6 +127,17 @@ typedef struct _SEC_OMX_BASECOMPONENT
OMX_CALLBACKTYPE *pCallbacks;
OMX_PTR callbackData;
+ /* Save Timestamp */
+ OMX_TICKS timeStamp[MAX_TIMESTAMP];
+ SEC_OMX_TIMESTAMP checkTimeStamp;
+
+ /* Save Flags */
+ OMX_U32 nFlags[MAX_FLAGS];
+
+ OMX_BOOL getAllDelayBuffer;
+ OMX_BOOL remainOutputData;
+ OMX_BOOL reInputData;
+
/* Android CapabilityFlags */
OMXComponentCapabilityFlagsType capabilityFlags;
diff --git a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.c b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.c
index 092b16d..091ab5d 100644
--- a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.c
+++ b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.c
@@ -112,8 +112,9 @@ OMX_ERRORTYPE SEC_OMX_FlushPort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 portIn
while (SEC_OSAL_GetElemNum(&pSECPort->bufferQ) < pSECPort->assignedBufferNum) {
SEC_OSAL_SemaphoreWait(pSECComponent->pSECPort[portIndex].bufferSemID);
}
- }
-
+ if (SEC_OSAL_GetElemNum(&pSECPort->bufferQ) != pSECPort->assignedBufferNum)
+ SEC_OSAL_SetElemNum(&pSECPort->bufferQ, pSECPort->assignedBufferNum);
+ } else {
while(1) {
int cnt;
SEC_OSAL_Get_SemaphoreCount(pSECComponent->pSECPort[portIndex].bufferSemID, &cnt);
@@ -121,12 +122,14 @@ OMX_ERRORTYPE SEC_OMX_FlushPort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 portIn
break;
SEC_OSAL_SemaphoreWait(pSECComponent->pSECPort[portIndex].bufferSemID);
}
+ SEC_OSAL_SetElemNum(&pSECPort->bufferQ, 0);
+ }
-/* pSECComponent->processData[portIndex].dataLen = 0; */
+ pSECComponent->processData[portIndex].dataLen = 0;
pSECComponent->processData[portIndex].nFlags = 0;
-/* pSECComponent->processData[portIndex].remainDataLen = 0; */
-/* pSECComponent->processData[portIndex].timeStamp = 0; */
-/* pSECComponent->processData[portIndex].usedDataLen = 0; */
+ pSECComponent->processData[portIndex].remainDataLen = 0;
+ pSECComponent->processData[portIndex].timeStamp = 0;
+ pSECComponent->processData[portIndex].usedDataLen = 0;
EXIT:
FunctionOut();
@@ -187,6 +190,16 @@ OMX_ERRORTYPE SEC_OMX_BufferFlushProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S
OMX_EventCmdComplete,
OMX_CommandFlush, portIndex, NULL);
}
+
+ if (portIndex == INPUT_PORT_INDEX) {
+ pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+ SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+ SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_TIMESTAMP);
+ pSECComponent->getAllDelayBuffer = OMX_FALSE;
+ pSECComponent->reInputData = OMX_FALSE;
+ } else if (portIndex == OUTPUT_PORT_INDEX) {
+ pSECComponent->remainOutputData = OMX_FALSE;
+ }
}
EXIT:
@@ -247,6 +260,15 @@ OMX_ERRORTYPE SEC_OMX_BufferFlushProcessNoEvent(OMX_COMPONENTTYPE *pOMXComponent
SEC_OSAL_MutexUnlock(flushBuffer->bufferMutex);
pSECComponent->pSECPort[portIndex].bIsPortFlushed = OMX_FALSE;
+
+ if (portIndex == INPUT_PORT_INDEX) {
+ pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+ SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+ SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_TIMESTAMP);
+ pSECComponent->getAllDelayBuffer = OMX_FALSE;
+ pSECComponent->remainOutputData = OMX_FALSE;
+ pSECComponent->reInputData = OMX_FALSE;
+ }
}
EXIT:
@@ -897,6 +919,11 @@ OMX_ERRORTYPE SEC_OMX_Port_Constructor(OMX_HANDLETYPE hComponent)
pSECOutputPort->markType.hMarkTargetComponent = NULL;
pSECOutputPort->markType.pMarkData = NULL;
+ pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+ pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE;
+ pSECComponent->checkTimeStamp.startTimeStamp = 0;
+ pSECComponent->checkTimeStamp.nStartFlags = 0x0;
+
pOMXComponent->EmptyThisBuffer = &SEC_OMX_EmptyThisBuffer;
pOMXComponent->FillThisBuffer = &SEC_OMX_FillThisBuffer;
@@ -913,10 +940,7 @@ OMX_ERRORTYPE SEC_OMX_Port_Destructor(OMX_HANDLETYPE hComponent)
OMX_COMPONENTTYPE *pOMXComponent = NULL;
SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
SEC_OMX_BASEPORT *pSECPort = NULL;
-/*
- SEC_OMX_BASEPORT *pSECInputPort = NULL;
- SEC_OMX_BASEPORT *pSECOutputPort = NULL;
-*/
+
FunctionIn();
int i = 0;
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);
}
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.h b/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.h
index eed16b2..b7f71da 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.h
@@ -37,13 +37,13 @@
#define MAX_VIDEO_INPUTBUFFER_NUM 5
#define MAX_VIDEO_OUTPUTBUFFER_NUM 2
-#define DEFAULT_FRAME_WIDTH 176 //1920
-#define DEFAULT_FRAME_HEIGHT 144 //1088
+#define DEFAULT_FRAME_WIDTH 176
+#define DEFAULT_FRAME_HEIGHT 144
-#define DEFAULT_VIDEO_INPUT_BUFFER_SIZE 700 * 1024 //(DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT)
+#define DEFAULT_VIDEO_INPUT_BUFFER_SIZE (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT) * 2
#define DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT * 3) / 2
-#define DEFAULT_MFC_INPUT_BUFFER_SIZE DEFAULT_VIDEO_INPUT_BUFFER_SIZE
+#define DEFAULT_MFC_INPUT_BUFFER_SIZE 1024 * 1024 /*DEFAULT_VIDEO_INPUT_BUFFER_SIZE*/
#define INPUT_PORT_SUPPORTFORMAT_NUM_MAX 1
#define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX 3
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c
index 00aab39..c25e18f 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c
@@ -41,6 +41,7 @@
#define SEC_LOG_OFF
#include "SEC_OSAL_Log.h"
+//#define ADD_SPS_PPS_I_FRAME
/* H.264 Decoder Supported Levels & profiles */
SEC_OMX_VIDEO_PROFILELEVEL supportedAVCProfileLevels[] ={
@@ -111,10 +112,19 @@ static int Check_H264_Frame(OMX_U8 *pInputStream, int buffSize, OMX_U32 flag, OM
SEC_OSAL_Log(SEC_LOG_TRACE, "NaluType : %d", naluType);
if (naluStart == 0) {
- if (naluType == 1 || naluType == 5 || naluType == 6 || naluType == 7 || naluType == 8)
+#ifdef ADD_SPS_PPS_I_FRAME
+ if (naluType == 1 || naluType == 5)
+#else
+ if (naluType == 1 || naluType == 5 || naluType == 7 || naluType == 8)
+#endif
naluStart = 1;
} else {
+#ifdef OLD_DETECT
frameTypeBoundary = (8 - naluType) & (naluType - 10); //AUD(9)
+#else
+ if (naluType == 9)
+ frameTypeBoundary = -2;
+#endif
if (naluType == 1 || naluType == 5) {
if (accessUnitSize == buffSize) {
accessUnitSize--;
@@ -144,8 +154,7 @@ static int Check_H264_Frame(OMX_U8 *pInputStream, int buffSize, OMX_U32 flag, OM
return (accessUnitSize + nextNaluSize);
EXIT:
-
- *pbEndOfFrame = OMX_FALSE;
+ *pbEndOfFrame = OMX_FALSE;
return accessUnitSize;
}
@@ -207,6 +216,7 @@ OMX_ERRORTYPE SEC_MFC_H264Dec_GetParameter(
OMX_VIDEO_PARAM_AVCTYPE *pDstAVCComponent = (OMX_VIDEO_PARAM_AVCTYPE *)pComponentParameterStructure;
OMX_VIDEO_PARAM_AVCTYPE *pSrcAVCComponent = NULL;
SEC_H264DEC_HANDLE *pH264Dec = NULL;
+
ret = SEC_OMX_Check_SizeVersion(pDstAVCComponent, sizeof(OMX_VIDEO_PARAM_AVCTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
@@ -359,6 +369,7 @@ OMX_ERRORTYPE SEC_MFC_H264Dec_SetParameter(
OMX_VIDEO_PARAM_AVCTYPE *pDstAVCComponent = NULL;
OMX_VIDEO_PARAM_AVCTYPE *pSrcAVCComponent = (OMX_VIDEO_PARAM_AVCTYPE *)pComponentParameterStructure;
SEC_H264DEC_HANDLE *pH264Dec = NULL;
+
ret = SEC_OMX_Check_SizeVersion(pSrcAVCComponent, sizeof(OMX_VIDEO_PARAM_AVCTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
@@ -677,8 +688,10 @@ OMX_ERRORTYPE SEC_MFC_H264Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pStreamBuffer;
pSECComponent->processData[INPUT_PORT_INDEX].allocSize = DEFAULT_MFC_INPUT_BUFFER_SIZE;
- SEC_OSAL_Memset(pH264Dec->hMFCH264Handle.timeStamp, 0, sizeof(OMX_TICKS)*MAX_TIMESTAMP);
+ SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+ SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
pH264Dec->hMFCH264Handle.indexTimestamp = 0;
+ pSECComponent->getAllDelayBuffer = OMX_FALSE;
EXIT:
return ret;
@@ -730,6 +743,13 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
if (pH264Dec->hMFCH264Handle.bConfiguredMFC == OMX_FALSE) {
SSBSIP_MFC_CODEC_TYPE eCodecType = H264_DEC;
+ if ((oneFrameSize <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+ pOutputData->timeStamp = pInputData->timeStamp;
+ pOutputData->nFlags = pInputData->nFlags;
+ ret = OMX_ErrorNone;
+ goto EXIT;
+ }
+
setConfVal = 5;
SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_EXTRA_BUFFER_NUM, &setConfVal);
@@ -745,19 +765,31 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
returnCodec = SsbSipMfcDecInit(pH264Dec->hMFCH264Handle.hMFCHandle, eCodecType, oneFrameSize);
if (returnCodec == MFC_RET_OK) {
SSBSIP_MFC_IMG_RESOLUTION imgResol;
+ SSBSIP_MFC_CROP_INFORMATION cropInfo;
SEC_OMX_BASEPORT *secInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT, &imgResol);
- SEC_OSAL_Log(SEC_LOG_TRACE, "set width height information : %d, %d", secInputPort->portDefinition.format.video.nFrameWidth, secInputPort->portDefinition.format.video.nFrameHeight);
- SEC_OSAL_Log(SEC_LOG_TRACE, "mfc width height information : %d, %d", imgResol.width, imgResol.height);
+ SEC_OSAL_Log(SEC_LOG_TRACE, "set width height information : %d, %d",
+ secInputPort->portDefinition.format.video.nFrameWidth,
+ secInputPort->portDefinition.format.video.nFrameHeight);
+ SEC_OSAL_Log(SEC_LOG_TRACE, "mfc width height information : %d, %d",
+ imgResol.width, imgResol.height);
+
+ SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_CROP_INFO, &cropInfo);
+ SEC_OSAL_Log(SEC_LOG_TRACE, "mfc crop_top crop_bottom crop_left crop_right : %d, %d, %d, %d",
+ cropInfo.crop_top_offset , cropInfo.crop_bottom_offset ,
+ cropInfo.crop_left_offset , cropInfo.crop_right_offset);
+
+ int actualWidth = imgResol.width - cropInfo.crop_left_offset - cropInfo.crop_right_offset;
+ int actualHeight = imgResol.height - cropInfo.crop_top_offset - cropInfo.crop_bottom_offset;
/** Update Frame Size **/
- if((secInputPort->portDefinition.format.video.nFrameWidth != imgResol.width) ||
- (secInputPort->portDefinition.format.video.nFrameHeight != imgResol.height)) {
+ if((secInputPort->portDefinition.format.video.nFrameWidth != actualWidth) ||
+ (secInputPort->portDefinition.format.video.nFrameHeight != actualHeight)) {
SEC_OSAL_Log(SEC_LOG_TRACE, "change width height information : OMX_EventPortSettingsChanged");
/* change width and height information */
- secInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
- secInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
+ secInputPort->portDefinition.format.video.nFrameWidth = actualWidth;
+ secInputPort->portDefinition.format.video.nFrameHeight = actualHeight;
secInputPort->portDefinition.format.video.nStride = ((imgResol.width + 15) & (~15));
secInputPort->portDefinition.format.video.nSliceHeight = ((imgResol.height + 15) & (~15));
@@ -774,7 +806,14 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
}
pH264Dec->hMFCH264Handle.bConfiguredMFC = OMX_TRUE;
+#ifdef ADD_SPS_PPS_I_FRAME
+ ret = OMX_ErrorInputDataDecodeYet;
+#else
+ pOutputData->timeStamp = pInputData->timeStamp;
+ pOutputData->nFlags = pInputData->nFlags;
+
ret = OMX_ErrorNone;
+#endif
goto EXIT;
} else {
ret = OMX_ErrorMFCInit;
@@ -787,18 +826,19 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
pSECComponent->bUseFlagEOF = OMX_TRUE;
}
- pH264Dec->hMFCH264Handle.timeStamp[pH264Dec->hMFCH264Handle.indexTimestamp] = pInputData->timeStamp;
+ pSECComponent->timeStamp[pH264Dec->hMFCH264Handle.indexTimestamp] = pInputData->timeStamp;
+ pSECComponent->nFlags[pH264Dec->hMFCH264Handle.indexTimestamp] = pInputData->nFlags;
SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_FRAME_TAG, &(pH264Dec->hMFCH264Handle.indexTimestamp));
pH264Dec->hMFCH264Handle.indexTimestamp++;
if (pH264Dec->hMFCH264Handle.indexTimestamp >= MAX_TIMESTAMP)
pH264Dec->hMFCH264Handle.indexTimestamp = 0;
- if (oneFrameSize <= 0) {
- ret = OMX_ErrorNone;
- goto EXIT;
+ if (Check_H264_StartCode(pInputData->dataBuffer, pInputData->dataLen) == OMX_TRUE) {
+ returnCodec = SsbSipMfcDecExe(pH264Dec->hMFCH264Handle.hMFCHandle, oneFrameSize);
+ } else {
+ returnCodec = MFC_RET_OK;
}
- returnCodec = SsbSipMfcDecExe(pH264Dec->hMFCH264Handle.hMFCHandle, oneFrameSize);
if (returnCodec == MFC_RET_OK) {
SSBSIP_MFC_DEC_OUTBUF_STATUS status;
OMX_S32 indexTimestamp = 0;
@@ -807,10 +847,13 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
bufWidth = (outputInfo.img_width + 15) & (~15);
bufHeight = (outputInfo.img_height + 15) & (~15);
- if (SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) {
+ if ((SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+ (((indexTimestamp < 0) || (indexTimestamp > MAX_TIMESTAMP)))) {
pOutputData->timeStamp = pInputData->timeStamp;
+ pOutputData->nFlags = pInputData->nFlags;
} else {
- pOutputData->timeStamp = pH264Dec->hMFCH264Handle.timeStamp[indexTimestamp];
+ pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+ pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
}
if ((status == MFC_GETOUTBUF_DISPLAY_DECODING) ||
@@ -825,27 +868,30 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
break;
}
}
+ if (pOutputData->nFlags & OMX_BUFFERFLAG_EOS)
+ pOutputData->dataLen = 0;
- if(status == MFC_GETOUTBUF_DISPLAY_ONLY) {
+ if ((status == MFC_GETOUTBUF_DISPLAY_ONLY) ||
+ (pSECComponent->getAllDelayBuffer == OMX_TRUE)) {
ret = OMX_ErrorInputDataDecodeYet;
}
+
if(status == MFC_GETOUTBUF_DECODING_ONLY) {
+ /* ret = OMX_ErrorInputDataDecodeYet; */
ret = OMX_ErrorNone;
goto EXIT;
}
-/*
- if (status == MFC_GETOUTBUF_DISPLAY_END) {
- inputData->nFlags |= OMX_BUFFERFLAG_EOS;
- outputData->nFlags |= OMX_BUFFERFLAG_EOS;
+
+ if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+ pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+ pSECComponent->getAllDelayBuffer = OMX_TRUE;
+ ret = OMX_ErrorInputDataDecodeYet;
}
- if ((inputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)
- {
- set_conf_val = 1;
- SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle,
- MFC_DEC_SETCONF_IS_LAST_FRAME, &set_conf_val);
+ if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+ pSECComponent->getAllDelayBuffer = OMX_FALSE;
+ ret = OMX_ErrorNone;
}
-*/
} else {
/* ret = OMX_ErrorUndefined; */ /* ????? */
ret = OMX_ErrorNone;
@@ -908,17 +954,7 @@ OMX_ERRORTYPE SEC_MFC_H264Dec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, SE
goto EXIT;
}
- if(pInputData->nFlags & OMX_BUFFERFLAG_EOS) {
- pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
- } else {
- pOutputData->nFlags = pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS);
- }
-
- if(Check_H264_StartCode(pInputData->dataBuffer, pInputData->dataLen) == OMX_TRUE) {
ret = SEC_MFC_H264_Decode(pOMXComponent, pInputData, pOutputData);
- } else {
- ret = OMX_ErrorNone;
- }
if (ret != OMX_ErrorNone) {
if (ret == OMX_ErrorInputDataDecodeYet) {
pOutputData->usedDataLen = 0;
@@ -929,6 +965,7 @@ OMX_ERRORTYPE SEC_MFC_H264Dec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, SE
OMX_EventError, ret, 0, NULL);
}
} else {
+ pInputData->previousDataLen = pInputData->dataLen;
pInputData->usedDataLen += pInputData->dataLen;
pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen;
pInputData->dataLen -= pInputData->usedDataLen;
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.h b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.h
index 0af04e0..b1374fb 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.h
@@ -32,14 +32,11 @@
#include "OMX_Video.h"
-#define MAX_TIMESTAMP 16
-
typedef struct _SEC_MFC_H264DEC_HANDLE
{
OMX_HANDLETYPE hMFCHandle;
OMX_PTR pMFCStreamBuffer;
OMX_PTR pMFCStreamPhyBuffer;
- OMX_TICKS timeStamp[MAX_TIMESTAMP];
OMX_U32 indexTimestamp;
OMX_BOOL bConfiguredMFC;
OMX_BOOL bThumbnailMode;
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c
index 1da8d0d..212e21f 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c
@@ -24,7 +24,6 @@
* 2010.7.15 : Create
*/
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -328,6 +327,7 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_GetParameter(
{
OMX_S32 codecType;
OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE *)pComponentParameterStructure;
+
ret = SEC_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
@@ -858,8 +858,10 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pStreamBuffer;
pSECComponent->processData[INPUT_PORT_INDEX].allocSize = DEFAULT_MFC_INPUT_BUFFER_SIZE;
- SEC_OSAL_Memset(pMpeg4Dec->hMFCMpeg4Handle.timestamp, 0, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+ SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+ SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp = 0;
+ pSECComponent->getAllDelayBuffer = OMX_FALSE;
EXIT:
FunctionOut();
@@ -922,6 +924,13 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
MFCCodecType = H263_DEC;
}
+ if ((oneFrameSize <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+ pOutputData->timeStamp = pInputData->timeStamp;
+ pOutputData->nFlags = pInputData->nFlags;
+ ret = OMX_ErrorNone;
+ goto EXIT;
+ }
+
/* Set the number of extra buffer to prevent tearing */
configValue = 5;
SsbSipMfcDecSetConfig(hMFCHandle, MFC_DEC_SETCONF_EXTRA_BUFFER_NUM, &configValue);
@@ -973,6 +982,8 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
pMpeg4Dec->hMFCMpeg4Handle.bConfiguredMFC = OMX_TRUE;
if (pMpeg4Dec->hMFCMpeg4Handle.codecType == CODEC_TYPE_MPEG4) {
+ pOutputData->timeStamp = pInputData->timeStamp;
+ pOutputData->nFlags = pInputData->nFlags;
ret = OMX_ErrorNone;
} else {
pOutputData->dataLen = 0;
@@ -991,31 +1002,35 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
pSECComponent->bUseFlagEOF = OMX_TRUE;
}
- pMpeg4Dec->hMFCMpeg4Handle.timestamp[pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp] = pInputData->timeStamp;
+ pSECComponent->timeStamp[pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp] = pInputData->timeStamp;
+ pSECComponent->nFlags[pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp] = pInputData->nFlags;
SsbSipMfcDecSetConfig(hMFCHandle, MFC_DEC_SETCONF_FRAME_TAG, &(pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp));
pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp++;
if (pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp >= MAX_TIMESTAMP)
pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp = 0;
- if (oneFrameSize <= 0) {
- ret = OMX_ErrorNone;
- goto EXIT;
+ if (Check_Stream_PrefixCode(pInputData->dataBuffer, pInputData->dataLen, pMpeg4Dec->hMFCMpeg4Handle.codecType) == OMX_TRUE) {
+ returnCodec = SsbSipMfcDecExe(hMFCHandle, oneFrameSize);
+ } else {
+ returnCodec = MFC_RET_OK;
}
- returnCodec = SsbSipMfcDecExe(hMFCHandle, oneFrameSize);
if (returnCodec == MFC_RET_OK) {
SSBSIP_MFC_DEC_OUTBUF_STATUS status;
OMX_S32 indexTimestamp = 0;
status = SsbSipMfcDecGetOutBuf(hMFCHandle, &outputInfo);
-
bufWidth = (outputInfo.img_width + 15) & (~15);
bufHeight = (outputInfo.img_height + 15) & (~15);
- if (SsbSipMfcDecGetConfig(hMFCHandle, MFC_DEC_GETCONF_FRAME_TAG, &indexTimestamp) == MFC_RET_OK)
- pOutputData->timeStamp = pMpeg4Dec->hMFCMpeg4Handle.timestamp[indexTimestamp];
- else
+ if ((SsbSipMfcDecGetConfig(hMFCHandle, MFC_DEC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+ (((indexTimestamp < 0) || (indexTimestamp > MAX_TIMESTAMP)))) {
pOutputData->timeStamp = pInputData->timeStamp;
+ pOutputData->nFlags = pInputData->nFlags;
+ } else {
+ pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+ pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+ }
if ((status == MFC_GETOUTBUF_DISPLAY_DECODING) ||
(status == MFC_GETOUTBUF_DISPLAY_ONLY)) {
@@ -1029,15 +1044,32 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
break;
}
}
+ if (pOutputData->nFlags & OMX_BUFFERFLAG_EOS)
+ pOutputData->dataLen = 0;
- if (status == MFC_GETOUTBUF_DISPLAY_ONLY) {
+ if ((status == MFC_GETOUTBUF_DISPLAY_ONLY) ||
+ (pSECComponent->getAllDelayBuffer == OMX_TRUE)) {
ret = OMX_ErrorInputDataDecodeYet;
}
+
if (status == MFC_GETOUTBUF_DECODING_ONLY) {
+ /* ret = OMX_ErrorInputDataDecodeYet; */
ret = OMX_ErrorNone;
goto EXIT;
}
+
+ if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+ pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+ pSECComponent->getAllDelayBuffer = OMX_TRUE;
+ ret = OMX_ErrorInputDataDecodeYet;
+ }
+
+ if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+ pSECComponent->getAllDelayBuffer = OMX_FALSE;
+ ret = OMX_ErrorNone;
+ }
} else {
+ /* ret = OMX_ErrorUndefined; */ /* ????? */
ret = OMX_ErrorNone;
goto EXIT;
}
@@ -1091,25 +1123,15 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, S
if ((!CHECK_PORT_ENABLED(pInputPort)) || (!CHECK_PORT_ENABLED(pOutputPort)) ||
(!CHECK_PORT_POPULATED(pInputPort)) || (!CHECK_PORT_POPULATED(pOutputPort))) {
+ ret = OMX_ErrorNone;
goto EXIT;
}
if (OMX_FALSE == SEC_Check_BufferProcess_State(pSECComponent)) {
+ ret = OMX_ErrorNone;
goto EXIT;
}
- if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) {
- pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
- } else {
- pOutputData->nFlags = pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS);
- }
-
- bCheckPrefix = Check_Stream_PrefixCode(pInputData->dataBuffer, pInputData->dataLen, pMpeg4Dec->hMFCMpeg4Handle.codecType);
-
- if (bCheckPrefix == OMX_TRUE) {
- ret = SEC_MFC_Mpeg4_Decode(pOMXComponent, pInputData, pOutputData);
- } else {
- ret = OMX_ErrorNone;
- }
+ ret = SEC_MFC_Mpeg4_Decode(pOMXComponent, pInputData, pOutputData);
if (ret != OMX_ErrorNone) {
if (ret == OMX_ErrorInputDataDecodeYet) {
pOutputData->usedDataLen = 0;
@@ -1120,6 +1142,7 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, S
OMX_EventError, ret, 0, NULL);
}
} else {
+ pInputData->previousDataLen = pInputData->dataLen;
pInputData->usedDataLen += pInputData->dataLen;
pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen;
pInputData->dataLen -= pInputData->usedDataLen;
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.h b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.h
index fbd8854..25170b8 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.h
@@ -30,8 +30,6 @@
#include "SEC_OMX_Def.h"
#include "OMX_Component.h"
-#define MAX_TIMESTAMP 16
-
typedef enum _CODEC_TYPE
{
@@ -62,7 +60,6 @@ typedef struct _SEC_MFC_MPEG4_HANDLE
OMX_HANDLETYPE hMFCHandle;
OMX_PTR pMFCStreamBuffer;
OMX_PTR pMFCStreamPhyBuffer;
- OMX_TICKS timestamp[MAX_TIMESTAMP];
OMX_U32 indexTimestamp;
OMX_BOOL bConfiguredMFC;
OMX_BOOL bThumbnailMode;
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c
index e5bd981..1ee198e 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c
@@ -32,6 +32,7 @@
#include "SEC_OSAL_Event.h"
#include "SEC_OMX_Venc.h"
#include "SEC_OMX_Basecomponent.h"
+#include "SEC_OSAL_Thread.h"
#undef SEC_LOG_TAG
#define SEC_LOG_TAG "SEC_VIDEO_ENC"
@@ -222,7 +223,6 @@ OMX_ERRORTYPE SEC_OMX_AllocateBuffer(
ret = OMX_ErrorInsufficientResources;
goto EXIT;
}
-SEC_OSAL_Log(SEC_LOG_TRACE, "SEC_OMX_AllocateBuffer => port:%d, size:%d", nPortIndex, nSizeBytes);
temp_bufferHeader = (OMX_BUFFERHEADERTYPE *)SEC_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE));
if (temp_bufferHeader == NULL) {
@@ -478,11 +478,9 @@ OMX_ERRORTYPE SEC_InputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent)
goto EXIT;
} else {
SEC_OSAL_SemaphoreWait(pSECPort->bufferSemID);
- if (dataBuffer->dataValid != OMX_TRUE)
- {
+ if (dataBuffer->dataValid != OMX_TRUE) {
message = (SEC_OMX_MESSAGE *)SEC_OSAL_Dequeue(&pSECPort->bufferQ);
- if (message == NULL)
- {
+ if (message == NULL) {
ret = OMX_ErrorUndefined;
goto EXIT;
}
@@ -630,7 +628,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 +637,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;
}
@@ -767,10 +761,10 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
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;
@@ -782,27 +776,33 @@ 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));
}
}
} else {
/*????????????????????????????????? Error ?????????????????????????????????*/
- SEC_DataDrop(pOMXComponent, INPUT_PORT_INDEX);
+ SEC_DataReset(pOMXComponent, INPUT_PORT_INDEX);
+ flagEOF = OMX_FALSE;
}
- if (inputUseBuffer->remainDataLen == 0) {
+ if (inputUseBuffer->remainDataLen == 0)
SEC_InputBufferReturn(pOMXComponent);
- } else {
+ else
inputUseBuffer->dataValid = 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 {
ret = OMX_FALSE;
}
-
return ret;
}
@@ -815,6 +815,25 @@ OMX_BOOL SEC_Postprocess_OutputData(OMX_COMPONENTTYPE *pOMXComponent)
OMX_U32 copySize = 0;
if (outputUseBuffer->dataValid == OMX_TRUE) {
+ if (pSECComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE) {
+ if (pSECComponent->checkTimeStamp.startTimeStamp == outputData->timeStamp){
+ 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;
if (copySize > 0)
@@ -830,14 +849,11 @@ 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 */
- if (outputUseBuffer->remainDataLen > 0)
+ if ((outputUseBuffer->remainDataLen > 0) ||
+ (outputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS))
SEC_OutputBufferReturn(pOMXComponent);
#else
if ((outputUseBuffer->remainDataLen > 0) ||
@@ -872,6 +888,7 @@ OMX_BOOL SEC_Postprocess_OutputData(OMX_COMPONENTTYPE *pOMXComponent)
ret = OMX_FALSE;
}
+EXIT:
return ret;
}
@@ -887,8 +904,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 reencodeInputData = OMX_FALSE;
+
+ pSECComponent->remainOutputData = OMX_FALSE;
+ pSECComponent->reInputData = OMX_FALSE;
FunctionIn();
@@ -916,8 +934,8 @@ OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent)
break;
}
}
- if (remainOutputData == OMX_FALSE) {
- if (reencodeInputData == 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);
@@ -928,21 +946,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);
- if (ret == OMX_ErrorInputDataEncodeYet) {
- reencodeInputData = OMX_TRUE;
- } else {
- reencodeInputData = OMX_FALSE;
- }
+ SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+
+ if (ret == OMX_ErrorInputDataEncodeYet)
+ pSECComponent->reInputData = OMX_TRUE;
+ else
+ pSECComponent->reInputData = OMX_FALSE;
}
SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
- if (SEC_Postprocess_OutputData(pOMXComponent) == OMX_FALSE) {
- remainOutputData = OMX_TRUE;
- } else {
- remainOutputData = OMX_FALSE;
- }
+ if (SEC_Postprocess_OutputData(pOMXComponent) == OMX_FALSE)
+ pSECComponent->remainOutputData = OMX_TRUE;
+ else
+ pSECComponent->remainOutputData = OMX_FALSE;
SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
}
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.h b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.h
index d7cbe4a..139bb43 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.h
@@ -36,13 +36,13 @@
#define MAX_VIDEO_INPUTBUFFER_NUM 5
#define MAX_VIDEO_OUTPUTBUFFER_NUM 2
-#define DEFAULT_FRAME_WIDTH 176 //1920
-#define DEFAULT_FRAME_HEIGHT 144 //1088
+#define DEFAULT_FRAME_WIDTH 176
+#define DEFAULT_FRAME_HEIGHT 144
#define DEFAULT_VIDEO_INPUT_BUFFER_SIZE ALIGN_TO_8KB(ALIGN_TO_128B(DEFAULT_FRAME_WIDTH) * ALIGN_TO_32B(DEFAULT_FRAME_HEIGHT)) \
+ ALIGN_TO_8KB(ALIGN_TO_128B(DEFAULT_FRAME_WIDTH) * ALIGN_TO_32B(DEFAULT_FRAME_HEIGHT / 2))
- //(DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT * 3) / 2
-#define DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE 700 * 1024 //(DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT)
+ /* (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT * 3) / 2 */
+#define DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE 1024 * 1024
#define INPUT_PORT_SUPPORTFORMAT_NUM_MAX 3
#define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX 1
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c
index aca335a..fa6ad1a 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c
@@ -242,9 +242,7 @@ void Set_H264ENC_Param(SSBSIP_MFC_ENC_H264_PARAM *pH264Arg, SEC_OMX_BASECOMPONEN
break;
}
-
H264PrintParams(*pH264Arg);
-
}
OMX_ERRORTYPE SEC_MFC_H264Enc_GetParameter(
@@ -603,7 +601,6 @@ EXIT:
return ret;
}
-
/* MFC Init */
OMX_ERRORTYPE SEC_MFC_H264Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
{
@@ -653,11 +650,11 @@ OMX_ERRORTYPE SEC_MFC_H264Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YSize = pH264Enc->hMFCH264Handle.inputInfo.YSize;
pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CSize = pH264Enc->hMFCH264Handle.inputInfo.CSize;
- SEC_OSAL_Memset(pH264Enc->hMFCH264Handle.timeStamp, 0, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+ SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+ SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
pH264Enc->hMFCH264Handle.indexTimestamp = 0;
EXIT:
-
FunctionOut();
return ret;
@@ -728,6 +725,7 @@ OMX_ERRORTYPE SEC_MFC_H264_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
pOutputData->dataBuffer = outputInfo.StrmVirAddr;
pOutputData->allocSize = outputInfo.headerSize;
pOutputData->dataLen = outputInfo.headerSize;
+ pOutputData->timeStamp = pInputData->timeStamp;
pOutputData->nFlags |= OMX_BUFFERFLAG_CODECCONFIG;
pOutputData->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
@@ -737,7 +735,8 @@ OMX_ERRORTYPE SEC_MFC_H264_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
goto EXIT;
}
- pH264Enc->hMFCH264Handle.timeStamp[pH264Enc->hMFCH264Handle.indexTimestamp] = pInputData->timeStamp;
+ pSECComponent->timeStamp[pH264Enc->hMFCH264Handle.indexTimestamp] = pInputData->timeStamp;
+ pSECComponent->nFlags[pH264Enc->hMFCH264Handle.indexTimestamp] = pInputData->nFlags;
SsbSipMfcEncSetConfig(pH264Enc->hMFCH264Handle.hMFCHandle, MFC_ENC_SETCONF_FRAME_TAG, &(pH264Enc->hMFCH264Handle.indexTimestamp));
pH264Enc->hMFCH264Handle.indexTimestamp++;
if (pH264Enc->hMFCH264Handle.indexTimestamp >= MAX_TIMESTAMP)
@@ -778,10 +777,13 @@ OMX_ERRORTYPE SEC_MFC_H264_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
OMX_S32 indexTimestamp = 0;
returnCodec = SsbSipMfcEncGetOutBuf(pH264Enc->hMFCH264Handle.hMFCHandle, &outputInfo);
- if (SsbSipMfcEncGetConfig(pH264Enc->hMFCH264Handle.hMFCHandle, MFC_ENC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) {
+ if ((SsbSipMfcEncGetConfig(pH264Enc->hMFCH264Handle.hMFCHandle, MFC_ENC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+ (((indexTimestamp < 0) || (indexTimestamp > MAX_TIMESTAMP)))){
pOutputData->timeStamp = pInputData->timeStamp;
+ pOutputData->nFlags = pInputData->nFlags;
} else {
- pOutputData->timeStamp = pH264Enc->hMFCH264Handle.timeStamp[indexTimestamp];
+ pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+ pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
}
if (returnCodec == MFC_RET_OK) {
@@ -835,11 +837,6 @@ OMX_ERRORTYPE SEC_MFC_H264Enc_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, SE
goto EXIT;
}
- if (pInputData->nFlags & OMX_BUFFERFLAG_EOS)
- pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
- else
- pOutputData->nFlags = pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS);
-
ret = SEC_MFC_H264_Encode(pOMXComponent, pInputData, pOutputData);
if (ret != OMX_ErrorNone) {
pSECComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.h b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.h
index a90965f..80f6260 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.h
@@ -32,7 +32,6 @@
#include "OMX_Video.h"
#include "SsbSipMfcApi.h"
-#define MAX_TIMESTAMP 16
typedef struct _EXTRA_DATA
{
@@ -48,7 +47,6 @@ typedef struct _SEC_MFC_H264ENC_HANDLE
SSBSIP_MFC_ENC_H264_PARAM mfcVideoAvc;
SSBSIP_MFC_ENC_INPUT_INFO inputInfo;
/* SSBSIP_MFC_ENC_OUTPUT_INFO outputInfo; */
- OMX_TICKS timeStamp[MAX_TIMESTAMP];
OMX_U32 indexTimestamp;
OMX_BOOL bConfiguredMFC;
EXTRA_DATA headerData;
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c
index 2135016..624e7fb 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c
@@ -790,7 +790,8 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YSize = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YSize;
pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CSize = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CSize;
- SEC_OSAL_Memset(pMpeg4Enc->hMFCMpeg4Handle.timestamp, 0, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+ SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+ SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp = 0;
EXIT:
@@ -850,6 +851,7 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
pOutputData->dataBuffer = outputInfo.StrmVirAddr;
pOutputData->allocSize = outputInfo.headerSize;
pOutputData->dataLen = outputInfo.headerSize;
+ pOutputData->timeStamp = pInputData->timeStamp;
pOutputData->nFlags |= OMX_BUFFERFLAG_CODECCONFIG;
pOutputData->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
@@ -869,7 +871,8 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
pSECComponent->bUseFlagEOF = OMX_TRUE;
}
- pMpeg4Enc->hMFCMpeg4Handle.timestamp[pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp] = pInputData->timeStamp;
+ pSECComponent->timeStamp[pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp] = pInputData->timeStamp;
+ pSECComponent->nFlags[pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp] = pInputData->nFlags;
SsbSipMfcEncSetConfig(hMFCHandle, MFC_ENC_SETCONF_FRAME_TAG, &(pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp));
pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp++;
if (pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp >= MAX_TIMESTAMP)
@@ -912,10 +915,14 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
returnCodec = SsbSipMfcEncGetOutBuf(hMFCHandle, &outputInfo);
- if (SsbSipMfcEncGetConfig(hMFCHandle, MFC_ENC_GETCONF_FRAME_TAG, &indexTimestamp) == MFC_RET_OK)
- pOutputData->timeStamp = pMpeg4Enc->hMFCMpeg4Handle.timestamp[indexTimestamp];
- else
+ if ((SsbSipMfcEncGetConfig(hMFCHandle, MFC_ENC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+ (((indexTimestamp < 0) || (indexTimestamp > MAX_TIMESTAMP)))) {
pOutputData->timeStamp = pInputData->timeStamp;
+ pOutputData->nFlags = pInputData->nFlags;
+ } else {
+ pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+ pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+ }
if (returnCodec == MFC_RET_OK) {
/** Fill Output Buffer **/
@@ -960,11 +967,6 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, S
goto EXIT;
}
- if (pInputData->nFlags & OMX_BUFFERFLAG_EOS)
- pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
- else
- pOutputData->nFlags = pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS);
-
ret = SEC_MFC_Mpeg4_Encode(pOMXComponent, pInputData, pOutputData);
if (ret != OMX_ErrorNone) {
if (ret == OMX_ErrorInputDataEncodeYet) {
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.h b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.h
index 57f3124..d4f9038 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.h
@@ -31,8 +31,6 @@
#include "OMX_Component.h"
#include "SsbSipMfcApi.h"
-#define MAX_TIMESTAMP 16
-
typedef enum _CODEC_TYPE
{
@@ -46,7 +44,6 @@ typedef struct _SEC_MFC_MPEG4ENC_HANDLE
SSBSIP_MFC_ENC_MPEG4_PARAM mpeg4MFCParam;
SSBSIP_MFC_ENC_H263_PARAM h263MFCParam;
SSBSIP_MFC_ENC_INPUT_INFO inputInfo;
- OMX_TICKS timestamp[MAX_TIMESTAMP];
OMX_U32 indexTimestamp;
OMX_BOOL bConfiguredMFC;
CODEC_TYPE codecType;