{"id":1482,"date":"2014-01-11T21:21:40","date_gmt":"2014-01-11T19:21:40","guid":{"rendered":"https:\/\/alax.info\/blog\/?p=1482"},"modified":"2014-01-11T01:20:37","modified_gmt":"2014-01-10T23:20:37","slug":"directshow-spy-filter-graph-data-and-properties-ui","status":"publish","type":"post","link":"https:\/\/alax.info\/blog\/1482","title":{"rendered":"DirectShow Spy: Filter Graph Data and Properties UI"},"content":{"rendered":"<div>\n<h3>Summary<\/h3>\n<p>DirectShow Spy receives a set of new powerful updates helping to develop and troubleshoot DirectShow applications:<\/p>\n<ul>\n<li>UI combining Markdown formatted filter graph details as well as property pages for all participating filters\n<ul>\n<li>available interactively via filter graph list<\/li>\n<li>available via helper COM class letting DirectShow application integrate incredible troubleshooting capabilities<\/li>\n<\/ul>\n<\/li>\n<li>Option to email filter graph details<\/li>\n<\/ul>\n<p>On of the next posts should be summarizing all DirectShowSpy capabilities currently split across posts.<\/p>\n<h3>Filter Graph Details UI<\/h3>\n<p>Filter graph list window received a new button Properties with the associated action duplicated on double click handler for the list item. Once clicked, a new UI pops up to bring information about the entire graph.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1483\" alt=\"Properties Button in the Filter Graph List\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2014\/01\/Image001.png\" width=\"635\" height=\"338\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2014\/01\/Image001.png 635w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2014\/01\/Image001-320x170.png 320w\" sizes=\"auto, (max-width: 635px) 100vw, 635px\" \/><\/p>\n<p>The window contains a tree control on the left, items of which show the following elements:<\/p>\n<ol>\n<li>Top &#8220;Filters&#8221; item shows Markdown formatted text, mentioned in\u00c2\u00a0<a href=\"https:\/\/alax.info\/blog\/1460\" target=\"_blank\">an earlier post<\/a><\/li>\n<li>Second level items are one per each filter participating in the filter graph\n<ul>\n<li>a double click of such item brings up standard\u00c2\u00a0<code>OleCreatePropertyFrame<\/code>\u00c2\u00a0property sheet with filter properties<\/li>\n<li>an edit control to the right lists filter specific information, with connections and media types<\/li>\n<\/ul>\n<\/li>\n<li>Third level items are property pages of the filter, the property pages are integrated into the window; all together, the window provides access to all property pages of all filters in the graph<\/li>\n<li>Bottom first level &#8220;Email&#8221; items provides a convenient way to send the information via email<\/li>\n<\/ol>\n<p>The picture below shows a property page integrated into the UI:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1484\" alt=\"Integrated Filter Property Page\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2014\/01\/Image002.png\" width=\"651\" height=\"452\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2014\/01\/Image002.png 651w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2014\/01\/Image002-320x222.png 320w\" sizes=\"auto, (max-width: 651px) 100vw, 651px\" \/><\/p>\n<p>Email interface adds basic information about the system, and also provides space to enter a note about the graph. Email information (From, To etc) is put on registry for further reuse.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1485\" alt=\"Email Filter Graph\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2014\/01\/Image003.png\" width=\"794\" height=\"538\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2014\/01\/Image003.png 794w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2014\/01\/Image003-320x216.png 320w\" sizes=\"auto, (max-width: 794px) 100vw, 794px\" \/><\/p>\n<h4>Programmatic Interface<\/h4>\n<p>Additionally to interactive access from filter graph list, the new UI is also accessible via<code>FilterGraphHelper<\/code>\u00c2\u00a0COM class. This lets applications integrate new capability right into the application as a troubleshooting option.<\/p>\n<p>While accessing the graph through ROT using GraphStudioNext\/GraphEdit application remains the most convenient interactive way to work with the graph, the helper&#8217;s advantage is access to the graph without crossing process boundaries: this, in particular, provides smooth access to property pages not implemented well for marshaling, such as, for example, Audio Renderer related property pages.<\/p>\n<p><code>FilterGraphHelper<\/code>&#8216;s\u00c2\u00a0<code>FilterGraph<\/code>\u00c2\u00a0property accepts filter graph interface pointer (from now on, it is also possible to supply any filter or pin interface, and helper will walk up to the graph automatically).<\/p>\n<p><code>IFilterGraphHelper::DoPropertyFrameModal<\/code>\u00c2\u00a0method shows the UI modal window introduced above.<\/p>\n<p>Two samples are demonstrating programmatic access to the new helper method.<\/p>\n<ol>\n<li><a href=\"https:\/\/www.alax.info\/trac\/public\/browser\/trunk\/DirectShowSpy\/Sample\/FilterGraphHelperDialog\"><code>Sample\\FilterGraphHelperDialog<\/code><\/a> (<a href=\"https:\/\/www.alax.info\/svn\/public\/trunk\/DirectShowSpy\/Sample\/FilterGraphHelperDialog\/\">SVN<\/a>) C# application (code snippet) shows it straightforward way: to build a graph, to initialize helper, to show modal UI:\n<pre><code>IFilterGraph2 graph = new FilterGraph() as IFilterGraph2;\r\ngraph.RenderFile(@\"E:\\Media\\GoPro 2010 Highlights - You in HD - 1920x1080.mp4\", \"\");\r\nFilterGraphHelper helper = new FilterGraphHelper();\r\nhelper.FilterGraph = graph;\r\nhelper.DoPropertyFrameModal(0);\r\n<\/code><\/pre>\n<\/li>\n<li><a href=\"https:\/\/www.alax.info\/trac\/public\/browser\/trunk\/DirectShowSpy\/Sample\/RegistrationFreeFilterGraphHelper\"><code>Sample\\RegistrationFreeFilterGraphHelper<\/code><\/a> (<a href=\"https:\/\/www.alax.info\/svn\/public\/trunk\/DirectShowSpy\/Sample\/RegistrationFreeFilterGraphHelper\/\">SVN<\/a>) C++ application features an advanced technique to leverage new capability in application, without need to COM-register the Spy.<\/li>\n<\/ol>\n<p>Registration of the DirectShowSpy requires, generally speaking, administrative privileges. Then in addition spy hooks the system which might be not desirable.<\/p>\n<p>The application however load the Spy directly using\u00c2\u00a0<code>LoadLibrary<\/code>\u00c2\u00a0API and instantiates the helper directly bypassing COM registration. This is sufficient to start the new UI feature and access the graph interactively.<\/p>\n<pre><code>    CComPtr&lt;IFilterGraphHelper&gt; pFilterGraphHelper;\r\n    #if TRUE\r\n        const HMODULE hModule = LoadLibrary(_T(\"DirectShowSpy.dll\"));\r\n        [...]\r\n        ATLENSURE_SUCCEEDED(pClassFactory-&gt;CreateInstance(NULL, __uuidof(IFilterGraphHelper), (VOID**) &amp;pFilterGraphHelper));\r\n        \/\/ TODO: FreeLibrary against hModule\r\n    #else\r\n        ATLENSURE_SUCCEEDED(pFilterGraphHelper.CoCreateInstance(__uuidof(FilterGraphHelper)));\r\n    #endif\r\n    ATLENSURE_SUCCEEDED(pFilterGraphHelper-&gt;put_FilterGraph(pFilterGraph));\r\n    ATLENSURE_SUCCEEDED(pFilterGraphHelper-&gt;DoPropertyFrameModal(0));\r\n<\/code><\/pre>\n<p>The alternate\u00c2\u00a0<code>#if<\/code>\u00c2\u00a0code path shows the COM registration equivalent for the code.<\/p>\n<h4>Download links<\/h4>\n<ul>\n<li>Binaries: Win32 \u00e2\u20ac\u201c <a href=\"https:\/\/www.alax.info\/svn\/public\/trunk\/DirectShowSpy\/_Bin\/DirectShowSpy-Win32.dll\">DirectShowSpy-Win32.dll<\/a> (1.0.0.1125), x64 \u00e2\u20ac\u201c <a href=\"https:\/\/www.alax.info\/svn\/public\/trunk\/DirectShowSpy\/_Bin\/DirectShowSpy-x64.dll\">DirectShowSpy-x64.dll<\/a> (1.0.0.1124)<\/li>\n<li>Shortcuts to Exported Functions: <a href=\"https:\/\/www.alax.info\/svn\/public\/trunk\/DirectShowSpy\/_Bin\/\">Helper <code>.BAT<\/code> files<\/a><\/li>\n<li>License: This software is free to use<\/li>\n<li>Installation Instructions: <a href=\"https:\/\/alax.info\/blog\/777\">Original post<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Summary DirectShow Spy receives a set of new powerful updates helping to develop and troubleshoot DirectShow applications: UI combining Markdown formatted filter graph details as well as property pages for all participating filters available interactively via filter graph list available via helper COM class letting DirectShow application integrate incredible troubleshooting capabilities Option to email filter&hellip; <\/p>\n<p><a class=\"moretag\" href=\"https:\/\/alax.info\/blog\/1482\">Read the full article<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[95,78,446],"class_list":["post-1482","post","type-post","status-publish","format-standard","hentry","category-utilities","tag-com","tag-directshow","tag-directshowspy"],"_links":{"self":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/1482","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/comments?post=1482"}],"version-history":[{"count":0,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/1482\/revisions"}],"wp:attachment":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/media?parent=1482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/categories?post=1482"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/tags?post=1482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}