Log in

View Full Version : DirectShow/COM problem


stax76
11th April 2003, 12:00
Hello,
I've problems to play a AVI file, actually it works
but only in a try catch block, does somebody know
what's wrong? It takes a few seconds until it plays

Regards
Dolemite


Try
Dim f1 As DirectShowLib.IBaseFilter
f1 = CType(Activator.CreateInstance(Type.GetTypeFromCLSID(New Guid("D3588AB0-0781-11CE-B03A-0020AF0BA770"))), DirectShowLib.IBaseFilter)

Dim f2 As DirectShowLib.IBaseFilter
f2 = CType(Activator.CreateInstance(Type.GetTypeFromCLSID(New Guid("CF49D4E0-1115-11CE-B03A-0020AF0BA770"))), DirectShowLib.IBaseFilter)

Dim f3 As DirectShowLib.IBaseFilter
f3 = CType(Activator.CreateInstance(Type.GetTypeFromCLSID(New Guid("70E102B0-5556-11CE-97C0-00AA0055595A"))), DirectShowLib.IBaseFilter)

Graph.AddSourceFilter(path, "AVI/WAV File Source", f1)
Graph.AddFilter(f2, "AVI Decompressor")
Graph.AddFilter(f3, "Video Renderer")

Dim Pin1 As DirectShowLib.IPin = GetPin(f1, DirectShowLib._PinDirection.PINDIR_OUTPUT)
Dim Pin2 As DirectShowLib.IPin = GetPin(f2, DirectShowLib._PinDirection.PINDIR_INPUT)
Dim Pin3 As DirectShowLib.IPin = GetPin(f2, DirectShowLib._PinDirection.PINDIR_OUTPUT)
Dim Pin4 As DirectShowLib.IPin = GetPin(f3, DirectShowLib._PinDirection.PINDIR_INPUT)

Graph.Connect(Pin1, Pin2)
Graph.Connect(Pin3, Pin4)

Graph.Render(Pin4)
Catch e As Exception
Message.Info(e.ToString)
'System.Runtime.InteropServices.COMException (0x80040204)
End Try

alexnoe
12th April 2003, 09:45
Is the AVI file valid?

BlackSun
13th April 2003, 13:17
Just call renderfile() on the IGraphBuilder object, that's easier than building the graph yourself.

You should read the chapter called 'Intelligent Connect' in the dshow sdk doc, everything is almost explained on how the graph is built.

stax76
13th April 2003, 14:06
@alexnoe

actually I have to work with avs files


@BlackSun


Just call renderfile()


I wish it would be that easy, almost all DirectShow filters are buggy, I had trouble already with subtitle mixer, DirectVobSub, ffdshow, XviD decoder filter and others, some of these filters are fixed with the latest versions or can be customized so they don't make trouble but not all...