📄 statinfo.cpp
字号:
HX_DELETE(m_pOutOfOrder); HX_DELETE(m_pLost); HX_DELETE(m_pLate); HX_DELETE(m_pDuplicate); HX_DELETE(m_pTotal); HX_DELETE(m_pLost30); HX_DELETE(m_pTotal30); HX_DELETE(m_pClipBandwidth); HX_DELETE(m_pResendRequested); HX_DELETE(m_pResendReceived); HX_DELETE(m_pAvgBandwidth); HX_DELETE(m_pCurBandwidth); HX_DELETE(m_pHighLatency); HX_DELETE(m_pLowLatency); HX_DELETE(m_pAvgLatency);}STATS& STATS::operator=(const STATS& rhs ){ if( this != &rhs ) { m_pNormal->SetInt( rhs.m_pNormal->GetInt()); m_pRecovered->SetInt( rhs.m_pRecovered->GetInt()); m_pReceived->SetInt( rhs.m_pReceived->GetInt()); m_pOutOfOrder->SetInt( rhs.m_pOutOfOrder->GetInt()); m_pLost->SetInt( rhs.m_pLost->GetInt()); m_pLate->SetInt( rhs.m_pLate->GetInt()); m_pDuplicate->SetInt( rhs.m_pDuplicate->GetInt()); m_pTotal->SetInt( rhs.m_pTotal->GetInt()); m_pLost30->SetInt( rhs.m_pLost30->GetInt()); m_pTotal30->SetInt( rhs.m_pTotal30->GetInt()); m_pClipBandwidth->SetInt( rhs.m_pClipBandwidth->GetInt()); m_pResendRequested->SetInt( rhs.m_pResendRequested->GetInt()); m_pResendReceived->SetInt( rhs.m_pResendReceived->GetInt()); m_pAvgBandwidth->SetInt( rhs.m_pAvgBandwidth->GetInt()); m_pCurBandwidth->SetInt( rhs.m_pCurBandwidth->GetInt()); m_pHighLatency->SetInt( rhs.m_pHighLatency->GetInt()); m_pLowLatency->SetInt( rhs.m_pLowLatency->GetInt()); m_pAvgLatency->SetInt( rhs.m_pAvgLatency->GetInt()); } return *this;}voidSTATS::Reset(){ if (m_bInitialized) { m_pNormal->SetInt(0); m_pRecovered->SetInt(0); m_pReceived->SetInt(0); m_pOutOfOrder->SetInt(0); m_pLost->SetInt(0); m_pLate->SetInt(0); m_pDuplicate->SetInt(0); m_pTotal->SetInt(0); m_pLost30->SetInt(0); m_pTotal30->SetInt(0); m_pClipBandwidth->SetInt(0); m_pResendRequested->SetInt(0); m_pResendReceived->SetInt(0); m_pAvgBandwidth->SetInt(0); m_pCurBandwidth->SetInt(0); m_pHighLatency->SetInt(0); m_pLowLatency->SetInt(0); m_pAvgLatency->SetInt(0); }}PLAYER_STATS::PLAYER_STATS(IHXRegistry* /*IN*/ pRegistry, UINT32 /*IN*/ ulRegistryID) :STATS(pRegistry, ulRegistryID) ,m_pBufferingMode(NULL){ HX_RESULT theErr = HXR_OK; IHXBuffer* pszParentName = NULL; char szRegKeyName[MAX_DISPLAY_NAME] = {0}; /* Flawfinder: ignore */ if (!pRegistry) { goto cleanup; } if (HXR_OK == m_pRegistry->GetPropName(m_ulRegistryID, pszParentName)) { SafeSprintf(szRegKeyName, MAX_DISPLAY_NAME, "%s.BufferingMode", pszParentName->GetBuffer()); if (!(m_pBufferingMode = new CStatisticEntry(m_pRegistry, szRegKeyName, REG_TYPE_NUMBER))) { theErr = HXR_OUTOFMEMORY; goto cleanup; } }cleanup: HX_RELEASE(pszParentName); if (HXR_OK == theErr) { m_lastError = HXR_OK; m_bInitialized = TRUE; } else { m_lastError = theErr; m_bInitialized = FALSE; }}PLAYER_STATS::~PLAYER_STATS(){ HX_DELETE(m_pBufferingMode);}PLAYER_STATS& PLAYER_STATS::operator=(const PLAYER_STATS& rhs ){ if( this != &rhs ) { STATS::operator=(rhs); m_pBufferingMode->SetInt( rhs.m_pBufferingMode->GetInt() ); } return *this;}voidPLAYER_STATS::Reset(){ if (m_bInitialized) { m_pBufferingMode->SetInt(0); STATS::Reset(); }}SOURCE_STATS::SOURCE_STATS(IHXRegistry* /*IN*/ pRegistry, UINT32 /*IN*/ ulRegistryID) :STATS(pRegistry, ulRegistryID){ HX_RESULT theErr = HXR_OK; IHXBuffer* pszParentName = NULL; char szRegKeyName[MAX_DISPLAY_NAME] = {0}; /* Flawfinder: ignore */ m_pTransportMode = NULL; m_pBufferingMode = NULL; m_pTitle = NULL; m_pAuthor = NULL; m_pCopyright = NULL; m_pAbstract = NULL; m_pDescription = NULL; m_pKeywords = NULL; m_pSourceName = NULL; m_pServerInfo = NULL; m_pProtocolVersion = NULL; m_pProtocol = NULL; if (!pRegistry) { goto cleanup; } if (HXR_OK == m_pRegistry->GetPropName(m_ulRegistryID, pszParentName)) { SafeSprintf(szRegKeyName, MAX_DISPLAY_NAME, "%s.TransportMode", pszParentName->GetBuffer()); if (!(m_pTransportMode = new CStatisticEntry(m_pRegistry, szRegKeyName, REG_TYPE_STRING))) { theErr = HXR_OUTOFMEMORY; goto cleanup; } SafeSprintf(szRegKeyName, MAX_DISPLAY_NAME, "%s.BufferingMode", pszParentName->GetBuffer()); if (!(m_pBufferingMode = new CStatisticEntry(m_pRegistry, szRegKeyName, REG_TYPE_NUMBER))) { theErr = HXR_OUTOFMEMORY; goto cleanup; } SafeSprintf(szRegKeyName, MAX_DISPLAY_NAME, "%s.SourceName", pszParentName->GetBuffer()); if (!(m_pSourceName = new CStatisticEntry(m_pRegistry, szRegKeyName, REG_TYPE_STRING))) { theErr = HXR_OUTOFMEMORY; goto cleanup; } SafeSprintf(szRegKeyName, MAX_DISPLAY_NAME, "%s.ServerInfo", pszParentName->GetBuffer()); if (!(m_pServerInfo = new CStatisticEntry(m_pRegistry, szRegKeyName, REG_TYPE_STRING))) { theErr = HXR_OUTOFMEMORY; goto cleanup; } SafeSprintf(szRegKeyName, MAX_DISPLAY_NAME, "%s.ProtocolVersion", pszParentName->GetBuffer()); if (!(m_pProtocolVersion = new CStatisticEntry(m_pRegistry, szRegKeyName, REG_TYPE_NUMBER))) { theErr = HXR_OUTOFMEMORY; goto cleanup; } SafeSprintf(szRegKeyName, MAX_DISPLAY_NAME, "%s.Protocol", pszParentName->GetBuffer()); if (!(m_pProtocol = new CStatisticEntry(m_pRegistry, szRegKeyName, REG_TYPE_STRING))) { theErr = HXR_OUTOFMEMORY; goto cleanup; } SafeSprintf(szRegKeyName, MAX_DISPLAY_NAME, "%s.Title", pszParentName->GetBuffer()); if (!(m_pTitle = new CStatisticEntry(m_pRegistry, szRegKeyName, REG_TYPE_STRING))) { theErr = HXR_OUTOFMEMORY; goto cleanup; } SafeSprintf(szRegKeyName, MAX_DISPLAY_NAME, "%s.Author", pszParentName->GetBuffer()); if (!(m_pAuthor = new CStatisticEntry(m_pRegistry, szRegKeyName, REG_TYPE_STRING))) { theErr = HXR_OUTOFMEMORY; goto cleanup; } SafeSprintf(szRegKeyName, MAX_DISPLAY_NAME, "%s.Copyright", pszParentName->GetBuffer()); if (!(m_pCopyright = new CStatisticEntry(m_pRegistry, szRegKeyName, REG_TYPE_STRING))) { theErr = HXR_OUTOFMEMORY; goto cleanup; } SafeSprintf(szRegKeyName, MAX_DISPLAY_NAME, "%s.Abstract", pszParentName->GetBuffer()); if (!(m_pAbstract = new CStatisticEntry(m_pRegistry, szRegKeyName, REG_TYPE_STRING))) { theErr = HXR_OUTOFMEMORY; goto cleanup; } SafeSprintf(szRegKeyName, MAX_DISPLAY_NAME, "%s.Description", pszParentName->GetBuffer()); if (!(m_pDescription = new CStatisticEntry(m_pRegistry, szRegKeyName, REG_TYPE_STRING))) { theErr = HXR_OUTOFMEMORY; goto cleanup; } SafeSprintf(szRegKeyName, MAX_DISPLAY_NAME, "%s.Keywords", pszParentName->GetBuffer()); if (!(m_pKeywords = new CStatisticEntry(m_pRegistry, szRegKeyName, REG_TYPE_STRING))) { theErr = HXR_OUTOFMEMORY; goto cleanup; } }cleanup: HX_RELEASE(pszParentName); if (HXR_OK == theErr) { m_lastError = HXR_OK; m_bInitialized = TRUE; } else { m_lastError = theErr; m_bInitialized = FALSE; }}SOURCE_STATS::~SOURCE_STATS(){ HX_DELETE(m_pTransportMode); HX_DELETE(m_pBufferingMode); HX_DELETE(m_pSourceName); HX_DELETE(m_pServerInfo); HX_DELETE(m_pProtocolVersion); HX_DELETE(m_pProtocol); HX_DELETE(m_pTitle); HX_DELETE(m_pAuthor); HX_DELETE(m_pCopyright); HX_DELETE(m_pAbstract); HX_DELETE(m_pDescription); HX_DELETE(m_pKeywords);}SOURCE_STATS& SOURCE_STATS::operator=(const SOURCE_STATS& rhs ){ if( this != &rhs ) { STATS::operator=(rhs); HX_ASSERT( m_bInitialized ); if (m_bInitialized) { m_pTransportMode->SetStr(rhs.m_pTransportMode->GetStr()); m_pBufferingMode->SetInt(rhs.m_pBufferingMode->GetInt()); m_pSourceName->SetStr(rhs.m_pSourceName->GetStr()); m_pServerInfo->SetStr(rhs.m_pServerInfo->GetStr()); m_pProtocolVersion->SetInt(rhs.m_pProtocolVersion->GetInt()); m_pProtocol->SetStr(rhs.m_pProtocol->GetStr()); m_pTitle->SetStr(rhs.m_pTitle->GetStr()); m_pAuthor->SetStr(rhs.m_pAuthor->GetStr()); m_pCopyright->SetStr(rhs.m_pCopyright->GetStr()); m_pAbstract->SetStr(rhs.m_pAbstract->GetStr()); m_pDescription->SetStr(rhs.m_pDescription->GetStr()); m_pKeywords->SetStr(rhs.m_pKeywords->GetStr()); } } return *this;}voidSOURCE_STATS::Reset(){ if (m_bInitialized) { m_pTransportMode->SetStr(NULL); m_pBufferingMode->SetInt(0); m_pSourceName->SetStr(NULL); m_pServerInfo->SetStr(NULL); m_pProtocolVersion->SetInt(0); m_pProtocol->SetStr(NULL); m_pTitle->SetStr(NULL); m_pAuthor->SetStr(NULL); m_pCopyright->SetStr(NULL); m_pAbstract->SetStr(NULL); m_pDescription->SetStr(NULL); m_pKeywords->SetStr(NULL); STATS::Reset(); }}STREAM_STATS::STREAM_STATS(IHXRegistry* /*IN*/ pRegistry, UINT32 /*IN*/ ulRegistryID) :STATS(pRegistry, ulRegistryID){ HX_RESULT theErr = HXR_OK; IHXBuffer* pszParentName = NULL; char szRegKeyName[MAX_DISPLAY_NAME] = {0}; /* Flawfinder: ignore */ m_pRenderer = NULL; m_pMimeType = NULL; if (!pRegistry) { goto cleanup; } if (HXR_OK == m_pRegistry->GetPropName(m_ulRegistryID, pszParentName)) { SafeSprintf(szRegKeyName, MAX_DISPLAY_NAME, "%s.Renderer", pszParentName->GetBuffer()); if (!(m_pRenderer = new CStatisticEntry(m_pRegistry, szRegKeyName, REG_TYPE_COMPOSITE))) { theErr = HXR_OUTOFMEMORY; goto cleanup; } SafeSprintf(szRegKeyName, MAX_DISPLAY_NAME, "%s.MimeType", pszParentName->GetBuffer()); if (!(m_pMimeType = new CStatisticEntry(m_pRegistry, szRegKeyName, REG_TYPE_STRING))) { theErr = HXR_OUTOFMEMORY; goto cleanup; } } cleanup: HX_RELEASE(pszParentName); if (HXR_OK == theErr) { m_lastError = HXR_OK; m_bInitialized = TRUE; } else { m_lastError = theErr; m_bInitialized = FALSE; }}STREAM_STATS::~STREAM_STATS(){ HX_DELETE(m_pRenderer); HX_DELETE(m_pMimeType);}STREAM_STATS& STREAM_STATS::operator=(const STREAM_STATS& rhs ){ if( this != &rhs ) { HX_ASSERT( m_bInitialized ); if (m_bInitialized) { STATS::operator=(rhs); m_pMimeType->SetStr( rhs.m_pMimeType->GetStr() ); } } return *this;}voidSTREAM_STATS::Reset(){ if (m_bInitialized) { m_pMimeType->SetStr(NULL); STATS::Reset(); }}BOOL SetIntIfNecessary(CStatisticEntry* pEntry, INT32 lValue){ BOOL bResult = FALSE; if (!pEntry) { goto cleanup; } if (pEntry->GetInt() != lValue) { pEntry->SetInt(lValue); bResult = TRUE; }cleanup: return bResult;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -