📄 smltime.cpp
字号:
}
}
}
}
}
else // /No begin offset, so use delay minus syncBase delay:
{
if (pSyncNode && pSyncNode->m_pElement)
{
if ((UINT32)-1 != ulSyncBaseDelay &&
(UINT32)-1 != m_pSourceElement->m_ulDelay )
{
HX_ASSERT(m_pSourceElement->m_ulDelay >=
ulSyncBaseDelay);
if (m_pSourceElement->m_ulDelay > ulSyncBaseDelay ||
// /Helps fix PR 66391: if delays are equal &
// revisedDur=0, then remove this track:
(0 == ulRevisedDur &&
m_pSourceElement->m_ulDelay == ulSyncBaseDelay))
{
ULONG32 ulEffectiveBeginOffset =
m_pSourceElement->m_ulDelay -
ulSyncBaseDelay;
ulRevisedDur =
ulRevisedDur>ulEffectiveBeginOffset?
ulRevisedDur-ulEffectiveBeginOffset : 0;
bRevisedDurDoesNotIncludeDelayBeyondSyncbase = TRUE;
bOKToResetDurationIncludesDelayVar = FALSE;
// /Be sure to update the begin offset relative
// to the parent: Helps fix
// "...20001116_parDurExtended_due_to_syncArc..."
m_pSourceElement->m_bCurBeginIsOffsetFromSyncBase =
TRUE;
m_pSourceElement->m_ulBeginOffsetFromSyncBase =
ulEffectiveBeginOffset;
// /Fixes part of PR 50684: if revised dur is 0
// or negative (ULONG32 floor of 0 prevents it
// from being negative), then we need to remove
// the track if it's been added already:
if (0 == ulRevisedDur &&
m_pSourceElement->m_pHandler &&
m_pSourceElement->m_bInsertedIntoTimeline)
{
m_pSourceElement->m_bCurEndClippedByParent = TRUE;
HX_RESULT retval2 = m_pSourceElement->m_pHandler->
handleTrackRemoval((const char*)m_pID,
(INT32)m_pSourceElement->m_pNode->m_nGroup);
if (HXR_OK == retval2)
{
// /Fixes case where element has sync arc
// to this end time and we need to notify it
// that we've ended early:
m_pParser->m_pTimelineElementManager->notify((const char*)m_pID);
bTrackStartsTooLateSoTrackRemoved = TRUE;
goto cleanup;
}
}
}
}
else if ((UINT32)-1 == ulSyncBaseDelay)
{
// /Fixes case where par parent child of excl was
// allowing child to begin even though par has no
// explicit resolved begin and thus shouldn't begin:
bOkToSetDuration = FALSE;
}
}
}
if (bOkToSetDuration && ((UINT32)-1 ==
m_pSourceElement->m_ulDuration ||
m_pSourceElement->m_ulDuration < ulRevisedDur) )
{
HX_ASSERT(m_pSourceElement->m_ulDuration == m_pSourceElement->getPureDuration());
// /Adding this if() fixes PR 53514; parent explicit dur was
// being forced on this child even if child has a shorter
// intrinsic duration (which isn't known yet). We need to
// hold off setting the duration and rather set the max
// duration:
setMaxDuration(ulRevisedDur);
}
else if (bOkToSetDuration)
{
m_bDurationSet = m_bDontResetDuration = TRUE;
if (m_pSourceElement->m_ulDuration != ulRevisedDur)
{
// /Parent-imposed duration always is relative to parent
// begin, so duration thus includes delay offset from
// parent. Don't set flag unless offset>0, for
// consistency:
if (m_pSourceElement->m_bCurBeginIsOffsetFromSyncBase &&
m_pSourceElement->m_ulBeginOffsetFromSyncBase > 0)
{
m_pSourceElement->m_bDurationIncludesDelayBeyondSyncbase = TRUE;
}
if (bRevisedDurDoesNotIncludeDelayBeyondSyncbase)
{
m_pSourceElement->m_bDurationIncludesDelayBeyondSyncbase = FALSE;
}
// /Adding this if() conditional around the call to
// "resetTimelineElement...()" makes PR55885 happen only
// after the first time it's played. If you don't close
// the player and then restart the clip, sometimes 55885
// bug still appears; need to debug with core folks to
// see why this happens.
// /NOTE: Adding the following conditional *does* 100% fix
// "BUG-20010613-clickAllFourAndRestartOfGreenCauses..."
// "...ExtensionOfTimelinePastParEnd.smil":
if ((UINT32)-1 != m_pSourceElement->m_ulDelay)
{
m_pParser->resetTimelineElementDuration(m_pID,
// /Using the revised dur here helps fix
// PR 59223, PR 50684, & PR 56795 (and
// probably a lot of others):
ulRevisedDur, ulPriorPureDuration);
}
}
}
}
// /Fixes bug where par with a synchbase end (e.g., end="foo.begin")
// was being ignored completely because its children were never
// being added to the timeline:
if (!m_pSourceElement->m_bInsertedIntoTimeline)
{
if (HXR_OK == m_pParser->adjustForNegativeOffset(m_pID))
{
// /Helps fix timing interop cases in the 11.2-11.9 range:
if ((UINT32)-1 != m_pSourceElement->m_ulDelay)
{
m_pParser->insertTimelineElement(m_pID,
m_pSourceElement->m_ulDelay);
}
}
}
}
else // /Else this duration is not being set by parent:
{
if(!m_bDurationSet ||
// /Helps fix PR 86107; if pause is extending duration, we're
// only here to notify our dependents and ancestor excl so it
// can potentially update its duration so subSEQuent clips can
// adjust their delays outward before getting scheduled w/core:
bDurationExtendingDueToPause)
{
LONG32 lDelayFromParentBegin = 0;
HX_ASSERT((!m_pSourceElement->m_bBeginOffsetSet ||
m_pSourceElement->m_lBeginOffset>=0 ||
m_pSourceElement->m_bNegBeginOffsetAlreadyUsed) &&
"ehodge_please_help_me_find_content_that_trips_this");
if (m_pSourceElement->m_bBeginOffsetSet &&
// /Don't adjust if already adjusted for neg offset:
!m_pSourceElement->m_bNegBeginOffsetAlreadyUsed)
{
lDelayFromParentBegin = m_pSourceElement->m_lBeginOffset;
}
// /Handle case where element began based on event or late-
// resolving time, in which case we want to treat the diff
// between when it resolved and what its sync-parent begin
// is as if it were a m_lBeginOffset:
else if (m_pSourceElement->m_bCurBeginIsOffsetFromSyncBase)
{
lDelayFromParentBegin = (LONG32)
m_pSourceElement->m_ulBeginOffsetFromSyncBase;
}
if (lDelayFromParentBegin>0 &&
// /1st part of fix for interop case 1.15 where begin and
// end are explicitly set to same val so dur should be 0:
ulDuration != 0)
{
m_pSourceElement->m_ulDuration = (
((INT32)ulDuration + lDelayFromParentBegin >0) ?
(UINT32)(
(INT32)ulDuration + lDelayFromParentBegin) : 0);
// /NOTE: m_pSourceElement->m_bDurationIncludesDelayBeyondSyncbase
// is TRUE in PR 79699 (occasionally) but it plays as expected so
// I removed the HX_ASSERT() on !(..->m_bDurationIncludesDelay...)].
// /XXXEH- 20020625: maybe don't do above adding of delay, and then set this to FALSE?:
m_pSourceElement->m_bDurationIncludesDelayBeyondSyncbase = TRUE;
// /If duration is unresolved or indefinite, don't include
// delay from parent so parent duration doesn't get extended
// beyond WAY_IN_THE_FUTURE:
if (WAY_IN_THE_FUTURE == ulDuration)
{
m_pSourceElement->m_ulDuration = WAY_IN_THE_FUTURE;
}
}
else
{
lDelayFromParentBegin = 0; // /In case it was negative.
m_pSourceElement->m_ulDuration = ulDuration;
// /If end==begin, we need to NOT play the clip but we do
// need to fire a beginEvent and endEvent for it. However,
// if end < begin, we don't fire these events (as in
// SMIL 2.0 Interop Timing case 1.16):
BOOL bEndBeforeBegin =
m_pSourceElement->m_bBeginOffsetSet &&
m_pSourceElement->m_bEndOffsetSet &&
m_pSourceElement->m_lBeginOffset >
m_pSourceElement->m_lEndOffset;
if (0 == m_pSourceElement->m_ulDuration &&
!bEndBeforeBegin && m_pSourceElement->m_pNode)
{
// /Raise a beginEvent but don't play the thing (as in
// SMIL 2.0 Interop Timing case 1.15):
HX_RESULT rslt = HXR_OK;
rslt = m_pParser->tryToResolveBeginEndEvents(
"beginEvent",
(const char*)m_pSourceElement->m_pNode->m_id,
m_pSourceElement->m_ulDelay);
rslt = m_pParser->tryToResolveBeginEndEvents(
"endEvent",
(const char*)m_pSourceElement->m_pNode->m_id,
m_pSourceElement->m_ulDelay);
}
}
m_bDurationSet = TRUE;
HX_ASSERT(m_pSourceElement->m_ulDuration>0 &&
"timing#1.15: child's dur (=0) not added to parent; refix!");
if(m_pParent &&
// /Timing interop case 1.15 2nd part of fix:
m_pSourceElement->m_ulDuration>0)
{
m_pParent->addDuration(m_pSourceElement->m_ulDuration,
m_pSourceElement->m_ulDelay,
(UINT32)lDelayFromParentBegin, m_pID);
m_pSourceElement->m_bAddDurationAlreadyDone = TRUE;
}
// /Only do this if we're really setting the original duration
// (and not updating duration due to predicted pause extension):
if (!bDurationExtendingDueToPause)
{
// /this keeps track of dur="x" or implicit source dur, in
// case this element restarts after playing at least once:
m_pSourceElement->m_ulOriginalDuration =
m_pSourceElement->getPureDuration();
HX_ASSERT(ulDuration == m_pSourceElement->getPureDuration() ||
m_pSourceElement->m_bDurationIncludesDelayBeyondSyncbase);
}
}
else if(!m_bDontResetDuration)
{
m_pSourceElement->m_ulDuration = ulDuration;
m_pParser->resetTimelineElementDuration(m_pID,
m_pSourceElement->getPureDuration(),
ulPriorPureDuration);
// /this keeps track of dur="x" or implicit source dur, in
// case this element restarts after playing at least once:
m_pSourceElement->m_ulOriginalDuration =
m_pSourceElement->getPureDuration();
HX_ASSERT(ulDuration == m_pSourceElement->getPureDuration() ||
m_pSourceElement->m_bDurationIncludesDelayBeyondSyncbase);
}
// /Adding the following else-if fixes PR 52110: if parent explicit
// dur sets this's duration but this never got added to parent (via
// addDuration()), then all subSEQuent tracks won't ever get resolved
// begins:
else if(!m_pSourceElement->m_bAddDurationAlreadyDone)
{
HX_ASSERT(m_bDurationSet); // /Here because this was already set.
HX_ASSERT(m_bDelaySet && (UINT32)-1 != m_pSourceElement->m_ulDelay);
HX_ASSERT(m_pSourceElement->m_ulDuration>0 &&
"child's dur (=0) not added to parent; refix!");
if(m_pParent && m_pSourceElement->m_ulDuration>0)
{
ULONG32 ulDelayFromSyncBaseBegin = 0;
if (m_pSourceElement->m_bCurBeginIsOffsetFromSyncBase)
{
ulDelayFromSyncBaseBegin =
m_pSourceElement->m_ulBeginOffsetFromSyncBase;
}
m_pParent->addDuration(m_pSourceElement->m_ulDuration,
m_pSourceElement->m_ulDelay,
ulDelayFromSyncBaseBegin, m_pID);
m_pSourceElement->m_bAddDurationAlreadyDone = TRUE;
}
}
// /If "dur" attribute value or intrinsic dur is less than the
// min attribute value or greater than the max attribute value,
// then we need to use min or max attribute's value as the duration:
if (!m_bDontResetDuration &&
(m_pSourceElement->m_bUseMediaDurForMinDur ||
m_pSourceElement->m_bUseMediaDurForMaxDur ||
m_pSourceElement->m_ulMinActiveDur > 0 ||
m_pSourceElement->m_ulMaxActiveDur != ((UINT32)-1) ) )
{
BOOL bDoUpdate = FALSE;
LONG32 lBeginOffset = 0;
if (m_pSourceElement->m_bBeginOffsetSet)
{
lBeginOffset = m_pSourceElement->m_lBeginOffset;
}
// /First, check if m_pSourceElement->m_bUseMediaDurForMinDur
// is TRUE. If so, we want to use the max of ulDuration
// (media's intrinsic dur) and any explicitly-set dur (via
// dur="..." {or end="..."[-begin=".."]}:
if (m_pSourceElement->m_bUseMediaDurForMinDur)
{
if (((UINT32)-1) != m_pSourceElement->m_ulAuthoredDur)
{
HX_ASSERT(0 == m_pSourceElement->m_ulMinActiveDur);
// /Use authored dur if it's greater than intrinsic
// duration OR if max<min (since max<min negates both
// properties):
if (m_pSourceElement->m_ulAuthoredDur > ulDuration ||
(((UINT32)-1) !=
m_pSourceElement->m_ulMaxActiveDur &&
m_pSourceElement->m_ulMaxActiveDur < ulDuration))
{
m_pSourceElement->m_ulDuration =
m_pSourceElement->m_ulAuthoredDur;
bDoUpdate = TRUE;
}
}
}
// /Next, check if m_pSourceElement->m_bUseMediaDurForMaxDur
// is TRUE. If so, we want to use the min of ulDuration
// (media's intrinsic dur) and any explicitly-set dur (via
// dur="..." or {end="..."[-begin=".."]}:
else if (m_pSourceElement->m_bUseMediaDurForMaxDur)
{
if (((UINT32)-1) != m_pSourceElement->m_ulAuthoredDur)
{
HX_ASSERT(((UINT32)-1) ==
m_pSourceElement->m_ulMaxActiveDur);
// /Use authored dur if it's less than intrinsic
// duration OR if min>max (since min>max negates both
// properties):
if (m_pSourceElement->m_ulAuthoredDur < ulDuration ||
(0 != m_pSourceElement->m_ulMinActiveDur &&
m_pSourceElement->m_ulMinActiveDur > ulDuration))
{
m_pSourceElement->m_ulDuration =
m_pSourceElement->m_ulAuthoredDur;
bDoUpdate = TRUE;
}
}
}
// /If no "dur" or "end" was specified, use the greater of the
// media's intrinsic dur and its min without exceeding its max,
// if any:
else if(((UINT32)-1) == m_pSourceElement->m_ulAuthoredDur)
{
if (m_pSourceElement->m_ulMinActiveDur!=0 &&
m_pSourceElement->m_ulDuration <
m_pSourceElement->m_ulMinActiveDur)
{
m_pSourceElement->m_ulDuration =
m_pSourceElement->m_ulMinActiveDur;
bDoUpdate = TRUE;
}
if (((UINT32)-1) != m_pSourceElement->m_ulMaxActiveDur &&
m_pSourceElement->m_ulDuration >
m_pSourceElement->m_ulMaxActiveDur)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -