DirectShow Spy: Integration with GraphStudioNext

DirectShow Spy is introducing integration with GraphStudioNext (and GraphEdit too) to let a developer quickly open a filter graph through Running Object table with external inspection tool.

Note that you need a revision 301 GraphStudioNext or later, prebuilt versions available for download here: graphstudionext.exe (Win32)graphstudionext64.exe (x64).

DirectShow Filter Graph list window offers context menu items and hotkeys to launch GraphStudioNext with command line parameters to open specific filter graph.

GraphStudioNext Integration in Filter Graph List

DirectShow Filter Graph Property Frame dialog’s actions view has a button and a hotkey to open current filter graph in GraphStudioNext:

GraphStudioNext Integration in Filter Graph Actions

When invoked from DirectShowSpy UI, GraphStudioNext opens immediately at view of interest:

A Filter Graph in Graph Studio Next

Spy is looking for GraphStudioNext in last used location (stored in registry), in current spy’s directory, in GraphStudioNext registry subkey and if none of the mentioned works then prompts user to locate the binary.

Similar functionality is also available programmatically using one of the following ways:

  • ISpy::OpenGraphStudioNext([in] LONG nParentWindowHandle, [out, retval] VARIANT_BOOL* pbResult);
  • IFilterGraphHelper::OpenGraphStudioNext([in] LONG nParentWindowHandle, [in] BSTR sMonikerDisplayName, [out, retval] VARIANT_BOOL* pbResult);

Download links

DirectShow Spy: Filter Graph Data and Properties UI


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 graph details

On of the next posts should be summarizing all DirectShowSpy capabilities currently split across posts.

Filter Graph Details UI

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.

Properties Button in the Filter Graph List

The window contains a tree control on the left, items of which show the following elements:

  1. Top “Filters” item shows Markdown formatted text, mentioned in an earlier post
  2. Second level items are one per each filter participating in the filter graph
    • a double click of such item brings up standard OleCreatePropertyFrame property sheet with filter properties
    • an edit control to the right lists filter specific information, with connections and media types
  3. 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
  4. Bottom first level “Email” items provides a convenient way to send the information via email

The picture below shows a property page integrated into the UI:

Integrated Filter Property Page

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.

Email Filter Graph

Programmatic Interface

Additionally to interactive access from filter graph list, the new UI is also accessible viaFilterGraphHelper COM class. This lets applications integrate new capability right into the application as a troubleshooting option.

While accessing the graph through ROT using GraphStudioNext/GraphEdit application remains the most convenient interactive way to work with the graph, the helper’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.

FilterGraphHelper‘s FilterGraph property 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).

IFilterGraphHelper::DoPropertyFrameModal method shows the UI modal window introduced above.

Two samples are demonstrating programmatic access to the new helper method.

  1. Sample\FilterGraphHelperDialog (SVN) C# application (code snippet) shows it straightforward way: to build a graph, to initialize helper, to show modal UI:
    IFilterGraph2 graph = new FilterGraph() as IFilterGraph2;
    graph.RenderFile(@"E:\Media\GoPro 2010 Highlights - You in HD - 1920x1080.mp4", "");
    FilterGraphHelper helper = new FilterGraphHelper();
    helper.FilterGraph = graph;
  2. Sample\RegistrationFreeFilterGraphHelper (SVN) C++ application features an advanced technique to leverage new capability in application, without need to COM-register the Spy.

Registration of the DirectShowSpy requires, generally speaking, administrative privileges. Then in addition spy hooks the system which might be not desirable.

The application however load the Spy directly using LoadLibrary API and instantiates the helper directly bypassing COM registration. This is sufficient to start the new UI feature and access the graph interactively.

    CComPtr<IFilterGraphHelper> pFilterGraphHelper;
    #if TRUE
        const HMODULE hModule = LoadLibrary(_T("DirectShowSpy.dll"));
        ATLENSURE_SUCCEEDED(pClassFactory->CreateInstance(NULL, __uuidof(IFilterGraphHelper), (VOID**) &pFilterGraphHelper));
        // TODO: FreeLibrary against hModule

The alternate #if code path shows the COM registration equivalent for the code.

Download links

ConnectivityWatchdog: Inaccessible TCP based Service Notification via Email

This is dual “yet another…” and utility clearance series. Once again an attempt to easily automate network availability check for a service.

The application is doing periodic TCP connectivity check and sends an email to notify on inaccessible service. If you got systems running at 2+ sites, they can be set up to check one another and inform timely on network issues.

ConnectivityWatchdog Screenshot

Configuration is provided through ConnectivityWatchdog.ini file to be put into the directory of the binary. Sample file is as follows:


$(SomeUniqueIdentifer)=$(FriendlyName), tcp, $(TcpHostOrIpAddress), $(TcpPort)
$(SomeUniqueIdentifer)=$(FriendlyName), tcp, $(TcpHostOrIpAddress), $(TcpPort)

Connection Time=45 ; Timeout for TCP connection attempt, seconds
Success Idleness Time=60 ; Next attempt in case of successful connection, seconds
Failure Idleness Time=10 ; Next attempt in case of failed connection, seconds
Notification Failure Count=3, 33, 333 ; Numbers of failure attempts which trigger email notification 

Delay=450 ; Delay in notification in order to combine messages into single email, seconds 

Authentication Methods=login
Authentication Name=$(UserName)
Authentication Password=$(Password)

Once the application notices TCP connectivity issues, it updates UI status and as configured (see “Notification Failure Count” value above) it will trigger a notification email:

The following are the updates on $(Host) system:

 * Remote host $(FriendlyName) connection SUCCEEDED after 8 failures [2013-12-12 02:15:06 - 4 minutes ago]
 * Remote host $(FriendlyName) connection FAILED 3 times in a row (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond - 0x8007274c) [2013-12-12 02:12:21 - 7 minutes ago]

  System: $(Host)
  Time: 2013-12-12 02:19:51
  Agent: Alax.Info ConnectivityWatchdog Application/

All $(…) values above are placeholders.

The application has a convenient option to enable automatic startup with user logon.

ConnectivityWatchdog Current User Startup

Download links

DirectShow Spy: Human Friendly Filter Graph Information and Filter Graph List

A typical task for DirectShow Spy is to get installed onto, make the target application filter graphs available for inspection and… then get inspected with some additional tool. The last step assumes there is an additional application ready to pick the graphs and an interactive user attaches to the graphs for visual inspection and troubleshooting.

There are great tools to access DirectShow filter graphs via Running Object Table, GraphEdit, GraphStudio and GraphStudioNext – to name a few. However quite so often the task in question is to simply grab information about the filter graph topology and take it away. DirectShow Spy now offers this capability:

ROT Filter Graphs

The property sheet lists the available ROT filter graphs in a developer-friendly way:

  • sorted in reverse chronological order to easily pick the one of interest
  • Check button updates filter count and state of the selected graphs
  • Copy button puts a user friendly filter graph description onto clipboard, for one or several selected filter graphs:
    • information is formatted using Markdown formatting (both readable as raw text and even better via HTML conversion; a sample filter graph information is shown below)
    • the text mentions graph state, filters, connections and media types

Clipboard integration makes it really easy to pass the information through remote access applications.

More to that, the “graph to text” conversion is available programmatically. C# code snippet (full C# project is here) as simple as the following makes Markdown filter graph information available to the application for logging or otherwise troubleshooting purposes:

static void Main(string[] args)
    IFilterGraph2 graph = new FilterGraph() as IFilterGraph2;
    graph.RenderFile(@"E:\Media\GoPro 2010 Highlights - You in HD - 1920x1080.mp4", "");
    FilterGraphHelper helper = new FilterGraphHelper();
    helper.FilterGraph = graph;

The new UI is available through exported function DoFilterGraphListPropertySheetModal.

Download links

An example of filter graph description is shown below:

Sample Markdown Output

DeckLinkCapabilities: A Printout of Capabilities of Blackmagic Design/DeckLink Hardware

The tool provides a user- (well, actually a developer-) friendly printout of capabilities accessible via Blackmagic Design DeckLink SDK for DeckLink series of hardware. This covers features of DeckLink and Intensity series of hardware for video/audio capture, accessible via vendor’s SDK. The data is printed out in Markdown format, easy to read on its own and even nicer on Markdown Pad.

Alax.Info DeckLinkCapabilities

Alax.Info DeckLinkCapabilities Output on MarkdownPad

The hardware is good, and the SDK is designed nicely as well, however the product range is wide and capabilities vary. So do driver and SDK versions, and the tool is handy to quick check the information out. One might want to use SDK for many reasons, including the following ideas I am sharing off the top of my head:

  • wanting to leverage the full feature set of the hardware
  • operate at minimal overhead
  • user a simpler API compared to generic media APIs
  • being unsatisfied with DirectShow interface provided by Blackmagic Design

Continue reading →

RotView: What is on ROT?

Once upon a time Windows SDK (or it was Visual Studio) had a tool named IROTVIEW which enumerated Running Object Table (ROT).

Running Object Table Viewer

IROTVIEW displays information about ActiveX and OLE objects currently existing in memory.

People ask “Where is IROTVIEW?” and there is no answer.

The API is really simple, but if you want a quick check what’s on your ROT you still want a handy tool. In particular, you might want to check ROT if your app is using RegisterActiveObject API to publish active COM objects. Here we go, this RotView application lists the ROT contents:

RotView UI

Available in both Win32 and x64 versions, it also shows OS marshaling of ROT entries and their availability to “both worlds”. The application does more:

  • Shows COM class descriptions for active COM objects, path to binary that hosts COM class
  • “Probes” COM objects by trying to query IUnknown of a ROT entry

Hint: Hold Ctrl+Shift to have a tool tip popping up duplicate its content onto clipboard.

Download links

CaptureClock: Utility to Check Video/Audio Capture Rates

Someone discovered the utility while browsing my public repository (the app prompts to post data back to the website, and the anonymous user accepted the offer and posted the report from this unpublished application), so I have to drop a few lines about the tool.

The idea is basically straightforward: live capture involves attaching time stamps to media samples, and there is a chance that the time stamps slide away causing unwanted effects on captured clip. The application captures video and audio simultaneously and tracks media sample time stamps, and compares them against system clock as well. Having it simply run for a few minutes one can see how the capture is doing and if any of the timings drift away. Being stopped it puts report onto clipboard and optionally posts it back to me online (no actually specific intent about this data, however if you want to share data for a device that does drift away, you are to only click once to send me the details).

CaptureClock operation

The output is on clipboard in tab-separated values (TSV) format:

Computer Name   PSI
Windows Version 6.1.7601 Service Pack 1
Video Device    Conexant's BtPCI Capture    @device:pnp:\\?\pci#ven_109e&dev_036e&subsys_18511851&rev_02#4&39c3dd91&0&08f0#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global
Audio Device    Stereo Mix (Realtek High Defini @device:cm:{33D9A762-90C8-11D0-BD43-00A0C911CE86}\Stereo Mix (Realtek High Defini

System Time Video Sample Count  Video Sample Time   Relative Video Sample Time  Audio Sample Count  Audio Sample Time   Relative Audio Sample Time
30439   907 30381   -57 304 30291   -147

Or you might prefer pasting it onto Excel:

CapptureClock Output on Excel

By the way, this is also an easy way to ensure devices are operational and check effective video frame rate.

Download links: