DirectShow Source Filter Connection Error 0x8004022F
-
Trying to build my own source filter (AVI format) I always get connection error with AVI Splitter. Please take in mind that I am trying to open a fully functional avi video file, that works just fine with microsoft's async file and I that tried at the very begginng to change my mediatype declaration without success. The error description in the graphEdit is "These filters cannot agree on connection. Verify type compatibility of input pin and output pin. Return code VFW_E_INVALID_FILE_FORMAT 0x8004022F". DXerr.exe reports : HRESULT: 0x80040207 (2147746311) Name: DIERR_NOTBUFFERED VFW_E_NO_ACCEPTABLE_TYPES Description: Attempted to read buffered device data from a device that is not buffered. & There is no common media type between these pins. Severity code: Failed Facility Code: FACILITY_ITF (4) Error Code: 0x0207 (519) My mediatype is declared as :
const AMOVIESETUP_MEDIATYPE sudOpPinTypes =
{
&MEDIATYPE_Stream,
&MEDIASUBTYPE_NULL
};I debugged the code and I found that somewhere in the
HRESULT CBasePin::AgreeMediaType(IPin *pReceivePin, const CMediaType *pmt)
inside the amfilter.cpp is gettings first the AVI Splitter's MediaType list with the folowing code :
hr = pReceivePin->EnumMediaTypes(&pEnumMediaTypes);
Ok with that. Then it tries all mediatypes inside the method
HRESULT CBasePin::TryMediaTypes(IPin *pReceivePin, __in_opt const CMediaType *pmt, IEnumMediaTypes *pEnum)
by retriving them one by one with the following statement
hr = pEnum->Next(1, (AM_MEDIA_TYPE**)&pMediaType,&ulMediaCount);
At this point, the hr result returns S_FALSE and the pMediaType is undefined. The error code is 0x8004022f error code VFW_E_INVALID_FILE_FORMAT So the AVISplitter does not purpose any right ? Now the code beggins to scan my own source filter mediatype list. Despite the fact that I declared 2 or 3 different mediatypes it returns only one and it fails at
hr = AttemptConnection(pReceivePin, pMediaType);
and specifically at
hr = pReceivePin->ReceiveConnection((IPin *)this, pmt);
What am I doing wrong ? I suspect my MediaType declaration, but i dont see anything wrong. Below I attach the filter's template declarations with only one mediatype.
const WCHAR szAsyncFile[] = L"Async Source (File)";
const WC