Tech Support > Computers & Technology > Programming > [DirectShow]How to connect filter?
[DirectShow]How to connect filter?
Posted by Litwin on September 13th, 2003


I'm writing my own transform filter derived from CTransformFilter ( using
DX8.1, WinXP).
I've connect (with GraphEdit) it to the MPEG video decoder, but I can't
connect the output pin of my filter to the video renderer ("filters cannot
agree on a connection"). I suppose that my function GetMediaType() is bad.
I've copied it from the sample filter Contrast:

HRESULT CMyFilter::GetMediaType(int iPosition, CMediaType *pMediaType)
{

// Is the input pin connected

if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}

// This should never happen

if (iPosition < 0) {
return E_INVALIDARG;
}

// Do we have more items to offer

if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}

*pMediaType = m_pInput->CurrentMediaType();
return NOERROR;
}

Its' my structure AMOVIESETUP_MEDIATYPE:

const AMOVIESETUP_MEDIATYPE sudPinTypes =
{
&MEDIATYPE_Video, // Major type
&MEDIASUBTYPE_NULL // Minor type
};

Anybody can help me?

Litwin