📄 hxtac.cpp
字号:
HX_RELEASE(pTrack); } } } HX_RELEASE(pGroupProps); HX_RELEASE(pGroup); } return bFoundTAC;}/************************************************************************ * Method: * HXMasterTAC::CheckPresentationForTACInfo * Purpose: * Private function used to examine presentation props for TAC info * */BOOL HXMasterTAC::CheckPresentationForTACInfo(){ BOOL bFoundTAC = FALSE; IHXValues* pPresProps = m_pGroupManager ? m_pGroupManager->GetPresentationProperties() : NULL; if (pPresProps) { // now search the group props for TAC info RetrieveTACProperties(pPresProps); if (m_pTACProps && IsTACComplete(m_pTACProps)) { SetTAC(m_pTACProps, TAC_Presentation); bFoundTAC = TRUE; } HX_RELEASE(pPresProps); } return bFoundTAC;}/************************************************************************ * Method: * HXMasterTAC::CheckTrackForTACInfo * Purpose: * Private function used to examine track props for TAC info * */BOOL HXMasterTAC::CheckTrackForTACInfo(INT32 nGroup, INT32 nTrack){ BOOL bFoundTAC = CheckPresentationForTACInfo(); if (bFoundTAC) { return bFoundTAC; } // first get the group object's properties using the IHXGroup IHXGroup* pGroup = NULL; if (m_pGroupManager && HXR_OK == m_pGroupManager->GetGroup((UINT16) nGroup, pGroup)) { // but first check the group's props IHXValues* pGroupProps = pGroup->GetGroupProperties(); // now search the group props for TAC info RetrieveTACProperties(pGroupProps); if (m_pTACProps && IsTACComplete(m_pTACProps)) { SetTAC(m_pTACProps, TAC_Group); bFoundTAC = TRUE; } else { // now get the track using track ID IHXValues* pTrack = NULL; if (HXR_OK == pGroup->GetTrack((UINT16) nTrack, pTrack)) { // now search the props for TAC info RetrieveTACProperties(pTrack); if (m_pTACProps && IsTACComplete(m_pTACProps)) { SetTAC(m_pTACProps, TAC_Track); bFoundTAC = TRUE; } HX_RELEASE(pTrack); } } HX_RELEASE(pGroupProps); } HX_RELEASE(pGroup); return bFoundTAC;}/************************************************************************ * Method: * HXMasterTAC::CheckSourceForTACInfo * Purpose: * Private function used to examine source props for TAC * info. If found, adds them to the Track props and sets * the player's TAC props. * * If Track props already had TAC props, this method would * not be called! * */BOOL HXMasterTAC::CheckSourceForTACInfo(INT32 nGroup, INT32 nTrack, UINT32 sourceID){ BOOL bFoundTAC = FALSE; // first get the group object's properties using the IHXGroup IHXGroup* pGroup = NULL; IHXValues* pTrack = NULL; if (m_pGroupManager && HXR_OK == m_pGroupManager->GetGroup((UINT16) nGroup, pGroup)) { pGroup->GetTrack((UINT16) nTrack, pTrack); }#if defined(HELIX_FEATURE_REGISTRY) // get source prop name IHXBuffer* pSourceName = NULL; if (HXR_OK == m_pRegistry->GetPropName(sourceID, pSourceName)) { if (!m_ptacPropIDs) { m_ptacPropIDs = new CHXSimpleList; if (!m_ptacPropIDs) { return FALSE; } } // build TAC property strings & get props IHXValues* pTACProps = new CHXHeader(); pTACProps->AddRef(); IHXBuffer* pValue = NULL; // create tac data object and add to collection TACData* pTACData = new TACData(); m_ptacPropIDs->AddTail(pTACData); // get each prop from the registry and add them to the // pTACProps & pTrack collection also char szPropName[1024]; /* Flawfinder: ignore */ for (int n=0; n<NUMB_TAC_NAMES; n++) { SafeSprintf(szPropName, 1024, "%s.%s", (char*) pSourceName->GetBuffer(), szTACNames[n]); if (HXR_OK == m_pRegistry->GetStrByName(szPropName, pValue) || m_pRegistry->GetId(szPropName)) { if (pValue) { // now add it to the pTACProps values pTACProps->SetPropertyCString(szTACNames[n], pValue); // if we have a track if (pTrack) { pTrack->SetPropertyCString(szTACNames[n], pValue); } HX_RELEASE(pValue); bFoundTAC = TRUE; } // set prop watch on this property (even if it has no TAC data so far - it may later!) pTACData->SetPropAndWatch(n, m_pRegistry->GetId(szPropName), m_pTACPropWatch); } } // if we found some (we might not have) set them as the player TAC props if (bFoundTAC) { RetrieveTACProperties(pTACProps); } SetTAC(m_pTACProps, TAC_Source); // cleanup HX_RELEASE(pTACProps); HX_RELEASE(pSourceName); }#endif /* HELIX_FEATURE_REGISTRY */ // clean up track & group - if present if (pTrack) { HX_RELEASE(pTrack); } if (pGroup) { HX_RELEASE(pGroup); } return bFoundTAC;}/************************************************************************ * Method: * HXMasterTAC::RetrieveTACProperties * Purpose: * Get registry ID(hash_key) of the objects(player, source and stream) * */void HXMasterTAC::RetrieveTACProperties(IHXValues* pFromProps){ IHXBuffer* pValue1 = NULL; IHXBuffer* pValue2 = NULL; IHXValues* pResult = NULL; if (pFromProps) { UINT16 nIdx; for(nIdx = 0; nIdx < NUMB_TAC_NAMES; nIdx++) { pFromProps->GetPropertyCString(szTACNames[nIdx], pValue1); if (pValue1) { m_pTACProps->GetPropertyCString(szTACNames[nIdx], pValue2); if (!pValue2) { m_pTACProps->SetPropertyCString(szTACNames[nIdx], pValue1); } HX_RELEASE(pValue1); HX_RELEASE(pValue2); } } }}/************************************************************************ * Method: * HXMasterTAC::SetTAC * Purpose: * Set TAC properties in registry using values in tacProps * */void HXMasterTAC::SetTAC(IHXValues* tacProps, TACStatus status){ // ignore new TAC settings unless this setting has a higher "status" if (status < m_tacStatus) { return; } // if we had Source based TAC before, and now we have a Track with // TAC props (ie. from the SMIL) we want that to be it for the group // so ignore any new mm sync events - clear all Source prop watches if (status == TAC_Track && m_tacStatus == TAC_Source) { // clear all TAC watches ResetTAC(); }#if defined(HELIX_FEATURE_REGISTRY) // set values in registry IHXBuffer* pValue = NULL; for (int i=0; i<NUMB_TAC_NAMES; i++) { tacProps->GetPropertyCString(szTACNames[i],pValue); if (pValue) { m_pRegistry->SetStrById(m_masterTACPropIDs[i], pValue); HX_RELEASE(pValue); } else { UCHAR nullString[1]; *nullString = '\0'; // set to blank string pValue = new CHXBuffer(); pValue->AddRef(); pValue->Set(nullString, 1); m_pRegistry->SetStrById(m_masterTACPropIDs[i], pValue); HX_RELEASE(pValue); } }#endif /* HELIX_FEATURE_REGISTRY */ // set new status m_tacStatus = status;}/************************************************************************ * Method: * TACData::SetPropAndWatch * Purpose: * Set a prop watch on the propID passed and save the ID * The propIndex value denotes which of the 4 TACA items we are setting * */void TACData::SetPropAndWatch(UINT32 propIndex, UINT32 propID, IHXPropWatch* pPropWatch){ // first save the propID in the appropriate member if (propIndex == TitlePosition) { m_titleID = propID; } else if (propIndex == AuthorPosition) { m_authorID = propID; } else if (propIndex == CopyrightPosition) { m_copyrightID = propID; } else if (propIndex == AbstractPosition) { m_abstractID = propID; } else if (propIndex == KeywordsPosition) { m_keywordsID = propID; } else if (propIndex == DescriptionPosition ) { m_descriptionID = propID; } // set the prop watch pPropWatch->SetWatchById(propID);}/************************************************************************ * Method: * TACData::ClearAll * Purpose: * Clear all/any prop watches for this TAC objects prop IDs * */void TACData::ClearAll(IHXPropWatch* pPropWatch){ if (m_titleID > 0) { pPropWatch->ClearWatchById(m_titleID); m_titleID = 0; } if (m_authorID > 0) { pPropWatch->ClearWatchById(m_authorID); m_authorID = 0; } if (m_copyrightID > 0) { pPropWatch->ClearWatchById(m_copyrightID); m_copyrightID = 0; } if (m_abstractID > 0) { pPropWatch->ClearWatchById(m_abstractID); m_abstractID = 0; } if (m_keywordsID > 0) { pPropWatch->ClearWatchById(m_keywordsID); m_keywordsID = 0; } if (m_descriptionID > 0) { pPropWatch->ClearWatchById(m_descriptionID); m_descriptionID = 0; }}/************************************************************************ * Method: * TACData::FindMasterID * Purpose: * Given a Source0 TAC prop id, find the correlating master ID * */UINT32 TACData::FindMasterIndex(UINT32 sourcePropID){ UINT32 res = NoFind; if (m_titleID == sourcePropID) { res = TitlePosition; } if (m_authorID == sourcePropID) { res = AuthorPosition; } if (m_copyrightID == sourcePropID) { res = CopyrightPosition; } if (m_abstractID == sourcePropID) { res = AbstractPosition; } if (m_keywordsID == sourcePropID) { res = KeywordsPosition; } if (m_descriptionID == sourcePropID) { res = DescriptionPosition; } return res;}/************************************************************************ * Method: * TACData::IsIDPresent * Purpose: * Given a Source0 TAC prop id, find the correlating master ID * */BOOL TACData::IsIDPresent(UINT32 sourcePropID){ BOOL res = FALSE; if (m_titleID == sourcePropID || m_authorID == sourcePropID || m_copyrightID == sourcePropID || m_abstractID == sourcePropID || m_keywordsID == sourcePropID || m_descriptionID == sourcePropID ) { res = TRUE; } return res;}/************************************************************************ * Method: * TACData::IsIDPresent * Purpose: * Given a Source0 TAC prop id, find the correlating master ID * */void TACData::Clear(UINT32 sourcePropID){ if (m_titleID == sourcePropID) { m_titleID = 0; } if (m_authorID == sourcePropID) { m_authorID = 0; } if (m_copyrightID == sourcePropID) { m_copyrightID = 0; } if (m_abstractID == sourcePropID) { m_abstractID = 0; } if (m_keywordsID == sourcePropID) { m_keywordsID = 0; } if (m_descriptionID == sourcePropID) { m_descriptionID = 0; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -