📄 smlrendr.cpp
字号:
errHandler.ReportError(SMILErrorBadAttribute, "missing quote", 0); } else if(pSmilPacket) { switch(pSmilPacket->m_type) { case CSmilPacket::SMILDocument: { rc = handleSMILDocumentPacket( (CSmilDocumentPacket*)pSmilPacket); if (HXR_OK != rc) { m_lastOnPacketResult = rc; } } break; default: break; } delete pSmilPacket; } HX_RELEASE(pBuffer); } return rc;}/////////////////////////////////////////////////////////////////////////// Method:// IHXRenderer::OnTimeSync// Purpose:// Called by client engine to inform the renderer of the current// time relative to the streams synchronized time-line. The // renderer should use this time value to update its display or// render it's stream data accordingly.//STDMETHODIMP CSmilRenderer::OnTimeSync(ULONG32 ulTime){ MLOG_FLOW(m_pErrorMessages, "CSmilRenderer::OnTimeSync(%lu) this=0x%08x\n", ulTime, this); HX_RESULT rc = HXR_OK; if(m_pSmilDocRenderer) { rc = m_pSmilDocRenderer->onTimeSync(ulTime); } if (rc != HXR_OUTOFMEMORY) { rc = HXR_OK; } return rc;}/////////////////////////////////////////////////////////////////////////// Method:// IHXRenderer::OnPreSeek// Purpose:// Called by client engine to inform the renderer that a seek is// about to occur. The render is informed the last time for the // stream's time line before the seek, as well as the first new// time for the stream's time line after the seek will be completed.//STDMETHODIMP CSmilRenderer::OnPreSeek(ULONG32 ulOldTime, ULONG32 ulNewTime){ MLOG_FLOW(m_pErrorMessages, "CSmilRenderer::OnPreSeek(%lu,%lu) this=0x%08x\n", ulOldTime, ulNewTime, this); HX_RESULT rc = HXR_OK; if(m_pSmilDocRenderer) { rc = m_pSmilDocRenderer->onPreSeek(ulOldTime, ulNewTime); } return rc;}/////////////////////////////////////////////////////////////////////////// Method:// IHXRenderer::OnPostSeek// Purpose:// Called by client engine to inform the renderer that a seek has// just occured. The render is informed the last time for the // stream's time line before the seek, as well as the first new// time for the stream's time line after the seek.//STDMETHODIMP CSmilRenderer::OnPostSeek(ULONG32 ulOldTime, ULONG32 ulNewTime){ MLOG_FLOW(m_pErrorMessages, "CSmilRenderer::OnPostSeek(%lu,%lu) this=0x%08x\n", ulOldTime, ulNewTime, this); return HXR_OK;}/////////////////////////////////////////////////////////////////////////// Method:// IHXRenderer::OnPause// Purpose:// Called by client engine to inform the renderer that a pause has// just occured. The render is informed the last time for the // stream's time line before the pause.//STDMETHODIMP CSmilRenderer::OnPause(ULONG32 ulTime){ MLOG_FLOW(m_pErrorMessages, "CSmilRenderer::OnPause(%lu) this=0x%08x\n", ulTime, this); if( m_pSmilDocRenderer ) { m_pSmilDocRenderer->unlockSiteComposition(); } return HXR_OK;}/////////////////////////////////////////////////////////////////////////// Method:// IHXRenderer::OnBegin// Purpose:// Called by client engine to inform the renderer that a begin or// resume has just occured. The render is informed the first time // for the stream's time line after the resume.//STDMETHODIMP CSmilRenderer::OnBegin(ULONG32 ulTime){ MLOG_FLOW(m_pErrorMessages, "CSmilRenderer::OnBegin(%lu) this=0x%08x\n", ulTime, this); if( m_pSmilDocRenderer ) { m_pSmilDocRenderer->lockSiteComposition(); } return HXR_OK;}/////////////////////////////////////////////////////////////////////////// Method:// IHXRenderer::OnBuffering// Purpose:// Called by client engine to inform the renderer that buffering// of data is occuring. The render is informed of the reason for// the buffering (start-up of stream, seek has occured, network// congestion, etc.), as well as percentage complete of the // buffering process.//STDMETHODIMP CSmilRenderer::OnBuffering(ULONG32 ulFlags, UINT16 unPercentComplete){ MLOG_FLOW(m_pErrorMessages, "CSmilRenderer::OnBuffering(%lu,%u) this=0x%08x\n", ulFlags, unPercentComplete, this); return HXR_OK;}/////////////////////////////////////////////////////////////////////////// Method:// IHXRenderer::GetDisplayType// Purpose:// Called by client engine to ask the renderer for it's preferred// display type. When layout information is not present, the // renderer will be asked for it's prefered display type. Depending// on the display type a buffer of additional information may be // needed. This buffer could contain information about preferred// window size.//STDMETHODIMP CSmilRenderer::GetDisplayType( REF(HX_DISPLAY_TYPE) ulFlags, REF(IHXBuffer*) pBuffer){ ulFlags = HX_DISPLAY_NONE; return HXR_OK;}/************************************************************************ * Method: * IHXRenderer::OnEndofPackets * Purpose: * Called by client engine to inform the renderer that all the * packets have been delivered. However, if the user seeks before * EndStream() is called, renderer may start getting packets again * and the client engine will eventually call this function again. */STDMETHODIMP CSmilRenderer::OnEndofPackets(void){ MLOG_FLOW(m_pErrorMessages, "CSmilRenderer::OnEndofPackets() this=0x%08x\n", this); return HXR_OK;}/************************************************************************ * Method: * IHXStatistics::Init * Purpose: * Pass registry ID to the caller * */STDMETHODIMPCSmilRenderer::InitializeStatistics( UINT32 /*IN*/ ulRegistryID){ IHXRegistry* pRegistry = NULL; if (m_pContext && HXR_OK == m_pContext->QueryInterface(IID_IHXRegistry, (void**)&pRegistry)) { char szRegistryEntry[MAX_DISPLAY_NAME] = {0}; /* Flawfinder: ignore */ IHXBuffer* pszRegistryName = NULL; // Get the current registry key name if (HXR_OK == pRegistry->GetPropName(ulRegistryID, pszRegistryName)) { IHXBuffer* pValue = new CHXBuffer(); pValue->AddRef(); SafeSprintf(szRegistryEntry, MAX_DISPLAY_NAME, "%s.name", pszRegistryName->GetBuffer()); pValue->Set((const UCHAR*)zm_pName, strlen(zm_pName) + 1); pRegistry->AddStr(szRegistryEntry, pValue); HX_RELEASE(pValue); HX_RELEASE(pszRegistryName); } HX_RELEASE(pRegistry); } return HXR_OK;}/************************************************************************ * Method: * IHXStatistics::Update * Purpose: * Notify the client to update its statistics stored in the registry * */STDMETHODIMP CSmilRenderer::UpdateStatistics(){ return HXR_OK;}// IHXPersistentRenderer methodsSTDMETHODIMPCSmilRenderer::InitPersistent(UINT32 ulPersistentComponentID, UINT16 uPersistentGroupID, UINT16 uPersistentTrackID, IHXPersistentRenderer* pPersistentParent){ return m_pSmilDocRenderer->InitPersistent(ulPersistentComponentID, uPersistentGroupID, uPersistentTrackID, pPersistentParent);}STDMETHODIMPCSmilRenderer::GetPersistentID(REF(UINT32) ulPersistentComponentID){ ulPersistentComponentID = m_pSmilDocRenderer->m_ulPersistentComponentID; return HXR_OK;}STDMETHODIMPCSmilRenderer::GetPersistentProperties(REF(IHXValues*) pProperties){ HX_RESULT rc = HXR_OK; pProperties = new CHXHeader(); pProperties->AddRef(); pProperties->SetPropertyULONG32("PersistentType", m_persistentType); pProperties->SetPropertyULONG32("PersistentVersion", m_ulPersistentVersion); return rc;}STDMETHODIMPCSmilRenderer::GetElementProperties(UINT16 uGroupID, UINT16 uTrackID, REF(IHXValues*) pProperties){ return m_pSmilDocRenderer->GetElementProperties(uGroupID, uTrackID, pProperties);}STDMETHODIMPCSmilRenderer::AttachElementLayout(UINT16 uGroupID, UINT16 uTrackID, IHXRenderer* pRenderer, IHXStream* pStream, IHXValues* pProps){ return m_pSmilDocRenderer->AttachElementLayout(uGroupID, uTrackID, pRenderer, pStream, pProps);}STDMETHODIMPCSmilRenderer::DetachElementLayout(IUnknown* pLSG){ return m_pSmilDocRenderer->DetachElementLayout(pLSG);}/************************************************************************ * Method: * IHXSmilToSmilRendererCommunicator::InitSmilStreamProxiedByOtherRenderer * Purpose: * Notify the client to update its statistics stored in the registry * */// IHXSmilToSmilRendererCommunicator methodsSTDMETHODIMPCSmilRenderer::InitSmilStreamProxiedByOtherRenderer(IHXBuffer* pDefaultNamespace){ HX_RESULT rc = HXR_FAIL; m_bStreamProxiedByOtherRenderer = TRUE; if (pDefaultNamespace && pDefaultNamespace->GetSize() > 0) { HX_RELEASE(m_pVersionNamespaceFromProxyRenderer); m_pVersionNamespaceFromProxyRenderer = pDefaultNamespace; m_pVersionNamespaceFromProxyRenderer->AddRef(); rc = HXR_OK; } return rc;}STDMETHODIMPCSmilRenderer::GetElementStatus(UINT16 uGroupID, UINT16 uTrackID, UINT32 ulCurrentTime, REF(IHXValues*) pStatus){ return m_pSmilDocRenderer->GetElementStatus(uGroupID, uTrackID, ulCurrentTime, pStatus);}HX_RESULT STDAPICALLTYPE CSmilRenderer::HXCreateInstance(IUnknown** ppIUnknown){ HX_RESULT retVal = HXR_FAIL; if (ppIUnknown) { CSmilRenderer* pObj = new CSmilRenderer(); if (pObj) { retVal = pObj->QueryInterface(IID_IUnknown, (void**) ppIUnknown); if (FAILED(retVal)) { HX_DELETE(pObj); } } } return retVal;}HX_RESULT STDAPICALLTYPE CSmilRenderer::CanUnload2(void){ return ((CHXBaseCountingObject::ObjectsActive() > 0) ? HXR_FAIL : HXR_OK);}HX_RESULTCSmilRenderer::HandleAddLayoutSiteGroup(IUnknown* pLSG){ HX_RESULT rc = HXR_OK; IHXValues* pProps = NULL; IHXPersistentRenderer* pPersistentParentRenderer = NULL; pPersistentParentRenderer = m_pSmilDocRenderer->m_pPersistentParentRenderer; // nested meta, get layout from its parent if (pPersistentParentRenderer) { pProps = new CHXHeader(); if (pProps) { pProps->AddRef(); pProps->SetPropertyULONG32("PersistentType", m_persistentType); } rc = pPersistentParentRenderer->AttachElementLayout(m_pSmilDocRenderer->m_uPersistentGroupID, m_pSmilDocRenderer->m_uPersistentTrackID, (IHXRenderer*)pLSG, NULL, pProps); } else if (m_pPlayer) { IHXLayoutSiteGroupManager* pLSGMgr = 0; if(HXR_OK == m_pPlayer->QueryInterface(IID_IHXLayoutSiteGroupManager, (void**)&pLSGMgr)) { rc = pLSGMgr->AddLayoutSiteGroup(pLSG); pLSGMgr->Release(); } } HX_RELEASE(pProps); return rc;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -