summaryrefslogtreecommitdiffstats
path: root/sec_mm
diff options
context:
space:
mode:
authorSeungBeom Kim <sbcrux.kim@samsung.com>2010-09-21 15:36:08 -0700
committerAndreas Huber <andih@google.com>2010-09-27 10:57:00 -0700
commit4446949fada172a194be1f785e4bcc5dde1149d1 (patch)
tree4cef7d429b0b2d3d568ec67932527be9c8aaa997 /sec_mm
parent550332aee52a0afaa5b26bdf7963c600ae71106c (diff)
downloaddevice_samsung_crespo-4446949fada172a194be1f785e4bcc5dde1149d1.zip
device_samsung_crespo-4446949fada172a194be1f785e4bcc5dde1149d1.tar.gz
device_samsung_crespo-4446949fada172a194be1f785e4bcc5dde1149d1.tar.bz2
S5PC11X: OMX: Change TimeStamp processing routine for Stagefright Seeking
Change-Id: I6a75b7a70013794e8c77bf43dd0ca288e9566235 Signed-off-by: SeungBeom Kim <sbcrux.kim@samsung.com>
Diffstat (limited to 'sec_mm')
-rw-r--r--sec_mm/sec_omx/Android.mk2
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/src/SsbSipMfcDecAPI.c22
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h8
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h5
-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
-rw-r--r--sec_mm/sec_omx/sec_omx_core/media_profiles.xml166
-rw-r--r--sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Def.h3
-rw-r--r--sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.c13
-rw-r--r--sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.h1
23 files changed, 565 insertions, 190 deletions
diff --git a/sec_mm/sec_omx/Android.mk b/sec_mm/sec_omx/Android.mk
index 63aac7b..e59c3ae 100644
--- a/sec_mm/sec_omx/Android.mk
+++ b/sec_mm/sec_omx/Android.mk
@@ -3,8 +3,6 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
-SEC_OMX_CFLAGS := -Wall -fpic -pipe -DSTATIC_TABLE -O0
-
SEC_OMX_TOP := $(LOCAL_PATH)
SEC_CODECS := $(SEC_OMX_TOP)/sec_codecs/
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/src/SsbSipMfcDecAPI.c b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/src/SsbSipMfcDecAPI.c
index abcc020..4293747 100644
--- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/src/SsbSipMfcDecAPI.c
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/src/SsbSipMfcDecAPI.c
@@ -178,6 +178,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
pCTX->decOutInfo.buf_width = DecArg.args.dec_init.out_buf_width;
pCTX->decOutInfo.buf_height = DecArg.args.dec_init.out_buf_height;
+ /* by RainAde : crop information */
+ pCTX->decOutInfo.crop_top_offset = DecArg.args.dec_init.out_crop_top_offset;
+ pCTX->decOutInfo.crop_bottom_offset = DecArg.args.dec_init.out_crop_bottom_offset;
+ pCTX->decOutInfo.crop_left_offset = DecArg.args.dec_init.out_crop_left_offset;
+ pCTX->decOutInfo.crop_right_offset = DecArg.args.dec_init.out_crop_right_offset;
+
pCTX->virFrmBuf.luma = DecArg.args.dec_init.out_u_addr.luma;
pCTX->virFrmBuf.chroma = DecArg.args.dec_init.out_u_addr.chroma;
@@ -358,6 +364,12 @@ SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecGetOutBuf(void *openHandle, SSBSIP_MFC_
output_info->buf_width = pCTX->decOutInfo.buf_width;
output_info->buf_height= pCTX->decOutInfo.buf_height;
+ /* by RainAde : for crop information */
+ output_info->crop_top_offset = pCTX->decOutInfo.crop_top_offset;
+ output_info->crop_bottom_offset= pCTX->decOutInfo.crop_bottom_offset;
+ output_info->crop_left_offset = pCTX->decOutInfo.crop_left_offset;
+ output_info->crop_right_offset= pCTX->decOutInfo.crop_right_offset;
+
if (pCTX->displayStatus == 0)
return MFC_GETOUTBUF_DISPLAY_END;
else if (pCTX->displayStatus == 1)
@@ -432,6 +444,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
mfc_common_args DecArg;
SSBSIP_MFC_IMG_RESOLUTION *img_resolution;
+ SSBSIP_MFC_CROP_INFORMATION *crop_information;
MFC_CRC_DATA *crc_data;
if (openHandle == NULL) {
@@ -456,6 +469,15 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
img_resolution->buf_height = pCTX->decOutInfo.buf_height;
break;
+ /* Added by RainAde */
+ case MFC_DEC_GETCONF_CROP_INFO:
+ crop_information = (SSBSIP_MFC_CROP_INFORMATION*)value;
+ crop_information->crop_top_offset = pCTX->decOutInfo.crop_top_offset;
+ crop_information->crop_bottom_offset= pCTX->decOutInfo.crop_bottom_offset;
+ crop_information->crop_left_offset = pCTX->decOutInfo.crop_left_offset;
+ crop_information->crop_right_offset= pCTX->decOutInfo.crop_right_offset;
+ break;
+
case MFC_DEC_GETCONF_CRC_DATA:
crc_data = (MFC_CRC_DATA *)value;
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h
index f8aaddc..1d2c0e8 100644
--- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h
@@ -72,6 +72,7 @@ typedef enum {
MFC_DEC_SETCONF_FRAME_TAG,
MFC_DEC_GETCONF_CRC_DATA,
MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT,
+ MFC_DEC_GETCONF_CROP_INFO,
MFC_DEC_GETCONF_FRAME_TAG
} SSBSIP_MFC_DEC_CONF;
@@ -272,6 +273,13 @@ typedef struct {
int buf_height;
} SSBSIP_MFC_IMG_RESOLUTION;
+typedef struct {
+ int crop_top_offset;
+ int crop_bottom_offset;
+ int crop_left_offset;
+ int crop_right_offset;
+} SSBSIP_MFC_CROP_INFORMATION;
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h
index ba7f537..e7e23c3 100644
--- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h
@@ -211,6 +211,11 @@ typedef struct {
int out_buf_height; /* [OUT] height of YUV420 frame */
int out_dpb_cnt; /* [OUT] the number of buffers which is nessary during decoding */
+ int out_crop_top_offset; /* [OUT] crop information, top offset */
+ int out_crop_bottom_offset; /* [OUT] crop information, bottom offset */
+ int out_crop_left_offset; /* [OUT] crop information, left offset */
+ int out_crop_right_offset; /* [OUT] crop information, right offset */
+
mfc_frame_buf_arg_t in_frm_buf; /* [IN] the address of dpb FRAME_BUF */
mfc_frame_buf_arg_t in_frm_size; /* [IN] size of dpb FRAME_BUF */
unsigned int in_mapped_addr;
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;
diff --git a/sec_mm/sec_omx/sec_omx_core/media_profiles.xml b/sec_mm/sec_omx/sec_omx_core/media_profiles.xml
new file mode 100644
index 0000000..a4ce852
--- /dev/null
+++ b/sec_mm/sec_omx/sec_omx_core/media_profiles.xml
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE MediaSettings [
+<!ELEMENT MediaSettings (CamcorderProfiles,
+ EncoderOutputFileFormat+,
+ VideoEncoderCap+,
+ AudioEncoderCap+,
+ VideoDecoderCap,
+ AudioDecoderCap)>
+<!ELEMENT CamcorderProfiles (EncoderProfile+, ImageEncoding+, ImageDecoding, Camera)>
+<!ELEMENT EncoderProfile (Video, Audio)>
+<!ATTLIST EncoderProfile quality (high|low) #REQUIRED>
+<!ATTLIST EncoderProfile fileFormat (mp4|3gp) #REQUIRED>
+<!ATTLIST EncoderProfile duration (30|60) #REQUIRED>
+<!ELEMENT Video EMPTY>
+<!ATTLIST Video codec (h264|h263|m4v) #REQUIRED>
+<!ATTLIST Video bitRate CDATA #REQUIRED>
+<!ATTLIST Video width CDATA #REQUIRED>
+<!ATTLIST Video height CDATA #REQUIRED>
+<!ATTLIST Video frameRate CDATA #REQUIRED>
+<!ELEMENT Audio EMPTY>
+<!ATTLIST Audio codec (amrnb|amrwb|aac) #REQUIRED>
+<!ATTLIST Audio bitRate CDATA #REQUIRED>
+<!ATTLIST Audio sampleRate CDATA #REQUIRED>
+<!ATTLIST Audio channels (1|2) #REQUIRED>
+<!ELEMENT ImageEncoding EMPTY>
+<!ATTLIST ImageEncoding quality (90|80|70|60|50|40) #REQUIRED>
+<!ELEMENT ImageDecoding EMPTY>
+<!ATTLIST ImageDecoding memCap CDATA #REQUIRED>
+<!ELEMENT Camera EMPTY>
+<!ELEMENT EncoderOutputFileFormat EMPTY>
+<!ATTLIST EncoderOutputFileFormat name (mp4|3gp) #REQUIRED>
+<!ELEMENT VideoEncoderCap EMPTY>
+<!ATTLIST VideoEncoderCap name (h264|h263|m4v|wmv) #REQUIRED>
+<!ATTLIST VideoEncoderCap enabled (true|false) #REQUIRED>
+<!ATTLIST VideoEncoderCap minBitRate CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap maxBitRate CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap minFrameWidth CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap maxFrameWidth CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap minFrameHeight CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap maxFrameHeight CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap minFrameRate CDATA #REQUIRED>
+<!ATTLIST VideoEncoderCap maxFrameRate CDATA #REQUIRED>
+<!ELEMENT AudioEncoderCap EMPTY>
+<!ATTLIST AudioEncoderCap name (amrnb|amrwb|aac|wma) #REQUIRED>
+<!ATTLIST AudioEncoderCap enabled (true|false) #REQUIRED>
+<!ATTLIST AudioEncoderCap minBitRate CDATA #REQUIRED>
+<!ATTLIST AudioEncoderCap maxBitRate CDATA #REQUIRED>
+<!ATTLIST AudioEncoderCap minSampleRate CDATA #REQUIRED>
+<!ATTLIST AudioEncoderCap maxSampleRate CDATA #REQUIRED>
+<!ATTLIST AudioEncoderCap minChannels (1|2) #REQUIRED>
+<!ATTLIST AudioEncoderCap maxChannels (1|2) #REQUIRED>
+<!ELEMENT VideoDecoderCap EMPTY>
+<!ATTLIST VideoDecoderCap name (wmv) #REQUIRED>
+<!ATTLIST VideoDecoderCap enabled (true|false) #REQUIRED>
+<!ELEMENT AudioDecoderCap EMPTY>
+<!ATTLIST AudioDecoderCap name (wma) #REQUIRED>
+<!ATTLIST AudioDecoderCap enabled (true|false) #REQUIRED>
+]>
+<!--
+ This file is used to declare the multimedia profiles and capabilities
+ on an android-powered device.
+-->
+<MediaSettings>
+ <!-- Each camcorder profile defines a set of predefined configuration parameters -->
+ <CamcorderProfiles>
+
+ <EncoderProfile quality="high" fileFormat="mp4" duration="60">
+ <Video codec="h264"
+ bitRate="800000"
+ width="720"
+ height="480"
+ frameRate="30" />
+
+ <Audio codec="aac"
+ bitRate="96000"
+ sampleRate="8000"
+ channels="1" />
+ </EncoderProfile>
+
+ <EncoderProfile quality="low" fileFormat="3gp" duration="30">
+ <Video codec="m4v"
+ bitRate="256000"
+ width="176"
+ height="144"
+ frameRate="30" />
+
+ <Audio codec="amrnb"
+ bitRate="12200"
+ sampleRate="8000"
+ channels="1" />
+
+ </EncoderProfile>
+
+ <ImageEncoding quality="90" />
+ <ImageEncoding quality="80" />
+ <ImageEncoding quality="70" />
+ <ImageDecoding memCap="20000000" />
+
+ </CamcorderProfiles>
+
+
+ <EncoderOutputFileFormat name="3gp" />
+ <EncoderOutputFileFormat name="mp4" />
+
+ <!--
+ If a codec is not enabled, it is invisible to the applications
+ In other words, the applications won't be able to use the codec
+ or query the capabilities of the codec at all if it is disabled
+ -->
+ <VideoEncoderCap name="h264" enabled="true"
+ minBitRate="64000" maxBitRate="3000000"
+ minFrameWidth="176" maxFrameWidth="720"
+ minFrameHeight="144" maxFrameHeight="480"
+ minFrameRate="10" maxFrameRate="30" />
+
+ <VideoEncoderCap name="h263" enabled="true"
+ minBitRate="64000" maxBitRate="1000000"
+ minFrameWidth="176" maxFrameWidth="720"
+ minFrameHeight="144" maxFrameHeight="480"
+ minFrameRate="10" maxFrameRate="30" />
+
+ <VideoEncoderCap name="m4v" enabled="true"
+ minBitRate="64000" maxBitRate="2000000"
+ minFrameWidth="176" maxFrameWidth="720"
+ minFrameHeight="144" maxFrameHeight="480"
+ minFrameRate="10" maxFrameRate="30" />
+
+ <AudioEncoderCap name="aac" enabled="true"
+ minBitRate="8192" maxBitRate="96000"
+ minSampleRate="8000" maxSampleRate="16000"
+ minChannels="1" maxChannels="1" />
+
+ <AudioEncoderCap name="amrwb" enabled="true"
+ minBitRate="6600" maxBitRate="23050"
+ minSampleRate="16000" maxSampleRate="16000"
+ minChannels="1" maxChannels="1" />
+
+ <AudioEncoderCap name="amrnb" enabled="true"
+ minBitRate="5525" maxBitRate="12200"
+ minSampleRate="8000" maxSampleRate="8000"
+ minChannels="1" maxChannels="1" />
+
+ <!--
+ FIXME:
+ We do not check decoder capabilities at present
+ At present, we only check whether windows media is visible
+ for TEST applications. For other applications, we do
+ not perform any checks at all.
+ -->
+ <VideoDecoderCap name="wmv" enabled="false"/>
+ <AudioDecoderCap name="wma" enabled="false"/>
+</MediaSettings>
diff --git a/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Def.h b/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Def.h
index 229accd..10dd94d 100644
--- a/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Def.h
+++ b/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Def.h
@@ -43,6 +43,9 @@
#define MAX_OMX_COMPONENT_LIBNAME_SIZE OMX_MAX_STRINGNAME_SIZE * 2
#define MAX_OMX_MIMETYPE_SIZE OMX_MAX_STRINGNAME_SIZE
+#define MAX_TIMESTAMP 16
+#define MAX_FLAGS 16
+
typedef enum _SEC_CODEC_TYPE
{
diff --git a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.c b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.c
index 8f26387..7a6c024 100644
--- a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.c
+++ b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.c
@@ -159,3 +159,16 @@ int SEC_OSAL_GetElemNum(SEC_QUEUE *queueHandle)
SEC_OSAL_MutexUnlock(queue->qMutex);
return ElemNum;
}
+
+int SEC_OSAL_SetElemNum(SEC_QUEUE *queueHandle, int ElemNum)
+{
+ SEC_QUEUE *queue = (SEC_QUEUE *)queueHandle;
+ if (queue == NULL)
+ return -1;
+
+ SEC_OSAL_MutexLock(queue->qMutex);
+ queue->numElem = ElemNum;
+ SEC_OSAL_MutexUnlock(queue->qMutex);
+ return ElemNum;
+}
+
diff --git a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.h b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.h
index 0f119e8..68910cc 100644
--- a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.h
+++ b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.h
@@ -58,6 +58,7 @@ OMX_ERRORTYPE SEC_OSAL_QueueTerminate(SEC_QUEUE *queueHandle);
int SEC_OSAL_Queue(SEC_QUEUE *queueHandle, void *data);
void *SEC_OSAL_Dequeue(SEC_QUEUE *queueHandle);
int SEC_OSAL_GetElemNum(SEC_QUEUE *queueHandle);
+int SEC_OSAL_SetElemNum(SEC_QUEUE *queueHandle, int ElemNum);
#ifdef __cplusplus
}