{"id":398,"date":"2008-06-27T06:02:05","date_gmt":"2008-06-27T04:02:05","guid":{"rendered":"https:\/\/alax.info\/blog\/?p=398"},"modified":"2008-11-24T17:57:08","modified_gmt":"2008-11-24T15:57:08","slug":"ffdshow-is-getting-more-annoying","status":"publish","type":"post","link":"https:\/\/alax.info\/blog\/398","title":{"rendered":"FFDShow is getting more annoying"},"content":{"rendered":"<p>Surprisingly fast I got new problems having <a href=\"http:\/\/sourceforge.net\/projects\/ffdshow\">ffdshow<\/a> installed as a part of <a href=\"http:\/\/www.free-codecs.com\/download\/K_lite_codec_pack.htm\">K-Lite Codec Pack<\/a>. No wonder though because let us take a look at registration information:<\/p>\n<blockquote><p>Display Name: @device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\\{0F40E1E5-4F79-4988-B1A9-CC98794E6B55}<br \/>\nCLSID: {0F40E1E5-4F79-4988-B1A9-CC98794E6B55}<br \/>\nFriendly Name: ffdshow Audio Decoder<br \/>\nPath: C:\\Program Files\\K-Lite Codec Pack\\ffdshow\\ffdshow.ax<br \/>\n<strong>Merit: 0x3fffffff<\/strong><\/p><\/blockquote>\n<p>Nice merit, ain&#8217;t it? What is merit anyway? Let us check at <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms787275(VS.85).aspx\">MSDN<\/a>:<\/p>\n<blockquote><p>MERIT_PREFERRED     = 0x800000,<br \/>\nMERIT_NORMAL        = 0x600000,<br \/>\n&#8230;<br \/>\nMERIT_HW_COMPRESSOR = 0x100050<\/p><\/blockquote>\n<p>The highest defined value is 0x00800000, while ffdshow is registered with 0x3FFFFFFF, that is on top of everything. No doubt the developers read <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms783757(VS.85).aspx\">Guidelines for Registering Filters<\/a> and decided to get rid of the rest of installed software as unnecessary crap.<\/p>\n<p>Anyway back to the problem: I had an <a href=\"http:\/\/en.wikipedia.org\/wiki\/A-law_algorithm\">A-law<\/a> 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!<\/p>\n<p>Finally I decided it was a right time to take an advantage of <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms783952(VS.85).aspx\">IAMGraphBuilderCallback<\/a> interface to detect and reject the bastard.<\/p>\n<p><!--more--><\/p>\n<p>Luckily it is much easier than it may seem:<\/p>\n<blockquote><p>CComQIPtr&lt; IObjectWithSite &gt; pObjectWithSite = pGraphBuilder;<br \/>\n__D(pObjectWithSite, E_NOINTERFACE);<br \/>\nCObjectPtr&lt; CAmGraphBuilderCallback &gt; pAmGraphBuilderCallback;<br \/>\npAmGraphBuilderCallback.Construct();<br \/>\n__C(pObjectWithSite-&gt;SetSite(pAmGraphBuilderCallback));<br \/>\n__C(pGraphBuilder-&gt;Render(_FilterGraphHelper::GetFilterPin(pSourceBaseFilter, PINDIR_OUTPUT)));<br \/>\n__C(pObjectWithSite-&gt;SetSite(NULL));<\/p><\/blockquote>\n<p>CAmGraphBuilderCallback is active between SetSite calls and it is sufficient to throw ffdshow Audio Decoder away.<\/p>\n<p>Partial (some header files are excluded) Visual C++.NET 2005 source code can be downloaded <a href=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2008\/06\/rejectspecificdirectshowfilter01.zip\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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: 0x3fffffff Nice merit, ain&#8217;t it? What is merit anyway? Let us&hellip; <\/p>\n<p><a class=\"moretag\" href=\"https:\/\/alax.info\/blog\/398\">Read the full article<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,6,21,13],"tags":[487,485,78,79,91,488],"class_list":["post-398","post","type-post","status-publish","format-standard","hentry","category-atl","category-audio","category-seriously","category-source","tag-atl","tag-audio","tag-directshow","tag-ffdshow","tag-merit","tag-source"],"_links":{"self":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/398","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/comments?post=398"}],"version-history":[{"count":0,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/398\/revisions"}],"wp:attachment":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/media?parent=398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/categories?post=398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/tags?post=398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}