AddFilter Problem



Hi all
To play a mms stream I implemented a player using DirectShow. It
plays well when I give proper URL. But for some url/invalid url,
AddFilter doesn't return immediately.


What should I do to return immediately from AddFilter?????

any help ???

IBaseFilter *pSource = NULL;

IFileSourceFilter *pSFilter = NULL;

IEnumPins *pEnum = NULL;
IPin *pPin = NULL;
PIN_DIRECTION PinDirThis;

CoCreateInstance(CLSID_WMAsfReader, NULL, CLSCTX_INPROC_SERVER,
IID_IFileSourceFilter, (void**)(&pSFilter));

wchar_t wcstr[1024];

mbstowcs(wcstr, mrl.c_str(), 1024);

HRESULT hr = pSFilter->Load(L"URL", NULL);

if (FAILED(hr))
return false;

hr = pSFilter->QueryInterface(IID_IBaseFilter, (void**)(&pSource));

hr = m_Graph->AddFilter(pSource, L"Asf Source Filter");

if (FAILED(hr))
return false;

pSource->EnumPins(&pEnum);

while(pEnum->Next(1, &pPin, 0) == S_OK)
{
pPin->QueryDirection(&PinDirThis);

if (PINDIR_OUTPUT == PinDirThis)
{
hr = m_Graph->Render(pPin);
if (FAILED(hr))
{
return false;
}
}

pPin->Release();
}
.