Ejemplo n.º 1
0
/* detect the compliance profile(s) that the component is eligible for */
OMX_U32 DetectComplianceProfile(OMX_STRING sArgument)
{
    OMX_U32 detectedCompliance;
    OMX_HANDLETYPE hThread, hComp, hTTC;
    OMX_CALLBACKTYPE oDummyCallbacks;
    OMX_TIME_CONFIG_TIMESTAMPTYPE oTimeStamp;
    OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE oRefClock;

    detectedCompliance = OMX_CONF_TestFlag_Base|OMX_CONF_TestFlag_AutoOutput;

    /* try to create a thread -> implies threading compliance */
    if (OMX_ErrorNone == OMX_OSAL_ThreadCreate( DummyThreadFunction, 0, 0, &hThread)){
        if (OMX_ErrorNone == OMX_OSAL_ThreadDestroy( hThread)){
            detectedCompliance |= OMX_CONF_TestFlag_Threaded;
        }
    }
    oDummyCallbacks.EmptyBufferDone = StubbedEmptyBufferDone;
    oDummyCallbacks.FillBufferDone = StubbedFillBufferDone;
    oDummyCallbacks.EventHandler = StubbedEventHandler;
    if (OMX_ErrorNone != OMX_Init()){
        return 0;
    }
    if (OMX_ErrorNone != OMX_GetHandle(&hComp, sArgument, NULL, &oDummyCallbacks)){
        OMX_Deinit();
        return 0;
    }
    if (OMX_ErrorNone != OMX_CONF_GetTunnelTestComponentHandle(&hTTC, NULL, &oDummyCallbacks)){
        OMX_FreeHandle(hComp);
        OMX_Deinit();
        return 0;
    }

    if (OMX_ErrorNone == OMX_CONF_TTCConnectAllPorts(hTTC, hComp))
    {
        INIT_PARAM(oRefClock);
        INIT_PARAM(oTimeStamp);
        oTimeStamp.nPortIndex = 0;

        detectedCompliance |= OMX_CONF_TestFlag_Interop;

        /* try to set active ref clock -> implies clock component compliance */
        if (OMX_ErrorUnsupportedIndex != OMX_SetConfig(hComp, OMX_IndexConfigTimeActiveRefClock, &oRefClock)){
            detectedCompliance &= ~OMX_CONF_TestFlag_AutoOutput; /* only clock component doesn't have autooutput */
            detectedCompliance |=  OMX_CONF_TestFlag_ClockComp; 
        } 

        /* try to set time position -> implies seeking compliance */
        if (OMX_ErrorUnsupportedIndex != OMX_SetConfig(hComp, OMX_IndexConfigTimePosition, &oTimeStamp)){
            detectedCompliance |=  OMX_CONF_TestFlag_Seeking; 
        }
    }

    OMX_CONF_FreeTunnelTestComponentHandle(hTTC);
    OMX_FreeHandle(hComp);
    OMX_Deinit();

    return detectedCompliance;
}
    /* Main entrypoint into the Incomplete Stop Test */
    OMX_ERRORTYPE OMX_CONF_IncompleteStopTest(OMX_IN OMX_STRING cComponentName)
    {
        OMX_PTR pWrappedAppData;
        OMX_CALLBACKTYPE *pWrappedCallbacks;
        OMX_HANDLETYPE hComp, hWrappedComp, hTTComp, hWrappedTTComp;
        OMX_ERRORTYPE  eTemp, eError = OMX_ErrorNone;
        OMX_CALLBACKTYPE oCallbacks;
        ISTDATATYPE oAppData;
        OMX_BOOL bTimedOut;

        /* create state change event */
        OMX_OSAL_EventCreate(&oAppData.hStateChangeEvent);
        OMX_OSAL_EventReset(oAppData.hStateChangeEvent);
        OMX_OSAL_EventCreate(&oAppData.hEOSEvent);
        OMX_OSAL_EventReset(oAppData.hEOSEvent);

        /* init component handles */
        hComp = hWrappedComp = hTTComp = hWrappedTTComp = 0;

        oCallbacks.EventHandler    = ISTEventHandler;
        oCallbacks.EmptyBufferDone = StubbedEmptyBufferDone;
        oCallbacks.FillBufferDone  = StubbedFillBufferDone;
        eError = OMX_CONF_CallbackTracerCreate(&oCallbacks, (OMX_PTR) & oAppData, cComponentName,
                                               &pWrappedCallbacks, &pWrappedAppData);

        /* Initialize OpenMax */
        eError = OMX_Init();

        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Creating component under test and tunnel test component.\n");

        /* Acquire component under test handle */
        OMX_CONF_FAIL_IF_ERROR(OMX_GetHandle(&hComp, cComponentName, pWrappedAppData, pWrappedCallbacks));
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_ComponentTracerCreate(hComp, cComponentName, &hWrappedComp));
        oAppData.hCUT = hComp;

        /* Acquire tunnel test component handle */
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_GetTunnelTestComponentHandle(&hTTComp, pWrappedAppData, pWrappedCallbacks));
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_ComponentTracerCreate(hTTComp, "OMX.CONF.tunnel.test", &hWrappedTTComp));

        /* Connect CUT to TTC */
        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Connecting all ports.\n");
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_TTCConnectAllPorts(hWrappedTTComp, hWrappedComp));

        /* Force all CUT ports to be suppliers */
        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Forcing all component ports to be suppliers.\n");
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_ForceSuppliers(hWrappedComp, OMX_TRUE));
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_ForceSuppliers(hWrappedTTComp, OMX_FALSE));

        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Transitioning to executing.\n");

        /* transition CUT to idle */
        OMX_CONF_FAIL_IF_ERROR(OMX_SendCommand(hWrappedComp, OMX_CommandStateSet, OMX_StateIdle, 0));

        /* transition TTC to idle */
        OMX_CONF_FAIL_IF_ERROR(OMX_SendCommand(hWrappedTTComp, OMX_CommandStateSet, OMX_StateIdle, 0));

        /* transition CUT to executing */
        OMX_CONF_FAIL_IF_ERROR(ISTWaitForState(&oAppData, OMX_StateIdle));
        OMX_OSAL_EventReset(oAppData.hStateChangeEvent);
        OMX_CONF_FAIL_IF_ERROR(OMX_SendCommand(hWrappedComp, OMX_CommandStateSet, OMX_StateExecuting, 0));
        OMX_CONF_FAIL_IF_ERROR(ISTWaitForState(&oAppData, OMX_StateExecuting));

        /* transition TTC to executing  */
        OMX_CONF_FAIL_IF_ERROR(OMX_SendCommand(hWrappedTTComp, OMX_CommandStateSet, OMX_StateExecuting, 0));

        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_WaitForBufferTraffic(hTTComp));

        /* tell TTC to hold buffers */
        TTCHoldBuffers(hTTComp);

        /* transition CUT to back to idle */
        OMX_OSAL_EventReset(oAppData.hStateChangeEvent);
        OMX_CONF_FAIL_IF_ERROR(OMX_SendCommand(hWrappedComp, OMX_CommandStateSet, OMX_StateIdle, 0));

        /* wait for change to idle - this must time out */
        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Holding outstanding buffers, waiting for transition to idle.\n");
        OMX_OSAL_EventWait(oAppData.hStateChangeEvent, OMX_CONF_TIMEOUT_EXPECTING_FAILURE, &bTimedOut);
        if (!bTimedOut)
        {
            OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "-ERROR: Transitioned to idle.\n");
            eError = OMX_ErrorUndefined;
        }
        else
        {
            OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "-OK: Didn't transitioned to idle.\n");
        }

        /* tell TTC to release buffers */
        TTCReleaseBuffers(hTTComp);

        /* wait for change to idle - this must succeed */
        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Released outstanding buffers, waiting for transition to idle.\n");
        OMX_OSAL_EventWait(oAppData.hStateChangeEvent, OMX_CONF_TIMEOUT_EXPECTING_SUCCESS, &bTimedOut);
        if (bTimedOut || oAppData.eState != OMX_StateIdle)
        {
            OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "-ERROR: Didn't transition to idle.\n");
            eError = OMX_ErrorUndefined;
        }
        else
        {
            OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "-OK: Transitioned to idle.\n");
        }

OMX_CONF_TEST_FAIL:

        /* Cleanup: Return function errors rather than closing errors if appropriate */

        /* transition CUT to Loaded state */
        if (hWrappedComp)
        {
            OMX_OSAL_EventReset(oAppData.hStateChangeEvent);
            OMX_CONF_REMEMBER_ERROR(OMX_SendCommand(hWrappedComp, OMX_CommandStateSet, OMX_StateLoaded, 0));
        }

        /* transition TTC to Loaded state */
        if (hWrappedTTComp)
        {
            OMX_CONF_REMEMBER_ERROR(OMX_SendCommand(hWrappedTTComp, OMX_CommandStateSet, OMX_StateIdle, 0));
            OMX_CONF_REMEMBER_ERROR(OMX_SendCommand(hWrappedTTComp, OMX_CommandStateSet, OMX_StateLoaded, 0));
        }

        OMX_CONF_REMEMBER_ERROR(ISTWaitForState(&oAppData, OMX_StateLoaded));

        /* destroy state change event */
        OMX_OSAL_EventDestroy(oAppData.hStateChangeEvent);
        OMX_OSAL_EventDestroy(oAppData.hEOSEvent);

        if (hWrappedComp)
        {
            OMX_CONF_REMEMBER_ERROR(OMX_CONF_ComponentTracerDestroy(hWrappedComp));
        }

        if (hComp)
        {
            OMX_CONF_REMEMBER_ERROR(OMX_FreeHandle(hComp));
        }

        if (hTTComp)
        {
            OMX_CONF_REMEMBER_ERROR(OMX_CONF_FreeTunnelTestComponentHandle(hTTComp));
            OMX_CONF_REMEMBER_ERROR(OMX_CONF_ComponentTracerDestroy(hWrappedTTComp));
        }

        OMX_CONF_REMEMBER_ERROR(OMX_CONF_CallbackTracerDestroy(pWrappedCallbacks, pWrappedAppData));
        OMX_CONF_REMEMBER_ERROR(OMX_Deinit());

        return eError;
    }
    /* Main entrypoint into the Seeking Component Test */
    OMX_ERRORTYPE OMX_CONF_SeekingComponentTest(OMX_IN OMX_STRING cComponentName)
    {
        OMX_TIME_CONFIG_SEEKMODETYPE oSeekMode;
        OMX_TIME_CONFIG_TIMESTAMPTYPE oTimeStamp;
        OMX_PTR pWrappedAppData;
        OMX_CALLBACKTYPE *pWrappedCallbacks;
        OMX_HANDLETYPE hComp, hWrappedComp, hTTComp, hWrappedTTComp;
        OMX_ERRORTYPE  eTemp, eError = OMX_ErrorNone;
        OMX_CALLBACKTYPE oCallbacks;
        SCTDATATYPE oAppData;

        /* create state change event */
        OMX_OSAL_EventCreate(&oAppData.hStateChangeEvent);
        OMX_OSAL_EventReset(oAppData.hStateChangeEvent);
        OMX_OSAL_EventCreate(&oAppData.hEOSEvent);
        OMX_OSAL_EventReset(oAppData.hEOSEvent);

        /* init component handles */
        hComp = hWrappedComp = hTTComp = hWrappedTTComp = 0;

        oCallbacks.EventHandler    = SCTEventHandler;
        oCallbacks.EmptyBufferDone = StubbedEmptyBufferDone;
        oCallbacks.FillBufferDone  = StubbedFillBufferDone;
        eError = OMX_CONF_CallbackTracerCreate(&oCallbacks, (OMX_PTR) & oAppData, cComponentName,
                                               &pWrappedCallbacks, &pWrappedAppData);

        /* Initialize OpenMax */
        eError = OMX_Init();

        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Creating component under test and tunnel test component.\n");

        /* Acquire component under test handle */
        OMX_CONF_FAIL_IF_ERROR(OMX_GetHandle(&hComp, cComponentName, pWrappedAppData, pWrappedCallbacks));
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_ComponentTracerCreate(hComp, cComponentName, &hWrappedComp));
        oAppData.hCUT = hComp;

        /* Acquire tunnel test component handle */
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_GetTunnelTestComponentHandle(&hTTComp, pWrappedAppData, pWrappedCallbacks));
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_ComponentTracerCreate(hTTComp, "OMX.CONF.tunnel.test", &hWrappedTTComp));

        /* Set the OnEmptyThisBuffer callback */
        OMX_CONF_SetTTCOnEmptyThisBuffer(hTTComp, SCTOnEmptyThisBuffer);

        /* Connect CUT to TTC */
        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Connecting all ports.\n");
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_TTCConnectAllPorts(hWrappedTTComp, hWrappedComp));

        /* Force all CUT ports to be suppliers */
        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Forcing all component ports to be suppliers.\n");
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_ForceSuppliers(hWrappedComp, OMX_TRUE));
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_ForceSuppliers(hWrappedTTComp, OMX_FALSE));

        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Transitioning to executing.\n");

        /* transition CUT to idle */
        OMX_CONF_FAIL_IF_ERROR(OMX_SendCommand(hWrappedComp, OMX_CommandStateSet, OMX_StateIdle, 0));

        /* transition TTC to idle */
        OMX_CONF_FAIL_IF_ERROR(OMX_SendCommand(hWrappedTTComp, OMX_CommandStateSet, OMX_StateIdle, 0));

        /* transition CUT to executing */
        OMX_CONF_FAIL_IF_ERROR(SCTWaitForState(&oAppData, OMX_StateIdle));
        OMX_OSAL_EventReset(oAppData.hStateChangeEvent);
        OMX_CONF_FAIL_IF_ERROR(OMX_SendCommand(hWrappedComp, OMX_CommandStateSet, OMX_StateExecuting, 0));
        OMX_CONF_FAIL_IF_ERROR(SCTWaitForState(&oAppData, OMX_StateExecuting));

        /* transition TTC to executing  */
        OMX_CONF_FAIL_IF_ERROR(OMX_SendCommand(hWrappedTTComp, OMX_CommandStateSet, OMX_StateExecuting, 0));

        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_WaitForBufferTraffic(hTTComp));

        /* Get/Set OMX_IndexConfigTimeSeekMode */
        INIT_CONFIG(oSeekMode);
        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Confirm support for OMX_IndexConfigTimeSeekMode\n");
        OMX_CONF_FAIL_IF_ERROR(OMX_GetConfig(hComp, OMX_IndexConfigTimeSeekMode, (OMX_PTR)&oSeekMode));
        oSeekMode.eType = OMX_TIME_SeekModeAccurate;
        OMX_CONF_FAIL_IF_ERROR(OMX_SetConfig(hComp, OMX_IndexConfigTimeSeekMode, (OMX_PTR)&oSeekMode));

        /* Get OMX_IndexConfigTimePosition */
        INIT_CONFIG(oTimeStamp);
        oTimeStamp.nPortIndex = 0; /* ignored - but we clear it anyway */
        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Confirm support for OMX_IndexConfigTimePosition\n");
        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "-Get the current position (remember it for later).\n");
        OMX_CONF_FAIL_IF_ERROR(OMX_GetConfig(hComp, OMX_IndexConfigTimePosition, (OMX_PTR)&oTimeStamp));

        /* Set OMX_IndexConfigTimePosition */
        /* Wait for the position to move on and then return to it */
        g_StartTimeDetected = OMX_FALSE;
        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "-Run for a while.\n");
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_WaitForBufferTraffic(hTTComp));
        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "-Seek to the remembered position.\n");
        OMX_CONF_FAIL_IF_ERROR(OMX_SetConfig(hComp, OMX_IndexConfigTimePosition, (OMX_PTR)&oTimeStamp));
        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "-Run for a while - wait for seek (i.e. a OMX_BUFFERFLAG_STARTTIME).\n");
        OMX_CONF_WaitForBufferTraffic(hTTComp);

        if (g_StartTimeDetected)
        {
            OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "--OK: Saw OMX_BUFFERFLAG_STARTTIME.\n");
        }
        else
        {
            OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "--ERROR: No OMX_BUFFERFLAG_STARTTIME.\n");
            eError = OMX_ErrorUndefined;
        }

OMX_CONF_TEST_FAIL:

        /* Cleanup: Return function errors rather than closing errors if appropriate */

        /* transition CUT and TTC to Loaded state */
        if (hWrappedComp)
        {
            OMX_OSAL_EventReset(oAppData.hStateChangeEvent);
            OMX_CONF_REMEMBER_ERROR(OMX_SendCommand(hWrappedComp, OMX_CommandStateSet, OMX_StateIdle, 0));
        }
        if (hWrappedTTComp)
        {
            OMX_CONF_REMEMBER_ERROR(OMX_SendCommand(hWrappedTTComp, OMX_CommandStateSet, OMX_StateIdle, 0));
            TTCReleaseBuffers(hTTComp);
        }
        if (hWrappedComp)
        {
            OMX_CONF_REMEMBER_ERROR(SCTWaitForState(&oAppData, OMX_StateIdle));
            OMX_OSAL_EventReset(oAppData.hStateChangeEvent);
            OMX_CONF_REMEMBER_ERROR(OMX_SendCommand(hWrappedComp, OMX_CommandStateSet, OMX_StateLoaded, 0));
            OMX_CONF_REMEMBER_ERROR(SCTWaitForState(&oAppData, OMX_StateLoaded));
        }
        if (hWrappedTTComp)
        {
            OMX_CONF_REMEMBER_ERROR(OMX_SendCommand(hWrappedTTComp, OMX_CommandStateSet, OMX_StateLoaded, 0));
        }

        /* destroy state change event */
        OMX_OSAL_EventDestroy(oAppData.hStateChangeEvent);
        OMX_OSAL_EventDestroy(oAppData.hEOSEvent);

        if (hWrappedComp)
        {
            OMX_CONF_REMEMBER_ERROR(OMX_CONF_ComponentTracerDestroy(hWrappedComp));
        }

        if (hComp)
        {
            OMX_CONF_REMEMBER_ERROR(OMX_FreeHandle(hComp));
        }

        if (hTTComp)
        {
            OMX_CONF_REMEMBER_ERROR(OMX_CONF_FreeTunnelTestComponentHandle(hTTComp));
            OMX_CONF_REMEMBER_ERROR(OMX_CONF_ComponentTracerDestroy(hWrappedTTComp));
        }

        OMX_CONF_REMEMBER_ERROR(OMX_CONF_CallbackTracerDestroy(pWrappedCallbacks, pWrappedAppData));
        OMX_CONF_REMEMBER_ERROR(OMX_Deinit());

        return eError;
    }
    /* Main entrypoint into the Valid Input Output Test */
    OMX_ERRORTYPE OMX_CONF_ValidInputOutputTest(OMX_IN OMX_STRING cComponentName)
    {
        OMX_PTR pWrappedAppData;
        OMX_CALLBACKTYPE *pWrappedCallbacks;
        OMX_HANDLETYPE hComp, hWrappedComp, hTTComp, hWrappedTTComp;
        OMX_ERRORTYPE  eTemp, eError = OMX_ErrorNone;
        OMX_CALLBACKTYPE oCallbacks;
        VIOTDATATYPE oAppData;

        /* create state change event */
        OMX_OSAL_EventCreate(&oAppData.hStateChangeEvent);
        OMX_OSAL_EventReset(oAppData.hStateChangeEvent);

        /* init component handles */
        hComp = hWrappedComp = hTTComp = hWrappedTTComp = 0;

        oCallbacks.EventHandler    = VIOTEventHandler;
        oCallbacks.EmptyBufferDone = StubbedEmptyBufferDone;
        oCallbacks.FillBufferDone  = StubbedFillBufferDone;
        eError = OMX_CONF_CallbackTracerCreate(&oCallbacks, (OMX_PTR) & oAppData, cComponentName,
                                               &pWrappedCallbacks, &pWrappedAppData);

        /* Initialize OpenMax */
        eError = OMX_Init();

        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Creating component under test and tunnel test component.\n");

        /* Acquire component under test handle */
        OMX_CONF_FAIL_IF_ERROR(OMX_GetHandle(&hComp, cComponentName, pWrappedAppData, pWrappedCallbacks));
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_ComponentTracerCreate(hComp, cComponentName, &hWrappedComp));
        oAppData.hCUT = hComp;

        /* Acquire tunnel test component handle */
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_GetTunnelTestComponentHandle(&hTTComp, pWrappedAppData, pWrappedCallbacks));
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_ComponentTracerCreate(hTTComp, "OMX.CONF.tunnel.test", &hWrappedTTComp));

        /* Connect CUT to TTC */
        OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Connecting all ports.\n");
        OMX_CONF_FAIL_IF_ERROR(OMX_CONF_TTCConnectAllPorts(hWrappedTTComp, hWrappedComp));

        /* transition CUT to idle */
        OMX_CONF_FAIL_IF_ERROR(OMX_SendCommand(hWrappedComp, OMX_CommandStateSet, OMX_StateIdle, 0));

        /* transition TTC to idle */
        OMX_CONF_FAIL_IF_ERROR(OMX_SendCommand(hWrappedTTComp, OMX_CommandStateSet, OMX_StateIdle, 0));
        OMX_CONF_FAIL_IF_ERROR(VOITWaitForState(&oAppData, OMX_StateIdle));

OMX_CONF_TEST_FAIL:

        /* Cleanup: Return function errors rather than closing errors if appropriate */

        /* transition CUT to Loaded state */
        if (hWrappedComp)
        {
            OMX_OSAL_EventReset(oAppData.hStateChangeEvent);
            OMX_CONF_REMEMBER_ERROR(OMX_SendCommand(hWrappedComp, OMX_CommandStateSet, OMX_StateLoaded, 0));
        }

        /* transition TTC to Loaded state */
        if (hWrappedTTComp)
        {
            OMX_CONF_REMEMBER_ERROR(OMX_SendCommand(hWrappedTTComp, OMX_CommandStateSet, OMX_StateLoaded, 0));
        }

        OMX_CONF_REMEMBER_ERROR(VOITWaitForState(&oAppData, OMX_StateLoaded));

        /* destroy state change event */
        OMX_OSAL_EventDestroy(oAppData.hStateChangeEvent);

        if (hWrappedComp)
        {
            OMX_CONF_REMEMBER_ERROR(OMX_CONF_ComponentTracerDestroy(hWrappedComp));
        }

        if (hComp)
        {
            OMX_CONF_REMEMBER_ERROR(OMX_FreeHandle(hComp));
        }

        if (hTTComp)
        {
            OMX_CONF_REMEMBER_ERROR(OMX_CONF_FreeTunnelTestComponentHandle(hTTComp));
            OMX_CONF_REMEMBER_ERROR(OMX_CONF_ComponentTracerDestroy(hWrappedTTComp));
        }

        OMX_CONF_REMEMBER_ERROR(OMX_CONF_CallbackTracerDestroy(pWrappedCallbacks, pWrappedAppData));
        OMX_CONF_REMEMBER_ERROR(OMX_Deinit());

        return eError;
    }