{"id":1550,"date":"2015-09-18T15:26:18","date_gmt":"2015-09-18T13:26:18","guid":{"rendered":"https:\/\/alax.info\/blog\/?p=1550"},"modified":"2015-09-18T15:27:18","modified_gmt":"2015-09-18T13:27:18","slug":"clsid_filtergraphnothread-and-imediaeventwaitforcompletion","status":"publish","type":"post","link":"https:\/\/alax.info\/blog\/1550","title":{"rendered":"CLSID_FilterGraphNoThread and IMediaEvent::WaitForCompletion"},"content":{"rendered":"<p>An interesting find about <code>CLSID_FilterGraphNoThread<\/code> version of DirectShow fitler graph implementation is that its <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/dd406914\" target=\"_blank\"><code>WaitForCompletion<\/code><\/a> method available through <code>IMediaEvent<\/code> and <code>IMediaEventEx<\/code> interfaces is not implemented: the immediately returned value is <code>E_NOTIMPL<\/code>.<\/p>\n<p><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/dd375786\" target=\"_blank\"><code>CLSID_FilterGraphNoThread<\/code><\/a> itself is not well documented and is rather a spin off the baseline implementation (which is &#8211; my guess would be &#8211; was introduced at some later stage and was necessary for windowless filter graphs running in worker threads; perhaps Windows Media Player team requested this at some point of WMP development):<\/p>\n<blockquote><p>&#8230; creates the Filter Graph Manager on the application&#8217;s thread. If you use this CLSID, the thread that calls CoCreateInstance must have a message loop that dispatches messages; otherwise, deadlocks can occur. Also, before the application thread exits, it must release the Filter Graph Manager and all graph objects (such as filters, pins, reference clocks, and so forth).<\/p><\/blockquote>\n<p>The filter graph does not have its internal worker window and is unable to wait for completion in its usual manner. Hence the error. Those who are using <code>CLSID_FilterGraphNoThread<\/code> version of the filter graphs are supposed to handle <code>EC_COMPLETE<\/code> events to detect the completion.<\/p>\n<p>I suppose it is not intended and not even somehow foreseen behavior, but who uses <code>CLSID_FilterGraphNoThread<\/code> anyway except Windows Media Player and those who can cope with the problem.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An interesting find about CLSID_FilterGraphNoThread version of DirectShow fitler graph implementation is that its WaitForCompletion method available through IMediaEvent and IMediaEventEx interfaces is not implemented: the immediately returned value is E_NOTIMPL. CLSID_FilterGraphNoThread itself is not well documented and is rather a spin off the baseline implementation (which is &#8211; my guess would be &#8211; was&hellip; <\/p>\n<p><a class=\"moretag\" href=\"https:\/\/alax.info\/blog\/1550\">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":[1],"tags":[78],"class_list":["post-1550","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-directshow"],"_links":{"self":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/1550","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=1550"}],"version-history":[{"count":0,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/1550\/revisions"}],"wp:attachment":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/media?parent=1550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/categories?post=1550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/tags?post=1550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}