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

📄 smlelem.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 5 页
字号:
			// so that x.focusInEvent-5s would be used over			// x.focusInEvent-3s if and only if (restart=="never"			// OR (restart!="never" AND this's dur <=2s)):			else if (lEffectiveResolvedToTime ==				lResolvedToTimeOfTimeValFoundSoFar  &&				lTimeOffset <				pTimeValFoundSoFar->getTimeOffset())			{			    pTimeValFoundSoFar = pTmpVal;			}		    }		}		break;	    }	}    	pWhichList->GetNext(lPos);    } // /end while(lPos...).    pValue = pTimeValFoundSoFar;    if (NULL == pValue)    {	retval = HXR_FAILED;    }cleanup:    return retval;}HX_RESULTCSmilElement::resolveEventTimeValues(INT32 lCurTime,				const char* pEventName,				const char* pEventElementId,				SmilTimingListType listType,				REF(BOOL) bATimeWasResolved){    HX_RESULT retval = HXR_OK;    SmilTimeValue* pValue = NULL;    CHXSimpleList* pWhichList = NULL;    bATimeWasResolved = FALSE;    LISTPOSITION lPos = NULL;    if (NULL == pEventName  ||	    // /pEventElementId can be NULL but not non-NULL and empty:	    (pEventElementId  &&  '\0' == *pEventElementId) )    {	retval = HXR_FAILED;	goto cleanup;    }    if (SmilBeginTimeList == listType) // /get begin time:    {	pWhichList = m_pBeginTimeList;    }    else if (SmilEndTimeList == listType)// /get end time:    {	pWhichList = m_pEndTimeList;    }    else    {	HX_ASSERT(SmilBeginTimeList == listType  ||		SmilEndTimeList == listType);    }    if (NULL == pWhichList)    {	retval = HXR_FAILED;	goto cleanup;    }    // /XXXEH- is there any reason we should start from tail instead?    lPos = pWhichList->GetHeadPosition();    if (NULL == lPos) // /list is empty.    {	retval = HXR_FAILED;	goto cleanup;    }    while (lPos  &&  HXR_OK == retval)    {	pValue = (SmilTimeValue*)pWhichList->GetAt(lPos);	// /If this begin or end time is a time event based on this event	// from the element with pEventElementId, then we can (and do)	// resolve it here:	if(NULL!= pValue  &&  (SmilTimeEvent == pValue->m_type  ||		(pValue->m_bTreatSyncArcAsEvent  &&		pValue->isSyncBaseTimeVal()) ) )	{	    // /Now, see if we've got an element that is waiting for this	    // event from the pEventElement:	    if (!pValue->getIdRef()  ||  !pValue->getEventName())	    {		HX_ASSERT(pValue->getIdRef()  && pValue->getEventName());		pWhichList->GetNext(lPos);		continue;	    }	    if ((!pEventElementId  ||  strcmp(pValue->getIdRef(),		    pEventElementId) == 0)  &&		    strcmp(pValue->getEventName(), pEventName) == 0 )	    {		BOOL bIsResolvedAlready = pValue->isTimeResolved();		INT32 lProirResolvedToTime = (bIsResolvedAlready?			pValue->getResolvedToTimeWithoutOffset():-1);		pValue->setIsTimeResolved(TRUE);		pValue->setResolvedToTime(lCurTime);		pValue->setWhenTimeWasResolved(lCurTime);		// /[Optimization]: In case we get called twice with the		// same event at the same resolved time, let's not force		// a stop/start of the element:		if (!bIsResolvedAlready  ||  lCurTime !=lProirResolvedToTime)		{		    bATimeWasResolved = TRUE;		}	    }	}    	pWhichList->GetNext(lPos);    } // /end while(lPos...).cleanup:    return retval;}// /This method goes through the m_pEndTimeList to see if there's an// event-arc end time or other unresolved end time; this is important// for use in the algorithm for determining whether or not something// should restart (see SMIL 2.0 Spec Timing Module's getNextInterval()// pseudocode):BOOLCSmilElement::hasUnresolvedEndTime(){    BOOL bHasUnresolvedEndTime = FALSE;    SmilTimeValue* pValue = NULL;    LISTPOSITION lPos = NULL;    if (NULL == m_pEndTimeList)    {	goto cleanup;    }    // /XXXEH- is there any reason we should start from tail instead?    lPos = m_pEndTimeList->GetHeadPosition();    if (NULL == lPos) // /list is empty.    {	goto cleanup;    }    while (lPos  &&  !bHasUnresolvedEndTime)    {	pValue = (SmilTimeValue*)m_pEndTimeList->GetAt(lPos);	if(NULL == pValue)	{	    m_pEndTimeList->GetNext(lPos);	    continue;	}	if (SmilTimeEvent == pValue->m_type)	{	    bHasUnresolvedEndTime = TRUE;	}	// /XXXEH- TODO: need to go through sync-arc element and see	// if *it* has any unresolved time(s) (begin or end, depending	// on this sync-arc time's position value) and, if not, then	// DON'T claim bHasUnresolvedEndTime is TRUE:	else if (pValue->m_bTreatSyncArcAsEvent  &&		pValue->isSyncBaseTimeVal())	{	    if (!pValue->isTimeResolved())	    {		bHasUnresolvedEndTime = TRUE;	    }	}    	m_pEndTimeList->GetNext(lPos);    } // /end while(lPos...).cleanup:    return bHasUnresolvedEndTime;}// /This method returns the pure duration from the media's begin to its// end, w/o any delay included:ULONG32CSmilElement::getPureDuration(){    HX_ASSERT(!m_bDurationIncludesDelayBeyondSyncbase  ||	    m_bCurBeginIsOffsetFromSyncBase);    if (m_bDurationIncludesDelayBeyondSyncbase)    {	return (m_ulDuration - m_ulBeginOffsetFromSyncBase);    }    else    {	return m_ulDuration;    }/*    return (m_bDurationIncludesDelayBeyondSyncbase?	    m_ulDuration-m_ulBeginOffsetFromSyncBase : m_ulDuration);*/}HX_RESULTCSmilElement::resolveSyncArcTimeValues(INT32 lResolvedToTime,				const char* pSyncBaseElementId,				SmilTimingListType listType,				REF(BOOL) bATimeWasResolved,				BOOL bMoveNewlyResolvedsToPendingTimesList,				CSmilParser* pParser){    HX_RESULT retval = HXR_OK;    SmilTimeValue* pValue = NULL;    CHXSimpleList* pWhichList = NULL;    bATimeWasResolved = FALSE;    LISTPOSITION lPos = NULL;    if (NULL == pSyncBaseElementId)    {	retval = HXR_FAILED;	goto cleanup;    }    if (SmilBeginTimeList == listType) // /get begin time:    {	pWhichList = m_pBeginTimeList;    }    else if (SmilEndTimeList == listType)// /get end time:    {	pWhichList = m_pEndTimeList;    }    else    {	HX_ASSERT(SmilBeginTimeList == listType  ||		SmilEndTimeList == listType);    }    if (NULL == pWhichList)    {	retval = HXR_FAILED;	goto cleanup;    }    // /XXXEH- is there any reason we should start from tail instead?    lPos = pWhichList->GetHeadPosition();    if (NULL == lPos) // /list is empty.    {	retval = HXR_FAILED;	goto cleanup;    }    while (lPos  &&  HXR_OK == retval)    {	pValue = (SmilTimeValue*)pWhichList->GetAt(lPos);	// /If this begin or end time is a time event based on this event	// from the element with pSyncBaseElementId, then we can (and do)	// resolve it here:	if(NULL!= pValue  &&  pValue->isSyncBaseTimeVal())	{	    // /Now, see if we've got an element that is waiting for this	    // event from the pEventElement:	    if (!pValue->getIdRef())	    {		HX_ASSERT(pValue->getIdRef());    		pWhichList->GetNext(lPos);		continue;	    }	    if (strcmp(pValue->getIdRef(), pSyncBaseElementId) == 0)	    {		// /Helps fix SMIL 2.0 Interop Timing #15.13:		// if we're resuming a paused element and its duration thus		// got extended, don't re-resolve (and re-insert) other		// elements who are sync-arc'd to the *begin* time of this		// resumed element:		if (pValue->isTimeResolved()  &&  lResolvedToTime ==			pValue->getResolvedToTimeWithoutOffset()  &&			SmilBeginTimeList == listType)		{		    bMoveNewlyResolvedsToPendingTimesList = FALSE;		}		pValue->setIsTimeResolved(TRUE);		pValue->setResolvedToTime(lResolvedToTime);		// /XXXEH- this shouldn't matter what we put here, but		// we *should* fill this with the current time:		pValue->setWhenTimeWasResolved(0);		bATimeWasResolved = TRUE;		if (pParser  &&  bMoveNewlyResolvedsToPendingTimesList)		{		    if (SmilBeginTimeList == listType)		    {			if (pParser->EstablishBeginTimeList())			{			    CHXSimpleList* pList =				    pParser->GetPendingBeginTimeList();			    // /Don't add if it's a duplicate:			    if (!pParser->isDuplicateEntry(pList, pValue))			    {				pList->AddTail(pValue);			    }			}		    }		    else		    {			if (pParser->EstablishEndTimeList())			{			    CHXSimpleList* pList =				    pParser->GetPendingEndTimeList();			    // /Don't add if it's a duplicate:			    if (!pParser->isDuplicateEntry(pList, pValue))			    {				pList->AddTail(pValue);			    }			}		    }		}	    }	}    	pWhichList->GetNext(lPos);    } // /end while(lPos...).cleanup:    return retval;}// /Returns HXR_FAILED if element or its parent don't exist.  The spec says// that "always" is what is to be used for restart and restartDefault for the// element if it has no parent or the parent has no restartDefault value:HX_RESULTCSmilElement::getParentRestartDefault(){    HX_RESULT ret = HXR_OK;    if (NULL == m_pNode)    {	ret = HXR_FAILED;    }    else    {	SMILNode* pParent = m_pNode->m_pParent;	if (!pParent  ||  !pParent->m_pElement)	{	    ret = HXR_FAILED;	}	else	{	    switch (pParent->m_pElement->m_restartDefaultBehavior)	    {		case SmilRestartNever:		case SmilRestartWhenNotActive:		case SmilRestartAlways:		    // /Both restartDefault and restart behavior are assigned		    // to parent's restartDefault behavior:		    m_restartDefaultBehavior =			    m_restartBehavior =			    pParent->m_pElement->m_restartDefaultBehavior;		    break;		case SmilRestartInherit:		    m_restartDefaultBehavior =			    m_restartBehavior = SmilRestartAlways;		    break;		default:		    HX_ASSERT(0);		    break;	    }	}    }    return ret;}void CSmilElement::updateRemoveTime(UINT32 ulRemoveTime){    m_ulRemoveTime = ulRemoveTime;    if (m_pHandler)    {        m_pHandler->handleRemoveTimeUpdate(this, ulRemoveTime);    }}void CSmilElement::handleXMMF(const char* pszID, const char* pszXMMFile, const char* pszSrc){    if (m_pHandler)    {        m_pHandler->handleExternalMediaMarkerFile(this,                                                  pszID,                                                  pszXMMFile,                                                  pszSrc);    }}BOOL CSmilElement::hasEventBasedBeginTime(){    BOOL bRet = FALSE;    if (m_pBeginTimeList)    {        LISTPOSITION pos = m_pBeginTimeList->GetHeadPosition();        while (pos)        {            SmilTimeValue* pValue =                (SmilTimeValue*) m_pBeginTimeList->GetNext(pos);            if (pValue &&                pValue->m_type == SmilTimeEvent)            {                bRet = TRUE;                break;            }        }    }    // We also have to check our sync ancestor because    // if our sync ancestor has an event based begin    // time, then so do we. However, if we already    // know we have an event based time, then we don't    // need to check    if (!bRet)    {        CSmilElement* pSyncAnc = getSyncAncestorElement();        if (pSyncAnc)        {            bRet = pSyncAnc->hasEventBasedBeginTime();        }    }    return bRet;}CSmilElement* CSmilElement::getSyncAncestorElement(){    CSmilElement* pRet = NULL;    if (m_pNode)    {        BOOL bLegalMediaObjectChild = FALSE;        if (m_pNode->m_tag == SMILArea         ||            m_pNode->m_tag == SMILAnchor       ||            m_pNode->m_tag == SMILAnimate      ||            m_pNode->m_tag == SMILSet          ||            m_pNode->m_tag == SMILAnimateColor ||            m_pNode->m_tag == SMILAnimateMotion)        {            bLegalMediaObjectChild = TRUE;        }        SMILNode* pAnc = m_pNode->m_pParent;        while (pAnc)        {            if (pAnc->m_tag == SMILPar  ||                pAnc->m_tag == SMILExcl ||                pAnc->m_tag == SMILSeq)            {                pRet = pAnc->m_pElement;                break;            }            else if ((pAnc->m_tag == SMILRef        ||                      pAnc->m_tag == SMILText       ||                      pAnc->m_tag == SMILImg        ||                      pAnc->m_tag == SMILAudio      ||                      pAnc->m_tag == SMILVideo      ||

⌨️ 快捷键说明

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