請問DShow播放影片的問題?
原本的功能已經在Console Mode成功播放影片了
目前想做出視窗版本的播放介面
但現在透過Dialog將影片抓進來後播放都只有聲音沒有畫面
想請問一下可能發生的原因?
變數:
m_pGraph -> IGraphBiluder
m_pControl -> IMediaControl
m_pVedioWindow ->IVideoWindow
m_hDlgWnd ->一個Picture Control的HWND(CStatic)
m_lpFilePath -> 播放影片檔名
m_rectScreenSize -> Picture Control的大小(CStatic)
程式碼
//透過m_pGraph Render影片
HRESULT hr = m_pGraph->RenderFile(m_lpFilePath, NULL);
m_pControl->StopWhenReady();
if(SUCCEEDED(hr))
{
hr = m_pVedioWindow->put_Owner((OAHWND)m_hDlgWnd);
hr = m_pVedioWindow->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS );
hr = m_pVedioWindow->SetWindowPosition(0, 0, m_rectScreenSize.right,
m_rectScreenSize.bottom);
m_pControl->Run();
}
//上面這段程式碼若沒有加入m_pVedioWindow的控制的話,是可以順利播放影片的
但增加了m_pVedioWindow後,播出的影片就只有聲音
我曾將m_pVedioWindow->put_Owner(NULL), 這就是順利將影片貼到桌面上播出
我想這大概就是因為我把影片貼到CStatic失敗,但是我不知道該如何正確的將
影片貼到可以播出的元件上??
// 我最主要想要做出的效果是透過Dlg開啟檔案後,播出畫面會和MediaPlayer
類似下面會有control bar上面有影片,所以我查了網路是IVideoWindow方式
請問有相關經驗的網友可以幫我解決問題嗎?多謝各位!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.115.116.245
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章