<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fooling Around &#187; ffdshow</title>
	<atom:link href="http://alax.info/blog/tag/ffdshow/feed" rel="self" type="application/rss+xml" />
	<link>http://alax.info/blog</link>
	<description>// Software Production Line</description>
	<lastBuildDate>Wed, 02 May 2012 15:42:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Yet another time about FFDShow</title>
		<link>http://alax.info/blog/841</link>
		<comments>http://alax.info/blog/841#comments</comments>
		<pubDate>Tue, 17 Feb 2009 22:12:23 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[AVI]]></category>
		<category><![CDATA[crap]]></category>
		<category><![CDATA[ffdshow]]></category>
		<category><![CDATA[resource]]></category>
		<category><![CDATA[rle]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=841</guid>
		<description><![CDATA[<a href="http://alax.info/blog/841" title="Yet another time about FFDShow"></a>While new NTFS Links propery page is looking for contained junction points, it shows an animated picture to indicate opertation in progress. The picture is a stock resource and is taken from shell32.dll resource type &#8220;AVI&#8221; name 150. It is &#8230;<p class="read-more"><a href="http://alax.info/blog/841">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/841" title="Yet another time about FFDShow"></a><p>While new <a href="http://alax.info/blog/ntfslinks">NTFS Links</a> propery page is looking for contained junction points, it shows an animated picture to indicate opertation in progress. The picture is a stock resource and is taken from <em>shell32.dll</em> resource type &#8220;AVI&#8221; name 150. It is an <a href="http://en.wikipedia.org/wiki/Audio_Video_Interleave">Audio Video Interleave (AVI)</a> file embedded into binary resources as is.</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2009/02/17-image011.png"><img class="alignnone size-medium wp-image-842" title="Alax.Info NTFS Links Junction Points Property Page in Operation" src="http://alax.info/blog/wp-content/uploads/2009/02/17-image011-219x300.png" alt="Alax.Info NTFS Links Junction Points Property Page in Operation" width="219" height="300" /></a></p>
<p>What is however interesting is that being saved as a file and double-clicked, it appeared to be crashing the player process. What might go wrong with a stock resource, is it <a href="http://sourceforge.net/projects/ffdshow">FFDShow</a> again? This was the first guess and yes, it was FFDShow again. This is a &#8220;video only&#8221; file with video encoded with MS-RLE compression, FOURCC &#8216;RLE &#8216;. Microsoft provides a <a href="http://msdn.microsoft.com/en-us/library/ms713467(VS.85).aspx">VCM</a> codec for the format through <em>msrle32.dll</em>.</p>
<p>However, as already discovered, <a href="http://sourceforge.net/projects/ffdshow">FFDShow</a> register itself under extremely high merit and for this reason is preferred as a video decoder and attempts to handle the decompression itself. But it fails, and miserably enough to crash the hosting process.</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2009/02/17-image012.png"><img class="alignnone size-medium wp-image-843" title="FFDShow Crash" src="http://alax.info/blog/wp-content/uploads/2009/02/17-image012-300x179.png" alt="FFDShow Crash" width="300" height="179" /></a></p>
<p>The registration under unfairly high merit defeats the purpose of DirectShow&#8217;s powerful <a href="http://msdn.microsoft.com/en-us/library/dd390342(VS.85).aspx">Intelligent Connect</a> approach. &#8220;Why do you need a video decoder? You have <a href="http://sourceforge.net/projects/ffdshow">FFDShow</a> Video Decoder, forget about the others. Oops, sorry, I don&#8217;t like your file.&#8221;</p>
<p>Is there any way to stop the villain? Of course, there is.</p>
<p><span id="more-841"></span>To start, I tried to disable the decoder through <a href="http://sourceforge.net/projects/ffdshow">FFDShow</a> Video Decoder native interface and give it a last chance. Video decoder offers decoding properties to choose from, and it looked as if it can stop serving as decoder for the mentioned video format.</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2009/02/17-image013.png"><img class="alignnone size-medium wp-image-844" title="FFDShow Video Decoder Properties" src="http://alax.info/blog/wp-content/uploads/2009/02/17-image013-300x251.png" alt="FFDShow Video Decoder Properties" width="300" height="251" /></a></p>
<p>Still with the disabled settings, it kept unsuccessful attempts to decode and process crashes. So another workaround, and it is in fact a proper one, which should be done from the start (and I would also prefer that it was done by FFDShow itself), is to lower decoder&#8217;s merit to a level at which it would honor specialized decoders so that <a href="http://msdn.microsoft.com/en-us/library/dd390342(VS.85).aspx">Intelligent Connect</a> could fall back to <a href="http://sourceforge.net/projects/ffdshow">FFDShow</a> in case there is no bettter alternative. <a href="http://msdn.microsoft.com/en-us/library/dd388793(VS.85).aspx">MERIT_UNLIKELY</a> seems to be a good one for this codec:</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2009/02/17-image014.png"><img class="alignnone size-medium wp-image-845" title="Updated FFDShow Video Decoder Merit" src="http://alax.info/blog/wp-content/uploads/2009/02/17-image014-300x188.png" alt="Updated FFDShow Video Decoder Merit" width="300" height="188" /></a></p>
<p>This fixes the issue by letting <a href="http://msdn.microsoft.com/en-us/library/dd375454(VS.85).aspx">DirectShow</a> choose stock video decoder for MS RLE video encoding.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/841/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>FFDShow strikes back</title>
		<link>http://alax.info/blog/719</link>
		<comments>http://alax.info/blog/719#comments</comments>
		<pubDate>Mon, 24 Nov 2008 16:16:29 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Seriously]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[crap]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[ffdshow]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=719</guid>
		<description><![CDATA[<a href="http://alax.info/blog/719" title="FFDShow strikes back"></a>FFDShow is already known for it issues (including for example mentioned one). Today&#8217;s featured one is related to its Video Decoder. A great deal of FFDShow related issues amy be worked around with a single shot by listing the image &#8230;<p class="read-more"><a href="http://alax.info/blog/719">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/719" title="FFDShow strikes back"></a><p><a href="http://sourceforge.net/projects/ffdshow">FFDShow</a> is already known for it issues (including for example <a href="http://alax.info/blog/398">mentioned one</a>). Today&#8217;s featured one is related to its Video Decoder. A great deal of FFDShow related issues amy be worked around with a single shot by listing the image name as an FFDShow exclusion under registry:</p>
<pre>HKEY_CURRENT_USER\Software\GNU\ffdshow; blacklist</pre>
<p>but I felt relaxed and the problem re-occurred from Windows service where HKEY_CURRENT_USER was not available/applicable.</p>
<p>FFDShow Video Decoder registration looks like:</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2008/11/24-image001.png"><img class="alignnone size-full wp-image-720" title="FFDSHOW Video Decoder Registation" src="http://alax.info/blog/wp-content/uploads/2008/11/24-image001.png" alt="" width="450" height="530" /></a></p>
<p>It is immediately clear that the filter registered with extremely (and definitely unreasonably, <a href="http://msdn.microsoft.com/en-us/library/ms783757(VS.85).aspx">breaking guidelines</a>) high merit in conjunction with generic video media type will be taken as a possible decoder in every single graph rendered. At the very least, this is a perofrmance issue, similar to frequently reported like this recent one: <a href="http://groups.google.com/group/microsoft.public.win32.programmer.directx.video/browse_thread/thread/a14756925dff15e5#"><span id="thread_subject_site">How to reduce time during pin connection on vista ultimate using RenderStream function&#8230;?</span></a>.</p>
<p>However the real problem was that the filter was accepting connection on my source pin and pretending it could be a valid decoder instead my own one (definitely registered with a proper merit of 0×00800000 (MERIT_PREFERRED). Did it actually decode? No, just sent blackness on the output&#8230; It seems that it is getting a good manner to distance from this crapware by implementing <a href="http://msdn.microsoft.com/en-us/library/ms783952%28VS.85%29.aspx">IAMGraphBuilderCallback</a> interface on the graph builder site and reject consideration of FFDShow A/V Decoders as candidates.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/719/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FFDShow is getting more annoying</title>
		<link>http://alax.info/blog/398</link>
		<comments>http://alax.info/blog/398#comments</comments>
		<pubDate>Fri, 27 Jun 2008 04:02:05 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[ATL]]></category>
		<category><![CDATA[Audio]]></category>
		<category><![CDATA[Seriously]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[ffdshow]]></category>
		<category><![CDATA[merit]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=398</guid>
		<description><![CDATA[<a href="http://alax.info/blog/398" title="FFDShow is getting more annoying"></a>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 &#8230;<p class="read-more"><a href="http://alax.info/blog/398">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/398" title="FFDShow is getting more annoying"></a><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>
<blockquote><p>Display Name: @device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\{0F40E1E5-4F79-4988-B1A9-CC98794E6B55}<br />
CLSID: {0F40E1E5-4F79-4988-B1A9-CC98794E6B55}<br />
Friendly Name: ffdshow Audio Decoder<br />
Path: C:\Program Files\K-Lite Codec Pack\ffdshow\ffdshow.ax<br />
<strong>Merit: 0x3fffffff</strong></p></blockquote>
<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>
<blockquote><p>MERIT_PREFERRED     = 0&#215;800000,<br />
MERIT_NORMAL        = 0&#215;600000,<br />
&#8230;<br />
MERIT_HW_COMPRESSOR = 0&#215;100050</p></blockquote>
<p>The highest defined value is 0&#215;00800000, 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>
<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>
<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>
<p><span id="more-398"></span></p>
<p>Luckily it is much easier than it may seem:</p>
<blockquote><p>CComQIPtr&lt; IObjectWithSite &gt; pObjectWithSite = pGraphBuilder;<br />
__D(pObjectWithSite, E_NOINTERFACE);<br />
CObjectPtr&lt; CAmGraphBuilderCallback &gt; pAmGraphBuilderCallback;<br />
pAmGraphBuilderCallback.Construct();<br />
__C(pObjectWithSite-&gt;SetSite(pAmGraphBuilderCallback));<br />
__C(pGraphBuilder-&gt;Render(_FilterGraphHelper::GetFilterPin(pSourceBaseFilter, PINDIR_OUTPUT)));<br />
__C(pObjectWithSite-&gt;SetSite(NULL));</p></blockquote>
<p>CAmGraphBuilderCallback is active between SetSite calls and it is sufficient to throw ffdshow Audio Decoder away.</p>
<p>Partial (some header files are excluded) Visual C++.NET 2005 source code can be downloaded <a href="http://alax.info/blog/wp-content/uploads/2008/06/rejectspecificdirectshowfilter01.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/398/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

