Remove build warnings and fixed svace issues
[platform/adaptation/ap_samsung/libomxil-e3250-v4l2.git] / openmax / component / video / enc / Exynos_OMX_Venc.c
old mode 100755 (executable)
new mode 100644 (file)
index c66643c..1b1b0ed
@@ -40,6 +40,7 @@
 #include "Exynos_OSAL_ETC.h"
 #include "ExynosVideoApi.h"
 #include "csc.h"
+#include "Exynos_OSAL_SharedMemory.h"
 
 #undef  EXYNOS_LOG_TAG
 #define EXYNOS_LOG_TAG    "EXYNOS_VIDEO_ENC"
@@ -95,7 +96,6 @@ OMX_BOOL Exynos_Check_BufferProcess_State(EXYNOS_OMX_BASECOMPONENT *pExynosCompo
 OMX_ERRORTYPE Exynos_Input_CodecBufferToData(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_PTR codecBuffer, EXYNOS_OMX_DATA *pData)
 {
     OMX_ERRORTYPE                  ret = OMX_ErrorNone;
-    EXYNOS_OMX_VIDEOENC_COMPONENT *pVideoEnc = (EXYNOS_OMX_VIDEOENC_COMPONENT *)pExynosComponent->hComponentHandle;
     CODEC_ENC_BUFFER *pInputCodecBuffer = (CODEC_ENC_BUFFER*)codecBuffer;
 
     pData->buffer.multiPlaneBuffer.dataBuffer[0] = pInputCodecBuffer->pVirAddr[0];
@@ -137,8 +137,6 @@ OMX_ERRORTYPE Exynos_Output_CodecBufferToData(EXYNOS_OMX_BASECOMPONENT *pExynosC
 
 void Exynos_Wait_ProcessPause(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 nPortIndex)
 {
-    EXYNOS_OMX_BASEPORT *exynosOMXInputPort  = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
-    EXYNOS_OMX_BASEPORT *exynosOMXOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
     EXYNOS_OMX_BASEPORT *exynosOMXPort = NULL;
 
     FunctionIn();
@@ -171,7 +169,6 @@ OMX_BOOL Exynos_CSC_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA
     OMX_U32                nFrameHeight = exynosInputPort->portDefinition.format.video.nFrameHeight;
     OMX_COLOR_FORMATTYPE   eColorFormat = exynosInputPort->portDefinition.format.video.eColorFormat;
     OMX_BYTE               checkInputStream = NULL;
-    OMX_BOOL               flagEOS = OMX_FALSE;
 
     FunctionIn();
 
@@ -200,9 +197,9 @@ OMX_BOOL Exynos_CSC_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA
 
     csc_get_method(pVideoEnc->csc_handle, &csc_method);
     if (csc_method == CSC_METHOD_HW) {
-        pDstBuf[0] = srcInputData->buffer.multiPlaneBuffer.fd[0];
-        pDstBuf[1] = srcInputData->buffer.multiPlaneBuffer.fd[1];
-        pDstBuf[2] = srcInputData->buffer.multiPlaneBuffer.fd[2];
+        pDstBuf[0] = (unsigned char*)(&srcInputData->buffer.multiPlaneBuffer.fd[0]);
+        pDstBuf[1] = (unsigned char*)(&srcInputData->buffer.multiPlaneBuffer.fd[1]);
+        pDstBuf[2] = (unsigned char*)(&srcInputData->buffer.multiPlaneBuffer.fd[2]);
     }
 
 #ifdef USE_METADATABUFFERTYPE
@@ -306,7 +303,6 @@ OMX_BOOL Exynos_CSC_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA
 
     ret = OMX_TRUE;
 
-EXIT:
     FunctionOut();
 
     return ret;
@@ -316,16 +312,10 @@ OMX_BOOL Exynos_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_
 {
     OMX_BOOL                      ret = OMX_FALSE;
     EXYNOS_OMX_BASECOMPONENT      *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
-    EXYNOS_OMX_VIDEOENC_COMPONENT *pVideoEnc = (EXYNOS_OMX_VIDEOENC_COMPONENT *)pExynosComponent->hComponentHandle;
     EXYNOS_OMX_BASEPORT   *exynosInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
     EXYNOS_OMX_DATABUFFER *inputUseBuffer = &exynosInputPort->way.port2WayDataBuffer.inputDataBuffer;
-    OMX_U32                nFrameWidth = exynosInputPort->portDefinition.format.video.nFrameWidth;
-    OMX_U32                nFrameHeight = exynosInputPort->portDefinition.format.video.nFrameHeight;
-    OMX_COLOR_FORMATTYPE   eColorFormat = exynosInputPort->portDefinition.format.video.eColorFormat;
     OMX_U32                copySize = 0;
-    OMX_BYTE               checkInputStream = NULL;
     OMX_U32                checkInputStreamLen = 0;
-    OMX_BOOL               flagEOS = OMX_FALSE;
 
     FunctionIn();
 
@@ -349,6 +339,8 @@ OMX_BOOL Exynos_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_
                 /* kMetadataBufferTypeCameraSource */
                 Exynos_OSAL_GetInfoFromMetaData((OMX_BYTE)inputUseBuffer->bufferHeader->pBuffer, ppBuf);
 #ifdef USE_DMA_BUF
+                EXYNOS_OMX_VIDEOENC_COMPONENT *pVideoEnc = (EXYNOS_OMX_VIDEOENC_COMPONENT *)pExynosComponent->hComponentHandle;
+
                 srcInputData->buffer.multiPlaneBuffer.fd[0] = ppBuf[0];
                 srcInputData->buffer.multiPlaneBuffer.fd[1] = ppBuf[1];
                 allocSize[0] = nFrameWidth * nFrameHeight;
@@ -393,14 +385,12 @@ OMX_BOOL Exynos_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_
             /* reset dataBuffer */
             Exynos_ResetDataBuffer(inputUseBuffer);
         } else if (exynosInputPort->bufferProcessType & BUFFER_COPY) {
-            checkInputStream = inputUseBuffer->bufferHeader->pBuffer + inputUseBuffer->usedDataLen;
             checkInputStreamLen = inputUseBuffer->remainDataLen;
 
             pExynosComponent->bUseFlagEOF = OMX_TRUE;
 
             if (checkInputStreamLen == 0) {
                 inputUseBuffer->nFlags |= OMX_BUFFERFLAG_EOS;
-                flagEOS = OMX_TRUE;
             }
 
             copySize = checkInputStreamLen;
@@ -550,7 +540,6 @@ OMX_ERRORTYPE Exynos_OMX_SrcInputBufferProcess(OMX_HANDLETYPE hComponent)
     EXYNOS_OMX_DATABUFFER    *srcInputUseBuffer = &exynosInputPort->way.port2WayDataBuffer.inputDataBuffer;
     EXYNOS_OMX_DATA          *pSrcInputData = &exynosInputPort->processData;
     OMX_BOOL               bCheckInputData = OMX_FALSE;
-    OMX_BOOL               bValidCodecData = OMX_FALSE;
 
     FunctionIn();
 
@@ -601,13 +590,11 @@ OMX_ERRORTYPE Exynos_OMX_SrcInputBufferProcess(OMX_HANDLETYPE hComponent)
             ret = pVideoEnc->exynos_codec_srcInputProcess(pOMXComponent, pSrcInputData);
             Exynos_ResetCodecData(pSrcInputData);
             Exynos_OSAL_MutexUnlock(srcInputUseBuffer->bufferMutex);
-            if (ret == OMX_ErrorCodecInit)
+            if (ret == (OMX_ERRORTYPE)OMX_ErrorCodecInit)
                 pVideoEnc->bExitBufferProcessThread = OMX_TRUE;
         }
     }
 
-EXIT:
-
     FunctionOut();
 
     return ret;
@@ -658,8 +645,6 @@ OMX_ERRORTYPE Exynos_OMX_SrcOutputBufferProcess(OMX_HANDLETYPE hComponent)
         }
     }
 
-EXIT:
-
     FunctionOut();
 
     return ret;
@@ -725,8 +710,6 @@ OMX_ERRORTYPE Exynos_OMX_DstInputBufferProcess(OMX_HANDLETYPE hComponent)
         }
     }
 
-EXIT:
-
     FunctionOut();
 
     return ret;
@@ -791,8 +774,6 @@ OMX_ERRORTYPE Exynos_OMX_DstOutputBufferProcess(OMX_HANDLETYPE hComponent)
         }
     }
 
-EXIT:
-
     FunctionOut();
 
     return ret;
@@ -802,8 +783,6 @@ static OMX_ERRORTYPE Exynos_OMX_SrcInputProcessThread(OMX_PTR threadData)
 {
     OMX_ERRORTYPE          ret = OMX_ErrorNone;
     OMX_COMPONENTTYPE     *pOMXComponent = NULL;
-    EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
-    EXYNOS_OMX_MESSAGE       *message = NULL;
 
     FunctionIn();
 
@@ -816,7 +795,6 @@ static OMX_ERRORTYPE Exynos_OMX_SrcInputProcessThread(OMX_PTR threadData)
     if (ret != OMX_ErrorNone) {
         goto EXIT;
     }
-    pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
     Exynos_OMX_SrcInputBufferProcess(pOMXComponent);
 
     Exynos_OSAL_ThreadExit(NULL);
@@ -831,8 +809,6 @@ static OMX_ERRORTYPE Exynos_OMX_SrcOutputProcessThread(OMX_PTR threadData)
 {
     OMX_ERRORTYPE          ret = OMX_ErrorNone;
     OMX_COMPONENTTYPE     *pOMXComponent = NULL;
-    EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
-    EXYNOS_OMX_MESSAGE       *message = NULL;
 
     FunctionIn();
 
@@ -845,7 +821,6 @@ static OMX_ERRORTYPE Exynos_OMX_SrcOutputProcessThread(OMX_PTR threadData)
     if (ret != OMX_ErrorNone) {
         goto EXIT;
     }
-    pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
     Exynos_OMX_SrcOutputBufferProcess(pOMXComponent);
 
     Exynos_OSAL_ThreadExit(NULL);
@@ -860,8 +835,6 @@ static OMX_ERRORTYPE Exynos_OMX_DstInputProcessThread(OMX_PTR threadData)
 {
     OMX_ERRORTYPE          ret = OMX_ErrorNone;
     OMX_COMPONENTTYPE     *pOMXComponent = NULL;
-    EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
-    EXYNOS_OMX_MESSAGE       *message = NULL;
 
     FunctionIn();
 
@@ -874,7 +847,6 @@ static OMX_ERRORTYPE Exynos_OMX_DstInputProcessThread(OMX_PTR threadData)
     if (ret != OMX_ErrorNone) {
         goto EXIT;
     }
-    pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
     Exynos_OMX_DstInputBufferProcess(pOMXComponent);
 
     Exynos_OSAL_ThreadExit(NULL);
@@ -889,8 +861,6 @@ static OMX_ERRORTYPE Exynos_OMX_DstOutputProcessThread(OMX_PTR threadData)
 {
     OMX_ERRORTYPE          ret = OMX_ErrorNone;
     OMX_COMPONENTTYPE     *pOMXComponent = NULL;
-    EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
-    EXYNOS_OMX_MESSAGE       *message = NULL;
 
     FunctionIn();
 
@@ -903,7 +873,6 @@ static OMX_ERRORTYPE Exynos_OMX_DstOutputProcessThread(OMX_PTR threadData)
     if (ret != OMX_ErrorNone) {
         goto EXIT;
     }
-    pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
     Exynos_OMX_DstOutputBufferProcess(pOMXComponent);
 
     Exynos_OSAL_ThreadExit(NULL);
@@ -941,7 +910,6 @@ OMX_ERRORTYPE Exynos_OMX_BufferProcess_Create(OMX_HANDLETYPE hComponent)
                      Exynos_OMX_SrcInputProcessThread,
                      pOMXComponent);
 
-EXIT:
     FunctionOut();
 
     return ret;
@@ -954,7 +922,6 @@ OMX_ERRORTYPE Exynos_OMX_BufferProcess_Terminate(OMX_HANDLETYPE hComponent)
     EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
     EXYNOS_OMX_VIDEOENC_COMPONENT *pVideoEnc = (EXYNOS_OMX_VIDEOENC_COMPONENT *)pExynosComponent->hComponentHandle;
     OMX_S32                countValue = 0;
-    unsigned int           i = 0;
 
     FunctionIn();
 
@@ -992,7 +959,6 @@ OMX_ERRORTYPE Exynos_OMX_BufferProcess_Terminate(OMX_HANDLETYPE hComponent)
     Exynos_OSAL_ThreadTerminate(pVideoEnc->hDstOutputThread);
     pVideoEnc->hDstOutputThread = NULL;
 
-EXIT:
     FunctionOut();
 
     return ret;