⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fxmanagr.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 4 页
字号:
                            {                                retVal = HXR_FAIL;                                break;                            }                        }                        // If we added ourselves in the above loop, then pos will be non-NULL.                        // If we DIDN'T add ourselves in the above loop, then pos will be NULL.                        if (!pos)                        {                            // We didn't find an effect with a start time greater, so                            // this effect must be the new largest start time, so                            // we add this effect to the tail of the list.                             //                            pEffect->AddRef();                            m_pEffectsList->AddTail((void *) pEffect);                        }                    }                    else                    {                        // Addref before adding to the list                        pEffect->AddRef();                        // Add it to the list                        m_pEffectsList->AddTail((void *) pEffect);                    }                }                else                {                    retVal = HXR_FAIL;                }            }            else            {                // Addref the effect object before adding to the list                pEffect->AddRef();                // Add it to the list                m_pEffectsList->AddTail((void *) pEffect);            }        }        else        {            retVal = HXR_UNEXPECTED;        }    }    else    {        retVal = HXR_INVALID_PARAMETER;    }    if (SUCCEEDED(retVal))    {        retVal = UpdatePostDurationExpirationTimes();    }    return retVal;}HX_RESULT PXEffectsManager::OnTimeSync(UINT32 ulTime){    HX_RESULT retVal = HXR_OK;    // First we check to see we have entered the execution    // window for any new effects. If there are any such    // effects, then we create an effect session for them    // and put them in the session list, we also remove    // them from the effect list    retVal = ScanForNewEffects(ulTime);    if (SUCCEEDED(retVal))    {        // Now that we've updated the effect session list, we        // need to run through the session list and call Execute(ulTime)        // on each of the sessions in the list        retVal = ExecuteAllSessions(ulTime);        if (SUCCEEDED(retVal))        {            // Now we need to remove all the sessions from the list            // which are finished.            retVal = UpdateSessionList(ulTime);            if (SUCCEEDED(retVal))            {                // Retire some effects from the post duration list                retVal = UpdatePostDurationList(ulTime);            }        }    }#ifdef XXXMEH_DEBUG_ASSERT    // Debug-only assert    HX_ASSERT(SUCCEEDED(retVal));#endif    return retVal;}HX_RESULT PXEffectsManager::GetNormalFadeLUT(UINT32 ulStart, UINT32 ulEnd, UINT32 ulTime,                                             BYTE** ppStartImageLUT, BYTE** ppEndImageLUT){    HX_RESULT retVal     = HXR_OK;    UINT32    ulTimeInto = 0;    UINT32    ulDuration = 0;    if (IsTimeEqualOrLaterDiff(ulStart, ulTime, ulTimeInto) &&        IsTimeEqualOrLater(ulTime,  ulEnd)                  &&        IsTimeLaterDiff(ulStart, ulEnd, ulDuration)         &&        ppStartImageLUT && ppEndImageLUT)    {        // Compute the scaled percentage done in the range [0, kEffectLUTGranularity]        UINT32 ulPct = ulTimeInto * kEffectLUTGranularity / ulDuration;        // Assign the LUTs The "end image" is the one we want to        // show up 100% at the end. The "start image" is the one we        // want to be 0% at the end. So the end image gets the straight        // percentage done and the start image gets the remaining percentage.        *ppStartImageLUT = m_pFadeLUT + (kEffectLUTGranularity - ulPct) * m_ulLUTWidth;        *ppEndImageLUT   = m_pFadeLUT + ulPct * m_ulLUTWidth;    }    else    {        retVal = HXR_INVALID_PARAMETER;    }    return retVal;}HX_RESULT PXEffectsManager::GetRecursiveFadeLUT(UINT32 ulStart,          UINT32 ulEnd,                                                UINT32 ulTime,           UINT32 ulLastTime,                                                BYTE** ppStartImageLUT,  BYTE** ppEndImageLUT){    HX_RESULT retVal      = HXR_OK;    UINT32    ulEndLast   = 0;    UINT32    ulEndStart  = 0;    UINT32    ulTimeStart = 0;    UINT32    ulEndTime   = 0;    UINT32    ulLastStart = 0;    if (IsTimeLaterDiff(ulLastTime, ulEnd, ulEndLast)            &&        IsTimeLaterDiff(ulStart, ulEnd, ulEndStart)              &&        IsTimeEqualOrLaterDiff(ulStart, ulTime, ulTimeStart)     &&        IsTimeEqualOrLaterDiff(ulTime, ulEnd, ulEndTime)         &&        IsTimeEqualOrLaterDiff(ulStart, ulLastTime, ulLastStart) &&        ppStartImageLUT && ppEndImageLUT)    {        // Compute the scaled percentage for the start image (which        // in this case is the display image (recursively operated on)        UINT32 ulStartPct = ulEndTime * kEffectLUTGranularity / ulEndLast;        // Compute the scaled percentage for the end image        UINT32 ulEndPct = (ulTimeStart*ulEndLast - ulEndTime*ulLastStart) * kEffectLUTGranularity /                          (ulEndStart*ulEndLast);        // Assign the LUTs        *ppStartImageLUT = m_pFadeLUT + ulStartPct * m_ulLUTWidth;        *ppEndImageLUT   = m_pFadeLUT + ulEndPct   * m_ulLUTWidth;    }    else    {        retVal = HXR_INVALID_PARAMETER;    }    return retVal;}HX_RESULT PXEffectsManager::CanUseRecursive(PXEffect* pEffect, BOOL& rbRecursive){    HX_RESULT retVal = HXR_OK;    if (pEffect)    {        // Set the default        rbRecursive = FALSE;        // Here we need to check whether this effect overlaps        // any other effect in time AND space. If it does NOT,        // then we can use the recursive version of the effect.        // If it DOES, then we have to use the "copying" version        // of the effect.        BOOL bOverlap = FALSE;        retVal        = AnySpaceTimeOverlap(pEffect, &bOverlap);        if (SUCCEEDED(retVal) && !bOverlap)        {            rbRecursive = TRUE;        }    }    else    {        retVal = HXR_INVALID_PARAMETER;    }    return retVal;}HX_RESULT PXEffectsManager::PacketLost(){    return HXR_OK;}HX_RESULT PXEffectsManager::GetEffectsPackageManager(PXEffectsPackageManager** ppEffectsPackageManager){    HX_RESULT retVal = HXR_OK;    if (ppEffectsPackageManager)    {        if (m_pEffectsPackageManager)        {            *ppEffectsPackageManager = m_pEffectsPackageManager;            (*ppEffectsPackageManager)->AddRef();        }        else        {            retVal = HXR_UNEXPECTED;        }    }    else    {        retVal = HXR_INVALID_PARAMETER;    }    return retVal;}void PXEffectsManager::ResetDamage(){    // Reset the damage-related members    m_bDisplayDamaged    = FALSE;    m_cDamageRect.left   = 0;    m_cDamageRect.top    = 0;    m_cDamageRect.right  = 0;    m_cDamageRect.bottom = 0;    if (m_pEffectSessionList)    {        // Call PXEffectSession::ResetDamage() on all active effect sessions        LISTPOSITION pos = m_pEffectSessionList->GetHeadPosition();        while (pos)        {            PXEffectSession* pSession = (PXEffectSession*) m_pEffectSessionList->GetNext(pos);            if (pSession)            {                // Call ResetDamage() on this session                pSession->ResetDamage();            }        }    }}void PXEffectsManager::DeleteEffectsList(){    if (m_pEffectsList)    {        // Delete all the objects in the effect queue        LISTPOSITION pos = m_pEffectsList->GetHeadPosition();        while (pos)        {            PXEffect *pEffect = (PXEffect *) m_pEffectsList->GetNext(pos);            HX_RELEASE(pEffect);        }        // Clear out the effect queue        m_pEffectsList->RemoveAll();    }}void PXEffectsManager::DeleteEffectSessionList(){    if (m_pEffectSessionList)    {        // Delete all the objects in the effect queue        LISTPOSITION pos = m_pEffectSessionList->GetHeadPosition();        while (pos)        {            PXEffectSession *pEffectSession = (PXEffectSession *) m_pEffectSessionList->GetNext(pos);            HX_RELEASE(pEffectSession);        }        // Clear out the effect queue        m_pEffectSessionList->RemoveAll();    }}void PXEffectsManager::DeletePostDurationList(){    if (m_pPostDurationList)    {        // Delete all the objects in the effect queue        LISTPOSITION pos = m_pPostDurationList->GetHeadPosition();        while (pos)        {            PXEffect *pEffect = (PXEffect*) m_pPostDurationList->GetNext(pos);            HX_RELEASE(pEffect);        }        // Clear out the effect queue        m_pPostDurationList->RemoveAll();    }}HX_RESULT PXEffectsManager::ScanForNewEffects(UINT32 ulTime){    HX_RESULT retVal = HXR_OK;    if (m_pEffectsList && m_pEffectSessionList)    {        // Scan the effects list. Since we know the effect list is        // sorted in time, we only need to scan until we hit        // an effect whose start time is greater than the current        // time.        BOOL bDelayedInit = FALSE;        LISTPOSITION pos = m_pEffectsList->GetHeadPosition();        while (pos)        {            PXEffect* pEffect = (PXEffect*) m_pEffectsList->GetAt(pos);            if (pEffect)            {                if (IsTimeEqualOrLater(pEffect->GetStart(), ulTime) ||                    (m_bIsLive && pEffect->GetDisplayImmediately()))                {                    // If we got this effect because we were live and                     // the effect said to display immediately, then we                    // need to reset the start time of the effect to                     // right now.                    if (m_bIsLive && pEffect->GetDisplayImmediately())                    {                        pEffect->SetStart(ulTime);                    }                    // Do we need to check for indefinite duration effects?                    if (m_bCheckIndefiniteDuration)                    {                        CheckIndefiniteDuration(pEffect);                    }                    // We found an effect, so we need to create an effect session                    // by calling the factory method                    PXEffectSession* pSession = NULL;                    retVal                    = CreateEffectSession(pEffect, &pSession);                    if (SUCCEEDED(retVal))                    {                        // Addref the session object                        pSession->AddRef();                        // Check if we should init this session now or delay it                        // until the first exe. We only delay the init of a session                        // if we know there are effects which are already past their                        // duration.                        HX_RESULT rv = HXR_OK;                        if (bDelayedInit)                        {                            pSession->SetDelayedInit(TRUE);                            pSession->SetEffect(pEffect);                        }                        else                        {                            // Init the effect session - note that if we can't init                            // the effect session, then we can't do the effect. No need to                            // halt the entire presentation - we just can't do this effect.                            rv = pSession->Init(this, pEffect, m_pImageManager, m_pErrorMessages);                        }                        if (SUCCEEDED(rv))                        {#ifdef XXXMEH_DEBUG_OUT                            DEBUG_OUT(m_pErrorMessages,                                      DOL_REALPIX,                                      (s, "Effect (start=%lu,dur=%lu,target=%lu,type=%lu,last=%lu) started.",                                       pEffect->GetStart(), pEffect->GetDuration(), pEffect->GetTarget(),                                       pEffect->GetEffectType(), (UINT32) pEffect->GetLastUse()));#endif                            // Add ref the session before adding to the list                            pSession->AddRef();                            // Now we need to add this session to the tail of the list                            m_pEffectSessionList->AddTail((void*) pSession);                            // If the effect has a clickthru URL, then tell the                            // hyperlink manager about it                            const char* pszURL = (const char*) pEffect->GetURL();                            if (strlen(pszURL) > 0 &&                                strspn(pszURL, " \r\n\t") < strlen(pszURL))                            {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -