向c++高手求教,应该是关于指针的问题,万分感谢!!
我做的是directshow自己添加Filter实现视频回放,程序调试时总出现如下错误:代码是在太长只能粘贴调试时提示有问题的部分了,调试时黄色箭头指向这一句:HRESU...
我做的是directshow自己添加Filter实现视频回放,程序调试时总出现如下错误:
代码是在太长只能粘贴调试时提示有问题的部分了,调试时黄色箭头指向这一句:HRESULT hr = pFilter->EnumPins(&pEnum);
下面是这句代码附近的:
HRESULT GetUnconnectedPin(
IBaseFilter *pFilter, // Pointer to the filter.
PIN_DIRECTION PinDir, // Direction of the pin to find.
IPin **ppPin=NULL
)
//pFilter=(IBaseFilter *)new(sizeof(IBaseFilter)) // Receives a pointer to the pin.
{
IEnumPins *pEnum = 0;
IPin *pPin = 0;
HRESULT hr = pFilter->EnumPins(&pEnum);
if (FAILED(hr))
{
return hr;
}
while (pEnum->Next(1, &pPin, NULL) == S_OK)
{
PIN_DIRECTION ThisPinDir;
pPin->QueryDirection(&ThisPinDir);
if (ThisPinDir == PinDir)
{
IPin *pTmp = 0;
hr = pPin->ConnectedTo(&pTmp);
if (SUCCEEDED(hr)) // Already connected, not the pin we want.
{
pTmp->Release();
}
else // Unconnected, this is the pin we want.
{
pEnum->Release();
*ppPin = pPin;
return S_OK;
}
}
pPin->Release();
}
pEnum->Release();
// Did not find a matching pin.
return E_FAIL;
}
实在不知道怎么把代码调通了,菜鸟求教啊。。等待大神的回复。。 展开
代码是在太长只能粘贴调试时提示有问题的部分了,调试时黄色箭头指向这一句:HRESULT hr = pFilter->EnumPins(&pEnum);
下面是这句代码附近的:
HRESULT GetUnconnectedPin(
IBaseFilter *pFilter, // Pointer to the filter.
PIN_DIRECTION PinDir, // Direction of the pin to find.
IPin **ppPin=NULL
)
//pFilter=(IBaseFilter *)new(sizeof(IBaseFilter)) // Receives a pointer to the pin.
{
IEnumPins *pEnum = 0;
IPin *pPin = 0;
HRESULT hr = pFilter->EnumPins(&pEnum);
if (FAILED(hr))
{
return hr;
}
while (pEnum->Next(1, &pPin, NULL) == S_OK)
{
PIN_DIRECTION ThisPinDir;
pPin->QueryDirection(&ThisPinDir);
if (ThisPinDir == PinDir)
{
IPin *pTmp = 0;
hr = pPin->ConnectedTo(&pTmp);
if (SUCCEEDED(hr)) // Already connected, not the pin we want.
{
pTmp->Release();
}
else // Unconnected, this is the pin we want.
{
pEnum->Release();
*ppPin = pPin;
return S_OK;
}
}
pPin->Release();
}
pEnum->Release();
// Did not find a matching pin.
return E_FAIL;
}
实在不知道怎么把代码调通了,菜鸟求教啊。。等待大神的回复。。 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询