i have added a source filter to graph ,now i need to conect filters individually.
at first , i need to retrive the source filter output pins .
i used this funtion to enumerate the pin but at the pEnum->Next(1, &pPin, NULL)
the pEnum return S_FALSE.
but HRESULT hr = pFilter->EnumPins(&pEnum); the hr =S_OK.
i have no idea about this .may i have lose any thing before call this funtion
and i have tried another source filter (AVI/WAV File Source)in GetUnconnectedPin funtion but it fails again.
HRESULT GetUnconnectedPin(
IBaseFilter *pFilter, PIN_DIRECTION PinDir, IPin **ppPin) {
*ppPin = 0;
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)) {
pTmp->Release();
}
else {
pEnum->Release();
*ppPin = pPin;
return S_OK;
}
}
pPin->Release();
}
pEnum->Release();
return E_FAIL;
}
[EDIT] Added pre tags for better readability - Code-o-mat [/EDIT]