LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
- hardware/samsung_slsi/exynos5/include
+ hardware/samsung_slsi/exynos5/include \
+ hardware/samsung_slsi/exynos5/exynos_omx/openmax/exynos_omx/include/khronos
LOCAL_MODULE := libExynosVideoApi
LOCAL_MODULE_TAGS := optional
#include "ExynosVideoApi.h"
#include "ExynosVideoDec.h"
+#include "OMX_Core.h"
/* #define LOG_NDEBUG 0 */
#define LOG_TAG "ExynosVideoDecoder"
buf.m.planes[i].bytesused = dataSize[i];
}
+ if ((((OMX_BUFFERHEADERTYPE *)pPrivate)->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+ buf.flags |= V4L2_BUF_FLAG_LAST_FRAME;
+ ALOGD("%s: OMX_BUFFERFLAG_EOS => LAST_FRAME: 0x%x", __func__,
+ !!(buf.flags & V4L2_BUF_FLAG_LAST_FRAME));
+ }
+
if (exynos_v4l2_qbuf(pCtx->hDec, &buf) != 0) {
ALOGE("%s: Failed to enqueue input buffer", __func__);
pCtx->pInbuf[buf.index].bQueued = VIDEO_FALSE;
OMX_BOOL reInputData;
OMX_BOOL bUseFlagEOF;
- OMX_BOOL bSaveFlagEOS;
+ OMX_BOOL bSaveFlagEOS; //bSaveFlagEOS is OMX_TRUE, if EOS flag is incoming.
+ OMX_BOOL bBehaviorEOS; //bBehaviorEOS is OMX_TRUE, if EOS flag with Data are incoming.
/* Check for Old & New OMX Process type switch */
OMX_BOOL bMultiThreadProcess;
return ret;
}
+OMX_ERRORTYPE Exynos_ResetAllPortConfig(OMX_COMPONENTTYPE *pOMXComponent)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+ EXYNOS_OMX_BASEPORT *pExynosInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
+ EXYNOS_OMX_BASEPORT *pExynosOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
+
+ /* Input port */
+ pExynosInputPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+ pExynosInputPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+ pExynosInputPort->portDefinition.format.video.nStride = 0; /*DEFAULT_FRAME_WIDTH;*/
+ pExynosInputPort->portDefinition.format.video.nSliceHeight = 0;
+ pExynosInputPort->portDefinition.nBufferSize = DEFAULT_VIDEO_INPUT_BUFFER_SIZE;
+ pExynosInputPort->portDefinition.format.video.pNativeRender = 0;
+ pExynosInputPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+ pExynosInputPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatUnused;
+ pExynosInputPort->portDefinition.bEnabled = OMX_TRUE;
+ pExynosInputPort->bufferProcessType = BUFFER_SHARE;
+ pExynosInputPort->portWayType = WAY2_PORT;
+
+ /* Output port */
+ pExynosOutputPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+ pExynosOutputPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+ pExynosOutputPort->portDefinition.format.video.nStride = 0; /*DEFAULT_FRAME_WIDTH;*/
+ pExynosOutputPort->portDefinition.format.video.nSliceHeight = 0;
+ pExynosOutputPort->portDefinition.nBufferSize = DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE;
+ pExynosOutputPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
+ Exynos_OSAL_Memset(pExynosOutputPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+ Exynos_OSAL_Strcpy(pExynosOutputPort->portDefinition.format.video.cMIMEType, "raw/video");
+ pExynosOutputPort->portDefinition.format.video.pNativeRender = 0;
+ pExynosOutputPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+ pExynosOutputPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
+ pExynosOutputPort->portDefinition.bEnabled = OMX_TRUE;
+ pExynosOutputPort->bufferProcessType = BUFFER_COPY | BUFFER_ANBSHARE;
+ pExynosOutputPort->bIsANBEnabled = OMX_FALSE;
+ pExynosOutputPort->portWayType = WAY2_PORT;
+
+ return ret;
+}
+
OMX_ERRORTYPE Exynos_Input_CodecBufferToData(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_PTR codecBuffer, EXYNOS_OMX_DATA *pData)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
if ((srcInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "bSaveFlagEOS : OMX_TRUE");
- srcInputData->dataLen = 0;
- srcInputData->remainDataLen = 0;
pExynosComponent->bSaveFlagEOS = OMX_TRUE;
+ if (srcInputData->dataLen != 0)
+ pExynosComponent->bBehaviorEOS = OMX_TRUE;
}
if (pExynosComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) {
Exynos_OSAL_ThreadTerminate(pVideoDec->hDstOutputThread);
pVideoDec->hDstOutputThread = NULL;
+ pExynosComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE;
+ pExynosComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE;
+
EXIT:
FunctionOut();
pExynosComponent->hComponentHandle = (OMX_HANDLETYPE)pVideoDec;
pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+ pExynosComponent->bBehaviorEOS = OMX_FALSE;
pExynosComponent->bMultiThreadProcess = OMX_TRUE;
/* Input port */
Exynos_OSAL_Memset(pExynosComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+ pExynosComponent->bBehaviorEOS = OMX_FALSE;
pExynosComponent->reInputData = OMX_FALSE;
}
}
if ((bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
- bufferHeader->nFilledLen = 0;
Exynos_OSAL_Log(EXYNOS_LOG_TRACE,"event OMX_BUFFERFLAG_EOS!!!");
pExynosComponent->pCallbacks->EventHandler(pOMXComponent,
pExynosComponent->callbackData,
}
if ((bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
- bufferHeader->nFilledLen = 0;
Exynos_OSAL_Log(EXYNOS_LOG_TRACE,"event OMX_BUFFERFLAG_EOS!!!");
pExynosComponent->pCallbacks->EventHandler(pOMXComponent,
pExynosComponent->callbackData,
pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
portDefinition = &pExynosPort->portDefinition;
- switch (index) {
- case supportFormat_0:
- portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
- portFormat->eColorFormat = OMX_COLOR_FormatYUV420Planar;
- portFormat->xFramerate = portDefinition->format.video.xFramerate;
- break;
- case supportFormat_1:
- portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
- portFormat->eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
- portFormat->xFramerate = portDefinition->format.video.xFramerate;
- break;
- case supportFormat_2:
- portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
- portFormat->eColorFormat = OMX_SEC_COLOR_FormatNV12TPhysicalAddress;
- portFormat->xFramerate = portDefinition->format.video.xFramerate;
- break;
- case supportFormat_3:
- portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
- portFormat->eColorFormat = OMX_SEC_COLOR_FormatNV12Tiled;
- portFormat->xFramerate = portDefinition->format.video.xFramerate;
- break;
- default:
- if (index > supportFormat_0) {
- ret = OMX_ErrorNoMore;
- goto EXIT;
+ if (pExynosPort->bIsANBEnabled == OMX_FALSE) {
+ switch (index) {
+ case supportFormat_0:
+ portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+ portFormat->eColorFormat = OMX_COLOR_FormatYUV420Planar;
+ portFormat->xFramerate = portDefinition->format.video.xFramerate;
+ break;
+ case supportFormat_1:
+ portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+ portFormat->eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
+ portFormat->xFramerate = portDefinition->format.video.xFramerate;
+ break;
+ case supportFormat_2:
+ portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+ portFormat->eColorFormat = OMX_SEC_COLOR_FormatNV12TPhysicalAddress;
+ portFormat->xFramerate = portDefinition->format.video.xFramerate;
+ break;
+ case supportFormat_3:
+ portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+ portFormat->eColorFormat = OMX_SEC_COLOR_FormatNV12Tiled;
+ portFormat->xFramerate = portDefinition->format.video.xFramerate;
+ break;
+ default:
+ if (index > supportFormat_0) {
+ ret = OMX_ErrorNoMore;
+ goto EXIT;
+ }
+ break;
+ }
+ } else {
+ switch (index) {
+ case supportFormat_0:
+ portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+ portFormat->eColorFormat = OMX_SEC_COLOR_FormatNV12Tiled;
+ portFormat->xFramerate = portDefinition->format.video.xFramerate;
+ break;
+ default:
+ if (index > supportFormat_0) {
+ ret = OMX_ErrorNoMore;
+ goto EXIT;
+ }
+ break;
}
- break;
}
}
ret = OMX_ErrorNone;
pH264Dec->hMFCH264Handle.bConfiguredMFCDst = OMX_FALSE;
pExynosComponent->bUseFlagEOF = OMX_TRUE;
pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+ pExynosComponent->bBehaviorEOS = OMX_FALSE;
/* H.264 Codec Open */
ret = H264CodecOpen(pH264Dec);
}
H264CodecClose(pH264Dec);
+ Exynos_ResetAllPortConfig(pOMXComponent);
+
EXIT:
FunctionOut();
((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) {
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "displayStatus:%d, nFlags0x%x", displayStatus, pDstOutputData->nFlags);
pDstOutputData->remainDataLen = 0;
+ if (((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+ (pExynosComponent->bBehaviorEOS == OMX_TRUE)) {
+ pDstOutputData->remainDataLen = bufferGeometry->nFrameWidth * bufferGeometry->nFrameHeight * 3 / 2;
+ pExynosComponent->bBehaviorEOS = OMX_FALSE;
+ }
} else {
pDstOutputData->remainDataLen = bufferGeometry->nFrameWidth * bufferGeometry->nFrameHeight * 3 / 2;
}
pMpeg4Dec->hMFCMpeg4Handle.bConfiguredMFCDst = OMX_FALSE;
pExynosComponent->bUseFlagEOF = OMX_TRUE;
pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+ pExynosComponent->bBehaviorEOS = OMX_FALSE;
/* H.264 Codec Open */
ret = Mpeg4CodecOpen(pMpeg4Dec);
}
Mpeg4CodecClose(pMpeg4Dec);
+ Exynos_ResetAllPortConfig(pOMXComponent);
+
EXIT:
FunctionOut();
((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) {
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "displayStatus:%d, nFlags0x%x", displayStatus, pDstOutputData->nFlags);
pDstOutputData->remainDataLen = 0;
+ if (((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+ (pExynosComponent->bBehaviorEOS == OMX_TRUE)) {
+ pDstOutputData->remainDataLen = bufferGeometry->nFrameWidth * bufferGeometry->nFrameHeight * 3 / 2;
+ pExynosComponent->bBehaviorEOS = OMX_FALSE;
+ }
} else {
pDstOutputData->remainDataLen = bufferGeometry->nFrameWidth * bufferGeometry->nFrameHeight * 3 / 2;
}
pVp8Dec->hMFCVp8Handle.bConfiguredMFCDst = OMX_FALSE;
pExynosComponent->bUseFlagEOF = OMX_TRUE;
pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+ pExynosComponent->bBehaviorEOS = OMX_FALSE;
/* H.264 Codec Open */
ret = VP8CodecOpen(pVp8Dec);
}
VP8CodecClose(pVp8Dec);
+ Exynos_ResetAllPortConfig(pOMXComponent);
+
EXIT:
FunctionOut();
((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) {
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "displayStatus:%d, nFlags0x%x", displayStatus, pDstOutputData->nFlags);
pDstOutputData->remainDataLen = 0;
+ if (((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+ (pExynosComponent->bBehaviorEOS == OMX_TRUE)) {
+ pDstOutputData->remainDataLen = bufferGeometry->nFrameWidth * bufferGeometry->nFrameHeight * 3 / 2;
+ pExynosComponent->bBehaviorEOS = OMX_FALSE;
+ }
} else {
pDstOutputData->remainDataLen = bufferGeometry->nFrameWidth * bufferGeometry->nFrameHeight * 3 / 2;
}
if ((srcInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "bSaveFlagEOS : OMX_TRUE");
- srcInputData->dataLen = 0;
- srcInputData->remainDataLen = 0;
pExynosComponent->bSaveFlagEOS = OMX_TRUE;
+ if (srcInputData->dataLen != 0)
+ pExynosComponent->bBehaviorEOS = OMX_TRUE;
}
if (pExynosComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) {
Exynos_OSAL_ThreadTerminate(pVideoEnc->hDstOutputThread);
pVideoEnc->hDstOutputThread = NULL;
+ pExynosComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE;
+ pExynosComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE;
+
EXIT:
FunctionOut();
pExynosComponent->hComponentHandle = (OMX_HANDLETYPE)pVideoEnc;
pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+ pExynosComponent->bBehaviorEOS = OMX_FALSE;
pVideoEnc->bFirstInput = OMX_FALSE;
pVideoEnc->bFirstOutput = OMX_FALSE;
Exynos_OSAL_Memset(pExynosComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+ pExynosComponent->bBehaviorEOS = OMX_FALSE;
pExynosComponent->reInputData = OMX_FALSE;
}
}
if ((bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
- bufferHeader->nFilledLen = 0;
Exynos_OSAL_Log(EXYNOS_LOG_TRACE,"event OMX_BUFFERFLAG_EOS!!!");
pExynosComponent->pCallbacks->EventHandler(pOMXComponent,
pExynosComponent->callbackData,
}
if ((bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
- bufferHeader->nFilledLen = 0;
Exynos_OSAL_Log(EXYNOS_LOG_TRACE,"event OMX_BUFFERFLAG_EOS!!!");
pExynosComponent->pCallbacks->EventHandler(pOMXComponent,
pExynosComponent->callbackData,
pH264Enc->hMFCH264Handle.bConfiguredMFCDst = OMX_FALSE;
pExynosComponent->bUseFlagEOF = OMX_TRUE;
pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+ pExynosComponent->bBehaviorEOS = OMX_FALSE;
eColorFormat = pExynosInputPort->portDefinition.format.video.eColorFormat;
if (pExynosInputPort->bStoreMetaData == OMX_TRUE) {
}
if ((displayStatus == VIDEO_FRAME_STATUS_CHANGE_RESOL) ||
- ((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) {
+ (((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+ (pExynosComponent->bBehaviorEOS == OMX_FALSE))) {
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "%x displayStatus:%d, nFlags0x%x", pExynosComponent, displayStatus, pDstOutputData->nFlags);
pDstOutputData->remainDataLen = 0;
}
+ if (((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+ (pExynosComponent->bBehaviorEOS == OMX_TRUE))
+ pExynosComponent->bBehaviorEOS = OMX_FALSE;
ret = OMX_ErrorNone;
pMpeg4Enc->hMFCMpeg4Handle.bConfiguredMFCDst = OMX_FALSE;
pExynosComponent->bUseFlagEOF = OMX_TRUE;
pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+ pExynosComponent->bBehaviorEOS = OMX_FALSE;
eColorFormat = pExynosInputPort->portDefinition.format.video.eColorFormat;
if (pExynosInputPort->bStoreMetaData == OMX_TRUE) {
}
if ((displayStatus == VIDEO_FRAME_STATUS_CHANGE_RESOL) ||
- ((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) {
+ (((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+ (pExynosComponent->bBehaviorEOS == OMX_FALSE))) {
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "%x displayStatus:%d, nFlags0x%x", pExynosComponent, displayStatus, pDstOutputData->nFlags);
pDstOutputData->remainDataLen = 0;
}
+ if (((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+ (pExynosComponent->bBehaviorEOS == OMX_TRUE))
+ pExynosComponent->bBehaviorEOS = OMX_FALSE;
ret = OMX_ErrorNone;
#define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000
/* Expects and returns a sync fence */
#define V4L2_BUF_FLAG_USE_SYNC 0x2000
+/* Buffer is end of stream */
+#define V4L2_BUF_FLAG_LAST_FRAME 0x4000
/*
* O V E R L A Y P R E V I E W