📄 smltime.cpp
字号:
// need to look at the max, if any): else if (m_pSourceElement->m_ulDuration < m_pSourceElement->m_ulMinActiveDur) { m_pSourceElement->m_ulDuration = m_pSourceElement->m_ulMinActiveDur; bDoUpdate = TRUE; } // /If the duration authored is greater than the specified max, // use the max (and we already know that the min < max, so we // don't need to look at the min, if any): else if (m_pSourceElement->m_ulDuration > m_pSourceElement->m_ulMaxActiveDur) { m_pSourceElement->m_ulDuration = m_pSourceElement->m_ulMaxActiveDur; bDoUpdate = TRUE; } else // /use authored duration: { m_pSourceElement->m_ulDuration = m_pSourceElement->m_ulAuthoredDur; bDoUpdate = TRUE; } if (bDoUpdate) { LONG32 lDiff = (LONG32)m_pSourceElement->m_ulDuration + lBeginOffset; m_pSourceElement->m_ulDuration = lDiff>0? lDiff : 0; m_pParser->resetTimelineElementDuration(m_pID, m_pSourceElement->getPureDuration(), ulPriorPureDuration); // /This keeps track of first-play dur, in case this // element restarts during or after playing at least // once: m_pSourceElement->m_ulOriginalDuration = m_pSourceElement->getPureDuration(); HX_ASSERT(ulDuration == m_pSourceElement->getPureDuration() || m_pSourceElement->m_bDurationIncludesDelayBeyondSyncbase); } } }cleanup: if (m_pDependent && ((UINT32)-1 != m_pSourceElement->m_ulDelay)) { HX_ASSERT(WAY_IN_THE_FUTURE >= m_pSourceElement->m_ulDuration + m_pSourceElement->m_ulDelay); // 59584(media version) & 50848 } if(m_pDependent && // /Helps fix PR 66391: If we removed this track because it fell // completely outside its parent's time bounds, then we shouldn't // update our dependent, but rather allow further processing of the // parent seq's setDuration() to remove it's track: !bTrackStartsTooLateSoTrackRemoved && // /Helps fix some timing interop cases in the 11.2-11.9 range: ((UINT32)-1 != m_pSourceElement->m_ulDelay) && // /Helps fix case where as-yet-unresolved end of seq child should // *not* be used to resolve next sibling's begin: (PR 50848) WAY_IN_THE_FUTURE > m_pSourceElement->m_ulDuration + m_pSourceElement->m_ulDelay) // /+delay for PR 59584-related bug. { //Removed the addition of m_pSourceElement->m_ulDelay from the // source's duration because the source's duration already includes // its delay; we don't want to count the delay twice. Fixes PR 13983: // /*XXXEH- UNFIXES 13983 by adding back in the ...m_ulDelay addition; // the full fix for 13983 requires keeping track of begin=... delay // (as opposed to seq-related delay) and then subtracting that begin // delay from the m_ulDelay below: adjustDependentDuration(m_pDependent); // /XXXEH- TODO: figure out if we need to claim this is being set by // "parent" (which is really time base) so clip-begin-like action can // occur; I don't think so, however: // /XXXEH- I think this fixes PR 13983 without breaking other stuff, // but need to make sure: // /Don't propagate delay of sourceElement (PR 13983) in case its // duration already includes its begin offset: ULONG32 ulDelayOfSourceElem = m_pSourceElement->m_ulDelay + m_pSourceElement->m_ulDuration; if (m_pSourceElement->m_bBeginOffsetSet && m_pSourceElement->m_lBeginOffset > 0) { ulDelayOfSourceElem = ((INT32)ulDelayOfSourceElem > m_pSourceElement->m_lBeginOffset ? ulDelayOfSourceElem - m_pSourceElement->m_lBeginOffset : 0);#if defined(XXXEH_DEBUG) HX_ASSERT(!m_pSourceElement->m_bDurationIncludesDelayBeyondSyncbase && "ehodge: don't count delay twice!");#endif if (m_pSourceElement->m_bDurationIncludesDelayBeyondSyncbase) { HX_ASSERT(m_pSourceElement->m_ulBeginOffsetFromSyncBase <= m_pSourceElement->m_lBeginOffset); // /PR 6XXXX. } } // /If this is a repeat element and the first iteration element // was clipped due to a negative begin offset, we want to use the // full duration for this clip: if (m_pDependent->m_pSourceElement->m_pNode->m_repeatTag == RepeatReplica && m_pSourceElement->m_lBeginOffset < 0) { ULONG32 ulRepeatIterationFullDur = m_pSourceElement->m_ulOriginalDuration - m_pSourceElement->m_lBeginOffset; if ((UINT32)-1 != m_pSourceElement->m_ulOriginalDuration) { m_pDependent->m_pSourceElement->m_ulDuration = ulRepeatIterationFullDur; } } if (WAY_IN_THE_FUTURE < ulDelayOfSourceElem) { HX_ASSERT(WAY_IN_THE_FUTURE == ulDelayOfSourceElem && "PR 59584"); ulDelayOfSourceElem = WAY_IN_THE_FUTURE; // /For PR 59584. } m_pDependent->setDelay(ulDelayOfSourceElem, FALSE); } m_pParser->m_pTimelineElementManager->notify(m_pID);}voidCSmilTimelineElement::setMaxDuration(UINT32 ulMaxDuration){ m_bMaxDurationSet = TRUE; m_pSourceElement->m_ulMaxDuration = ulMaxDuration;}void CSmilTimelineElement::adjustDependentDuration(CSmilTimelineElement* pDependent){ if (m_pParent) { m_pParent->adjustDependentDuration(m_pDependent); }}void CSmilTimelineElement::resetDelay(UINT32 ulDelay){ INT32 lAdjustedDelay = 0; UINT32 ulPriorDelay = m_pSourceElement->m_ulDelay; if(m_pSourceElement->m_bBeginOffsetSet) { lAdjustedDelay = (INT32)ulDelay + m_pSourceElement->m_lBeginOffset; m_pSourceElement->m_ulDelay = lAdjustedDelay > 0?lAdjustedDelay:0; } else { m_pSourceElement->m_ulDelay = ulDelay; } if (m_pDependent && m_bDurationSet) {#if defined(XXXEH_WAIT_UNTIL_getCurrentScheduledStopTime_IS_FIXED_WHEN_BEGINOFFSETSET_20011022) ULONG32 ulTotalDelay = 0; if (m_pSourceElement->m_bCurBeginIsOffsetFromSyncBase && m_pSourceElement->m_bDurationIncludesDelayBeyondSyncbase) { HX_ASSERT(0 && "ehodge: CHANGE NOT TESTED!"); } if (HXR_OK != m_pSourceElement->getCurrentScheduledStopTime(ulTotalDelay)) { goto doneSettingDependent; }#else ULONG32 ulTotalDelay = m_pSourceElement->m_ulDelay + m_pSourceElement->m_ulDuration; // /Helps fix PR 6XXXX(media version): if delay is already packed // into the duration, then don't count it twice (as can happen in // <seq><ref begin="1s" .../><ref begin="1s" .../>...): if (m_pSourceElement->m_bDurationIncludesDelayBeyondSyncbase) { HX_ASSERT(m_pSourceElement->m_ulBeginOffsetFromSyncBase != (UINT32)-1);/*OK[]*/ if (m_pSourceElement->m_ulBeginOffsetFromSyncBase !=(UINT32)-1) { HX_ASSERT(m_pSourceElement->m_ulBeginOffsetFromSyncBase < ulTotalDelay); if (m_pSourceElement->m_ulBeginOffsetFromSyncBase < ulTotalDelay) { ulTotalDelay -= m_pSourceElement->m_ulBeginOffsetFromSyncBase; } } }#endif if (WAY_IN_THE_FUTURE < ulTotalDelay) { HX_ASSERT(WAY_IN_THE_FUTURE == ulTotalDelay && "PR 59584"); ulTotalDelay = WAY_IN_THE_FUTURE; // /For PR 59584. } #if defined(_DEBUG) && defined(XXXEH_DEBUGOUT_ADDDURATION) { FILE* f1 = ::fopen("c:\\smil2AddDuration.txt", bFirstTimeAddDurDebugout? ADDDURATION_DEBUGOUT_STR_NEW_FILE : ADDDURATION_DEBUGOUT_STR_APPEND_TO_FILE ); ::fprintf(f1, "\n\t%s:CSmilTimelineElement::resetDelay(%lu):from %lu to %lu;" "\tresetting dependent (%s)'s delay to %lu\n", (const char*)m_pID, ulDelay, ulPriorDelay, m_pSourceElement->m_ulDelay, (const char*)m_pDependent->m_pID, ulTotalDelay); ::fclose(f1); bFirstTimeAddDurDebugout = FALSE; } #endif m_pDependent->resetDelay(ulTotalDelay); }#if defined(XXXEH_WAIT_UNTIL_getCurrentScheduledStopTime_IS_FIXED_WHEN_BEGINOFFSETSET_20011022)doneSettingDependent:#endif if (m_pSourceElement->m_bRendererInitialized) { m_pParser->resetTimelineElementDelay(m_pID, m_pSourceElement->m_ulDelay, ulPriorDelay); } // /(Added while fixing PR 59851) Let others know our begin time changed: m_pParser->m_pTimelineElementManager->notify(m_pID);}void CSmilTimelineElement::resetDuration(UINT32 ulDuration){ INT32 lAdjustedDuration = 0; UINT32 ulPriorPureDuration = m_pSourceElement->getPureDuration(); if(m_pSourceElement->m_bBeginOffsetSet) { if (!m_pSourceElement->m_bDurationIncludesDelayBeyondSyncbase) { m_pSourceElement->m_bDurationIncludesDelayBeyondSyncbase = TRUE; // /=TRUE,not ULONG32. Helps fix PR 68190. } lAdjustedDuration = (INT32)ulDuration + m_pSourceElement->m_lBeginOffset; m_pSourceElement->m_ulDuration = lAdjustedDuration > 0?lAdjustedDuration:0; } else { m_pSourceElement->m_ulDuration = ulDuration; } if(m_pParent) { // /Added surrounding if() to prevent adjusting dur of parent when // parent has clearly imposed its dur on *this (helps fix PR 58568) if (!m_pSourceElement->m_bCurEndClippedByParent) { m_pParent->adjustDuration(); } } if(m_pDependent) {#if defined(XXXEH_WAIT_UNTIL_getCurrentScheduledStopTime_IS_FIXED_WHEN_BEGINOFFSETSET_20011022) ULONG32 ulTotalDelay = 0; if (m_pSourceElement->m_bCurBeginIsOffsetFromSyncBase && m_pSourceElement->m_bDurationIncludesDelayBeyondSyncbase) { HX_ASSERT(0 && "ehodge: CHANGE NOT TESTED!"); } if (HXR_OK != m_pSourceElement->getCurrentScheduledStopTime(ulTotalDelay)) { goto doneSettingDependent; }#else ULONG32 ulTotalDelay = m_pSourceElement->m_ulDelay + m_pSourceElement->m_ulDuration; // /Helps fix PR 6XXXX(media version): if delay is already packed // into the duration, then don't count it twice (as can happen in // <seq><ref begin="1s" .../><ref begin="1s" .../>...): if (m_pSourceElement->m_bDurationIncludesDelayBeyondSyncbase) { HX_ASSERT(m_pSourceElement->m_ulBeginOffsetFromSyncBase != (UINT32)-1);/*OK[]*/ if (m_pSourceElement->m_ulBeginOffsetFromSyncBase !=(UINT32)-1) { HX_ASSERT(m_pSourceElement->m_ulBeginOffsetFromSyncBase < ulTotalDelay); if (m_pSourceElement->m_ulBeginOffsetFromSyncBase < ulTotalDelay) { ulTotalDelay -= m_pSourceElement->m_ulBeginOffsetFromSyncBase; } } }#endif if (WAY_IN_THE_FUTURE < ulTotalDelay) { HX_ASSERT(WAY_IN_THE_FUTURE == ulTotalDelay && "PR 59584"); ulTotalDelay = WAY_IN_THE_FUTURE; // /For PR 59584. } #if defined(_DEBUG) && defined(XXXEH_DEBUGOUT_ADDDURATION) { FILE* f1 = ::fopen("c:\\smil2AddDuration.txt", bFirstTimeAddDurDebugout? ADDDURATION_DEBUGOUT_STR_NEW_FILE : ADDDURATION_DEBUGOUT_STR_APPEND_TO_FILE ); ::fprintf(f1, "\n\t%s:CSmilTimelineElement::resetDuration(%lu):from %lu to %lu;" "\tresetting dependent (%s)'s delay to %lu\n", (const char*)m_pID, ulPriorPureDuration, ulDuration, m_pSourceElement->m_ulDuration, (const char*)m_pDependent->m_pID, ulTotalDelay); ::fclose(f1); bFirstTimeAddDurDebugout = FALSE; } #endif // /Helps fix PR 66391; if parent clipped our duration to 0, don't // update dependent; that'll be handled in parent seq's setDuration(): if (0 != ulDuration && !m_pSourceElement->m_bCurEndClippedByParent) { m_pDependent->resetDelay(ulTotalDelay); } }#if defined(XXXEH_WAIT_UNTIL_getCurrentScheduledStopTime_IS_FIXED_WHEN_BEGINOFFSETSET_20011022)doneSettingDependent:#endif m_pParser->m_pTimelineElementManager->notify(m_pID);}void CSmilTimelineElement::adjustDuration(){ // no-op return;}HX_RESULTCSmilTimelineElement::handlePrefetchFinished(UINT32 ulTimeFinished){ HX_RESULT pnr = HXR_FAILED; if ((UINT32)-1 != ulTimeFinished) { if (m_pSourceElement && (UINT32)-1==m_pSourceElement->m_ulDuration) { if (m_bDelaySet) { if (ulTimeFinished > m_pSourceElement->m_ulDelay) { ulTimeFinished -= m_pSourceElement->m_ulDelay; } else { ulTimeFinished = 0; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -