连接ffdshow Video Decoder失败
一直执行添加Filter的操作都是成功的,但不知道为什么到了添加ffdshow Video Decoder时就出错了,即添加不成功!希望高手帮忙解决下!
//添加Capture Filter
hr = AddFilterByName(mGraph,CLSID_VideoInputDeviceCategory,wt,L"USB 视频设备",&pCap);
if (FAILED(hr))
{
AfxMessageBox("Can not add Capture Filter!");
return false;
}
//添加Infinite Pin Tee Filter
IBaseFilter *pInfinitePinTee;
hr = AddFilterByName(mGraph,CLSID_LegacyAmFilterCategory,L"Infinite Pin Tee Filter",L"Infinite Pin Tee Filter",&pInfinitePinTee);
if (FAILED(hr))
{
AfxMessageBox("Can not add Infinite Pin Tee Filter!");
return false;
}
//连接Capture Filter和Infinite Pin Tee Filter
//获取Capture Filter的捕获引脚
IPin *pCaptureOut = NULL;
pCaptureOut = GetOutPin(pCap,0);
if (FAILED(hr))
{
AfxMessageBox("Can not get Capture Filter capture Output pin!");
return false;
}
hr = ConnectFilters(mGraph,pCaptureOut,pInfinitePinTee);
if (FAILED(hr))
{
AfxMessageBox("Can not connect Capture Filter with Infinite Pin Tee Filter!");
return false;
}
//添加ffdshow Video Decoder Filter
IBaseFilter *pffdshowVdeoDecoder;
hr = AddFilterByName(mGraph,CLSID_LegacyAmFilterCategory,L"ffdshow Video Decoder",L"ffdshow Video Decoder",&pffdshowVdeoDecoder);
if (FAILED(hr))
{
AfxMessageBox("Can not add ffdshow Video Decoder Filter!");
return false;
}