Published by Roman on 27 Jun 2008 at 06:02 am
FFDShow is getting more annoying
Surprisingly fast I got new problems having ffdshow installed as a part of K-Lite Codec Pack. No wonder though because let us take a look at registration information:
Display Name: @device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\{0F40E1E5-4F79-4988-B1A9-CC98794E6B55}
CLSID: {0F40E1E5-4F79-4988-B1A9-CC98794E6B55}
Friendly Name: ffdshow Audio Decoder
Path: C:\Program Files\K-Lite Codec Pack\ffdshow\ffdshow.ax
Merit: 0×3fffffff
Nice merit, ain’t it? What is merit anyway? Let us check at MSDN:
MERIT_PREFERRED = 0×800000,
MERIT_NORMAL = 0×600000,
…
MERIT_HW_COMPRESSOR = 0×100050
The highest defined value is 0×00800000, while ffdshow is registered with 0×3FFFFFFF, that is on top of everything. No doubt the developers read Guidelines for Registering Filters and decided to get rid of the rest of installed software as unnecessary crap.
Anyway back to the problem: I had an A-law wave file (WAVE_FORMAT_ALAW) to play and make sure its data is valid and quite unexpectedly there was a silence while playing. A quick check confirmed that the sustem has CCITT A-law codec installed, however GraphEdit shown ffdshow Audio Decoder intercepting decoding. Obviously it spoiled the thing!
Finally I decided it was a right time to take an advantage of IAMGraphBuilderCallback interface to detect and reject the bastard.
Luckily it is much easier than it may seem:
CComQIPtr< IObjectWithSite > pObjectWithSite = pGraphBuilder;
__D(pObjectWithSite, E_NOINTERFACE);
CObjectPtr< CAmGraphBuilderCallback > pAmGraphBuilderCallback;
pAmGraphBuilderCallback.Construct();
__C(pObjectWithSite->SetSite(pAmGraphBuilderCallback));
__C(pGraphBuilder->Render(_FilterGraphHelper::GetFilterPin(pSourceBaseFilter, PINDIR_OUTPUT)));
__C(pObjectWithSite->SetSite(NULL));
CAmGraphBuilderCallback is active between SetSite calls and it is sufficient to throw ffdshow Audio Decoder away.
Partial (some header files are excluded) Visual C++.NET 2005 source code can be downloaded here.
Leave a Reply
You must be logged in to post a comment.
