From 3858590dbde15ed3ab7fd58d8c177a11d25e4315 Mon Sep 17 00:00:00 2001 From: Taehwan Kim Date: Fri, 1 Feb 2013 06:03:53 +0000 Subject: [PATCH] venc: removed FlushXXBufferReturn function modified to use Exynos_XXBufferReturn instead of Exynos_FlushXXBufferReturn. Change-Id: Icb3f26ef9c1e9e46ad97f6a7efc26bd796e73a7f Signed-off-by: Taehwan Kim --- component/video/enc/Exynos_OMX_Venc.c | 8 +- component/video/enc/Exynos_OMX_VencControl.c | 161 +++---------------- component/video/enc/Exynos_OMX_VencControl.h | 6 +- 3 files changed, 26 insertions(+), 149 deletions(-) diff --git a/component/video/enc/Exynos_OMX_Venc.c b/component/video/enc/Exynos_OMX_Venc.c index d3c1d60..d50d3ec 100644 --- a/component/video/enc/Exynos_OMX_Venc.c +++ b/component/video/enc/Exynos_OMX_Venc.c @@ -574,7 +574,7 @@ OMX_BOOL Exynos_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_ if (((exynosInputPort->bStoreMetaData == OMX_TRUE) && (eColorFormat == OMX_COLOR_FormatAndroidOpaque)) || (exynosInputPort->bStoreMetaData == OMX_FALSE)) { - Exynos_InputBufferReturn(pOMXComponent); + Exynos_InputBufferReturn(pOMXComponent, inputUseBuffer); } else { inputUseBuffer->dataValid = OMX_TRUE; } @@ -655,7 +655,7 @@ OMX_BOOL Exynos_Postprocess_OutputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_ if ((outputUseBuffer->remainDataLen > 0) || (outputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS)) { - Exynos_OutputBufferReturn(pOMXComponent); + Exynos_OutputBufferReturn(pOMXComponent, outputUseBuffer); } } else { Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "output buffer is smaller than encoded data size Out Length"); @@ -668,7 +668,7 @@ OMX_BOOL Exynos_Postprocess_OutputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_ if ((outputUseBuffer->remainDataLen > 0) || ((outputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) || (CHECK_PORT_BEING_FLUSHED(exynosOutputPort))) - Exynos_OutputBufferReturn(pOMXComponent); + Exynos_OutputBufferReturn(pOMXComponent, outputUseBuffer); } } else { ret = OMX_FALSE; @@ -859,7 +859,7 @@ OMX_ERRORTYPE Exynos_OMX_SrcOutputBufferProcess(OMX_HANDLETYPE hComponent) if (eColorFormat == OMX_COLOR_FormatAndroidOpaque) bNeedUnlock = OMX_TRUE; Exynos_Shared_DataToBuffer(&srcOutputData, srcOutputUseBuffer, bNeedUnlock); - Exynos_InputBufferReturn(pOMXComponent); + Exynos_InputBufferReturn(pOMXComponent, srcOutputUseBuffer); } Exynos_ResetCodecData(&srcOutputData); } diff --git a/component/video/enc/Exynos_OMX_VencControl.c b/component/video/enc/Exynos_OMX_VencControl.c index fbd3b6d..2fcc0f9 100644 --- a/component/video/enc/Exynos_OMX_VencControl.c +++ b/component/video/enc/Exynos_OMX_VencControl.c @@ -499,16 +499,16 @@ OMX_ERRORTYPE Exynos_OMX_FlushPort( if ((pDataBuffer[0] != NULL) && (pDataBuffer[0]->dataValid == OMX_TRUE)) { if (nPortIndex == INPUT_PORT_INDEX) - Exynos_FlushInputBufferReturn(pOMXComponent, pDataBuffer[0]); + Exynos_InputBufferReturn(pOMXComponent, pDataBuffer[0]); else if (nPortIndex == OUTPUT_PORT_INDEX) - Exynos_FlushOutputBufferReturn(pOMXComponent, pDataBuffer[0]); + Exynos_OutputBufferReturn(pOMXComponent, pDataBuffer[0]); } if ((pDataBuffer[1] != NULL) && (pDataBuffer[1]->dataValid == OMX_TRUE)) { if (nPortIndex == INPUT_PORT_INDEX) - Exynos_FlushInputBufferReturn(pOMXComponent, pDataBuffer[1]); + Exynos_InputBufferReturn(pOMXComponent, pDataBuffer[1]); else if (nPortIndex == OUTPUT_PORT_INDEX) - Exynos_FlushOutputBufferReturn(pOMXComponent, pDataBuffer[1]); + Exynos_OutputBufferReturn(pOMXComponent, pDataBuffer[1]); } if (pExynosComponent->bMultiThreadProcess == OMX_TRUE) { @@ -688,12 +688,12 @@ EXIT: } OMX_ERRORTYPE Exynos_InputBufferReturn( - OMX_COMPONENTTYPE *pOMXComponent) + OMX_COMPONENTTYPE *pOMXComponent, + EXYNOS_OMX_DATABUFFER *pDataBuffer) { OMX_ERRORTYPE ret = OMX_ErrorNone; EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_DATABUFFER *pDataBuffer = NULL; OMX_BUFFERHEADERTYPE *pBufferHdr = NULL; FunctionIn(); @@ -710,80 +710,15 @@ OMX_ERRORTYPE Exynos_InputBufferReturn( pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; pExynosPort = &(pExynosComponent->pExynosPort[INPUT_PORT_INDEX]); - if (pExynosPort->bufferProcessType & BUFFER_COPY) { - pDataBuffer = &(pExynosPort->way.port2WayDataBuffer.inputDataBuffer); - } else if (pExynosPort->bufferProcessType & BUFFER_SHARE) { - pDataBuffer = &(pExynosPort->way.port2WayDataBuffer.outputDataBuffer); - } - if (pDataBuffer != NULL) pBufferHdr = pDataBuffer->bufferHeader; if (pBufferHdr != NULL) { if (pExynosPort->markType.hMarkTargetComponent != NULL) { - pBufferHdr->hMarkTargetComponent = pExynosPort->markType.hMarkTargetComponent; - pBufferHdr->pMarkData = pExynosPort->markType.pMarkData; - pExynosPort->markType.hMarkTargetComponent = NULL; - pExynosPort->markType.pMarkData = NULL; - } - - if (pBufferHdr->hMarkTargetComponent != NULL) { - if (pBufferHdr->hMarkTargetComponent == pOMXComponent) { - pExynosComponent->pCallbacks->EventHandler(pOMXComponent, - pExynosComponent->callbackData, - OMX_EventMark, - 0, 0, pBufferHdr->pMarkData); - } else { - pExynosComponent->propagateMarkType.hMarkTargetComponent = pBufferHdr->hMarkTargetComponent; - pExynosComponent->propagateMarkType.pMarkData = pBufferHdr->pMarkData; - } - } - - pBufferHdr->nFilledLen = 0; - pBufferHdr->nOffset = 0; - Exynos_OMX_InputBufferReturn(pOMXComponent, pBufferHdr); - } - - /* reset dataBuffer */ - Exynos_ResetDataBuffer(pDataBuffer); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_FlushInputBufferReturn( - OMX_COMPONENTTYPE *pOMXComponent, - EXYNOS_OMX_DATABUFFER *pDataBuffer) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_BUFFERHEADERTYPE *pBufferHdr = NULL; - - FunctionIn(); - - if (pOMXComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - pExynosPort = &(pExynosComponent->pExynosPort[INPUT_PORT_INDEX]); - - pBufferHdr = pDataBuffer->bufferHeader; - - if (pBufferHdr != NULL) { - if (pExynosPort->markType.hMarkTargetComponent != NULL) { - pBufferHdr->hMarkTargetComponent = pExynosPort->markType.hMarkTargetComponent; - pBufferHdr->pMarkData = pExynosPort->markType.pMarkData; - pExynosPort->markType.hMarkTargetComponent = NULL; - pExynosPort->markType.pMarkData = NULL; + pBufferHdr->hMarkTargetComponent = pExynosPort->markType.hMarkTargetComponent; + pBufferHdr->pMarkData = pExynosPort->markType.pMarkData; + pExynosPort->markType.hMarkTargetComponent = NULL; + pExynosPort->markType.pMarkData = NULL; } if (pBufferHdr->hMarkTargetComponent != NULL) { @@ -793,13 +728,13 @@ OMX_ERRORTYPE Exynos_FlushInputBufferReturn( OMX_EventMark, 0, 0, pBufferHdr->pMarkData); } else { - pExynosComponent->propagateMarkType.hMarkTargetComponent = pBufferHdr->hMarkTargetComponent; - pExynosComponent->propagateMarkType.pMarkData = pBufferHdr->pMarkData; + pExynosComponent->propagateMarkType.hMarkTargetComponent = pBufferHdr->hMarkTargetComponent; + pExynosComponent->propagateMarkType.pMarkData = pBufferHdr->pMarkData; } } - pBufferHdr->nFilledLen = 0; - pBufferHdr->nOffset = 0; + pBufferHdr->nFilledLen = 0; + pBufferHdr->nOffset = 0; Exynos_OMX_InputBufferReturn(pOMXComponent, pBufferHdr); } @@ -870,12 +805,12 @@ EXIT: } OMX_ERRORTYPE Exynos_OutputBufferReturn( - OMX_COMPONENTTYPE *pOMXComponent) + OMX_COMPONENTTYPE *pOMXComponent, + EXYNOS_OMX_DATABUFFER *pDataBuffer) { OMX_ERRORTYPE ret = OMX_ErrorNone; EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_DATABUFFER *pDataBuffer = NULL; OMX_BUFFERHEADERTYPE *pBufferHdr = NULL; FunctionIn(); @@ -892,8 +827,8 @@ OMX_ERRORTYPE Exynos_OutputBufferReturn( pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; pExynosPort = &(pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]); - pDataBuffer = &(pExynosPort->way.port2WayDataBuffer.outputDataBuffer); - pBufferHdr = pDataBuffer->bufferHeader; + if (pDataBuffer != NULL) + pBufferHdr = pDataBuffer->bufferHeader; if (pBufferHdr != NULL) { pBufferHdr->nFilledLen = pDataBuffer->remainDataLen; @@ -904,8 +839,8 @@ OMX_ERRORTYPE Exynos_OutputBufferReturn( if (pExynosComponent->propagateMarkType.hMarkTargetComponent != NULL) { pBufferHdr->hMarkTargetComponent = pExynosComponent->propagateMarkType.hMarkTargetComponent; pBufferHdr->pMarkData = pExynosComponent->propagateMarkType.pMarkData; - pExynosComponent->propagateMarkType.hMarkTargetComponent = NULL; - pExynosComponent->propagateMarkType.pMarkData = NULL; + pExynosComponent->propagateMarkType.hMarkTargetComponent = NULL; + pExynosComponent->propagateMarkType.pMarkData = NULL; } if ((pBufferHdr->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) { @@ -930,62 +865,6 @@ EXIT: return ret; } -OMX_ERRORTYPE Exynos_FlushOutputBufferReturn( - OMX_COMPONENTTYPE *pOMXComponent, - EXYNOS_OMX_DATABUFFER *pDataBuffer) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - OMX_BUFFERHEADERTYPE *pBufferHdr = NULL; - - FunctionIn(); - - if (pOMXComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - pBufferHdr = pDataBuffer->bufferHeader; - - if (pBufferHdr != NULL) { - pBufferHdr->nFilledLen = pDataBuffer->remainDataLen; - pBufferHdr->nOffset = 0; - pBufferHdr->nFlags = pDataBuffer->nFlags; - pBufferHdr->nTimeStamp = pDataBuffer->timeStamp; - - if (pExynosComponent->propagateMarkType.hMarkTargetComponent != NULL) { - pBufferHdr->hMarkTargetComponent = pExynosComponent->propagateMarkType.hMarkTargetComponent; - pBufferHdr->pMarkData = pExynosComponent->propagateMarkType.pMarkData; - pExynosComponent->propagateMarkType.hMarkTargetComponent = NULL; - pExynosComponent->propagateMarkType.pMarkData = NULL; - } - - if ((pBufferHdr->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) { - pBufferHdr->nFilledLen = 0; - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "event OMX_BUFFERFLAG_EOS!!!"); - pExynosComponent->pCallbacks->EventHandler(pOMXComponent, - pExynosComponent->callbackData, - OMX_EventBufferFlag, - OUTPUT_PORT_INDEX, - pBufferHdr->nFlags, NULL); - } - Exynos_OMX_OutputBufferReturn(pOMXComponent, pBufferHdr); - } - - /* reset dataBuffer */ - Exynos_ResetDataBuffer(pDataBuffer); - -EXIT: - FunctionOut(); - - return ret; -} - OMX_ERRORTYPE Exynos_OutputBufferGetQueue( EXYNOS_OMX_BASECOMPONENT *pExynosComponent) { diff --git a/component/video/enc/Exynos_OMX_VencControl.h b/component/video/enc/Exynos_OMX_VencControl.h index 777e59c..fa618eb 100644 --- a/component/video/enc/Exynos_OMX_VencControl.h +++ b/component/video/enc/Exynos_OMX_VencControl.h @@ -87,11 +87,9 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeGetExtensionIndex( OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_STRING szParameterName, OMX_OUT OMX_INDEXTYPE *pIndexType); -OMX_ERRORTYPE Exynos_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent); -OMX_ERRORTYPE Exynos_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent); +OMX_ERRORTYPE Exynos_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATABUFFER *pDataBuffer); +OMX_ERRORTYPE Exynos_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATABUFFER *pDataBuffer); OMX_ERRORTYPE Exynos_OMX_BufferFlush(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex, OMX_BOOL bEvent); -OMX_ERRORTYPE Exynos_FlushInputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATABUFFER *pDataBuffer); -OMX_ERRORTYPE Exynos_FlushOutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATABUFFER *pDataBuffer); OMX_ERRORTYPE Exynos_Shared_DataToBuffer(EXYNOS_OMX_DATA *pData, EXYNOS_OMX_DATABUFFER *pUseBuffer, OMX_BOOL bNeedUnlock); #ifdef __cplusplus -- 2.20.1