Beispiel #1
0
OMX_ERRORTYPE GMSubtitlePlayer::Stop()
{
    LOG_DEBUG("GMSubtitlePlayer::Stop\n");
    bThreadStop = OMX_TRUE;
    fsl_osal_cond_broadcast(Cond);
    fsl_osal_sem_post(pSem);

    return OMX_ErrorNone;
}
Beispiel #2
0
OMX_ERRORTYPE GMSubtitlePlayer::Reset()
{
    LOG_DEBUG("GMSubtitlePlayer::Reset\n");

    bReset = OMX_TRUE;
    while(fsl_osal_sem_trywait(pSem) == E_FSL_OSAL_SUCCESS);
    fsl_osal_cond_broadcast(Cond);

    mSample.pBuffer = NULL;
    RenderOneSample();

    fsl_osal_memset(&delayedSample, 0, sizeof(delayedSample));
    delayedSample.nFilledLen = -1;
    return OMX_ErrorNone;
}
OMX_ERRORTYPE Clock::SetTimeScale(
        OMX_TIME_CONFIG_SCALETYPE *pScale)
{
    OMX_ERRORTYPE ret = OMX_ErrorNone;
    OMX_TIME_MEDIATIMETYPE UpdateType;
    OMX_U32 i;

    OMX_CHECK_STRUCT(pScale, OMX_TIME_CONFIG_SCALETYPE, ret);
    if(ret != OMX_ErrorNone)
        return ret;

    if(pScale->xScale == Scale) {
        LOG_INFO("Set same scale value:[%d:%d]\n", pScale->xScale, Scale);
        return OMX_ErrorNone;
    }

    fsl_osal_mutex_lock(lock);

    CurMediaAndWallTime(&MediaTimeBase, NULL);
    CurMediaAndWallTime(NULL, &WallTimeBase);

    Scale = pScale->xScale;

    OMX_INIT_STRUCT(&UpdateType, OMX_TIME_MEDIATIMETYPE);
    UpdateType.eUpdateType = OMX_TIME_UpdateScaleChanged;
    UpdateType.xScale = Scale;

    fsl_osal_mutex_unlock(lock);

    for(i=0; i<PORT_NUM; i++) {
        if(ports[i]->IsEnabled() == OMX_TRUE)
            MediaTimeUpdate(&UpdateType, i);
    }

    fsl_osal_cond_broadcast(Cond);


    return ret;
}
OMX_ERRORTYPE Clock::SetRefClock(
        OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE *pRefClock)
{
    OMX_ERRORTYPE ret = OMX_ErrorNone;

    OMX_CHECK_STRUCT(pRefClock, OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE, ret);
    if(ret != OMX_ErrorNone)
        return ret;

        
    LOG_DEBUG("%s,%d,Set reference clock %d, curr ref clock %d\n",__FUNCTION__,__LINE__, pRefClock->eClock, RefClock);
    if(RefClock == pRefClock->eClock) {
        LOG_INFO("Set same reference clock:[%d:%d]\n", pRefClock->eClock, RefClock);
        return OMX_ErrorNone;
    }

    fsl_osal_mutex_lock(lock);
    RefClock = pRefClock->eClock;
    fsl_osal_cond_broadcast(Cond);
    fsl_osal_mutex_unlock(lock);

    return OMX_ErrorNone;
}
OMX_ERRORTYPE Clock::SetState(
        OMX_TIME_CONFIG_CLOCKSTATETYPE *pState)
{
    OMX_ERRORTYPE ret = OMX_ErrorNone;
    OMX_TIME_CLOCKSTATE NewState;
    OMX_TIME_MEDIATIMETYPE UpdateType;
    OMX_U32 i;

    OMX_CHECK_STRUCT(pState, OMX_TIME_CONFIG_CLOCKSTATETYPE, ret);
    if(ret != OMX_ErrorNone)
        return ret;

    NewState = pState->eState;
    if(NewState == CurState) {
        LOG_INFO("Set same state to clock: [%d:%d]\n", pState->eState, CurState);
        return OMX_ErrorNone;
    }

    fsl_osal_mutex_lock(lock);

    switch (NewState)
    {
        case OMX_TIME_ClockStateRunning:
            if(CurState == OMX_TIME_ClockStateWaitingForStartTime) {
                LOG_ERROR("Clock can't switch from WaitForStartTime to Running directly.\n");
                ret = OMX_ErrorIncorrectStateTransition;
                goto err;
            }
            /* Stop -> Running */
            fsl_osal_memcpy(&sState, pState, sizeof(OMX_TIME_CONFIG_CLOCKSTATETYPE));
            SegmentStartTime = sState.nStartTime;
            break;
        case OMX_TIME_ClockStateWaitingForStartTime:
            if(CurState == OMX_TIME_ClockStateRunning) {
                LOG_ERROR("Clock can't switch from Running to WaitForStartTime.\n");
                ret = OMX_ErrorIncorrectStateTransition;
                goto err;
            }
            /* Stop -> WaitForStartTime */
            fsl_osal_memcpy(&sState, pState, sizeof(OMX_TIME_CONFIG_CLOCKSTATETYPE));
            StartTimeWaitMask = sState.nWaitMask;
            break;
        case OMX_TIME_ClockStateStopped:
            /* Running->Stop / WaitForStartTime->Stop */
            sState.eState = OMX_TIME_ClockStateStopped;
            break;
        default :
            LOG_ERROR("Invalid clock state setting: %d\n", pState->eState);
            ret = OMX_ErrorIncorrectStateTransition;
            goto err;
    }

    CurState = sState.eState;
    OMX_INIT_STRUCT(&UpdateType, OMX_TIME_MEDIATIMETYPE);
    UpdateType.eUpdateType = OMX_TIME_UpdateClockStateChanged;
    UpdateType.eState = sState.eState;

    fsl_osal_mutex_unlock(lock);

    for(i=0; i<PORT_NUM; i++) {
        if(ports[i]->IsEnabled() == OMX_TRUE)
            MediaTimeUpdate(&UpdateType, i);
    }

    if(sState.eState == OMX_TIME_ClockStateStopped)
        fsl_osal_cond_broadcast(Cond);

    return ret;

err:
    fsl_osal_mutex_unlock(lock);
    return ret;
}