Ejemplo n.º 1
0
OMX_ERRORTYPE Clock::CurMediaAndWallTime(
        OMX_TICKS *pMediaTime, 
        fsl_osal_timeval *pWallTime)
{
    fsl_osal_timeval tv;

    fsl_osal_systime(&tv);
    if(pWallTime != NULL) {
        pWallTime->sec = tv.sec;
        pWallTime->usec = tv.usec;
    }
    LOG_DEBUG("CurWallTime: [%ds : %dus]\n", tv.sec, tv.usec);

    if(pMediaTime != NULL) {
        if(bPaused != OMX_TRUE && IS_NORMAL_PLAY(Scale))
        {
            OMX_S64 diff = (OMX_S64)WALLTIMESUB(tv, WallTimeBase);
            *pMediaTime = MediaTimeBase + diff*Scale/Q16_SHIFT;
        }
        else
            *pMediaTime = MediaTimeBase;
    }

    return OMX_ErrorNone;
}
Ejemplo n.º 2
0
OMX_ERRORTYPE VideoRender::DoIdle2Loaded()
{
    fsl_osal_systime(&tv_end);
    nDeviceDropCnt = GetDeviceDropFames();
    LOG_INFO("Frame rate %f, Total frames: %d, Total Droped frames: %d, Render device dropped frames: %d\n", \
        (nFrameCnt - nDropCnt - nDeviceDropCnt) * 1000000.0 / ((tv_end.sec - tv_begin.sec) * OMX_TICKS_PER_SECOND + (tv_end.usec - tv_begin.usec)), \
         nFrameCnt, nDropCnt + nDeviceDropCnt, nDeviceDropCnt);
    CloseDevice();
    return OMX_ErrorNone;
}
Ejemplo n.º 3
0
OMX_ERRORTYPE VideoRender::ProcessDataBuffer()
{
    OMX_ERRORTYPE ret = OMX_ErrorNone;
    OMX_BUFFERHEADERTYPE *pBufferHdr = NULL;

    if(ports[IN_PORT]->BufferNum() == 0)
        return OMX_ErrorNoMore;

    if(pSyncFrame != NULL)
        return OMX_ErrorNoMore;

    ports[IN_PORT]->GetBuffer(&pBufferHdr);

    if(nFrameCnt == 0 && ports[CLK_PORT]->IsEnabled() == OMX_TRUE) {
        OMX_TIME_CONFIG_CLOCKSTATETYPE sState;
        OMX_INIT_STRUCT(&sState, OMX_TIME_CONFIG_CLOCKSTATETYPE);
        ports[CLK_PORT]->GetTunneledInfo(&hClock);
        OMX_GetConfig(hClock.hTunneledComp, OMX_IndexConfigTimeClockState, &sState);
        ClockState = sState.eState;
    }

    nFrameCnt ++;
    if(OMX_BUFFERFLAG_STARTTIME == pBufferHdr->nFlags) {
        fsl_osal_systime(&tv_begin);
    }

    LOG_DEBUG("VideoRender get bufer: %p:%lld:%x\n",
            pBufferHdr->pBuffer, pBufferHdr->nTimeStamp, pBufferHdr->nFlags);

    if(ports[CLK_PORT]->IsEnabled() == OMX_TRUE)
        ret = SyncFrame(pBufferHdr);
    else
        ret = RenderFrame(pBufferHdr);

    return ret;
}