[問題] 自己加Filter在directshow中撥放影片

看板C_and_CPP作者 (飯糰丸)時間15年前 (2009/06/01 02:08), 編輯推噓0(005)
留言5則, 2人參與, 最新討論串1/1
大家好 我是新手 這禮拜開始學directshow的運作 只有看了些網站的資料跟MSDN 我是用Visual Studio 2005 目標是希望能夠開mov格式的檔案 我從網路上找到了一個免費的QuickTime source filter http://www.roguestream.com/quicktime_source_filter.html 這是官網 我下載了之後 開GraphEdit可以正常撥放mov影片 但是我想實作的時候 卻卡在無法取得輸出pin 也就無法把他丟給renderer撥放出來 我想請問是哪邊出了問題呢? 另外我還想問 如果我今天希望在別的電腦跑的時候 即使沒有裝這個Filter 也可以正常撥放 那我應該怎麼做呢? 非常感謝大家 ======以下是我的程式碼====== if (dlg.DoModal()==IDOK) { CString m_sourceFile = dlg.GetPathName(); IGraphBuilder *pGraph = NULL; IBaseFilter *pAddSource = NULL; IMediaControl *pControl = NULL; IMediaEvent *pEvent = NULL; IPin *pVideoPinOut = NULL; IPin *pAudioPinOut = NULL; //Initialize the COM libary HRESULT hr = CoInitialize(NULL); if (FAILED(hr)) { MessageBoxA(NULL, "Could not initialize COM library", "", NULL); return; } //Create the Filter Graph Manager hr=CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph); if (FAILED(hr)) { MessageBoxA(NULL, "Could not create the Filter Graph Manager.", "", NULL); return; } //Add an existing source filter hr = pGraph->AddSourceFilter(m_sourceFile, L"Rogue Stream QuickTime Source Filter", &pAddSource); if(SUCCEEDED(hr)) { //Try to get the output pin from the previous filter hr = pAddSource->FindPin(L"Video", &pVideoPinOut); if(FAILED(hr)) //程式會卡在這無法完成動作 { MessageBoxA(NULL, "Could not find the video pin.", "", NULL); return; } hr = pAddSource->FindPin(L"Audio", &pAudioPinOut); if(FAILED(hr)) { MessageBoxA(NULL, "Could not find the audio pin.", "", NULL); return; } //Get the interface of media control and media event hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl); hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent); //Directly render the data from the output pin hr = pGraph->Render(pVideoPinOut); if (SUCCEEDED(hr)) { hr = pControl->Run(); if (SUCCEEDED(hr)) { //Wait until the media is complete long evCode; pEvent->WaitForCompletion(INFINITE, &evCode); } } } //Release all the resources and COM libary pControl->Release(); pEvent->Release(); pGraph->Release(); CoUninitialize(); return; } -- ████████ ████████ █ █ ◥████████◤ █ █ ◥◣ ◢◤ █ █ ◥◣ ◢◤ █ █ ◥◣◢◤ █ █ ◥◤http://www.wretch.cc/album/MysterySW -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.166.102.57 ※ 編輯: MysterySW 來自: 218.166.102.57 (06/01 03:17)

06/01 10:03, , 1F
用IGraphBuilder::RenderFile看看吧...
06/01 10:03, 1F

06/01 10:05, , 2F
DirectShow是非常「使用者付費的」真不想用QT就找QT Alter
06/01 10:05, 2F

06/01 10:05, , 3F
native吧...
06/01 10:05, 3F

06/01 21:08, , 4F
突然發現自己是18000XD 用RederFile的話 不就失去我自
06/01 21:08, 4F

06/01 21:10, , 5F
己加SourceFilter的意義了? 不過我還是再試試看 真挫折
06/01 21:10, 5F
文章代碼(AID): #1A8iUHDr (C_and_CPP)