資源描述:
《根據(jù)clsid取得取得filter》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫。
1、CoInitialize(NULL);????HRESULThr;????IGraphBuilder*pGraphBuilder=NULL;????CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC,IID_IGraphBuilder,(void**)&pGraphBuilder);????IBaseFilter*????pMpeg4PSFileStream;????IBaseFilter*????pMpegDemuxFilter;????IBaseFilter*????pMpeg4VideoDecoder;????IBas
2、eFilter*????pOverlayMaxer2;????IBaseFilter*????pVideoRenderer;????????hr=CoCreateInstance(CLSID_Mpeg4PSFileStream,NULL,CLSCTX_INPROC_SERVER,IID_IBaseFilter,(void**)&pMpeg4PSFileStream);????if(FAILED(hr))??????AfxMessageBox("errcreateCLSID_Mpeg4PSFileStream");????hr=CoCreateInstance(CLSID_Mpeg
3、DemuxFilter,NULL,CLSCTX_INPROC_SERVER,IID_IBaseFilter,(void**)&pMpegDemuxFilter);????if(FAILED(hr))??????AfxMessageBox("errcreateCLSID_MpegDemuxFilter");????hr=CoCreateInstance(CLSID_Mpeg4VideoDecoder,NULL,CLSCTX_INPROC_SERVER,IID_IBaseFilter,(void**)&pMpeg4VideoDecoder);????if(FAILED(hr))???
4、???AfxMessageBox("errcreateCLSID_Mpeg4VideoDecoder");????hr=CoCreateInstance(CLSID_OverlayMaxer2,NULL,CLSCTX_INPROC_SERVER,IID_IBaseFilter,(void**)&pOverlayMaxer2);????if(FAILED(hr))??????AfxMessageBox("errcreateCLSID_OverlayMaxer2");????hr=CoCreateInstance(CLSID_VideoRenderer,NULL,CLSCTX_INP
5、ROC_SERVER,IID_IBaseFilter,(void**)&pVideoRenderer);????if(FAILED(hr))??????AfxMessageBox("errcreateCLSID_VideoRenderer");????pGraphBuilder->AddFilter(pMpeg4PSFileStream????,NULL);????pGraphBuilder->AddFilter(pMpegDemuxFilter????,NULL);????pGraphBuilder->AddFilter(pMpeg4VideoDecoder,NULL);???
6、?pGraphBuilder->AddFilter(pOverlayMaxer2????,NULL);????pGraphBuilder->AddFilter(pVideoRenderer????,NULL);????//setthesourcefile????IFileSourceFilter*pLoader;????pMpeg4PSFileStream->QueryInterface(IID_IFileSourceFilter,(void**)&pLoader);????hr=pLoader->Load(L"E:\temp\mpeg4_ps.mpg",NULL);????
7、if(FAILED(hr))??????AfxMessageBox("裝載文件出錯(cuò)!");????//connectfilter????char*strPinName=newchar;????IEnumPins*????EnumPins;????IPin*????????OutPin;????IPin*????????InPin;????ULONG????????fetched;????PIN_INFO????pinfo;????????????//findsourceoutpu