taylorwilken
Newbie
Karma: +0/-0
Posts: 3
|
 |
« on: October 07, 2008, 07:42:20 PM » |
|
Hi, I just purchased GraphEdit Plus, great product, btw!
I'm doing some testing putting together a TV tuner app, and I'm having problems with the generated code being able to enumerate the pins using DirectShowLib. I'm trying to run a pristine version of the generated code from GraphEdit. The graph runs perfectly in the GraphEdit Plus.
I'm using VS2005 and XP pro, all updated with current patches, etc., along with the latest DirectShowLib from sourceforge. The Tuner card is a Hauppage PVR-150, a pretty basic tuner card.
The relevant code where the problem is happening is here (in red):
static IPin GetPin(IBaseFilter filter, string pinname) { IEnumPins epins; int hr = filter.EnumPins(out epins); checkHR(hr, "Can't enumerate pins"); IntPtr fetched = Marshal.AllocCoTaskMem(4); IPin[] pins = new IPin[1]; while (epins.Next(1, pins, fetched) == 0) { PinInfo pinfo; pins[0].QueryPinInfo(out pinfo); bool found = (pinfo.name == pinname); DsUtils.FreePinInfo(pinfo); if (found) return pins[0]; } checkHR(-1, "Pin not found"); return null; }
I've tried the thread.sleep fix mentioned in another post, to no avail, even with a sleep time of 10 seconds. I've also tried moving all pin connections to after all the filters have been added to the graph. Here's an example of a failing line:
//connect Hauppauge WinTV PVR PCI II TvTuner and Hauppauge WinTV PVR PCI II Crossbar hr = pGraph.ConnectDirect(GetPin(pHauppaugeWinTVPVRPCIIITvTuner, "Analog Video"), GetPin(pHauppaugeWinTVPVRPCIIICrossbar, "0: Video Tuner In"), null); checkHR(hr, "Can't connect Hauppauge WinTV PVR PCI II TvTuner and Hauppauge WinTV PVR PCI II Crossbar");
Obviously, the above is failing with invalid pointers as the GetPin method is failing.
I've commented out the thrown exceptions so it can run through all the pin connections to see if it's just one pin that's failing, but every pin connect method is failing. No pins are able to be enumerated from any of the filters.
Is there something obvious I'm missing in my setup or install, or with my version of the direct show lib? I'm thinking the most likely culprit is some kind of COM interop compatibility issue between this code and the directshow library.
I wanted to see if I'm missing something obvious before I go and try to rework the GetPin method.
Has anyone else run into anything like this?
|