Discussion:
Exception after EnumPins
(too old to reply)
Benjamin Sonnemann
2010-01-19 21:19:10 UTC
Permalink
Hi i have following code:


----------------------

HRESULT hr = _graphBuilder->RenderFile(fileName(), NULL);

hr = _graphBuilder->QueryInterface(IID_IVideoWindow, (void**)
&_videoWindow);
if(hr == S_OK){
FILTER_INFO filterInfo;
_debugLog << "\tQuery info: ";
hr = _videoWindow->QueryFilterInfo(&filterInfo);
_debugLog << "\t\t" <<(hr == S_OK ? "SUCCESS" : "FAILURE");
_debugLog << "\t" << std::wstring(filterInfo.achName);
}else{
_debugLog << "\tFAILURE!";
return -1;
}
reconnectVideoOutput();

-------------

and in reconnectVideoOutput i do :

------------
IEnumPins* pins;
if(_videoWindow->EnumPins(&pins) != S_OK){
return -1;
}else{
_debugLog() << "\t\t\t Start enumerating:";
}

while(pins->Next(1, &videoInPin, &fetched) == S_OK){
//is never reached :(
}

-------------

_videoWindow is a class member of type IBaseFilter*

My problem now is, every call returns S_OK, but when Next on pins is
called, i get an Access violation reading location 0xwhatever.
I honestly dont know whats wrong here.
Benjamin Sonnemann
2010-01-19 21:45:42 UTC
Permalink
Post by Benjamin Sonnemann
----------------------
    HRESULT hr = _graphBuilder->RenderFile(fileName(), NULL);
    hr = _graphBuilder->QueryInterface(IID_IVideoWindow, (void**)
&_videoWindow);
    if(hr == S_OK){
        FILTER_INFO filterInfo;
       _debugLog << "\tQuery info: ";
        hr = _videoWindow->QueryFilterInfo(&filterInfo);
       _debugLog << "\t\t" <<(hr == S_OK ? "SUCCESS" : "FAILURE");
       _debugLog  << "\t" << std::wstring(filterInfo.achName);
    }else{
       _debugLog << "\tFAILURE!";
       return -1;
    }
    reconnectVideoOutput();
-------------
------------
    IEnumPins* pins;
    if(_videoWindow->EnumPins(&pins) != S_OK){
        return -1;
    }else{
       _debugLog() << "\t\t\t Start enumerating:";
    }
    while(pins->Next(1, &videoInPin, &fetched) == S_OK){
//is never reached :(
    }
-------------
_videoWindow is a class member of type IBaseFilter*
My problem now is, every call returns S_OK, but when Next on pins is
called, i get an Access violation reading location 0xwhatever.
I honestly dont know whats wrong here.
Nevermind, after plaiyng around for 4hours and posting a usenet post i
found the porblem:

IVideoWindow* vidWindow;
hr = _graphBuilder->QueryInterface(IID_IVideoWindow, (void**)
&vidWindow);
hr = vidWindow->QueryInterface(IID_IBaseFilter, &_videoWindow);
vidWindow->Release();

This works!

Loading...