End Google Ads 201810 - BS.net 01 --> 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 MediaType list of my own Source Filter 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 I get the error. The hr result returns S_FALSE and the pMediaType is undefined. The error code is

0x8004022f error code
VFW_E_INVALID_FILE_FORMAT

What am I doing wrong ? It seems that my mediatype is empty. The code above should at least return S_OK and pMediaType filled with the appropriate values, and then to try to Attempt the Connection and in the case that is not compatible with the AVI Splitter's input pin, then it should fail.

I suspect my MediaType declaration, but i dont see anything wrong. Below I attach the filter's template declarations.

const WCHAR szAsyncFile[] = L"Async Source (File)"; const WCHAR szAsyncHttp[] = L"Async Source (Http)"; // // Setup data for filter registration // const AMOVIESETUP_MEDIATYPE sudOpPinTypes = { &MEDIATYPE_Stream, &MEDIASUBTYPE_NULL }; const AMOVIESETUP_PIN sudOpPin = { L"Output", // String pin name FALSE, // Is it rendered TRUE, // Is it an output FALSE, // Allowed none FALSE, // Allowed many &CLSID_NULL, // Connects to filter L"Input", // Connects to pin 1, // Number of types &sudOpPinTypes // The pin details }; const AMOVIESETUP_FILTER sudAsyncFile = { &CLSID_PIAsyncFile, // clsID szAsyncFile, // strName MERIT_UNLIKELY, // dwMerit 1, // nPins &sudOpPin // lpPin }; const AMOVIESETUP_FILTER sudAsyncHttp = { &CLSID_PIAsyncHttp, // clsID szAsyncHttp, // strName MERIT_UNLIKELY, // dwMerit 1, // nPins &sudOpPin // lpPin }; // // Object creation template // CFactoryTemplate g_Templates[] = { { szAsyncFile, &CLSID_PIAsyncFile, CAsyncFilter::CreateInstance, NULL, &sudAsyncFile }, { szAsyncHttp, &CLSID_PIAsyncHttp, CAsyncFilterHttp::CreateInstance, NULL, &sudAsyncHttp } }; int g_cTemplates = sizeof(g_Templates) / sizeof(CFactoryTemplate); sdancer75