Media Player Classic - HC 源代码分析 3:核心类 (CMainFrame)(2)
上一篇文章分析了Media Player Classic - HC(mpc-hc)的源代码中的核心类 CMainFrame:Media Player Classic - HC 源代码分析 2:核心类 (CMainFrame)(1)
主要介绍了CMainFrame类中的以下几个函数(“->”代表调用关系):
OpenMedia()->OpenMediaPrivate()->OpenFile()
本文补充介绍CMainFrame类中的其他一些函数。
再回顾一下打开文件功能主要所在的函数OpenMediaPrivate():
//关闭void CMainFrame::CloseMediaPrivate(){ SetLoadState(MLS_CLOSING); // why it before OnPlayStop()? // TODO: remake or add detailed comments OnPlayStop(); // SendMessage(WM_COMMAND, ID_PLAY_STOP); if (m_pMC) { m_pMC->Stop(); // needed for StreamBufferSource, because m_iMediaLoadState is always MLS_CLOSED // TODO: fix the opening for such media } SetPlaybackMode(PM_NONE); m_fLiveWM = false; m_fEndOfStream = false; m_rtDurationOverride = -1; m_kfs.RemoveAll(); m_pCB.Release(); { CAutoLock cAutoLock(&m_csSubLock); m_pSubStreams.RemoveAll(); } m_pSubClock.Release(); //if (m_pVW) m_pVW->put_Visible(OAFALSE); //if (m_pVW) m_pVW->put_MessageDrain((OAHWND)NULL), m_pVW->put_Owner((OAHWND)NULL); // IMPORTANT: IVMRSurfaceAllocatorNotify/IVMRSurfaceAllocatorNotify9 has to be released before the VMR/VMR9, otherwise it will crash in Release() //各种清空m_OSD.Stop(); m_pCAP2.Release(); m_pCAP.Release(); m_pVMRWC.Release(); m_pVMRMC.Release(); m_pMFVP.Release(); m_pMFVDC.Release(); m_pLN21.Release(); m_pSyncClock.Release(); m_pAMXBar.Release(); m_pAMDF.Release(); m_pAMVCCap.Release(); m_pAMVCPrev.Release(); m_pAMVSCCap.Release(); m_pAMVSCPrev.Release(); m_pAMASC.Release(); m_pVidCap.Release(); m_pAudCap.Release(); m_pAMTuner.Release(); m_pCGB.Release(); m_pDVDC.Release(); m_pDVDI.Release(); m_pAMOP.Release(); m_pBI.Release(); m_pQP.Release(); m_pFS.Release(); m_pMS.Release(); m_pBA.Release(); m_pBV.Release(); m_pVW.Release(); m_pME.Release(); m_pMC.Release(); if (m_pGB) { m_pGB->RemoveFromROT(); m_pGB.Release(); } m_pProv.Release(); m_fRealMediaGraph = m_fShockwaveGraph = m_fQuicktimeGraph = false; m_VidDispName.Empty(); m_AudDispName.Empty(); m_closingmsg.LoadString(IDS_CONTROLS_CLOSED); AfxGetAppSettings().nCLSwitches &= CLSW_OPEN | CLSW_PLAY | CLSW_AFTERPLAYBACK_MASK | CLSW_NOFOCUS;//设置状态 SetLoadState(MLS_CLOSED);}