v***@gmail.com
2006-10-17 09:14:02 UTC
Hi
I have written a demux filter for a custom file format, along with
corresponding transform filters. I am using File Async filter as source
filter. All the filters work fine when I choose the file of correct
format.
However, when I select a file of different format, even then my demux
filter is being selected.
MyDemuxInputPin::CheckMediaType returns error 2 times but I don't
understand how, the third time it returns S_OK.
Please let me know if you have any hint as to what's happening. I have
appended main function snippets below...
STDMETHODIMP MyDemuxInputPin::ReceiveConnection(
IPin *pConnector,
const AM_MEDIA_TYPE *pmt
)
{
return CBaseInputPin::ReceiveConnection(pConnector, pmt);
}
HRESULT MyDemuxInputPin::CheckMediaType(const CMediaType* pmt)
{
CAutoLock lock(m_pLock);
// I get media type and sub type from pmt
const GUID* pType = pmt->Type();
const GUID* pSubType = pmt->Subtype();
if(*pType == MEDIATYPE_Stream && *pSubType == MEDIASUBTYPE_MYTYPE)
return S_OK;
else
return E_FAIL;
}
HRESULT MyDemuxInputPin::GetMediaType(int iPosition, CMediaType*
pMediaType)
{
//check for iPosition here...
if(iPosition == 0)
{
pMediaType->SetType(&MEDIATYPE_Stream);
pMediaType->SetSubtype(&MEDIASUBTYPE_MYTYPE);
}
return S_OK;
Thanks,
Vikram
I have written a demux filter for a custom file format, along with
corresponding transform filters. I am using File Async filter as source
filter. All the filters work fine when I choose the file of correct
format.
However, when I select a file of different format, even then my demux
filter is being selected.
MyDemuxInputPin::CheckMediaType returns error 2 times but I don't
understand how, the third time it returns S_OK.
Please let me know if you have any hint as to what's happening. I have
appended main function snippets below...
STDMETHODIMP MyDemuxInputPin::ReceiveConnection(
IPin *pConnector,
const AM_MEDIA_TYPE *pmt
)
{
return CBaseInputPin::ReceiveConnection(pConnector, pmt);
}
HRESULT MyDemuxInputPin::CheckMediaType(const CMediaType* pmt)
{
CAutoLock lock(m_pLock);
// I get media type and sub type from pmt
const GUID* pType = pmt->Type();
const GUID* pSubType = pmt->Subtype();
if(*pType == MEDIATYPE_Stream && *pSubType == MEDIASUBTYPE_MYTYPE)
return S_OK;
else
return E_FAIL;
}
HRESULT MyDemuxInputPin::GetMediaType(int iPosition, CMediaType*
pMediaType)
{
//check for iPosition here...
if(iPosition == 0)
{
pMediaType->SetType(&MEDIATYPE_Stream);
pMediaType->SetSubtype(&MEDIASUBTYPE_MYTYPE);
}
return S_OK;
Thanks,
Vikram