Remove build warnings and fixed svace issues
[platform/adaptation/ap_samsung/libomxil-e3250-v4l2.git] / openmax / component / video / enc / Exynos_OMX_VencControl.c
index 7053059..5734400 100755 (executable)
@@ -91,8 +91,7 @@ OMX_ERRORTYPE Exynos_OMX_UseBuffer(
     }
     pVideoEnc = (EXYNOS_OMX_VIDEOENC_COMPONENT *)pExynosComponent->hComponentHandle;
 
-    if ((nPortIndex < 0) ||
-        (nPortIndex >= pExynosComponent->portParam.nPorts)) {
+    if (nPortIndex >= pExynosComponent->portParam.nPorts) {
         ret = OMX_ErrorBadPortIndex;
         goto EXIT;
     }
@@ -222,8 +221,8 @@ OMX_ERRORTYPE Exynos_OMX_AllocateBuffer(
     }
     pVideoEnc = (EXYNOS_OMX_VIDEOENC_COMPONENT *)pExynosComponent->hComponentHandle;
 
-    if ((nPortIndex < 0) ||
-        (nPortIndex >= pExynosComponent->portParam.nPorts)) {
+    if (nPortIndex >= pExynosComponent->portParam.nPorts) {
+        Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] invalid parameter(0x%x)", pExynosComponent, __FUNCTION__, nPortIndex);
         ret = OMX_ErrorBadPortIndex;
         goto EXIT;
     }
@@ -333,8 +332,8 @@ OMX_ERRORTYPE Exynos_OMX_FreeBuffer(
     }
     pVideoEnc = (EXYNOS_OMX_VIDEOENC_COMPONENT *)pExynosComponent->hComponentHandle;
 
-    if ((nPortIndex < 0) ||
-        (nPortIndex >= pExynosComponent->portParam.nPorts)) {
+    if (nPortIndex >= pExynosComponent->portParam.nPorts) {
+        Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] invalid parameter(0x%x)", pExynosComponent, __FUNCTION__, nPortIndex);
         ret = OMX_ErrorBadPortIndex;
         goto EXIT;
     }
@@ -401,31 +400,14 @@ OMX_ERRORTYPE Exynos_OMX_AllocateTunnelBuffer(
     EXYNOS_OMX_BASEPORT     *pOMXBasePort,
     OMX_U32                  nPortIndex)
 {
-    OMX_ERRORTYPE                 ret               = OMX_ErrorNone;
-    EXYNOS_OMX_BASEPORT          *pExynosPort       = NULL;
-    OMX_BUFFERHEADERTYPE         *pTempBufferHdr    = NULL;
-    OMX_U8                       *pTempBuffer       = NULL;
-    OMX_U32                       nBufferSize       = 0;
-    OMX_PARAM_PORTDEFINITIONTYPE  portDefinition;
-
-    ret = OMX_ErrorTunnelingUnsupported;
-EXIT:
-    return ret;
+    return OMX_ErrorTunnelingUnsupported;
 }
 
 OMX_ERRORTYPE Exynos_OMX_FreeTunnelBuffer(
     EXYNOS_OMX_BASEPORT     *pOMXBasePort,
     OMX_U32                  nPortIndex)
 {
-    OMX_ERRORTYPE            ret            = OMX_ErrorNone;
-    EXYNOS_OMX_BASEPORT     *pExynosPort    = NULL;
-    OMX_BUFFERHEADERTYPE    *pTempBufferHdr = NULL;
-    OMX_U8                  *pTempBuffer    = NULL;
-    OMX_U32                  nBufferSize    = 0;
-
-    ret = OMX_ErrorTunnelingUnsupported;
-EXIT:
-    return ret;
+    return OMX_ErrorTunnelingUnsupported;
 }
 
 OMX_ERRORTYPE Exynos_OMX_ComponentTunnelRequest(
@@ -435,11 +417,7 @@ OMX_ERRORTYPE Exynos_OMX_ComponentTunnelRequest(
     OMX_IN OMX_U32        nTunneledPort,
     OMX_INOUT OMX_TUNNELSETUPTYPE *pTunnelSetup)
 {
-    OMX_ERRORTYPE ret = OMX_ErrorNone;
-
-    ret = OMX_ErrorTunnelingUnsupported;
-EXIT:
-    return ret;
+    return OMX_ErrorTunnelingUnsupported;
 }
 
 OMX_ERRORTYPE Exynos_OMX_GetFlushBuffer(
@@ -459,7 +437,6 @@ OMX_ERRORTYPE Exynos_OMX_GetFlushBuffer(
         pDataBuffer[1] = &(pExynosPort->way.port2WayDataBuffer.outputDataBuffer);
     }
 
-EXIT:
     FunctionOut();
 
     return ret;
@@ -591,7 +568,6 @@ OMX_ERRORTYPE Exynos_OMX_BufferFlush(
     EXYNOS_OMX_VIDEOENC_COMPONENT   *pVideoEnc          = NULL;
     EXYNOS_OMX_BASEPORT             *pExynosPort        = NULL;
     EXYNOS_OMX_DATABUFFER           *pDataBuffer[2]     = {NULL, NULL};
-    OMX_U32                          i                  = 0;
 
     FunctionIn();
 #ifdef TIZEN_FEATURE_E3250
@@ -1126,8 +1102,7 @@ OMX_ERRORTYPE Exynos_CodecBufferEnqueue(
         goto EXIT;
     }
 
-    if ((nPortIndex < 0) ||
-        (nPortIndex >= pExynosComponent->portParam.nPorts)) {
+    if (nPortIndex >= pExynosComponent->portParam.nPorts) {
         ret = OMX_ErrorBadPortIndex;
         goto EXIT;
     }
@@ -1169,8 +1144,7 @@ OMX_ERRORTYPE Exynos_CodecBufferDequeue(
         goto EXIT;
     }
 
-    if ((nPortIndex < 0) ||
-        (nPortIndex >= pExynosComponent->portParam.nPorts)) {
+    if (nPortIndex >= pExynosComponent->portParam.nPorts) {
         ret = OMX_ErrorBadPortIndex;
         goto EXIT;
     }
@@ -1206,8 +1180,7 @@ OMX_ERRORTYPE Exynos_CodecBufferReset(
         goto EXIT;
     }
 
-    if ((nPortIndex < 0) ||
-        (nPortIndex >= pExynosComponent->portParam.nPorts)) {
+    if (nPortIndex >= pExynosComponent->portParam.nPorts) {
         ret = OMX_ErrorBadPortIndex;
         goto EXIT;
     }
@@ -1220,7 +1193,7 @@ OMX_ERRORTYPE Exynos_CodecBufferReset(
     }
 
     while (1) {
-        int cnt = 0;
+        OMX_S32 cnt = 0;
         Exynos_OSAL_Get_SemaphoreCount(pExynosPort->codecSemID, &cnt);
         if (cnt > 0)
             Exynos_OSAL_SemaphoreWait(pExynosPort->codecSemID);
@@ -1243,7 +1216,6 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeGetParameter(
     OMX_ERRORTYPE             ret               = OMX_ErrorNone;
     OMX_COMPONENTTYPE        *pOMXComponent     = NULL;
     EXYNOS_OMX_BASECOMPONENT *pExynosComponent  = NULL;
-    EXYNOS_OMX_BASEPORT      *pExynosPort       = NULL;
 
     FunctionIn();
 
@@ -1302,8 +1274,7 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeGetParameter(
             goto EXIT;
         }
 
-        if ((nPortIndex < 0) ||
-            (nPortIndex >= pExynosComponent->portParam.nPorts)) {
+        if (nPortIndex >= pExynosComponent->portParam.nPorts) {
             ret = OMX_ErrorBadPortIndex;
             goto EXIT;
         }
@@ -1406,9 +1377,7 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeGetParameter(
     {
         OMX_VIDEO_PARAM_QUANTIZATIONTYPE  *pVideoQuantization = (OMX_VIDEO_PARAM_QUANTIZATIONTYPE *)pComponentParameterStructure;
         OMX_U32                            nPortIndex         = pVideoQuantization->nPortIndex;
-        EXYNOS_OMX_BASEPORT               *pExynosPort        = NULL;
         EXYNOS_OMX_VIDEOENC_COMPONENT     *pVideoEnc          = NULL;
-        OMX_PARAM_PORTDEFINITIONTYPE      *pPortDef           = NULL;
 
         if (nPortIndex != OUTPUT_PORT_INDEX) {
             ret = OMX_ErrorBadPortIndex;
@@ -1419,8 +1388,6 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeGetParameter(
                 ret = OMX_ErrorBadParameter;
                 goto EXIT;
             }
-            pExynosPort = &pExynosComponent->pExynosPort[nPortIndex];
-            pPortDef = &pExynosPort->portDefinition;
 
             pVideoQuantization->nQpI = pVideoEnc->quantization.nQpI;
             pVideoQuantization->nQpP = pVideoEnc->quantization.nQpP;
@@ -1435,8 +1402,7 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeGetParameter(
         OMX_U32                       nPortIndex    = pPortDef->nPortIndex;
         EXYNOS_OMX_BASEPORT          *pExynosPort   = NULL;
 
-        if ((nPortIndex < 0) ||
-            (nPortIndex >= pExynosComponent->portParam.nPorts)) {
+        if (nPortIndex >= pExynosComponent->portParam.nPorts) {
             ret = OMX_ErrorBadPortIndex;
             goto EXIT;
         }
@@ -1477,7 +1443,6 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeSetParameter(
     OMX_ERRORTYPE             ret               = OMX_ErrorNone;
     OMX_COMPONENTTYPE        *pOMXComponent     = NULL;
     EXYNOS_OMX_BASECOMPONENT *pExynosComponent  = NULL;
-    EXYNOS_OMX_BASEPORT      *pExynosPort       = NULL;
 
     FunctionIn();
 
@@ -1513,17 +1478,14 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeSetParameter(
     {
         OMX_VIDEO_PARAM_PORTFORMATTYPE *pPortFormat     = (OMX_VIDEO_PARAM_PORTFORMATTYPE *)pComponentParameterStructure;
         OMX_U32                         nPortIndex      = pPortFormat->nPortIndex;
-        OMX_U32                         nIndex          = pPortFormat->nIndex;
         OMX_PARAM_PORTDEFINITIONTYPE   *pPortDef        = NULL;
-        OMX_U32                         nSupportFormat  = 0;
 
         ret = Exynos_OMX_Check_SizeVersion(pPortFormat, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE));
         if (ret != OMX_ErrorNone) {
             goto EXIT;
         }
 
-        if ((nPortIndex < 0) ||
-            (nPortIndex >= pExynosComponent->portParam.nPorts)) {
+        if (nPortIndex >= pExynosComponent->portParam.nPorts) {
             ret = OMX_ErrorBadPortIndex;
             goto EXIT;
         }
@@ -1538,7 +1500,6 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeSetParameter(
     {
         OMX_VIDEO_PARAM_BITRATETYPE     *pVideoBitrate = (OMX_VIDEO_PARAM_BITRATETYPE *)pComponentParameterStructure;
         OMX_U32                          nPortIndex    = pVideoBitrate->nPortIndex;
-        EXYNOS_OMX_BASEPORT             *pExynosPort   = NULL;
         EXYNOS_OMX_VIDEOENC_COMPONENT   *pVideoEnc     = NULL;
         OMX_PARAM_PORTDEFINITIONTYPE    *pPortDef      = NULL;
 
@@ -1563,9 +1524,7 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeSetParameter(
     {
         OMX_VIDEO_PARAM_QUANTIZATIONTYPE *pVideoQuantization = (OMX_VIDEO_PARAM_QUANTIZATIONTYPE *)pComponentParameterStructure;
         OMX_U32                           nPortIndex         = pVideoQuantization->nPortIndex;
-        EXYNOS_OMX_BASEPORT              *pExynosPort        = NULL;
         EXYNOS_OMX_VIDEOENC_COMPONENT    *pVideoEnc          = NULL;
-        OMX_PARAM_PORTDEFINITIONTYPE     *pPortDef           = NULL;
 
         if (nPortIndex != OUTPUT_PORT_INDEX) {
             ret = OMX_ErrorBadPortIndex;
@@ -1576,8 +1535,6 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeSetParameter(
                 ret = OMX_ErrorBadParameter;
                 goto EXIT;
             }
-            pExynosPort = &pExynosComponent->pExynosPort[nPortIndex];
-            pPortDef = &pExynosPort->portDefinition;
 
             pVideoEnc->quantization.nQpI = pVideoQuantization->nQpI;
             pVideoEnc->quantization.nQpP = pVideoQuantization->nQpP;
@@ -1591,10 +1548,8 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeSetParameter(
         OMX_PARAM_PORTDEFINITIONTYPE *pPortDef      = (OMX_PARAM_PORTDEFINITIONTYPE *)pComponentParameterStructure;
         OMX_U32                       nPortIndex    = pPortDef->nPortIndex;
         EXYNOS_OMX_BASEPORT          *pExynosPort   = NULL;
-        OMX_U32 width, height, size;
 
-        if ((nPortIndex < 0) ||
-            (nPortIndex >= pExynosComponent->portParam.nPorts)) {
+        if (nPortIndex >= pExynosComponent->portParam.nPorts) {
             ret = OMX_ErrorBadPortIndex;
             goto EXIT;
         }