Click here to Skip to main content
15,938,218 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to build a video player application for specific purpose using DirectShow. I've got stuck quite early - I cannot even connect filters into a graph.

1. filter is async file reader. Loading a file succeeds. It has one output pin with MEDIATYPE_Stream, as expected.
2. filter is Haali Media Splitter (AR). Async file reader connects successfully to Splitter. Splitter has two output pins, video and audio.
3. filter is ffdshow Video Decoder. It has an input pin accepting video. Connecting splitter's video output with MEDIATYPE_Video to decoder's video input fails with hr=0x80040217 (cannot connect pins, neither directly nor using Intelligent Connect feature).

I have a log file set for IGraphBuilder, but it doesn't seem that it contains any useful information - it's just a list of several unsuccessful pin connection attempts.

The same thing works perfectly in GraphStudioNext - all the filters connect as described, as well as further to the renderer. Haali and ffdshow are able to connect directly. Also the graph plays successfully.

I've tried printing out media subtypes, filter clsids, etc, as far as I can see I really am using same identical filters and their pins just like GraphStudioNext. But the same graph simply can't be built in my application.

I will be grateful for any hint what I'm doing wrong?

Basically what I want to do is: [file reader]-[splitter]-[video decoder]-[sample grabber]-[video renderer]. I'll render audio too, audio renderer branch is omitted for simplicity. For unknown reason, I can build even several variations of a graph like that i GraphStudioNext, but nothing works in my code, everything seems stuck on [splitter]-[video decoder] connection. I've also tried LAV splitter instead of Haali and LAV decoder instead of ffdshow - but they all work elsewhere.

I have also tried both CoCreateInstance and IMoniker->BindToStorage() approaches regarding loading filters - both seem to create identical filters, nothing works. :-( At some later time, I'll make list of available splitters, decoders and renderers visible to user; for now it's enough if it works on my development machine (Win7 Pro x64).
Updated 27-Dec-14 6:09am
Frankie-C 27-Jan-15 6:09am    
Have you used mutithreaded init ? (CoInitializeEx(NULL, COINIT_MULTITHREADED))
Maxim Kartavenkov 31-Mar-15 15:16pm    
The ffdshow filter internally can query for application name and according to that enable/disable some features according blacklist or white list.Also ffdshow have multi instancing property, check for the filter settings.
Another thing that Probably GraphStudioNext is x64 and you creates x86 application - so the filters are loading are different and have different settings loads from registry.

O'Doudarragh 1-Apr-15 10:39am    
Thanks for hints. It turned out, it was entirely my fault: I wasn't properly enumerating pins on filters and always made one iteration too much. What helped to pinpoint the issue was printing out all properties of all filters and pins involved in connecting the pins - it immediately became obvious that I was actually trying to connect wrong ones. Somehow I've managed to miss that even though I've gone step by step through the routines with debugger several times.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900