Browse Source

sf-omx-il:fix warnings

Signed-off-by: sw.multimedia <sw.multimedia@starfivetech.com>
sw.multimedia 2 years ago
parent
commit
7d83ca9b39

+ 7 - 12
soft_3rdpart/omx-il/component/image/common/SF_OMX_mjpeg_common.c

@@ -9,13 +9,8 @@ static void sf_get_component_functions(SF_CODAJ12_FUNCTIONS *funcs, OMX_PTR *soh
 OMX_ERRORTYPE GetStateMjpegCommon(OMX_IN OMX_HANDLETYPE hComponent, OMX_OUT OMX_STATETYPE *pState)
 {
     OMX_ERRORTYPE ret = OMX_ErrorNone;
-    OMX_COMPONENTTYPE *pOMXComponent = NULL;
-    SF_OMX_COMPONENT *pSfOMXComponent = NULL;
-    OMX_STATETYPE nextState;
 
     FunctionIn();
-
-EXIT:
     FunctionOut();
     return ret;
 }
@@ -111,19 +106,19 @@ OMX_ERRORTYPE InitMjpegStructorCommon(SF_OMX_COMPONENT *pSfOMXComponent)
     if (pSfCodaj12Implement->sInputMessageQueue < 0)
     {
         LOG(SF_LOG_ERR, "get ipc_id error");
-        return;
+        return OMX_ErrorInsufficientResources;
     }
     pSfCodaj12Implement->sOutputMessageQueue = msgget(IPC_PRIVATE, 0666 | IPC_CREAT);
     if (pSfCodaj12Implement->sOutputMessageQueue < 0)
     {
         LOG(SF_LOG_ERR, "get ipc_id error");
-        return;
+        return OMX_ErrorInsufficientResources;
     }
     pSfCodaj12Implement->sBufferDoneQueue = msgget(IPC_PRIVATE, 0666 | IPC_CREAT);
     if (pSfCodaj12Implement->sBufferDoneQueue < 0)
     {
         LOG(SF_LOG_ERR, "get ipc_id error");
-        return;
+        return OMX_ErrorInsufficientResources;
     }
 
     for (int i = 0; i < 2; i++)
@@ -254,7 +249,7 @@ OMX_BOOL AttachOutputBuffer(SF_OMX_COMPONENT *pSfOMXComponent, OMX_U8* pBuffer,
     JpgDecOpenParam *decOP = &pSfCodaj12Implement->decOP;
     DecConfigParam *decConfig = pSfCodaj12Implement->config;
     JpgDecInitialInfo *initialInfo = &pSfCodaj12Implement->initialInfo;
-    FrameBuffer *pFrameBuf = &pSfCodaj12Implement->frameBuf;
+    FrameBuffer *pFrameBuf = pSfCodaj12Implement->frameBuf;
     JpgDecHandle handle = pSfCodaj12Implement->handle;
 
     Uint32 framebufWidth = 0, framebufHeight = 0, framebufStride = 0;
@@ -263,7 +258,7 @@ OMX_BOOL AttachOutputBuffer(SF_OMX_COMPONENT *pSfOMXComponent, OMX_U8* pBuffer,
     Uint32 bitDepth = 0;
     FrameFormat subsample;
     Uint32 temp;
-    OMX_U8 *virtAddr;
+    OMX_U8 *virtAddr = NULL;
     Uint32 bufferIndex;
     JpgRet jpgret;
 
@@ -353,7 +348,7 @@ OMX_BOOL AttachOutputBuffer(SF_OMX_COMPONENT *pSfOMXComponent, OMX_U8* pBuffer,
         return OMX_FALSE;
     }
 
-     LOG(SF_LOG_INFO, "Allocate frame buffer %p, index = %d\r\n", virtAddr, bufferIndex);
+    LOG(SF_LOG_INFO, "Allocate frame buffer %p, index = %d\r\n", virtAddr, bufferIndex);
 
     //Register frame buffer
     FRAME_BUF *pFrame = pSfCodaj12Implement->functions->GetFrameBuffer(instIdx, bufferIndex);
@@ -382,7 +377,7 @@ OMX_U8 *AllocateOutputBuffer(SF_OMX_COMPONENT *pSfOMXComponent, OMX_U32 nSizeByt
     JpgDecOpenParam *decOP = &pSfCodaj12Implement->decOP;
     DecConfigParam *decConfig = pSfCodaj12Implement->config;
     JpgDecInitialInfo *initialInfo = &pSfCodaj12Implement->initialInfo;
-    FrameBuffer *pFrameBuf = &pSfCodaj12Implement->frameBuf;
+    FrameBuffer *pFrameBuf = pSfCodaj12Implement->frameBuf;
     JpgDecHandle handle = pSfCodaj12Implement->handle;
 
     Uint32 framebufWidth = 0, framebufHeight = 0, framebufStride = 0;

+ 1 - 0
soft_3rdpart/omx-il/component/image/common/SF_OMX_mjpeg_common.h

@@ -133,6 +133,7 @@ extern "C"
 
     OMX_ERRORTYPE GetStateMjpegCommon(OMX_IN OMX_HANDLETYPE hComponent, OMX_OUT OMX_STATETYPE *pState);
     OMX_ERRORTYPE InitMjpegStructorCommon(SF_OMX_COMPONENT *hComponent);
+    OMX_U8* AllocateOutputBuffer(SF_OMX_COMPONENT *pSfOMXComponent, OMX_U32 nSizeBytes);
     void GetMpegfunctions(SF_CODAJ12_FUNCTIONS *funcs, OMX_PTR *sohandle);
 
 #ifdef __cplusplus

+ 14 - 107
soft_3rdpart/omx-il/component/image/dec/SF_OMX_Mjpeg_decoder.c

@@ -13,12 +13,6 @@ extern OMX_TICKS gInitTimeStamp;
 #define TEMP_DEBUG 1
 #define NUM_OF_PORTS 2
 
-static char *Event2Str(unsigned long event)
-{
-    char *event_str = NULL;
-    return event_str;
-}
-
 static OMX_ERRORTYPE SF_OMX_EmptyThisBuffer(
     OMX_IN OMX_HANDLETYPE hComponent,
     OMX_IN OMX_BUFFERHEADERTYPE *pBuffer)
@@ -40,7 +34,7 @@ static OMX_ERRORTYPE SF_OMX_EmptyThisBuffer(
 
     LOG(SF_LOG_DEBUG, "nFilledLen = %d, nFlags = %d, pBuffer = %p\r\n", pBuffer->nFilledLen, pBuffer->nFlags, pBuffer->pBuffer);
 
-    if (pBuffer->nFilledLen == 0 || pBuffer->nFlags & 0x1 == 0x1)
+    if (pBuffer->nFilledLen == 0 || (pBuffer->nFlags & 0x1) == 0x1)
     {
         bSendNULL = OMX_TRUE;
     }
@@ -84,8 +78,6 @@ EXIT:
 }
 
 #define MAX_INDEX 1
-static int frame_array[MAX_INDEX] = {-1};
-static int frame_array_index = 0;
 
 static OMX_ERRORTYPE SF_OMX_FillThisBuffer(
     OMX_IN OMX_HANDLETYPE hComponent,
@@ -124,7 +116,7 @@ EXIT:
     return ret;
 }
 
-static int nOutBufIndex = 0;
+static OMX_U64 nOutBufIndex = 0;
 
 static OMX_ERRORTYPE SF_OMX_UseBuffer(
     OMX_IN OMX_HANDLETYPE hComponent,
@@ -137,7 +129,6 @@ static OMX_ERRORTYPE SF_OMX_UseBuffer(
     OMX_ERRORTYPE ret = OMX_ErrorNone;
     OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
     SF_OMX_COMPONENT *pSfOMXComponent = pOMXComponent->pComponentPrivate;
-    SF_CODAJ12_IMPLEMEMT *pSfCodaj12Implement = pSfOMXComponent->componentImpl;
     FunctionIn();
 
     if (hComponent == NULL)
@@ -166,7 +157,7 @@ static OMX_ERRORTYPE SF_OMX_UseBuffer(
         temp_bufferHeader->pOutputPortPrivate = (OMX_PTR)nOutBufIndex;
         nOutBufIndex ++;
     }
-    LOG(SF_LOG_DEBUG, "pBuffer address = %p, nOutBufIndex = %d\r\n", temp_bufferHeader->pBuffer, (int)temp_bufferHeader->pOutputPortPrivate);
+    LOG(SF_LOG_DEBUG, "pBuffer address = %p, nOutBufIndex = %d\r\n", temp_bufferHeader->pBuffer, (OMX_U64)temp_bufferHeader->pOutputPortPrivate);
 EXIT:
     FunctionOut();
 
@@ -217,7 +208,7 @@ static OMX_ERRORTYPE SF_OMX_AllocateBuffer(
             LOG(SF_LOG_ERR, "fail to allocate bitstream buffer\r\n");
             return OMX_ErrorInsufficientResources;
         }
-        temp_bufferHeader->pBuffer = vbStream->virt_addr;
+        temp_bufferHeader->pBuffer = (OMX_U8 *)vbStream->virt_addr;
         temp_bufferHeader->pInputPortPrivate = (void *)vbStream->phys_addr;
     }
 
@@ -242,7 +233,6 @@ static OMX_ERRORTYPE SF_OMX_GetParameter(
     OMX_ERRORTYPE ret = OMX_ErrorNone;
     OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
     SF_OMX_COMPONENT *pSfOMXComponent = pOMXComponent->pComponentPrivate;
-    SF_CODAJ12_IMPLEMEMT *pSfMjpegImplement = (SF_CODAJ12_IMPLEMEMT *)pSfOMXComponent->componentImpl;
 
     FunctionIn();
     if (hComponent == NULL)
@@ -271,7 +261,7 @@ static OMX_ERRORTYPE SF_OMX_GetParameter(
 
     case OMX_IndexParamImagePortFormat:
     {
-        OMX_IMAGE_PARAM_PORTFORMATTYPE *portFormat = (OMX_VIDEO_PARAM_PORTFORMATTYPE *)ComponentParameterStructure;
+        OMX_IMAGE_PARAM_PORTFORMATTYPE *portFormat = (OMX_IMAGE_PARAM_PORTFORMATTYPE *)ComponentParameterStructure;
         OMX_U32 index = portFormat->nIndex;
         switch (index)
         {
@@ -547,7 +537,6 @@ static OMX_ERRORTYPE SF_OMX_GetConfig(
         return OMX_ErrorBadParameter;
     }
 
-EXIT:
     FunctionOut();
 
     return ret;
@@ -565,40 +554,11 @@ static OMX_ERRORTYPE SF_OMX_SetConfig(
     {
         return OMX_ErrorBadParameter;
     }
-EXIT:
     FunctionOut();
 
     return ret;
 }
 
-static OMX_ERRORTYPE SF_OMX_GetExtensionIndex(
-    OMX_IN OMX_HANDLETYPE hComponent,
-    OMX_IN OMX_STRING cParameterName,
-    OMX_OUT OMX_INDEXTYPE *pIndexType)
-{
-    OMX_ERRORTYPE ret = OMX_ErrorNone;
-
-    FunctionIn();
-    //TODO
-    FunctionOut();
-    return ret;
-}
-
-static OMX_ERRORTYPE SF_OMX_GetComponentVersion(
-    OMX_IN OMX_HANDLETYPE hComponent,
-    OMX_OUT OMX_STRING pComponentName,
-    OMX_OUT OMX_VERSIONTYPE *pComponentVersion,
-    OMX_OUT OMX_VERSIONTYPE *pSpecVersion,
-    OMX_OUT OMX_UUIDTYPE *pComponentUUID)
-{
-    OMX_ERRORTYPE ret = OMX_ErrorNone;
-
-    FunctionIn();
-    //TODO
-    FunctionOut();
-    return ret;
-}
-
 static OMX_ERRORTYPE InitDecoder(SF_OMX_COMPONENT *pSfOMXComponent)
 {
     FunctionIn();
@@ -606,27 +566,24 @@ static OMX_ERRORTYPE InitDecoder(SF_OMX_COMPONENT *pSfOMXComponent)
     JpgRet ret = JPG_RET_SUCCESS;
     DecConfigParam *decConfig = pSfCodaj12Implement->config;
     jpu_buffer_t *vbStream = &pSfCodaj12Implement->vbStream;
-    JpgDecOpenParam *decOP = &pSfCodaj12Implement->decOP;
-    JpgDecHandle handle = pSfCodaj12Implement->handle;
 
     ret = pSfCodaj12Implement->functions->JPU_Init();
     if (ret != JPG_RET_SUCCESS && ret != JPG_RET_CALLED_BEFORE)
     {
         LOG(SF_LOG_ERR, "JPU_Init failed Error code is 0x%x \r\n", ret);
-        return;
+        return ret;
     }
 
     decConfig->feedingMode = FEEDING_METHOD_BUFFER;
     LOG(SF_LOG_DEBUG, "feedingMode = %d, StreamEndian = %d\r\n", decConfig->feedingMode, decConfig->StreamEndian);
     if ((pSfCodaj12Implement->feeder = pSfCodaj12Implement->functions->BitstreamFeeder_Create(decConfig->bitstreamFileName, decConfig->feedingMode, (EndianMode)decConfig->StreamEndian)) == NULL)
     {
-        return;
+        return OMX_ErrorResourcesLost;
     }
 
     FunctionOut();
     return OMX_ErrorNone;
 
-ERR_DEC_INIT:
     pSfCodaj12Implement->functions->FreeFrameBuffer(pSfCodaj12Implement->instIdx);
 
     pSfCodaj12Implement->functions->jdi_free_dma_memory(vbStream);
@@ -636,40 +593,6 @@ ERR_DEC_INIT:
     return OMX_ErrorHardware;
 }
 
-static OMX_BOOL AdjustFrame(OMX_BUFFERHEADERTYPE* pBuffer, OMX_U32 nSrcWidth, OMX_U32 nSrcHeight,
-                            OMX_U32 nDestWidth, OMX_U32 nDestHeight)
-{
-    OMX_U32 nDeltaWidth = 0;
-    OMX_U32 nDeltaHeight = 0;
-
-    FunctionIn();
-
-    nDeltaWidth = nSrcWidth - nDestWidth;
-    nDeltaHeight = nSrcHeight - nDestHeight;
-
-    if (nDeltaWidth == 0 && nDeltaHeight == 0)
-    {
-        return OMX_TRUE;
-    }
-
-    if (nDeltaWidth != 0)
-    {
-        LOG(SF_LOG_ERR, "nSrcWidth != nDestWidth not supported\r\n");
-        return OMX_FALSE;
-    }
-
-    OMX_U8 *pDestCbCrStart = pBuffer->pBuffer + nDestHeight * nDestWidth;
-    OMX_U8 *pSrcCbCrStart = pBuffer->pBuffer + nDestHeight * nDestWidth + nDeltaHeight * nDestWidth;
-    OMX_U32 pCbCrSize =  nDestWidth * nDestHeight / 2;
-    LOG(SF_LOG_DEBUG, "pBuffer = %p, pDestCbCrStart = %p, pSrcCbCrStart = %p, pCbCrSize = %d\r\n",
-        pBuffer->pBuffer, pDestCbCrStart, pSrcCbCrStart, pCbCrSize);
-    memmove(pDestCbCrStart, pSrcCbCrStart, pCbCrSize);
-    pBuffer->nFilledLen = nDestHeight * nDestWidth * 3 / 2;
-
-    FunctionOut();
-
-    return OMX_TRUE;
-}
 
 static OMX_BOOL FillBufferDone(SF_OMX_COMPONENT *pSfOMXComponent, OMX_BUFFERHEADERTYPE *pBuffer)
 {
@@ -827,7 +750,6 @@ static void ProcessThread(void *args)
 {
     SF_OMX_COMPONENT *pSfOMXComponent = (SF_OMX_COMPONENT *)args;
     SF_CODAJ12_IMPLEMEMT *pSfCodaj12Implement = pSfOMXComponent->componentImpl;
-    BSFeeder feeder = pSfCodaj12Implement->feeder;
     jpu_buffer_t *vbStream = &pSfCodaj12Implement->vbStream;
     JpgDecInitialInfo *initialInfo = &pSfCodaj12Implement->initialInfo;
 
@@ -840,7 +762,6 @@ static void ProcessThread(void *args)
     JpgDecOutputInfo outputInfo = {0};
     Int32 int_reason = 0;
     Int32 instIdx;
-    FrameFormat subsample;
     JpgRet ret = JPG_RET_SUCCESS;
 
     FunctionIn();
@@ -1125,8 +1046,6 @@ static void ProcessThread(void *args)
         
         LOG(SF_LOG_DEBUG, "decPicSize = [%d %d], pBuffer = %p\r\n",
             outputInfo.decPicWidth, outputInfo.decPicHeight, pBuffer->pBuffer);
-        OMX_U32 nDestHeight = pSfOMXComponent->portDefinition[OMX_OUTPUT_PORT_INDEX].format.video.nFrameHeight;
-        OMX_U32 nDestStride = pSfOMXComponent->portDefinition[OMX_OUTPUT_PORT_INDEX].format.video.nStride;
         // AdjustFrame(pBuffer, outputInfo.decPicWidth, outputInfo.decPicHeight, nDestStride, nDestHeight);
         FillBufferDone(pSfOMXComponent, pBuffer);
         // LOG(SF_LOG_DEBUG, "FillBufferDone IN\r\n");
@@ -1307,20 +1226,6 @@ static OMX_ERRORTYPE SF_OMX_FreeBuffer(
     return ret;
 }
 
-static OMX_ERRORTYPE SF_OMX_UseEGLImage(
-    OMX_IN OMX_HANDLETYPE hComponent,
-    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr,
-    OMX_IN OMX_U32 nPortIndex,
-    OMX_IN OMX_PTR pAppPrivate,
-    OMX_IN void *eglImage)
-{
-    (void)hComponent;
-    (void)ppBufferHdr;
-    (void)nPortIndex;
-    (void)pAppPrivate;
-    (void)eglImage;
-    return OMX_ErrorNotImplemented;
-}
 
 static OMX_ERRORTYPE SF_OMX_ComponentConstructor(SF_OMX_COMPONENT *pSfOMXComponent)
 {
@@ -1365,18 +1270,20 @@ static OMX_ERRORTYPE SF_OMX_ComponentClear(SF_OMX_COMPONENT *pSfOMXComponent)
     jpu_buffer_t *vbStream = &pSfCodaj12Implement->vbStream;
     JpgDecHandle handle = pSfCodaj12Implement->handle;
     FunctionIn();
-ERR_DEC_OPEN:
-    ret = pSfCodaj12Implement->functions->JPU_DecClose(handle);
-    if (ret != JPG_RET_SUCCESS)
+
+    if (pSfCodaj12Implement->functions->JPU_DecClose(handle) != JPG_RET_SUCCESS)
+    {
         LOG(SF_LOG_ERR, "\nDec End\r\n");
+        ret = OMX_ErrorHardware;
+    }
     pSfCodaj12Implement->functions->BitstreamFeeder_Destroy(pSfCodaj12Implement->feeder);
-ERR_DEC_INIT:
+
     pSfCodaj12Implement->functions->FreeFrameBuffer(pSfCodaj12Implement->instIdx);
     pSfCodaj12Implement->functions->jdi_free_dma_memory(vbStream);
     pSfCodaj12Implement->functions->JPU_DeInit();
     // TODO
     // MjpegClearCommon(hComponent);
-EXIT:
+
     FunctionOut();
 
     return ret;

+ 4 - 3
soft_3rdpart/omx-il/component/video/common/SF_OMX_video_common.c

@@ -367,7 +367,7 @@ OMX_ERRORTYPE FlushBuffer(SF_OMX_COMPONENT *pSfOMXComponent, OMX_U32 nPort)
     FunctionIn();
     if (nPort == 0)
     {
-        ComponentImpl *pFeederComponent = pSfVideoImplement->hSFComponentFeeder;
+        ComponentImpl *pFeederComponent = (ComponentImpl *)(pSfVideoImplement->hSFComponentFeeder);
         OMX_U32 inputQueueCount = pSfVideoImplement->functions->Queue_Get_Cnt(pFeederComponent->srcPort.inputQ);
         LOG(SF_LOG_PERF, "Flush %d buffers on inputPort\r\n", inputQueueCount);
         if (inputQueueCount > 0)
@@ -388,7 +388,7 @@ OMX_ERRORTYPE FlushBuffer(SF_OMX_COMPONENT *pSfOMXComponent, OMX_U32 nPort)
     }
     else if (nPort == 1)
     {
-        ComponentImpl *pRendererComponent = pSfVideoImplement->hSFComponentRender;
+        ComponentImpl *pRendererComponent = (ComponentImpl *)(pSfVideoImplement->hSFComponentRender);
         OMX_U32 OutputQueueCount = pSfVideoImplement->functions->Queue_Get_Cnt(pRendererComponent->sinkPort.inputQ);
         LOG(SF_LOG_PERF, "Flush %d buffers on outputPort\r\n", OutputQueueCount);
         if (OutputQueueCount > 0)
@@ -410,6 +410,7 @@ OMX_ERRORTYPE FlushBuffer(SF_OMX_COMPONENT *pSfOMXComponent, OMX_U32 nPort)
         }
     }
     FunctionOut();
+    return OMX_ErrorNone;
 }
 
 static void sf_get_component_functions(SF_COMPONENT_FUNCTIONS *funcs, OMX_PTR *sohandle)
@@ -505,7 +506,7 @@ SF_OMX_COMPONENT *GetSFOMXComponrntByComponent(Component *pComponent)
             break;
         }
     }
-EXIT:
+
     if (pSfOMXComponent == NULL)
     {
         LOG(SF_LOG_ERR, "Could not get SfOMXComponent buy %p\r\n", pComponent);

+ 3 - 3
soft_3rdpart/omx-il/component/video/common/SF_OMX_video_common.h

@@ -94,8 +94,8 @@ typedef struct _SF_COMPONENT_FUNCTIONS
     void* (*AllocateFrameBuffer2)(ComponentImpl* com, Uint32 size);
     BOOL (*AttachDMABuffer)(ComponentImpl* com, Uint64 virtAddress, Uint32 size);
     void (*SetRenderTotalBufferNumber)(ComponentImpl* com, Uint32 number);
-    void (*WaitForExecoderReady)(ComponentImpl *com)
-} SF_COMPONENT_FUNCTIONS;
+    void (*WaitForExecoderReady)(ComponentImpl *com);
+}SF_COMPONENT_FUNCTIONS;
 
 typedef struct _SF_WAVE5_IMPLEMEMT
 {
@@ -110,7 +110,7 @@ typedef struct _SF_WAVE5_IMPLEMEMT
     CodStd bitFormat;
     OMX_VIDEO_PARAM_AVCTYPE AVCComponent[2];
     OMX_VIDEO_PARAM_HEVCTYPE HEVCComponent[2];
-} SF_WAVE5_IMPLEMEMT;
+}SF_WAVE5_IMPLEMEMT;
 
 #ifdef __cplusplus
 extern "C"

+ 8 - 49
soft_3rdpart/omx-il/component/video/dec/SF_OMX_Vdec_decoder.c

@@ -231,7 +231,7 @@ EXIT:
 }
 
 #define MAX_INDEX 1
-static int frame_array[MAX_INDEX] = {-1};
+static OMX_U64 frame_array[MAX_INDEX] = {-1};
 static int frame_array_index = 0;
 
 static OMX_ERRORTYPE SF_OMX_FillThisBuffer(
@@ -265,7 +265,7 @@ static OMX_ERRORTYPE SF_OMX_FillThisBuffer(
     {
         int clear = frame_array[frame_array_index];
         pSfVideoImplement->functions->Render_DecClrDispFlag(pRendererComponent->context, clear);
-        frame_array[frame_array_index] = (int)pBuffer->pOutputPortPrivate;
+        frame_array[frame_array_index] = (OMX_U64)(pBuffer->pOutputPortPrivate);
         LOG(SF_LOG_INFO, "store display flag: %d, clear display flag: %d\r\n", frame_array[frame_array_index], clear);
         frame_array_index ++;
     }
@@ -287,7 +287,7 @@ EXIT:
     return ret;
 }
 
-static int nOutBufIndex = 0;
+static OMX_U64 nOutBufIndex = 0;
 
 static OMX_ERRORTYPE SF_OMX_UseBuffer(
     OMX_IN OMX_HANDLETYPE hComponent,
@@ -331,7 +331,7 @@ static OMX_ERRORTYPE SF_OMX_UseBuffer(
         nOutBufIndex ++;
     }
     ret = StoreOMXBuffer(pSfOMXComponent, temp_bufferHeader);
-    LOG(SF_LOG_INFO, "pBuffer address = %p, nOutBufIndex = %d\r\n", temp_bufferHeader->pBuffer, (int)temp_bufferHeader->pOutputPortPrivate);
+    LOG(SF_LOG_INFO, "pBuffer address = %p, nOutBufIndex = %d\r\n", temp_bufferHeader->pBuffer, (OMX_U64)(temp_bufferHeader->pOutputPortPrivate));
     LOG(SF_LOG_PERF, "alloc size = %d, buffer count = %d\r\n",nSizeBytes, GetOMXBufferCount(pSfOMXComponent));
 EXIT:
     FunctionOut();
@@ -780,34 +780,6 @@ EXIT:
     return ret;
 }
 
-static OMX_ERRORTYPE SF_OMX_GetExtensionIndex(
-    OMX_IN OMX_HANDLETYPE hComponent,
-    OMX_IN OMX_STRING cParameterName,
-    OMX_OUT OMX_INDEXTYPE *pIndexType)
-{
-    OMX_ERRORTYPE ret = OMX_ErrorNone;
-
-    FunctionIn();
-
-    FunctionOut();
-    return ret;
-}
-
-static OMX_ERRORTYPE SF_OMX_GetComponentVersion(
-    OMX_IN OMX_HANDLETYPE hComponent,
-    OMX_OUT OMX_STRING pComponentName,
-    OMX_OUT OMX_VERSIONTYPE *pComponentVersion,
-    OMX_OUT OMX_VERSIONTYPE *pSpecVersion,
-    OMX_OUT OMX_UUIDTYPE *pComponentUUID)
-{
-    OMX_ERRORTYPE ret = OMX_ErrorNone;
-
-    FunctionIn();
-
-    FunctionOut();
-    return ret;
-}
-
 static OMX_ERRORTYPE InitDecoder(SF_OMX_COMPONENT *pSfOMXComponent)
 {
     TestDecConfig *testConfig = NULL;
@@ -988,8 +960,6 @@ static OMX_ERRORTYPE SF_OMX_SendCommand(
             case COMPONENT_STATE_EXECUTED:
             case COMPONENT_STATE_TERMINATED:
                 {
-                    PortContainerExternal *pPortContainerExternal = NULL;
-                    OMX_BUFFERHEADERTYPE *pOMXBuffer;
                     pSFComponentDecoder->pause = OMX_TRUE;
                     pSFComponentFeeder->pause = OMX_TRUE;
                     pSFComponentRender->pause = OMX_TRUE;
@@ -997,6 +967,8 @@ static OMX_ERRORTYPE SF_OMX_SendCommand(
                     FlushBuffer(pSfOMXComponent, 1);
                 }
                 break;
+            case COMPONENT_STATE_MAX:
+                break;
             }
             pSfOMXComponent->callbacks->EventHandler(pSfOMXComponent->pOMXComponent, pSfOMXComponent->pAppData,
                                                      OMX_EventCmdComplete, OMX_CommandStateSet, nParam, NULL);
@@ -1046,6 +1018,8 @@ static OMX_ERRORTYPE SF_OMX_SendCommand(
                 pSFComponentFeeder->pause = OMX_FALSE;
                 pSFComponentRender->pause = OMX_FALSE;
                 break;
+            case COMPONENT_STATE_MAX:
+                break;
             }
            
             break;
@@ -1126,21 +1100,6 @@ static OMX_ERRORTYPE SF_OMX_FreeBuffer(
     return ret;
 }
 
-static OMX_ERRORTYPE SF_OMX_UseEGLImage(
-    OMX_IN OMX_HANDLETYPE hComponent,
-    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr,
-    OMX_IN OMX_U32 nPortIndex,
-    OMX_IN OMX_PTR pAppPrivate,
-    OMX_IN void *eglImage)
-{
-    (void)hComponent;
-    (void)ppBufferHdr;
-    (void)nPortIndex;
-    (void)pAppPrivate;
-    (void)eglImage;
-    return OMX_ErrorNotImplemented;
-}
-
 static OMX_ERRORTYPE SF_OMX_ComponentConstructor(SF_OMX_COMPONENT *pSfOMXComponent)
 {
     OMX_ERRORTYPE ret = OMX_ErrorNone;

+ 9 - 60
soft_3rdpart/omx-il/component/video/enc/SF_OMX_Venc_encoder.c

@@ -61,7 +61,6 @@ static void OnEventArrived(Component com, unsigned long event, void *data, void
     FunctionIn();
     SF_OMX_COMPONENT *pSfOMXComponent = GetSFOMXComponrntByComponent(com);
     SF_WAVE5_IMPLEMEMT *pSfVideoImplement = (SF_WAVE5_IMPLEMEMT *)pSfOMXComponent->componentImpl;
-    ComponentImpl *pSFComponent = (ComponentImpl *)com;
     static OMX_U32 enc_cnt = 0;
     static struct timeval tv_old = {0};
     OMX_U32 fps = 0;
@@ -159,7 +158,7 @@ static OMX_ERRORTYPE SF_OMX_EmptyThisBuffer(
 
     SF_OMX_COMPONENT *pSfOMXComponent = pOMXComponent->pComponentPrivate;
     SF_WAVE5_IMPLEMEMT *pSfVideoImplement = (SF_WAVE5_IMPLEMEMT *)pSfOMXComponent->componentImpl;
-    ComponentImpl *pFeederComponent = pSfVideoImplement->hSFComponentFeeder;
+    ComponentImpl *pFeederComponent = (ComponentImpl *)(pSfVideoImplement->hSFComponentFeeder);
 
     PortContainerExternal *pPortContainerExternal = malloc(sizeof(PortContainerExternal));
     if (pPortContainerExternal == NULL)
@@ -172,7 +171,7 @@ static OMX_ERRORTYPE SF_OMX_EmptyThisBuffer(
     pPortContainerExternal->nFilledLen = pBuffer->nFilledLen;
     pPortContainerExternal->nFlags = pBuffer->nFlags;
     pPortContainerExternal->nBufferIndex = (OMX_U32)pBuffer->pInputPortPrivate;
-    LOG(SF_LOG_INFO, "Index = %d, Address = %p, Flag = %X\r\n",(int)pBuffer->pInputPortPrivate, pBuffer->pBuffer, pBuffer->nFlags);
+    LOG(SF_LOG_INFO, "Index = %lu, Address = %p, Flag = %X\r\n",(OMX_U64)(pBuffer->pInputPortPrivate), pBuffer->pBuffer, pBuffer->nFlags);
     if (pSfVideoImplement->functions->Queue_Enqueue(pFeederComponent->srcPort.inputQ, (void *)pPortContainerExternal) != OMX_TRUE)
     {
         LOG(SF_LOG_ERR, "%p:%p FAIL\r\n", pFeederComponent->srcPort.inputQ, pPortContainerExternal);
@@ -205,7 +204,7 @@ static OMX_ERRORTYPE SF_OMX_FillThisBuffer(
     OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
     SF_OMX_COMPONENT *pSfOMXComponent = (SF_OMX_COMPONENT *)pOMXComponent->pComponentPrivate;
     SF_WAVE5_IMPLEMEMT *pSfVideoImplement = (SF_WAVE5_IMPLEMEMT *)pSfOMXComponent->componentImpl;
-    ComponentImpl *pRendererComponent = pSfVideoImplement->hSFComponentRender;
+    ComponentImpl *pRendererComponent = (ComponentImpl *)(pSfVideoImplement->hSFComponentRender);
     PortContainerExternal *pPortContainerExternal = malloc(sizeof(PortContainerExternal));
     if (pPortContainerExternal == NULL)
     {
@@ -231,7 +230,7 @@ EXIT:
     return ret;
 }
 
-static int nOutBufIndex = 0;
+static OMX_U64 nOutBufIndex = 0;
 
 static OMX_ERRORTYPE SF_OMX_UseBuffer(
     OMX_IN OMX_HANDLETYPE hComponent,
@@ -284,7 +283,7 @@ static OMX_ERRORTYPE SF_OMX_AllocateBuffer(
     SF_OMX_COMPONENT *pSfOMXComponent = pOMXComponent->pComponentPrivate;
     SF_WAVE5_IMPLEMEMT *pSfVideoImplement = (SF_WAVE5_IMPLEMEMT *)pSfOMXComponent->componentImpl;
     ComponentImpl *pComponentFeeder = (ComponentImpl *)pSfVideoImplement->hSFComponentFeeder;
-    OMX_U32 i = 0;
+    // OMX_U32 i = 0;
 
     FunctionIn();
     if (nSizeBytes == 0)
@@ -357,7 +356,6 @@ static OMX_ERRORTYPE SF_OMX_GetParameter(
     OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
     SF_OMX_COMPONENT *pSfOMXComponent = pOMXComponent->pComponentPrivate;
     SF_WAVE5_IMPLEMEMT *pSfVideoImplement = (SF_WAVE5_IMPLEMEMT *)pSfOMXComponent->componentImpl;
-    OMX_PARAM_PORTDEFINITIONTYPE *pInputPort = &pSfOMXComponent->portDefinition[0];
     OMX_PARAM_PORTDEFINITIONTYPE *pOutputPort = &pSfOMXComponent->portDefinition[1];
 
     FunctionIn();
@@ -528,8 +526,6 @@ static OMX_ERRORTYPE SF_OMX_SetParameter(
             width, height, xFramerate, nBitrate, nBufferCountActual, portIndex);
         OMX_COLOR_FORMATTYPE eColorFormat = pPortDefinition->format.video.eColorFormat;
         TestEncConfig *pTestEncConfig = (TestEncConfig *)pSfVideoImplement->testConfig;
-        CNMComponentConfig *config = pSfVideoImplement->config;
-        EncOpenParam *encOpenParam = &config->encOpenParam;
 
         if (xFramerate == 0)
         {
@@ -779,36 +775,6 @@ EXIT:
     return ret;
 }
 
-static OMX_ERRORTYPE SF_OMX_GetExtensionIndex(
-    OMX_IN OMX_HANDLETYPE hComponent,
-    OMX_IN OMX_STRING cParameterName,
-    OMX_OUT OMX_INDEXTYPE *pIndexType)
-{
-    OMX_ERRORTYPE ret = OMX_ErrorNone;
-
-    FunctionIn();
-
-EXIT:
-    FunctionOut();
-    return ret;
-}
-
-static OMX_ERRORTYPE SF_OMX_GetComponentVersion(
-    OMX_IN OMX_HANDLETYPE hComponent,
-    OMX_OUT OMX_STRING pComponentName,
-    OMX_OUT OMX_VERSIONTYPE *pComponentVersion,
-    OMX_OUT OMX_VERSIONTYPE *pSpecVersion,
-    OMX_OUT OMX_UUIDTYPE *pComponentUUID)
-{
-    OMX_ERRORTYPE ret = OMX_ErrorNone;
-
-    FunctionIn();
-
-EXIT:
-    FunctionOut();
-    return ret;
-}
-
 static OMX_ERRORTYPE InitEncoder(SF_OMX_COMPONENT *pSfOMXComponent)
 {
     TestEncConfig *testConfig = NULL;
@@ -868,7 +834,6 @@ static OMX_ERRORTYPE InitEncoder(SF_OMX_COMPONENT *pSfOMXComponent)
         LOG(SF_LOG_ERR, "SetupEncoderOpenParam error\n");
         return OMX_ErrorBadParameter;
     }
-    CNMComponentConfig *pCNMComponentConfig = (CNMComponentConfig*)pSfVideoImplement->config;
     config->encOpenParam.picWidth = pSfOMXComponent->portDefinition[0].format.video.nFrameWidth;
     config->encOpenParam.picHeight = pSfOMXComponent->portDefinition[0].format.video.nFrameHeight;
 
@@ -1054,8 +1019,6 @@ static OMX_ERRORTYPE SF_OMX_SendCommand(
             case COMPONENT_STATE_EXECUTED:
             case COMPONENT_STATE_TERMINATED:
                 {
-                    PortContainerExternal *pPortContainerExternal = NULL;
-                    OMX_BUFFERHEADERTYPE *pOMXBuffer;
                     pSFComponentEncoder->pause = OMX_TRUE;
                     pSFComponentFeeder->pause = OMX_TRUE;
                     pSFComponentRender->pause = OMX_TRUE;
@@ -1063,6 +1026,8 @@ static OMX_ERRORTYPE SF_OMX_SendCommand(
                     FlushBuffer(pSfOMXComponent, 1);
                 }
                 break;
+            case COMPONENT_STATE_MAX:
+                break;
             }
             break;
 
@@ -1088,6 +1053,8 @@ static OMX_ERRORTYPE SF_OMX_SendCommand(
                 pSFComponentFeeder->pause = OMX_FALSE;
                 pSFComponentRender->pause = OMX_FALSE;
                 break;
+            case COMPONENT_STATE_MAX:
+                break;
             }
             break;
         default:
@@ -1133,7 +1100,6 @@ static OMX_ERRORTYPE SF_OMX_GetState(
     FunctionIn();
     GetStateCommon(hComponent, pState);
 
-EXIT:
     FunctionOut();
     return ret;
 }
@@ -1146,32 +1112,15 @@ static OMX_ERRORTYPE SF_OMX_FreeBuffer(
     OMX_ERRORTYPE ret = OMX_ErrorNone;
     OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
     SF_OMX_COMPONENT *pSfOMXComponent = pOMXComponent->pComponentPrivate;
-    OMX_U32 i = 0;
     FunctionIn();
     ClearOMXBuffer(pSfOMXComponent, pBufferHdr);
     LOG(SF_LOG_PERF, "buffer count = %d\r\n", GetOMXBufferCount(pSfOMXComponent));
     free(pBufferHdr);
 
-EXIT:
     FunctionOut();
     return ret;
 }
 
-static OMX_ERRORTYPE SF_OMX_UseEGLImage(
-    OMX_IN OMX_HANDLETYPE hComponent,
-    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr,
-    OMX_IN OMX_U32 nPortIndex,
-    OMX_IN OMX_PTR pAppPrivate,
-    OMX_IN void *eglImage)
-{
-    (void)hComponent;
-    (void)ppBufferHdr;
-    (void)nPortIndex;
-    (void)pAppPrivate;
-    (void)eglImage;
-    return OMX_ErrorNotImplemented;
-}
-
 static OMX_ERRORTYPE SF_OMX_ComponentConstructor(SF_OMX_COMPONENT *pSfOMXComponent)
 {
     OMX_ERRORTYPE ret = OMX_ErrorNone;