<?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; filter</title>
	<atom:link href="http://alax.info/blog/tag/filter/feed" rel="self" type="application/rss+xml" />
	<link>http://alax.info/blog</link>
	<description>// Software Production Line</description>
	<lastBuildDate>Fri, 03 Feb 2012 22:49:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>DirectShow Spy: Intelligent Connect Trace, Selective Process Black Listing</title>
		<link>http://alax.info/blog/1253</link>
		<comments>http://alax.info/blog/1253#comments</comments>
		<pubDate>Sun, 24 Jul 2011 18:55:47 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[intelligent connect]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[spy]]></category>
		<category><![CDATA[trace]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1253</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1253" title="DirectShow Spy: Intelligent Connect Trace, Selective Process Black Listing"></a>DirectShow Spy is updated with a few new features: retroactive Intelligent Connect trace log output for IAMGraphBuilderCallback-related activity process name based black list to selectively exclude processes from spying Intelligent Connect Trace The utility received a capability to read back &#8230;<p class="read-more"><a href="http://alax.info/blog/1253">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1253" title="DirectShow Spy: Intelligent Connect Trace, Selective Process Black Listing"></a><p>DirectShow Spy is updated with a few new features:</p>
<ul>
<li>retroactive Intelligent Connect trace</li>
<li>log output for IAMGraphBuilderCallback-related activity</li>
<li>process name based black list to selectively exclude processes from spying</li>
</ul>
<h4>Intelligent Connect Trace</h4>
<p>The utility received a capability to read back from its own log file (DirectShowSpy.log, located typically in C:\ProgramData directory) and reconstruct graph building sequence, including steps taken by DirectShow <a href="http://msdn.microsoft.com/en-us/library/dd390342%28VS.85%29.aspx">Intelligent Connect</a>.</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2011/07/Image0012.png"><img class="alignnone size-large wp-image-1254" title="Intelligent Connect Trace" src="http://alax.info/blog/wp-content/uploads/2011/07/Image0012-582x600.png" alt="" width="582" height="600" /></a></p>
<p>In order to activate the Intelligent Connect Trace property sheet, one needs to call exported function &#8220;<em>DoGraphBuilderCallbackPropertySheetModal</em>&#8220;, such as using <em>runndll32</em> tool:</p>
<p style="text-align: left; padding-left: 30px;">C:\DirectShowSpy&gt;rundll32 DirectShowSpy.dll,DoGraphBuilderCallbackPropertySheetModal</p>
<p style="text-align: left;">The upper part of the property page displays recently created DirectShow fitler graphs, newest to older. For a selected graph, the lower part displays events in chronological order. The events include:</p>
<ul>
<li>Adding a filter, at <a href="http://msdn.microsoft.com/en-us/library/dd390016%28VS.85%29.aspx">IFilterGraph2::AddFilter</a> method</li>
<li>Removing a filter, at <a href="http://msdn.microsoft.com/en-us/library/dd390022%28VS.85%29.aspx">IFilterGraph2::RemoveFilter</a> method</li>
<li>Selecting a filter, at Intelligent Connect&#8217;s callback at <a href="http://msdn.microsoft.com/en-us/library/dd389378%28VS.85%29.aspx">IAMGraphBuilderCallback::SelectedFilter</a></li>
<li>Creating a filter, at <a href="http://msdn.microsoft.com/en-us/library/dd389377%28VS.85%29.aspx">IAMGraphBuilderCallback::CreatedFilter</a></li>
</ul>
<p>The latter two methods also show &#8220;Application Result&#8221; column and values, which are HRESULT values returned by IAMGraphBuilderCallback callback provided by the application. Typically, a failure HRESULT code indicates that the application rejected the filter.</p>
<p>The trace log is good to expose all DirectShow junk installed in the system. For example,</p>
<p><span id="more-1253"></span><a href="http://alax.info/blog/wp-content/uploads/2011/07/Image0022.png"><img class="alignnone size-large wp-image-1255" title="Junk: ffdshowBC.ax" src="http://alax.info/blog/wp-content/uploads/2011/07/Image0022-800x496.png" alt="" width="620" height="384" /></a></p>
<p>In an attempt to build graph to decode FourCC &#8216;LXH4&#8242; video (which is a private alias for H.264 media type), Filter Graph Manager tried to apply &#8216;ffdshow Video Decoder&#8217; filter, which is unable to process the feed, but is registered at an extremely high merit and violating the guidelines.</p>
<p>The tool shows that the file hosting the filter is &#8220;<em>ffdshowBC.ax</em>&#8221; and shows its location. The application however appears to be aware of this piece of trash, and returned E_FAIL (0&#215;80004005) rejecting the filter.</p>
<p>How comes the garbage is hooking into place where it is not supposed to be, yet is sophisticated enough to reach such internals of operating system? This module is a clone/branch of well-known <a href="http://www.google.com/search?q=ffdshow">ffdshow</a> software, which by default registers itself with abnormally high merit &#8220;with good intentions in mind&#8221;. A short-sighted manufacturer of cheap stuff IP camera duplicated the project, changed the GUIDs, packaged the pathetic crap into ActiveX control cabinet and started distributing it over clean and virgin workstations around the globe.</p>
<p>Going further with the the trace being checked, there are more things to enjoy:</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2011/07/Image0033.png"><img class="alignnone size-large wp-image-1256" title="Junk: MainConcept Showcase" src="http://alax.info/blog/wp-content/uploads/2011/07/Image0033-800x553.png" alt="" width="620" height="428" /></a></p>
<p>Trying to decode the same H.264 video feed, the Filter Graph Manager mounting three demultiplexers made  by MainConcept in a row, for MP4, MPEG and MXF containers. The utility immediately indicates that this trash contribution was brought by <a href="http://www.mainconcept.com/products/sdks/others/showcase.html">MainConcept Showcase</a> 8.7.0.28412. One might wanted to install it for a purpose, and it started killing other DirectShow software it shares workstation with.</p>
<p>The good news is that the method is friendly for production environment and only requires to register spy and collect log file. You don&#8217;t eve need to check the UI at the same computer, it is possible to transfer the log file into development environment and have spy read the log there.</p>
<p>The &#8220;Copy to Clipboard&#8221; link is a convenient option to transfer the findings into tab-separated values format, such as to paste into Microsoft Excel:</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2011/07/Image0042.png"><img class="alignnone size-large wp-image-1257" title="Data Transfered to Microsoft Excel" src="http://alax.info/blog/wp-content/uploads/2011/07/Image0042-800x394.png" alt="" width="620" height="305" /></a></p>
<h4>Process Black Listing</h4>
<p>The utility received a capability to selectively not load into specific processes. DirectShowSpy is a developer tool and is not intended for production environment, nor it is guaranteed to be issue-free. So in case of specific conflict it is possible to exclude specific process from applying a spy using registry:</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2011/07/Image0051.png"><img class="alignnone size-large wp-image-1258" title="Black List Registry" src="http://alax.info/blog/wp-content/uploads/2011/07/Image0051-800x424.png" alt="" width="620" height="328" /></a></p>
<p>The values are under <em>HKLM, SOFTWARE\[Wow6432Node\]Alax.Info\Utilities\DirectShowSpy</em> key, and there are three values defined:</p>
<ul>
<li>CFilterMapperSpy Black List &#8211; defines exclusion for filter mapper spying</li>
<li>CSpy Black List &#8211; defines exclusion for filter graph spy (effective for most applications)</li>
<li>CNoThreadSpy Black List &#8211; defines exclusion for filter graphs created with <a href="http://msdn.microsoft.com/en-us/library/dd375786%28VS.85%29.aspx">CLSID_FilterGraphNoThread</a></li>
</ul>
<p>The exclusion value is a comma-separated list of process names, exact case-insensitive match for executable file names without directory and extension.</p>
<p>It is recommended that filter mapper spy has at least as rich exclusion list as the filter graph spy entires (otherwise, it is possible that spy might raise unexpected exceptions).</p>
<p>Partial Visual C++ .NET 2008 source code is <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy">available from SVN</a>, release binary included (<a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/Release%20Trace/Win32/DirectShowSpy.dll?format=raw">Win32</a>, <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/Release%20Trace/x64/DirectShowSpy.dll?format=raw">x64</a>); installation instructions are in <a href="../777">another post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1253/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IP Video Source: Pure JPEG URLs and Software Version</title>
		<link>http://alax.info/blog/1227</link>
		<comments>http://alax.info/blog/1227#comments</comments>
		<pubDate>Tue, 07 Jun 2011 19:02:47 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[capture]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[dshow]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[JPEG]]></category>
		<category><![CDATA[M-JPEG]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1227</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1227" title="IP Video Source: Pure JPEG URLs and Software Version"></a>This does not update the software with new features, but there are a few simple things worth mentioning explicitly. The first is that virtual DirectShow camera device can be set up with both M-JPEG and JPEG URLs. That is, IP &#8230;<p class="read-more"><a href="http://alax.info/blog/1227">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1227" title="IP Video Source: Pure JPEG URLs and Software Version"></a><p>This does not update the software with new features, but there are a few simple things worth mentioning explicitly.</p>
<p>The first is that virtual DirectShow camera device can be set up with both M-JPEG and JPEG URLs. That is, IP cameras which do not implement M-JPEG, or implement it in a buggy way (there is a *huge* deal of such out there) can still be set up to send video as individual video frames/images as long as they implement JPEG snapshots. This is taking place often at a lower frame rate, but still works.</p>
<p>The driver will automatically detect type of URL (by response from the device) and will choose best access method for the given URL.</p>
<p>Second is that if you are looking for IP Video Source software version, such as to check against available updates, it is here on the UI (right click the caption):</p>
<p><img class="alignnone size-full wp-image-1228" title="About on System Menu" src="http://alax.info/blog/wp-content/uploads/2011/06/Image004.png" alt="" width="563" height="430" /></p>
<p><img class="alignnone size-full wp-image-1229" title="About and Version" src="http://alax.info/blog/wp-content/uploads/2011/06/Image005.png" alt="" width="436" height="294" /></p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1227/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>IP Video Source: 64-bit version, resolution flexibility, Adobe FMLE</title>
		<link>http://alax.info/blog/1223</link>
		<comments>http://alax.info/blog/1223#comments</comments>
		<pubDate>Sun, 05 Jun 2011 17:42:10 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[capture]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[dshow]]></category>
		<category><![CDATA[ecnoder]]></category>
		<category><![CDATA[encoder]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[FMLE]]></category>
		<category><![CDATA[google talk]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[JPEG]]></category>
		<category><![CDATA[M-JPEG]]></category>
		<category><![CDATA[skype]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1223</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1223" title="IP Video Source: 64-bit version, resolution flexibility, Adobe FMLE"></a>The IP Video Source update provides several improvements to the driver: copy/paste feature to backup, restore, or synchronize installed devices between 32-bit and 64-bit versions 64-bit version and .MSI dynamic video resizing (via Video Resizer DSP) Adobe FMLE compatibility Updates &#8230;<p class="read-more"><a href="http://alax.info/blog/1223">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1223" title="IP Video Source: 64-bit version, resolution flexibility, Adobe FMLE"></a><p>The <a href="http://alax.info/blog/1216">IP Video Source</a> update provides several improvements to the driver:</p>
<ul>
<li>copy/paste feature to backup, restore, or synchronize installed devices between 32-bit and 64-bit versions</li>
<li>64-bit version and .MSI</li>
<li>dynamic video resizing (via <a href="http://msdn.microsoft.com/en-us/library/ff819491%28VS.85%29.aspx">Video Resizer DSP</a>)</li>
<li>Adobe FMLE compatibility</li>
</ul>
<p>Updates in greater detail follow.</p>
<h4>Device Copy/Paste Feature</h4>
<p>The video device management window is providing Copy and Paste buttons, which let user transfer device information, including name and settings, through clipboard for various purposes:</p>
<ul>
<li>save data in order to be able to restore devices later</li>
<li>restore devices from saved list, or re-create from a list saved on another machine</li>
<li>duplicate a device</li>
<li>synchronize devices between 32-bit and 64-bit versions</li>
</ul>
<p>The device data is a text, one line per device, lines in comma-separated values (<a href="http://en.wikipedia.org/wiki/Comma-separated_values">CSV</a>) format.</p>
<p><img class="alignnone size-full wp-image-1224" title="Manage Video Devices" src="http://alax.info/blog/wp-content/uploads/2011/06/Image001.png" alt="" width="565" height="432" /></p>
<p><span id="more-1223"></span></p>
<h4>64-Bit Version</h4>
<p>Software is available in both 32-bit and 64-bit versions. While most of multimedia software is still 32-bit, sometimes 64-bit version is really helpful to, for example:</p>
<ul>
<li> interface to &#8220;Any CPU&#8221; .NET code which executes in 64-bit on a 64-bit operating system</li>
<li>go beyond 32-bit code boundaries, especially in part of multiple devices and virtual address space limit</li>
</ul>
<p>64-bit version duplicates functionality available in 32-bit version, though 32- and 64-bit modules run in completely separated environments.</p>
<p><img class="alignnone size-full wp-image-1225" title="Start Menu - Video Type-In" src="http://alax.info/blog/wp-content/uploads/2011/06/Image002.png" alt="" width="420" height="451" /></p>
<h4>Dynamic Video Resizing</h4>
<p>The source DirectShow filter is capable of connecting with media types different from original/camera media type in resolution part for decompressed video. The filter is internally taking advantage of <a href="http://msdn.microsoft.com/en-us/library/ff819491%28VS.85%29.aspx">Video Resizer DSP</a>, and resizes decompressed video to format of interest.</p>
<p>As Video Resizer DSP is available starting with Windows Vista, the functionality availability is subject to the same conditions.</p>
<p>The feature is absolutely required for Adobe Flash Media Live Encoder software, as it make certain assumptions as for supported resolutions, and completely ignores the information the filter makes available in standard way.</p>
<h4>Adobe Flash Media Live Encoder Friendliness</h4>
<p>The update make the device much closer to interoperation with Adobe product. The software works around a handful of bugs, including as ridiculous as neglecting to provide correct BI_RGB value in BITMAPINFOHEADER::biCompression structure, yet researchers are still to resolve the remained ones.</p>
<p>FMLE would start perfect and stream video being run under debugger, otherwise in a regular run chances are that Adobe application would internally respond with E_UNEXPECTED failure for unknown reason, stop any encoding without giving a single little notice on the GUI.</p>
<p>After all, the encoding runs perfectly through web based encoder, and the driver is providing a good way to stream to video distribution sites such as <a href="http://ustream.tv">http://ustream.tv</a>, <a href="http://livestream.com">http://livestream.com</a> from an IP camera or video encoder.</p>
<p><img class="alignnone size-large wp-image-1226" title="Adobe FMLE 3.2" src="http://alax.info/blog/wp-content/uploads/2011/06/Image003-800x600.png" alt="" width="620" height="465" /></p>
<h4>Download Information</h4>
<ul>
<li>Download (32-bit): <a href="../../blog-dist/AlaxInfoIpVideoSourceSetup.msi">AlaxInfoIpVideoSourceSetup.msi</a></li>
<li>Download (64-bit): <a href="http://alax.info/blog-dist/AlaxInfoIpVideoSourceSetup-x64.msi">AlaxInfoIpVideoSourceSetup-x64.msi</a></li>
<li>License: This software is free to use</li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1223/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>DirectShow Video Source Filter for JPEG and M-JPEG IP Cameras</title>
		<link>http://alax.info/blog/1216</link>
		<comments>http://alax.info/blog/1216#comments</comments>
		<pubDate>Sun, 22 May 2011 22:07:03 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[capture]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[dshow]]></category>
		<category><![CDATA[ecnoder]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[google talk]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[JPEG]]></category>
		<category><![CDATA[M-JPEG]]></category>
		<category><![CDATA[skype]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1216</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1216" title="DirectShow Video Source Filter for JPEG and M-JPEG IP Cameras"></a>This implements a DirectShow driver/wrapper over a HTTP based JPEG/M-JPEG streamed video, widely available with IP cameras. Once installed, it provides a Start Menu shortcut to manage video capture devices, where a user can add/remove devices. The devices are automatically &#8230;<p class="read-more"><a href="http://alax.info/blog/1216">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1216" title="DirectShow Video Source Filter for JPEG and M-JPEG IP Cameras"></a><p>This implements a <a href="http://msdn.microsoft.com/en-us/library/dd375454%28VS.85%29.aspx">DirectShow</a> driver/wrapper over a HTTP based JPEG/<a href="http://en.wikipedia.org/wiki/Motion_JPEG#IP_Cameras">M-JPEG</a> streamed video, widely available with IP cameras. Once installed, it provides a Start Menu shortcut to manage video capture devices, where a user can add/remove devices. The devices are automatically registered with DriectShow and are available to applications.</p>
<p><img class="alignnone size-full wp-image-1217" title="Start Menu Shortcut" src="http://alax.info/blog/wp-content/uploads/2011/05/Image0011.png" alt="" width="451" height="482" /> <img class="alignnone size-full wp-image-1218" title="Manage Video Devices" src="http://alax.info/blog/wp-content/uploads/2011/05/Image0021.png" alt="" width="377" height="432" /></p>
<p>The compatibility list includes:</p>
<ul>
<li>Windows SDK <a href="http://msdn.microsoft.com/en-us/library/dd373424%28VS.85%29.aspx">AmCap</a> Sample (reference)</li>
<li><a href="http://msdn.microsoft.com/en-us/library/dd390950%28VS.85%29.aspx">VideoLan VLC</a></li>
<li><a href="http://www.skype.com/">Skype</a> (see below)</li>
<li><a href="http://www.google.com/talk/">Google Talk Video Chat</a></li>
<li><a href="http://luxriot.com">Luxriot</a> (as rather an example as Luxriot has its own generic JPEG/M-JPEG device driver, however this still demonstrates compatibility and interoperability of applications)</li>
<li><a href="http://msdn.microsoft.com/en-us/library/dd390950%28VS.85%29.aspx">GraphEdit</a>, GraphStudio and similar tools</li>
</ul>
<p><span id="more-1216"></span></p>
<p>For a created device it is required to configure:</p>
<ol>
<li>JPEG or M-JPEG resource URL on the device, where the driver will access video feed or sequential snapshots</li>
<li>Image/video size on the device</li>
</ol>
<p><img class="alignnone size-full wp-image-1219" title="Device Property Sheet - General Property Page" src="http://alax.info/blog/wp-content/uploads/2011/05/Image0032.png" alt="" width="377" height="432" /></p>
<p>Resource URLs vary from device to device and there is no standard identifier. This has to be looked up for specific model in device API reference or SDK. For JPEG snapshots it is possible to copy image shortcut from web browser and paste address into device settings.</p>
<p>Note that some devices, especially low end IP cameras deliver non-compliant feed which can be decoded either by manufacturer&#8217;s ActiveX control or model-specific implementation which this driver does not convert and is unlikely to ever cover. The driver will only work with hardware which honors industry standards.</p>
<p>For example, <a href="http://www.stardot.com/products/cameras">Stardot NetCam SC</a> cameras make the video feed accessible using /nph-mjpeg.cgi resource, so the full URL will consist of protocol prefix &#8220;http://&#8221;, optional username and password (see screenshot above), IP address or host name e.g. &#8220;demo2.stardotcams.com&#8221;, resource identifier on the device &#8220;/nph-mjpeg.cgi&#8221;.</p>
<p>Hence, http://demo2.stardotcams.com/nph-mjpeg.cgi</p>
<p>It is necessary to provide video size of the footage in advance so that the driver could negotiate content media types without accessing the device. Future versions of the driver might implement auto-detection.</p>
<h4>Skype Compatibility</h4>
<p>To make the device work with Skype, it is necessary to:</p>
<ol>
<li>Configure the device (using its web interface) to work at resolution 640&#215;480</li>
<li>Add/configure device with Alax.Info IP video Source as described above, including setting of 640 by 480 pixel resolution in device configuration</li>
</ol>
<p><img class="alignnone size-full wp-image-1220" title="Skype Video Device" src="http://alax.info/blog/wp-content/uploads/2011/05/Image0042.png" alt="" width="716" height="612" /></p>
<h4>Internals</h4>
<p>Software implements and registers video input/capture devices, listed under <a href="http://msdn.microsoft.com/en-us/library/ms783347%28VS.85%29.aspx">DirectShow CLSID_VideoInputDeviceCategory</a> category. The applications access devices from the list and treat as a regular device such as web camera.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/dd373424%28VS.85%29.aspx">Windows SDK AmCap sample</a> will create the following DirectShow graph where the source filter implemented by this software:</p>
<p><img class="alignnone size-full wp-image-1221" title="Outer DirectShow Fitler Graph" src="http://alax.info/blog/wp-content/uploads/2011/05/Image006.png" alt="" width="615" height="295" /></p>
<p>Internally, software creates a worker filter graph in order to stream data from the device:</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2011/05/Image0051.png"><img class="alignnone size-large wp-image-1222" title="Inner DirectShow Fitler Graph" src="http://alax.info/blog/wp-content/uploads/2011/05/Image0051-800x294.png" alt="" width="620" height="227" /></a></p>
<p>To decode video, software uses stock <a href="http://msdn.microsoft.com/en-us/library/dd390691%28VS.85%29.aspx">MJPEG Decompressor Filter</a> provided with operating system.</p>
<h4>Download Information</h4>
<ul>
<li>Download (32-bit): <a href="http://alax.info/blog-dist/AlaxInfoIpVideoSourceSetup.msi">AlaxInfoIpVideoSourceSetup.msi</a></li>
<li>Download (64-bit): To Be Done/On Request</li>
<li>License: This software is free to use</li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1216/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to use your own video transformation DirectShow filter as an effect while playing back a file</title>
		<link>http://alax.info/blog/1175</link>
		<comments>http://alax.info/blog/1175#comments</comments>
		<pubDate>Fri, 11 Mar 2011 23:34:31 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Source]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1175</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1175" title="How to use your own video transformation DirectShow filter as an effect while playing back a file"></a>One of the popular questions asked in relation to DirectShow filters, and also a popular task is to modify video stream while in playback. There are various reasons one might need to do it, including keying video to replace color/range, &#8230;<p class="read-more"><a href="http://alax.info/blog/1175">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1175" title="How to use your own video transformation DirectShow filter as an effect while playing back a file"></a><p>One of the popular questions asked in relation to DirectShow filters, and also a popular task is to modify video stream while in playback. There are various reasons one might need to do it, including keying video to replace color/range, or apply text or time code on top of video, including while re-compressing footage, adjust brightness or contrast.</p>
<p>DirectShow BaseClasses/SDK include samples (in most cases <a href="http://msdn.microsoft.com/en-us/library/dd375634%28VS.85%29.aspx">EzRGB24</a> sample is the best to start for a video effect, also demonstrates use of private interface on a filter) to quick-start with the task without getting too much into detail and once this part is done, next step is to integrate filter into playback, connect it with other filters.</p>
<p>As a result of DircetShowflexibility, there are ways to do things not so good, while still being under impression of keeping right track.</p>
<p>File playback is one of the basic tasks with DirectShow. To play a file, one creates a filter graph using powerful helpers provided by <a href="http://msdn.microsoft.com/en-us/library/dd375786%28VS.85%29.aspx">Filter Graph Manager</a> object. It might be a actually a single call <a href="http://msdn.microsoft.com/en-us/library/dd390090%28VS.85%29.aspx">IGraphBuilder::RenderFile</a> which takes all the complexity of finding matching filters, connecting them together, dealing with splitters and renderers, video and audio. A single call resolves the problems in a convenient way &#8211; easy.</p>
<p>Still a simple thing of inserting your own video transformation filters breaks the simplicity. One needs to build the graph partilly, insert the effect and complete building, or build the thing and break in with a new filter. How to find insertion point? Will the other filters like intrusion? Different file types and formats.</p>
<p>There is an easy and elegant solution to pre-add your own effect filter into graph and start rendering a file from there. Sounds reasonable and sometimes works. The problem is however that it does not work always, and you never know when it lets you down. The graph might be build and the effect filter is never taken and is left orphaned aside of playback pipeline.</p>
<p>Reliable graph building assumes you are in control over building steps and allow only the level of flexibility required to connect and build parts &#8211; and this is where <a href="http://msdn.microsoft.com/en-us/library/dd390342%28VS.85%29.aspx">Intelligent Connect</a> is still a powerful helper. With an effect, the parts are &#8220;before the effect&#8221; and &#8220;after the effect&#8221;. RenderFile is no longer an option, and one has to dive deeper into graph building API.</p>
<p>First of all, the building starts with the file itself: unlike RenderFile, <a href="http://msdn.microsoft.com/en-us/library/dd390087%28VS.85%29.aspx">IGraphBuilder::AddSourceFilter</a> method adds just the first filter for a given file/format. It stops there and lets caller continue building as required. At this point, it is the right time to manually add effect filter with <a href="http://msdn.microsoft.com/en-us/library/dd390016%28VS.85%29.aspx">IFilterGraph::AddFilter</a> (IGraphBuilder is inherited from IFilterGraph and exposes the same method).</p>
<p>Having both ends in the graph for the &#8220;before the effect&#8221; part, intelligent connect can be used to connect and add filters required to make the connection. For an arbitrary file format, the task may be not trivial: depending on format and installed software components, the chain may look rather different. First, some filters combine stream splitting capability with immediate access to file (or another type of resource), others rely on joint operation of <a href="http://msdn.microsoft.com/en-us/library/dd375641%28VS.85%29.aspx">Async File Source</a> filter with a format-dependent splitter filter. Some expose elementary stream pins immediately, some provide transport stream pin.</p>
<p>There may be a few approaches as for addressing pin connection task (see also <a href="http://msdn.microsoft.com/en-us/library/dd375815%28VS.85%29.aspx">General Graph-Building Techniques</a> on MSDN). Straightforwardly, one might want to call <a href="http://msdn.microsoft.com/en-us/library/dd390088%28VS.85%29.aspx">IGraphBuilder::Connect</a> and take advantage of intelligent connect. Before this can be done, however it takes caller to select a pin of the obtained source filter to start from. There might be a few pins, including those exposing video formats, non-video formats and pre-split formats where video is behind depacketizing (demultiplexing). Considering variety of formats and support, it might make sense to make a first attempt finding a video pin (by enumerating pins and their media types, looking and <a href="http://msdn.microsoft.com/en-us/library/dd373477%28VS.85%29.aspx">AM_MEDIA_TYPE</a>::majortype and comparing to MEDIATYPE_Video) and, if not found, taking a first output pin of any type, or going through ping trying to connect first one which succeeds in connection.</p>
<p>An alternate approach is to take advantage of a helper object: <a href="http://msdn.microsoft.com/en-us/library/ms779896%28VS.85%29.aspx">Capture Graph Builder</a>. While originally it is intended to help capture graph building, it contains useful methods for general building and connecting pins. It does not own a graph itself: it is designed to operate on top of existing graph, provided by its owner. So one need to provide its existing graph and call helper methods for easy graph building. One of the methods is <a href="http://msdn.microsoft.com/en-us/library/ms784859%28VS.85%29.aspx">ICaptureGraphBuilder2::RenderStream</a>, which connects pins of given filters. Unlike API discussed earlier, it takes filter interfaces on input and will be responsible for finding proper pins itself, which might be a good idea if you don&#8217;t want to bother yourself doing it. To specify the requested task, it takes media type argument, which in this case might be video or, if fails, any type provided that video media type will still be anyway checked on input of effect filter.</p>
<p>Once the part &#8220;before the effect&#8221; is done, the other part may be completed as simple as calling <a href="http://msdn.microsoft.com/en-us/library/dd390089%28VS.85%29.aspx">IGraphBuilder::Render</a> on the output pin of the effect. This will correspond to final step of original RenderFile execution.</p>
<p>A tiny Visual Studio 2010 C++ project illustrates discussed techniques and it available at SVN repository: <a href="http://www.assembla.com/code/roatl-utilities/subversion/nodes/trunk/RenderStreamTest01">RenderStreamTest01</a>:</p>
<ul>
<li>for a given media file in <a href="http://www.assembla.com/code/roatl-utilities/subversion/nodes/trunk/RenderStreamTest01/RenderStreamTest01.cpp#ln109">line 109</a> the project will start graph building</li>
<li>a suitable replacement for a video effect filter will be a <a href="http://msdn.microsoft.com/en-us/library/dd377544%28VS.85%29.aspx">Sample Grabber</a> filter initialized with a video type (24-bit RGB, but the <a href="http://www.assembla.com/code/roatl-utilities/subversion/nodes/trunk/RenderStreamTest01/RenderStreamTest01.cpp#ln137">line 137</a> can be commented out)</li>
<li>switch in <a href="http://www.assembla.com/code/roatl-utilities/subversion/nodes/trunk/RenderStreamTest01/RenderStreamTest01.cpp#ln109">line 147</a> switches between base Connect approach and Capture Graph Builder helper</li>
<li>while message box is on the screen and also showing building status, the graph can be looked at using <a href="http://msdn.microsoft.com/en-us/library/dd390950%28VS.85%29.aspx">Graph Edit</a> or similar tool, provided that <a href="http://alax.info/blog/777">DirectShow Spy</a> is installed; alternatively you might want to put the graph onto <a href="http://msdn.microsoft.com/en-us/library/ms694349%28VS.85%29.aspx">ROT</a> manually</li>
</ul>
<p>The project also illustrates a solution for recent problems referencing Sample Grabber with new SDK. Sample Grabber was obsoleted and removed from Window SDK definition file (qedit.h). In order to resolved the problem without using an older version of SDK, the definitions might be imported from type the corresponding library and (apart from used as such) copied into the source code directly, as in lines <a href="http://www.assembla.com/code/roatl-utilities/subversion/nodes/trunk/RenderStreamTest01/RenderStreamTest01.cpp#ln13">13-60</a>.</p>
<p>See also on graph building:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/dd318197%28VS.85%29.aspx">Basic DirectShow Tasks</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/dd390342%28VS.85%29.aspx">Intelligent Connect</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/dd375815%28VS.85%29.aspx">General Graph-Building Techniques</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/dd387915%28VS.85%29.aspx">Connect Filters</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/dd318240%28VS.85%29.aspx">Using Capture Graph Builder</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1175/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DirectShow Spy: Memory Allocator Properties</title>
		<link>http://alax.info/blog/1168</link>
		<comments>http://alax.info/blog/1168#comments</comments>
		<pubDate>Sat, 05 Mar 2011 10:15:42 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[allocator]]></category>
		<category><![CDATA[buffer]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[spy]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1168</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1168" title="DirectShow Spy: Memory Allocator Properties"></a>A small update to the DirectShow Spy today: DirectShow Filter Graph Spy prints memory allocator properties as a part of graph topology trace on transition to running state. Why is that and what it is for? Filters normally agree on &#8230;<p class="read-more"><a href="http://alax.info/blog/1168">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1168" title="DirectShow Spy: Memory Allocator Properties"></a><p>A small update to the DirectShow Spy today: <a href="http://alax.info/blog/777">DirectShow Filter Graph Spy</a> prints memory allocator properties as a part of graph topology trace on transition to running state. Why is that and what it is for? Filters normally agree on allocator properties (<a href="http://msdn.microsoft.com/en-us/library/dd373419%28VS.85%29.aspx">ALLOCATOR_PROPERTIES</a>, obtained from <a href="http://msdn.microsoft.com/en-us/library/dd407061%28VS.85%29.aspx">IMemAllocator</a>, obtained from <a href="http://msdn.microsoft.com/en-us/library/dd407073%28VS.85%29.aspx">IMemInputPin</a>) themselves without interference from controlling application. Sometimes an undesired choice of buffers can cause sick runtime behavior, including but not limited to the following:</p>
<ol>
<li>live audio capture buffers are too long, and introduce significant latency, including from live video capture stream taking place in parallel; controlling application might need to take advantage of <a href="http://msdn.microsoft.com/en-us/library/dd389144%28VS.85%29.aspx">IAMBufferNegotiation::SuggestAllocatorProperties</a> and request shorter buffers.</li>
<li>a filter, such as for example DMO Wrapper Filter, may default to 1 buffer on allocator, which means that if a buffer reference is for some reason held for future reference (e.g. a video filter might be holding a reference to be able to re-push a video sample if an application is requesting video update), the entire streaming might lock.</li>
<li>some filters are requesting unreasonably many/large buffers and consume vast spaces of RAM, such as MainConcept MXF Demultiplexer requesting 200 buffers x 640 kilobytes each (128 MB in total out of sudden)</li>
<li>some filters are requesting unreasonably few/small buffers resulting in inability to pre-buffer data</li>
</ol>
<p>In a chase for answers to questions &#8220;Where is my memory?&#8221;, &#8220;Why is it so choppy?&#8221;, &#8220;I would really appreciate a nice lipsync&#8221; and to troubleshoot the mentioned scenarios it is helpful to understand buffering configuration. DirectShow Filter Spy is here to deliver this information. Once the graph is put into running state, spy prints out topology data into log file (which is in most cases C:\ProgramData\DirectShowSpy.log):</p>
<pre>Pin 2: Name "Input 01", Direction "Input", Peer "Tee 0x087A5AF0.Output2"
 Connection media type:
 majortype {73646976-0000-0010-8000-00AA00389B71}, subtype {31435641-0000-0010-8000-00AA00389B71}, pUnk 0x00000000
 bFixedSizeSamples 0, bTemporalCompression 0, lSampleSize 1
 formattype {E06D80E3-DB46-11CF-B4D1-00805F6CBBEA}, cbFormat 170, pbFormat 0x07c46fc0
pbFormat as MPEG2VIDEOINFO:
 rcSource { 0, 0, 0, 0 ), rcTarget { 0, 0, 0, 0 }
 dwBitRate 0, dwBitErrorRate 0, AvgTimePerFrame 0
 dwInterlaceFlags 0x0, dwCopyProtectFlags 0x0, dwPictAspectRatioX 16, dwPictAspectRatioY 9, dwControlFlags 0x0
 bmiHeader.biSize 40, bmiHeader.biWidth 1280, bmiHeader.biHeight 720, bmiHeader.biPlanes 1, bmiHeader.biBitCount 24, bmiHeader.biCompression avc1
 bmiHeader.biSizeImage 0, bmiHeader.biXPelsPerMeter 1, bmiHeader.biYPelsPerMeter 1, bmiHeader.biClrUsed 0, bmiHeader.biClrImportant 0
 dwStartTimeCode 0x00000000, cbSequenceHeader 38, dwProfile 100, dwLevel 31, dwFlags 0x4
 [0x0000] 00 1D 67 64 00 1F AC 24 88 05 00 5B BF F0 00 10
 [0x0010] 00 11 00 00 03 03 E8 00 00 E9 BA 0F 18 32 A0 00
 [0x0020] 05 68 EE 32 C8 B0
<strong><span style="text-decoration: underline;"> Memory Allocator: 1 buffers, 1,024 bytes each (1,024 bytes total), align 1, prefix 0</span></strong></pre>
<p>Partial Visual C++ .NET 2008 source code is <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy">available  from SVN</a>, release binary included (<a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/Release%20Trace/Win32/DirectShowSpy.dll?format=raw">Win32</a>,  <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/Release%20Trace/x64/DirectShowSpy.dll?format=raw">x64</a>);  installation instructions are in <a href="http://alax.info/blog/777">another post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1168/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>DirectShow Spy: IAMFilterData interface</title>
		<link>http://alax.info/blog/1111</link>
		<comments>http://alax.info/blog/1111#comments</comments>
		<pubDate>Mon, 08 Feb 2010 18:47:28 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Utilities]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[mapper]]></category>
		<category><![CDATA[spy]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1111</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1111" title="DirectShow Spy: IAMFilterData interface"></a>This quick update for DirectShow Filter Graph Spy adds tracing for (deprecated) IAMFilterData interface, and also fixes problem with Media Player Classic &#8211; Home Cinema, when the player crashes in External Filters windows. Partial Visual C++ .NET 2008 source code &#8230;<p class="read-more"><a href="http://alax.info/blog/1111">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1111" title="DirectShow Spy: IAMFilterData interface"></a><p>This quick update for <a href="http://alax.info/blog/777">DirectShow Filter Graph Spy</a> adds tracing for (deprecated) <a href="http://msdn.microsoft.com/en-us/library/dd389369%28VS.85%29.aspx" rel="nofollow">IAMFilterData</a> interface, and also fixes problem with <a href="http://www.xvidvideo.ru/media-player-classic-home-cinema-x86-x64/">Media Player Classic &#8211; Home Cinema</a>, when the player <a href="http://alax.info/blog/1100/comment-page-1#comment-5738">crashes in External Filters windows</a>.</p>
<p>Partial Visual C++ .NET 2008 source code is <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy">available from SVN</a>, release binary included (<a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/Release%20Trace/Win32/DirectShowSpy.dll?format=raw">Win32</a>, <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/Release%20Trace/x64/DirectShowSpy.dll?format=raw">x64</a>); installation instructions are in <a href="http://alax.info/blog/777">another post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1111/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>DirectShow Spy: Filter Mapper Spy</title>
		<link>http://alax.info/blog/1100</link>
		<comments>http://alax.info/blog/1100#comments</comments>
		<pubDate>Thu, 24 Dec 2009 13:07:50 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[mapper]]></category>
		<category><![CDATA[spy]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1100</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1100" title="DirectShow Spy: Filter Mapper Spy"></a>DirectShow Filter Graph Spy was updated to add new functionality: spying over another DirectShow object &#8211; Filter Mapper. Filter Mapper object is used for filter registration purposes and also internally by DirectShow&#8217;s Intelligent Connect. IFilterMapper2 interface traces provide detailed description &#8230;<p class="read-more"><a href="http://alax.info/blog/1100">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1100" title="DirectShow Spy: Filter Mapper Spy"></a><p><a href="http://alax.info/blog/777">DirectShow Filter Graph Spy</a> was updated to add new functionality: spying over another DirectShow object &#8211; <a href="http://msdn.microsoft.com/en-us/library/dd375788%28VS.85%29.aspx">Filter Mapper</a>. Filter Mapper object is used for filter registration purposes and also internally by DirectShow&#8217;s <a href="http://msdn.microsoft.com/en-us/library/ms940065.aspx">Intelligent Connect</a>. <a href="http://msdn.microsoft.com/en-us/library/dd390033%28VS.85%29.aspx">IFilterMapper2</a> interface traces provide detailed description on steps DirectShow takes in order to connect and/or render filter pins. For example when trying to render <em>MEDIATYPE_Audio</em> pin, Filter Mapper suggested &#8220;RDP DShow Redirection Filter&#8221; and, then, &#8220;Default DirectSound Device&#8221;:</p>
<pre style="background: #ffffff none repeat scroll 0% 0%; color: #000000;">FilterMapperSpy<span style="color: #008c00;">.</span>h<span style="color: #808030;">(</span><span style="color: #008c00;">186</span><span style="color: #808030;">)</span><span style="color: #808030;">:</span> CFilterMapperSpy<span style="color: #808030;">:</span><span style="color: #808030;">:</span>EnumMatchingFilters<span style="color: #808030;">:</span> nFlags 0x0<span style="color: #808030;">,</span> bExactMatch <span style="color: #008c00;">0</span><span style="color: #808030;">,</span> nMinimalMerit 0x00200001<span style="color: #808030;">,</span> bInputNeeded <span style="color: #008c00;">1</span><span style="color: #808030;">,</span> nInputTypeCount <span style="color: #008c00;">1</span><span style="color: #808030;">,</span> pInputPinCategory NULL<span style="color: #808030;">,</span> bRender <span style="color: #008c00;">1</span><span style="color: #808030;">,</span> bOutputNeeded <span style="color: #008c00;">0</span><span style="color: #808030;">,</span> nOutputTypeCount <span style="color: #008c00;">0</span><span style="color: #808030;">,</span> pOutputPinCategory NULL
FilterMapperSpy<span style="color: #008c00;">.</span>h<span style="color: #808030;">(</span><span style="color: #008c00;">191</span><span style="color: #808030;">)</span><span style="color: #808030;">:</span> CFilterMapperSpy<span style="color: #808030;">:</span><span style="color: #808030;">:</span>EnumMatchingFilters<span style="color: #808030;">:</span> nInputTypeIndex <span style="color: #008c00;">0</span><span style="color: #808030;">,</span> MajorType <span style="color: #808030;">{</span><span style="color: #008c00;">73647561</span><span style="color: #808030;">-</span><span style="color: #008c00;">0000</span><span style="color: #808030;">-</span><span style="color: #008c00;">0010</span><span style="color: #808030;">-</span><span style="color: #008c00;">8000</span><span style="color: #808030;">-</span>00AA00389B71<span style="color: #808030;">}</span><span style="color: #808030;">,</span> Subtype <span style="color: #808030;">{</span><span style="color: #008c00;">00000000</span><span style="color: #808030;">-</span><span style="color: #008c00;">0000</span><span style="color: #808030;">-</span><span style="color: #008c00;">0000</span><span style="color: #808030;">-</span><span style="color: #008c00;">0000</span><span style="color: #808030;">-</span><span style="color: #008c00;">000000000000</span><span style="color: #808030;">}</span>
FilterMapperSpy<span style="color: #008c00;">.</span>h<span style="color: #808030;">(</span><span style="color: #008c00;">212</span><span style="color: #808030;">)</span><span style="color: #808030;">:</span> CFilterMapperSpy<span style="color: #808030;">:</span><span style="color: #808030;">:</span>EnumMatchingFilters<span style="color: #808030;">:</span> pMoniker @device<span style="color: #808030;">:</span>sw<span style="color: #808030;">:</span><span style="color: #808030;">{</span>083863F1<span style="color: #808030;">-</span>70DE<span style="color: #808030;">-</span>11D0<span style="color: #808030;">-</span>BD40<span style="color: #808030;">-</span>00A0C911CE86<span style="color: #808030;">}</span><span style="color: #808030;">\</span><span style="color: #808030;">{</span>AB9D6472<span style="color: #808030;">-</span>752F<span style="color: #808030;">-</span>43F6<span style="color: #808030;">-</span>B29E<span style="color: #808030;">-</span>61207BDA8E06<span style="color: #808030;">}</span>
FilterMapperSpy<span style="color: #008c00;">.</span>h<span style="color: #808030;">(</span><span style="color: #008c00;">220</span><span style="color: #808030;">)</span><span style="color: #808030;">:</span> CFilterMapperSpy<span style="color: #808030;">:</span><span style="color: #808030;">:</span>EnumMatchingFilters<span style="color: #808030;">:</span> sFriendlyName <span style="color: #800000;">"</span><span style="color: #0000e6;">RDP DShow Redirection Filter</span><span style="color: #800000;">"</span><span style="color: #808030;">,</span> sDescription <span style="color: #800000;">"</span><span style="color: #800000;">"</span><span style="color: #808030;">,</span> sDevicePath <span style="color: #800000;">"</span><span style="color: #800000;">"</span>
FilterMapperSpy<span style="color: #008c00;">.</span>h<span style="color: #808030;">(</span><span style="color: #008c00;">212</span><span style="color: #808030;">)</span><span style="color: #808030;">:</span> CFilterMapperSpy<span style="color: #808030;">:</span><span style="color: #808030;">:</span>EnumMatchingFilters<span style="color: #808030;">:</span> pMoniker @device<span style="color: #808030;">:</span>cm<span style="color: #808030;">:</span><span style="color: #808030;">{</span>E0F158E1<span style="color: #808030;">-</span>CB04<span style="color: #808030;">-</span>11D0<span style="color: #808030;">-</span>BD4E<span style="color: #808030;">-</span>00A0C911CE86<span style="color: #808030;">}</span><span style="color: #808030;">\</span>Default DirectSound Device
FilterMapperSpy<span style="color: #008c00;">.</span>h<span style="color: #808030;">(</span><span style="color: #008c00;">220</span><span style="color: #808030;">)</span><span style="color: #808030;">:</span> CFilterMapperSpy<span style="color: #808030;">:</span><span style="color: #808030;">:</span>EnumMatchingFilters<span style="color: #808030;">:</span> sFriendlyName <span style="color: #800000;">"</span><span style="color: #0000e6;">Default DirectSound Device</span><span style="color: #800000;">"</span><span style="color: #808030;">,</span> sDescription <span style="color: #800000;">"</span><span style="color: #800000;">"</span><span style="color: #808030;">,</span> sDevicePath <span style="color: #800000;">"</span><span style="color: #800000;">"</span></pre>
<p>Important is that DirectShow&#8217;s internals are using the mapper through COM instantiation and this provides a safe method to override default behavior process wide in order to, for example, extend <a href="http://msdn.microsoft.com/en-us/library/ms940065.aspx">Intelligent Connect</a> functionality onto custom, unregistered globally, private filters.</p>
<p>Also, the binary is renamed from FilterGraphSpy.dll to DirectShowSpy.dll.</p>
<p>Partial Visual C++ .NET 2008 source code is <a href="http://www.assembla.com/code/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy">available from SVN</a>, release binary included (<a href="http://www.assembla.com/code/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/Release%20Trace/Win32/DirectShowSpy.dll?format=raw">Win32</a>, <a href="http://www.assembla.com/code/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/Release%20Trace/x64/DirectShowSpy.dll?format=raw">x64</a>); installation instructions are in <a href="./777">another post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1100/feed</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>DirectShow Filter Graph Spy: 64-bit version and hook API</title>
		<link>http://alax.info/blog/1094</link>
		<comments>http://alax.info/blog/1094#comments</comments>
		<pubDate>Sun, 01 Nov 2009 19:30:19 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[ATL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[64-bit]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[spy]]></category>
		<category><![CDATA[x64]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1094</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1094" title="DirectShow Filter Graph Spy: 64-bit version and hook API"></a>Today&#8217;s update for DirectShow Filter Graph Spy introduces 64-bit version (mind the beta state) and a mini-API for an external module to be involved into graph building process. Filter Graph Spy is offering three new interfaces that provide extensibility of &#8230;<p class="read-more"><a href="http://alax.info/blog/1094">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1094" title="DirectShow Filter Graph Spy: 64-bit version and hook API"></a><p>Today&#8217;s update for DirectShow Filter Graph Spy introduces 64-bit version (mind the beta state) and a mini-API for an external module to be involved into graph building process.</p>
<p>Filter Graph Spy is offering three new interfaces that provide extensibility of the spy:</p>
<ul>
<li>IFilterGraphAddRemoveHook</li>
<li>IFilterGraphConnectHook</li>
<li>IFilterGraphStateControlHook</li>
</ul>
<p>The interfaces are contained in the type library and can be imported using <a href="http://msdn.microsoft.com/en-us/library/8etzzkb6%28VS.71%29.aspx">#import</a> directive. An implementation of one or more of these interfaces will receive hook style calls corresponding to respective <a href="http://msdn.microsoft.com/en-us/library/dd375786%28VS.85%29.aspx">Filter Graph Manager</a> calls, system wide including in context of other applications.</p>
<p>A COM object may be registered as a hook object with <em>Spy</em> and <em>NoThreadSpy</em> COM classes under predefined registry keys:</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2009/11/02-Image001.png"><img class="alignnone size-medium wp-image-1095" title="Registering a DirectShow Filter Graph Spy Hook" src="http://alax.info/blog/wp-content/uploads/2009/11/02-Image001-320x136.png" alt="Registering a DirectShow Filter Graph Spy Hook" width="320" height="136" /></a></p>
<p>Spy will instantiate the registered hook objects and forward them the calls it receive, before passing them to system Filter Graph Manager object. A hook object has an option to override default processing, including, for example, inserting its own filter in between. For example, <a href="http://msdn.microsoft.com/en-us/library/dd390021%28VS.85%29.aspx">IFilterGraph::Reconnect</a> call is implemented the following way:</p>
<pre>
<pre style="background: #ffffff none repeat scroll 0% 0%; color: #000000;">STDMETHOD<span style="color: #808030;">(</span>Reconnect<span style="color: #808030;">)</span><span style="color: #808030;">(</span>IPin<span style="color: #808030;">*</span> pPin<span style="color: #808030;">)</span> <span style="color: #800000; font-weight: bold;">throw</span><span style="color: #808030;">(</span><span style="color: #808030;">)</span>
<span style="color: #800080;">{</span>
    _Z4<span style="color: #808030;">(</span>atlTraceCOM<span style="color: #808030;">,</span> <span style="color: #008c00;">4</span><span style="color: #808030;">,</span> _T<span style="color: #808030;">(</span><span style="color: #800000;">"</span><span style="color: #0000e6;">...</span><span style="color: #0f69ff;">\n</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
    HOOK_PROLOG<span style="color: #808030;">(</span>CFilterGraphConnectHookHost<span style="color: #808030;">)</span>
        OnReconnect<span style="color: #808030;">(</span>pT<span style="color: #808030;">,</span> pPin<span style="color: #808030;">,</span> <span style="color: #808030;">&amp;</span>bDefault<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
    HOOK_EPILOG<span style="color: #808030;">(</span><span style="color: #808030;">)</span>
    <span style="color: #800000; font-weight: bold;">return</span> m_pInnerFilterGraph2<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>Reconnect<span style="color: #808030;">(</span>pPin<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="color: #800080;">}</span></pre>
</pre>
<p>Before passing the call to original Reconnect method, spy is iterating through associated hooks, passing them <em>IFilterGraphConnectHook::OnReconnect</em> call. Setting <em>bDefault</em> parameter to <em>FALSE</em> will prevent spy from passing the call to original method.</p>
<p>Included <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/BdaHooks">BdaHooks</a> project shows a sample implementation of the hooking COM classes (note <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/BdaHooks/ConnectHook.rgs">.rgs registration</a>).</p>
<p>Filter Graph Spy is compatible with all current Windows operating systems, 32-bit and 64-bit (<a href="http://en.wikipedia.org/wiki/X86-64">x64</a>), in particular including:</p>
<ul>
<li><a href="http://www.microsoft.com/windows/windows-7/">Windows 7</a></li>
<li>Windows Server 2008</li>
<li>Windows Vista</li>
<li>Windows Server 2003</li>
<li>Windows XP</li>
<li>Windows 2000</li>
</ul>
<p>NOTE: DirectShow Filter Graph Spy is <span style="text-decoration: underline;">NOT</span> suitable for production environment, it is <span style="text-decoration: underline;">NOT</span> licensed to be redistributed to be a part of production state software item.</p>
<p>Partial Visual C++ .NET 2008 source code is <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy">available from SVN</a>, release binary included (<a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/Release%20Trace/Win32/DirectShowSpy.dll?format=raw">Win32</a>, <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/Release%20Trace/x64/DirectShowSpy.dll?format=raw">x64</a>); installation instructions are in <a href="http://alax.info/blog/777">another post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1094/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DirectShow Filter Graph Spy: Log Filters and Connection Media Types</title>
		<link>http://alax.info/blog/1078</link>
		<comments>http://alax.info/blog/1078#comments</comments>
		<pubDate>Tue, 06 Oct 2009 19:26:23 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[spy]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1078</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1078" title="DirectShow Filter Graph Spy: Log Filters and Connection Media Types"></a>Having hard time to connect to remote filter graph on Windows 7 machine, I suspected that some of the filters do not like being connected through marshaling and freeze. Or, actually more likely, it is SDK&#8217;s proppage.dll which hosts proxy &#8230;<p class="read-more"><a href="http://alax.info/blog/1078">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1078" title="DirectShow Filter Graph Spy: Log Filters and Connection Media Types"></a><p>Having hard time to connect to remote filter graph on Windows 7 machine, I suspected that some of the filters do not like being connected through marshaling and freeze. Or, actually more likely, it is SDK&#8217;s proppage.dll which hosts proxy stub pairs behaves itself in a not quite expected way and freezes remote application (Graph Edit or similar) during attempt to connect to remote graph.</p>
<p>As the goal was to find out details about connection media types between the filters being spied over, the spy received a new feature of logging graph details each time the graph is going to running state:</p>
<blockquote>
<pre>Filter 7: Name "[1BDADev]", Class {17CCA71B-ECD7-11D0-B908-00A0C9223196}, State 2
 Pin 1: Name "MPEG2 Transport", Direction "Input", Peer "[0BDATnr].MPEG2 Transport"
 Connection media type:
 majortype {E436EB83-524F-11CE-9F53-0020AF0BA770}, subtype {E06D8023-DB46-11CF-B4D1-00805F6CBBEA}, pUnk 0x00000000
 bFixedSizeSamples 0, bTemporalCompression 0, lSampleSize 1
 formattype {8DEDA6FD-AC5F-4334-8ECF-A4BA8FA7D0F0}, cbFormat 24, pbFormat 0x00350868
 [0x0000] BC 00 00 00 38 9A 00 00 00 00 00 00 00 00 00 00
 [0x0010] 00 00 00 00 00 00 00 00
 Pin 2: Name "MPEG2 Transport", Direction "Output", Peer "Infinite Pin Tee Filter[BDATsIft].Input"
 Connection media type:
 majortype {E436EB83-524F-11CE-9F53-0020AF0BA770}, subtype {F4AEB342-0329-4FDD-A8FD-4AFF4926C978}, pUnk 0x00000000
 bFixedSizeSamples 1, bTemporalCompression 0, lSampleSize 39480
 formattype {0F6417D6-C318-11D0-A43F-00A0C9223196}, cbFormat 0, pbFormat 0x00000000
Filter 8: Name "[0BDATnr]", Class {17CCA71B-ECD7-11D0-B908-00A0C9223196}, State 2
 Pin 1: Name "Input0", Direction "Input", Peer "Microsoft Network Provider[NwPvd].Antenna Out"
 Connection media type:
 majortype {71985F41-1CA1-11D3-9CC8-00C04F7971E0}, subtype {E436EB8E-524F-11CE-9F53-0020AF0BA770}, pUnk 0x00000000
 bFixedSizeSamples 0, bTemporalCompression 0, lSampleSize 1
 formattype {0F6417D6-C318-11D0-A43F-00A0C9223196}, cbFormat 0, pbFormat 0x00000000
 Pin 2: Name "MPEG2 Transport", Direction "Output", Peer "[1BDADev].MPEG2 Transport"
 Connection media type:
 majortype {E436EB83-524F-11CE-9F53-0020AF0BA770}, subtype {E06D8023-DB46-11CF-B4D1-00805F6CBBEA}, pUnk 0x00000000
 bFixedSizeSamples 0, bTemporalCompression 0, lSampleSize 1
 formattype {8DEDA6FD-AC5F-4334-8ECF-A4BA8FA7D0F0}, cbFormat 24, pbFormat 0x00350868
 [0x0000] BC 00 00 00 38 9A 00 00 00 00 00 00 00 00 00 00
 [0x0010] 00 00 00 00 00 00 00 00</pre>
</blockquote>
<p>Partial Visual C++ .NET 2008 source code is <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy">available from SVN</a>, release binary <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/Release%20Trace/FilterGraphSpy.dll?format=raw">included</a>; installation instructions are in <a href="http://alax.info/blog/777">another post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1078/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

