<?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; DirectShow</title>
	<atom:link href="http://alax.info/blog/tag/directshow/feed" rel="self" type="application/rss+xml" />
	<link>http://alax.info/blog</link>
	<description>Software Production Line</description>
	<lastBuildDate>Mon, 08 Feb 2010 19:01:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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[Uncategorized]]></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[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 is available  from SVN, release binary included (Win32,  x64);  installation instructions are in [...]]]></description>
			<content:encoded><![CDATA[<p>This quick update for <a href="http://alax.info/blog/777">DirectShow Filter Graph Spy</a> adds tracing for (deprecated) <a rel="nofollow" href="http://msdn.microsoft.com/en-us/library/dd389369%28VS.85%29.aspx">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>2</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[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 on steps DirectShow takes in order to connect  and/or render filter pins. For example when [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://alax.info/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>
<pre style="background: #ffffff none repeat scroll 0% 0%; color: #000000; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;">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>
</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://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/1100/feed</wfw:commentRss>
		<slash:comments>9</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[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 the spy:

IFilterGraphAddRemoveHook
IFilterGraphConnectHook
IFilterGraphStateControlHook

The interfaces are contained in the type library and can be imported using #import directive. [...]]]></description>
			<content:encoded><![CDATA[<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>How to use windowless Video Mixing Renderer Filter to show video fullscreen</title>
		<link>http://alax.info/blog/1082</link>
		<comments>http://alax.info/blog/1082#comments</comments>
		<pubDate>Fri, 09 Oct 2009 17:04:27 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[ATL]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[WTL]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[fullscreen]]></category>
		<category><![CDATA[IVideoWidow]]></category>
		<category><![CDATA[IVMRWindowlessControl]]></category>
		<category><![CDATA[renderer]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[VMR]]></category>
		<category><![CDATA[windowless]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1082</guid>
		<description><![CDATA[The question is being asked from time to time. Everyone knows what is full screen video. Video renderers implement full screen capability since long ago through their IVideoWindow::put_FullScreenMode property, and even Filter Graph Manager exposes its own IVideoWindow interface to forward calls to filter&#8217;s implementation of IVideoWindow interface.
However, for Video Mixing Renderers, version 7 and [...]]]></description>
			<content:encoded><![CDATA[<p>The question is being asked from time to time. Everyone knows what is full screen video. Video renderers implement full screen capability since long ago through their <a href="http://msdn.microsoft.com/en-us/library/dd377320(VS.85).aspx">IVideoWindow::put_FullScreenMode</a> property, and even <a href="http://msdn.microsoft.com/en-us/library/dd375786(VS.85).aspx">Filter Graph Manager</a> exposes its own <a href="http://msdn.microsoft.com/en-us/library/dd377276%28VS.85%29.aspx">IVideoWindow</a> interface to forward calls to filter&#8217;s implementation of <a href="http://msdn.microsoft.com/en-us/library/dd377276%28VS.85%29.aspx">IVideoWindow</a> interface.</p>
<p>However, for Video Mixing Renderers, version <a href="http://msdn.microsoft.com/en-us/library/dd407343(VS.85).aspx">7</a> and <a href="http://msdn.microsoft.com/en-us/library/dd407344%28VS.85%29.aspx">9</a>, the preferred and recommended mode is windowless, where no IVideoWindow interface is available.</p>
<blockquote><p><strong>Note</strong> The <a id="ctl00_MTCS_main_ctl01" onclick="javascript:Track('ctl00_MTCS_main_ctl00|ctl00_MTCS_main_ctl01',this);" href="http://msdn.microsoft.com/en-us/library/dd390536%28VS.85%29.aspx"><strong>IVMRWindowlessControl</strong></a> or <a id="ctl00_MTCS_main_ctl02" onclick="javascript:Track('ctl00_MTCS_main_ctl00|ctl00_MTCS_main_ctl02',this);" href="http://msdn.microsoft.com/en-us/library/dd390537%28VS.85%29.aspx"><strong>IVMRWindowlessControl9</strong></a> interface is now preferred over <strong>IVideoWindow</strong>. For more information, see <a id="ctl00_MTCS_main_ctl03" onclick="javascript:Track('ctl00_MTCS_main_ctl00|ctl00_MTCS_main_ctl03',this);" href="http://msdn.microsoft.com/en-us/library/dd407299%28VS.85%29.aspx">Using Windowless Mode</a>.</p></blockquote>
<p>So in order to implement full screen mode it takes the application to attach Video Mixing Renderer filter to a private frameless window, to its entire client area and expand the window to entire monitor area.</p>
<p>The sample project <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FullScreenWindowlessVmrSample01">FullScreenWindowlessVmrSample01</a> is illustrating this technique.</p>
<p><img class="alignnone size-full wp-image-1083" title="FullScreenWindowlessVmrSample01 Main Dialog" src="http://alax.info/blog/wp-content/uploads/2009/10/09-Image001.png" alt="FullScreenWindowlessVmrSample01 Main Dialog" width="489" height="141" /></p>
<p><span id="more-1082"></span>Main application dialog owns a special window to host renderer, implemented by CRendererDialog class.</p>
<pre>
<pre style="background: #ffffff none repeat scroll 0% 0%; color: #000000;"><span style="color: #800000; font-weight: bold;">class</span> CRendererDialog <span style="color: #800080;">:</span>
    <span style="color: #800000; font-weight: bold;">public</span> CDialogImpl<span style="color: #800080;">&lt;</span>CRendererDialog<span style="color: #800080;">&gt;</span>
<span style="color: #800080;">{</span>
<span style="color: #800000; font-weight: bold;">public</span><span style="color: #e34adc;">:</span>

    <span style="color: #800000; font-weight: bold;">enum</span> <span style="color: #800080;">{</span> IDD <span style="color: #808030;">=</span> IDD_RENDERER <span style="color: #800080;">}</span><span style="color: #800080;">;</span>

BEGIN_MSG_MAP_EX<span style="color: #808030;">(</span>CRendererDialog<span style="color: #808030;">)</span>
    MSG_WM_INITDIALOG<span style="color: #808030;">(</span>OnInitDialog<span style="color: #808030;">)</span>
    MSG_WM_DESTROY<span style="color: #808030;">(</span>OnDestroy<span style="color: #808030;">)</span>
    MSG_WM_ERASEBKGND<span style="color: #808030;">(</span><span style="color: #400000;">OnEraseBkgnd</span><span style="color: #808030;">)</span>
    MSG_WM_PAINT<span style="color: #808030;">(</span>OnPaint<span style="color: #808030;">)</span>
    MSG_WM_DISPLAYCHANGE<span style="color: #808030;">(</span>OnDisplayChange<span style="color: #808030;">)</span>
    MSG_WM_KEYDOWN<span style="color: #808030;">(</span>OnKeyDown<span style="color: #808030;">)</span>
    COMMAND_ID_HANDLER_EX<span style="color: #808030;">(</span>IDCANCEL<span style="color: #808030;">,</span> OnCancel<span style="color: #808030;">)</span>
END_MSG_MAP<span style="color: #808030;">(</span><span style="color: #808030;">)</span>

<span style="color: #800000; font-weight: bold;">private</span><span style="color: #e34adc;">:</span>
    CMainDialog<span style="color: #808030;">&amp;</span> m_Owner<span style="color: #800080;">;</span>
<span style="color: #696969;">//...</span></pre>
</pre>
<p>The dialog template does not have a caption, it has no frame and has its window rectangle equal to client area. As a result, spanning the Video Mixing Renderer to the entire client area and proper positioning of the dialog window is showing video on the entire monitor.</p>
<pre>
<pre style="background: #ffffff none repeat scroll 0% 0%; color: #000000;">ATLVERIFY<span style="color: #808030;">(</span>m_RendererDialog<span style="color: #808030;">.</span>Create<span style="color: #808030;">(</span>m_hWnd<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
ATLVERIFY<span style="color: #808030;">(</span>m_RendererDialog<span style="color: #808030;">.</span><span style="color: #400000;">MoveWindow</span><span style="color: #808030;">(</span>MonitorData<span style="color: #808030;">.</span>m_Position<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
m_RendererDialog<span style="color: #808030;">.</span><span style="color: #400000;">ShowWindow</span><span style="color: #808030;">(</span>SW_SHOWNORMAL<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="color: #696969;">// ...</span>
ATLENSURE_SUCCEEDED<span style="color: #808030;">(</span>pVmrWindowlessControl<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>SetVideoClippingWindow<span style="color: #808030;">(</span>m_RendererDialog<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
ATLENSURE_SUCCEEDED<span style="color: #808030;">(</span>pVmrWindowlessControl<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>SetVideoPosition<span style="color: #808030;">(</span><span style="color: #7d0045;">NULL</span><span style="color: #808030;">,</span> m_RendererDialog<span style="color: #808030;">.</span>GetVideoPosition<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span></pre>
</pre>
<p>Visual C++ .NET 2008 source code is <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FullScreenWindowlessVmrSample01">available from SVN</a>, release binary <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FullScreenWindowlessVmrSample01/Release/FullScreenWindowlessVmrSample01.exe?format=raw">included</a>. The project is using ATL and <a href="http://wtl.sourceforge.net/">WTL</a> libraries.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1082/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to make a constant frame rate video stream from variable frame rate stream, and rescale it</title>
		<link>http://alax.info/blog/1080</link>
		<comments>http://alax.info/blog/1080#comments</comments>
		<pubDate>Thu, 08 Oct 2009 16:51:15 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[fps]]></category>
		<category><![CDATA[frame rate]]></category>
		<category><![CDATA[resolution]]></category>
		<category><![CDATA[time stamp]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1080</guid>
		<description><![CDATA[From a conversation:
I have a  video stream with variable frame rate, I want to make this in to a constant  frame rate. Do you know of any filters that could help me with this?
Such filter is actually quite easy. You only need to update time stamps of the media samples that are going through. [...]]]></description>
			<content:encoded><![CDATA[<p>From a conversation:</p>
<blockquote><p>I have a  video stream with variable frame rate, I want to make this in to a constant  frame rate. Do you know of any filters that could help me with this?</p></blockquote>
<p>Such filter is actually quite easy. You only need to update time stamps of the media samples that are going through. I am not aware of  an &#8220;out of the box&#8221; ready filter, but you can even do it without special filter: if you build your graph with <a href="http://msdn.microsoft.com/en-us/library/dd377544%28VS.85%29.aspx">Sample Grabber Filter</a> in it in  the place of interest, and initialize it to have a callback for each sample, then in <a href="http://msdn.microsoft.com/en-us/library/dd376987%28VS.85%29.aspx">SampleCB</a> method you will be able to update time stamps using methods of <a href="http://msdn.microsoft.com/en-us/library/dd407001%28VS.85%29.aspx">IMediaSample</a> interface. This is sufficient to redistribute the frames on the timeline, so that they go at constant frame rate.</p>
<blockquote><p>In your opinion what is the best way to scale the video?</p></blockquote>
<p>The best depends on what is the criteria (speed, quality etc). The simplest for me while very efficient &#8211; and I did this a number of times &#8211; is to use a custom filter which inside it uses <a href="http://msdn.microsoft.com/en-us/library/dd145120%28VS.85%29.aspx">StretchBlt</a> <a href="http://msdn.microsoft.com/en-us/library/dd145120%28VS.85%29.aspx" target="_blank"></a> function on a per frame basis to scale input RGB video into output RGB video of a different resolution.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1080/feed</wfw:commentRss>
		<slash:comments>0</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[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 [...]]]></description>
			<content:encoded><![CDATA[<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>
		<item>
		<title>DirectShow Related Bugs: MediaLooks MPEG-2 Video Decoder, Haali Media Splitter (AR)</title>
		<link>http://alax.info/blog/1064</link>
		<comments>http://alax.info/blog/1064#comments</comments>
		<pubDate>Sat, 03 Oct 2009 06:50:03 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[decoder]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[filters]]></category>
		<category><![CDATA[haali]]></category>
		<category><![CDATA[medialooks]]></category>
		<category><![CDATA[message]]></category>
		<category><![CDATA[protection]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1064</guid>
		<description><![CDATA[An attempt to render media file in GraphStudio ended up with an error message:
Protection
A monitor program has been foun drunning in your system. Please unload it from memory and restart your program.
The module which popped up the message chose to not identify itself in a friendly manner, however as nothing goes untraceable it appeared to [...]]]></description>
			<content:encoded><![CDATA[<p>An attempt to render media file in <a href="http://blog.monogram.sk/janos/tools/monogram-graphstudio/">GraphStudio</a> ended up with an error message:</p>
<blockquote><p>Protection<br />
A monitor program has been foun drunning in your system. Please unload it from memory and restart your program.</p></blockquote>
<p>The module which popped up the message chose to not identify itself in a friendly manner, however as nothing goes untraceable it appeared to be <a href="http://www.medialooks.com">MediaLooks</a> MPEG-2 Video Decoder file, Mpeg2DecoderL.dll (version 1.0.3.9). As the message was popped up from a non-GUI thread, there was no way to close the box &#8211; the entire application froze&#8230;</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2009/10/03-Image001.png"><img class="alignnone size-medium wp-image-1065" title="MediaLooks MPEG-2 Video Decoder Error Message" src="http://alax.info/blog/wp-content/uploads/2009/10/03-Image001-320x166.png" alt="MediaLooks MPEG-2 Video Decoder Error Message" width="320" height="166" /></a></p>
<p>The problem does not happen in <a href="http://msdn.microsoft.com/en-us/library/dd390950%28VS.85%29.aspx">GraphEdit</a>, as the decoder is probably handling this case specifically.</p>
<p>The decoder has an deinstallation batch file located in application directory: C:\Program Files\MediaLooks\Mpeg2Decoder\Uninstall.bat. A curious thing, however, is that running this file in attempt to uninstall the decoder shows the same problem: the decoder refuses to be uninstalled due to mystic &#8220;monitor program&#8221; running in the system:</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2009/10/03-Image002.png"><img class="alignnone size-medium wp-image-1066" title="MediaLooks MPEG-2 Video Decoder Deinstallation Failure" src="http://alax.info/blog/wp-content/uploads/2009/10/03-Image002-320x96.png" alt="MediaLooks MPEG-2 Video Decoder Deinstallation Failure" width="320" height="96" /></a></p>
<p>After closing the message box the application still continues deinstallation script and removes the decoder from system.</p>
<p>Another issue for this file (and hopefully for today) is that another filter <a href="http://haali.cs.msu.ru/mkv/">Haali Media Splitter (AR)</a> (splitter.ax, version 1.9.42.1) is crashing the hosting process on being removed from the graph.</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2009/10/03-Image003.png"><img class="alignnone size-medium wp-image-1067" title="Haali Media Splitter Crash" src="http://alax.info/blog/wp-content/uploads/2009/10/03-Image003-320x172.png" alt="Haali Media Splitter Crash" width="320" height="172" /></a> <a href="http://alax.info/blog/wp-content/uploads/2009/10/03-Image004.png"><img class="alignnone size-medium wp-image-1068" title="Haali Media Splitter Crash" src="http://alax.info/blog/wp-content/uploads/2009/10/03-Image004-320x122.png" alt="Haali Media Splitter Crash" width="320" height="122" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1064/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to dynamically change resolution for video preview</title>
		<link>http://alax.info/blog/1061</link>
		<comments>http://alax.info/blog/1061#comments</comments>
		<pubDate>Wed, 30 Sep 2009 16:28:08 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[bridge]]></category>
		<category><![CDATA[capture]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[preview]]></category>
		<category><![CDATA[question]]></category>
		<category><![CDATA[resolution]]></category>
		<category><![CDATA[split]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1061</guid>
		<description><![CDATA[From a conversation:
Q: I am using Web camera with DirectShow. Camera has only capture pin, so I am looking for the best way to switch resolution on the pin while graph is running. I would like to keep preview with smaller image size and when i would like to capture an image i would like [...]]]></description>
			<content:encoded><![CDATA[<p>From a conversation:</p>
<blockquote><p><span id=":1t8" dir="ltr">Q: I am using Web camera with DirectShow. </span>Camera has only capture pin, so I am looking for the best way to switch resolution on the pin while graph is running. I would like to keep preview with smaller image size and when i would like to capture an image i would like to switch to full resolution. I have to use sample grabber callback since i need access to single image to process them. Is there a way to do that without stopping and starting a graph? This works but very slow between captures.</p></blockquote>
<p><span id=":1sb" dir="ltr">Is it possible to just reconnect the sample grabber only with new media changes and then resume the graph? Currently i just kill the graph and start it again, but it takes few seconds to do so, so I am looking the way to reduce that time.</span></p>
<p><span id=":1rj" dir="ltr">There is no way to switch resolution on the running graph. There is a technique to dynamically start/stop individual filters and re-negotiate resolutions (media types), but it does not work for the majority of filters. </span><span id=":1rl" dir="ltr">Additionally to that <a href="http://msdn.microsoft.com/en-us/library/dd377544%28VS.85%29.aspx">Sample Grabber </a></span><a href="http://msdn.microsoft.com/en-us/library/dd377544%28VS.85%29.aspx"><span id=":1rl" dir="ltr">Filter</span></a><span id=":1rl" dir="ltr"><a href="http://msdn.microsoft.com/en-us/library/dd377544%28VS.85%29.aspx"></a> cannot change resolution too, as it passes data through.</span></p>
<p><span id=":1u4" dir="ltr">If you only have to use switched resolution for preview, you can use <a href="http://www.gdcl.co.uk/gjd.htm">Geraint&#8217;s</a> <a href="http://www.gdcl.co.uk/gmfbridge/index.htm">GMFBridge Toolkit</a> to join two graphs, and a filter that changes resolution. Combining all that you will have a running capture graph that [also] renders video to a bridge sink. </span>In the other graph you have another bridge sink that receives video from first graph and then you resize video to the resolution of interest already in the second graph. You can stop and reconfigure only second graph to update resolution and have first graph running and capturing. This is the best you can do, or just stop your single graph and change resolution this simple way.</p>
<p>So a solution, which is used by many, and I can recommend it too, is to use <span id=":1u4" dir="ltr"><a href="http://www.gdcl.co.uk/gmfbridge/index.htm">GMFBridge</a></span> bridging. Additionally, <span id=":1tv" dir="ltr">you can find questions and answers on it on <a href="http://social.msdn.microsoft.com/forums/en-US/windowsdirectshowdevelopment/threads/?filter=unread">MSDN DirectShow Development Forum</a> (search for &#8220;bridge&#8221; there). W</span><span id=":1tv" dir="ltr">ith a certain effort you can duplicate this with your own code but this is more or less ready to use solution and</span>, again, the key advantage you have that you have two graphs which you can top independently.</p>
<blockquote><p><span id=":1tc" dir="ltr">Would it be possible to use smart tee as a splitter on the capture pin, and then use two sample grabbers on capture and preview, one with smaller resolution and the other one with higher one?</span></p></blockquote>
<p><span id=":1tt" dir="ltr">With a <a href="http://msdn.microsoft.com/en-us/library/dd377612%28VS.85%29.aspx">Smart Tee Filter</a> you will still have 1 graph, so no individual resolution changes without stopping the graph. Additionally to that, Smart Tee Filter will deliver same frame on its output pins, so they will have to have one resolution and no resizing takes place inside.</span></p>
<blockquote><p><span dir="ltr">Also, </span><span id=":1sg" dir="ltr">is it possible to run 2 graphs in the same time? Same device, 2 graphs, 2 sample grabbers.</span></p></blockquote>
<p><span id=":1u8" dir="ltr">Most likely no, for only one reason: you won&#8217;t be able to have two running filters for the same device, as source filter will exclusively lock the device.</span><span dir="ltr"> </span> <span id=":1tf" dir="ltr">So capture filter will be a single filter. You can use <a href="http://msdn.microsoft.com/en-us/library/dd390336%28VS.85%29.aspx">Infinite Tee Pin Filter</a> to split stream between 2+ processing lines. And you can use the same bridge to pass data into another graph for further processing.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1061/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to overlay a bitmap on top of video with Video Mixing Renderer (VMR-9)</title>
		<link>http://alax.info/blog/1044</link>
		<comments>http://alax.info/blog/1044#comments</comments>
		<pubDate>Mon, 21 Sep 2009 17:01:25 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[ATL]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[overlay]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[VMR]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1044</guid>
		<description><![CDATA[A 100-lines code snippet which illustrates how a bitmap is overlaid over displayed video with Video Mixing Renderer 9 Filter using IVMRMixerBitmap9 interface. A video clip is played (default is Windows clock.avi, but you can replace it with your longer one to see overlay is really in a loop).
http://code.assembla.com/&#8230;/VmrMixerBitmapSample01/&#8230;
VMR9AlphaBitmap AlphaBitmap;
ZeroMemory(&#38;AlphaBitmap, sizeof AlphaBitmap);
AlphaBitmap.dwFlags = VMR9AlphaBitmap_hDC;
AlphaBitmap.hdc = [...]]]></description>
			<content:encoded><![CDATA[<p>A 100-lines code snippet which illustrates how a bitmap is overlaid over displayed video with <a href="http://msdn.microsoft.com/en-us/library/dd407344%28VS.85%29.aspx">Video Mixing Renderer 9 Filter</a> using <a href="http://msdn.microsoft.com/en-us/library/dd390449%28VS.85%29.aspx">IVMRMixerBitmap9</a> interface. A video clip is played (default is Windows clock.avi, but you can replace it with your longer one to see overlay is really in a loop).</p>
<p><a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/VmrMixerBitmapSample01/VmrMixerBitmapSample01.cpp#ln49">http://code.assembla.com/&#8230;/VmrMixerBitmapSample01/&#8230;</a></p>
<pre>VMR9AlphaBitmap AlphaBitmap<span style="color: #800080;">;</span>
<span style="color: #400000;">ZeroMemory</span><span style="color: #808030;">(</span><span style="color: #808030;">&amp;</span>AlphaBitmap<span style="color: #808030;">,</span> <span style="color: #800000; font-weight: bold;">sizeof</span> AlphaBitmap<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
AlphaBitmap<span style="color: #808030;">.</span>dwFlags <span style="color: #808030;">=</span> VMR9AlphaBitmap_hDC<span style="color: #800080;">;</span>
AlphaBitmap<span style="color: #808030;">.</span>hdc <span style="color: #808030;">=</span> Dc<span style="color: #800080;">;</span>
AlphaBitmap<span style="color: #808030;">.</span>rSrc <span style="color: #808030;">=</span> <span style="color: #603000;">CRect</span><span style="color: #808030;">(</span><span style="color: #008c00;">0</span><span style="color: #808030;">,</span> <span style="color: #008c00;">0</span><span style="color: #808030;">,</span> <span style="color: #008c00;">32</span><span style="color: #808030;">,</span> <span style="color: #008c00;">32</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
AlphaBitmap<span style="color: #808030;">.</span>rDest<span style="color: #808030;">.</span>left <span style="color: #808030;">=</span> <span style="color: #808030;">(</span><span style="color: #603000;">FLOAT</span><span style="color: #808030;">)</span> <span style="color: #008000;">0.75</span><span style="color: #800080;">;</span>
AlphaBitmap<span style="color: #808030;">.</span>rDest<span style="color: #808030;">.</span>top <span style="color: #808030;">=</span> <span style="color: #808030;">(</span><span style="color: #603000;">FLOAT</span><span style="color: #808030;">)</span> <span style="color: #008000;">0.75</span><span style="color: #800080;">;</span>
AlphaBitmap<span style="color: #808030;">.</span>rDest<span style="color: #808030;">.</span>right <span style="color: #808030;">=</span> <span style="color: #808030;">(</span><span style="color: #603000;">FLOAT</span><span style="color: #808030;">)</span> <span style="color: #008000;">0.95</span><span style="color: #800080;">;</span>
AlphaBitmap<span style="color: #808030;">.</span>rDest<span style="color: #808030;">.</span>bottom <span style="color: #808030;">=</span> <span style="color: #808030;">(</span><span style="color: #603000;">FLOAT</span><span style="color: #808030;">)</span> <span style="color: #008000;">0.95</span><span style="color: #800080;">;</span>
AlphaBitmap<span style="color: #808030;">.</span>fAlpha <span style="color: #808030;">=</span> <span style="color: #008000;">0.75</span><span style="color: #800080;">;</span>
<span style="color: #800000; font-weight: bold;">const</span> HRESULT nSetAlphaBitmapResult <span style="color: #808030;">=</span> pVmrMixerBitmap<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>SetAlphaBitmap<span style="color: #808030;">(</span><span style="color: #808030;">&amp;</span>AlphaBitmap<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
ATLENSURE_SUCCEEDED<span style="color: #808030;">(</span>nSetAlphaBitmapResult<span style="color: #808030;">)</span><span style="color: #800080;">;</span></pre>
<p>With a low FPS clip like clock.avi it is clear that the overlaid image is only updated with the next &#8220;main&#8221; video frame.</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2009/09/21-image002.png"><img class="alignnone size-medium wp-image-1045" title="IVMRMixerBitmap9 Usage Sample" src="http://alax.info/blog/wp-content/uploads/2009/09/21-image002-320x272.png" alt="IVMRMixerBitmap9 Usage Sample" width="320" height="272" /></a></p>
<p>Visual C++ .NET 2008 source code is <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/VmrMixerBitmapSample01/">available from SVN</a>, release binary <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/VmrMixerBitmapSample01/Release/VmrMixerBitmapSample01.exe?format=raw">included</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1044/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Audio Oscillogram DirectShow Filter</title>
		<link>http://alax.info/blog/1033</link>
		<comments>http://alax.info/blog/1033#comments</comments>
		<pubDate>Fri, 18 Sep 2009 17:01:32 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Media Tools]]></category>
		<category><![CDATA[Audio]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[mediatools]]></category>
		<category><![CDATA[visual]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1033</guid>
		<description><![CDATA[Unlike video, audio is difficult to troubleshoot in a way that once an issue has been noticed it was dynamic and already in past and it may be difficult to repeat, explain, forward as a screenshot etc. So it needs a visualization in order to check certain specific of the media stream.
Here we go with [...]]]></description>
			<content:encoded><![CDATA[<p>Unlike video, audio is difficult to troubleshoot in a way that once an issue has been noticed it was dynamic and already in past and it may be difficult to repeat, explain, forward as a screenshot etc. So it needs a visualization in order to check certain specific of the media stream.</p>
<p>Here we go with a Audio Oscillogram Filter, a filter which may be inserted into audio part of the graph, it insists on PCM audio (multichannel is OK, 8 or 16 bits per sample), so decoders might be required upstream and will be automatically inserted.</p>
<p>Once the filter is running, it shows a tool window with a visualization of the waveform coming through. Additionally, it shows a discontinuity sample (that is, a sample with <a href="http://msdn.microsoft.com/en-us/library/dd373500%28VS.85%29.aspx">AM_SAMPLE_DATADISCONTINUITY</a> flag)  with a thick read vertical line, and a mismatch (gap or override) in neighboring sample start and stop times with a thin red line.</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2009/09/18-image001.png"><img class="alignnone size-medium wp-image-1034" title="Alax.Info Audio Oscillogram Filter" src="http://alax.info/blog/wp-content/uploads/2009/09/18-image001-320x193.png" alt="Alax.Info Audio Oscillogram Filter" width="320" height="193" /></a></p>
<p>Additionally to this, a window provides an option to pop up downstream audio renderer property sheet in order to check/debug rendering statistics, such as buffer fullness and break count (programmatically available via <a href="http://msdn.microsoft.com/en-us/library/dd389140%28VS.85%29.aspx">IAMAudioRendererStats</a> interface). Unfortunately Microsoft does not provide a well done proxy/stub pair for this interface and the property page and there is no way to access this property page connecting to graph remotely. Using this filter the property sheet is shown directly from the hosting process and works correctly.</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2009/09/20-image001.png"><img class="alignnone size-medium wp-image-1042" title="Audio Renderer Properties" src="http://alax.info/blog/wp-content/uploads/2009/09/20-image001-320x231.png" alt="Audio Renderer Properties" width="320" height="231" /></a></p>
<p>A partial Visual C++ .NET 2008 source code is <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/MediaTools/Utility">available from SVN</a>, release binary <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/MediaTools/_Bin/Release%20Trace/Utility.dll?format=raw">included</a>.</p>
<h2>File and Class Summary</h2>
<h3>Utility.dll</h3>
<p>Utility.dll (<a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/MediaTools/_Bin/Release%20Trace/Utility.dll?format=raw">download</a>) hosts the following classes:</p>
<ul>
<li>DirectShow Filters
<ul>
<li><span style="text-decoration: underline;">Audio Oscillogram Filter</span>, to visualize/debug audio data</li>
</ul>
</li>
</ul>
<h2>Class Overview</h2>
<h3>Audio Oscillogram Filter</h3>
<p>The filter visualizes PCM audio data going through in a form of oscillogram.</p>
<ul>
<li>Filter Executable: Utility.dll</li>
<li>Filter CLSID: __uuidof(PcmAudioOscillogramFilter) {1450C047-C394-469e-BBB6-A1F949B893FA}</li>
<li>Filter Property Page CLSID: N/A</li>
<li>Filter Merit: <a href="http://msdn.microsoft.com/en-us/library/ms787275%28VS.85%29.aspx">MERIT_DO_NOT_USE</a></li>
<li>Filter Category: <a href="http://msdn.microsoft.com/en-us/library/ms783347%28VS.85%29.aspx">CLSID_LegacyAmFilterCategory</a></li>
<li>Filter Interfaces: <a href="http://msdn.microsoft.com/en-us/library/ms682273%28VS.85%29.aspx">IPersistStreamInit</a>, <a href="http://msdn.microsoft.com/en-us/library/ms690091%28VS.85%29.aspx">IPersistStream</a>, <a href="http://msdn.microsoft.com/en-us/library/ms784601%28VS.85%29.aspx">IBaseFilter</a>, <a href="http://msdn.microsoft.com/en-us/library/ms785914%28VS.85%29.aspx">IMediaFilter</a>, <a href="http://msdn.microsoft.com/en-us/library/ms688695%28VS.85%29.aspx">IPersist</a>, <a href="http://msdn.microsoft.com/en-us/library/ms784083%28VS.85%29.aspx">IAMovieSetup</a>, <a href="http://msdn.microsoft.com/en-us/library/ms783950%28VS.85%29.aspx">IAMFilterMiscFlags</a>, IPcmAudioOscillogramFilter, <a href="http://msdn.microsoft.com/en-us/library/ms221608.aspx">IDispatch</a></li>
<li>Filter Pins: single input pin (Input), single ouput pin (Ouput)</li>
<li>Input Pin Media Types: MEDIATYPE_Audio/MEDIASUBTYPE_PCM</li>
<li>Input Pin Interfaces: <a href="http://msdn.microsoft.com/en-us/library/ms786565%28VS.85%29.aspx">IPin</a>, <a href="http://msdn.microsoft.com/en-us/library/ms786054%28VS.85%29.aspx">IMemInputPin</a></li>
<li>Output Pin Media Types: MEDIATYPE_Audio/MEDIASUBTYPE_PCM</li>
<li>Output Pin Interfaces: <a href="http://msdn.microsoft.com/en-us/library/ms786565%28VS.85%29.aspx">IPin</a></li>
</ul>
<h4>Remarks</h4>
<p>The filter will create a tool window with audio visualization when put into paused/running state. The filter graph should be controlled (IMediaControl) from a GUI aware apartment so that window messages could reach internal filter&#8217;s window.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1033/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
