View Single Post
Old 07-13-2004, 05:37 PM   #13
NoPistonPC
Variable Bitrate
 
NoPistonPC's Avatar
 
Join Date: Apr 2004
Location: Boston
Vehicle: 1994 Mazda RX-7
Posts: 360
My Photos: ()
Ok, here is how easy it is to play a file using DirectShow:

1. Add "ActiveMovie control type library" as reference (quartz.dll) in VB (via Project/Add Reference... menu)

2. Declare a FilgraphManager variable:
Code:
Dim mGraph as New QuartzTypeLib.FilgraphManager()

3. Write your Play and Stop functions:
Code:
Private Sub PlayFile(ByRef strFileName As String) mGraph = New QuartzTypeLib.FilgraphManager() mGraph.RenderFile(strFileName) mGraph.Run() End Sub Private Sub StopFile() mGraph.Stop() End Sub

That's it! Just pass in any music or video filename into PlayFile and it will start playing. You can use the IVideoWindow interface to draw the video in one of your own windows and do things like full screen, etc. You can use the IMediaPosition interface to pause, ff, rew, skip, get current time/position, etc. You can use the IBasicAudio interface to set the balance and volume. It will automatically use all of the codec installed in your system (DivX, XviD, WinDVD, blah, blah, blah...)

It doesn't get any easier than that.
__________________
1994 RX-7, EPIA P4-ITX w/ Celeron 2.4 Ghz, Arise PSU, Xenarc 700TSV (new model)
NoPistonPC is offline   Reply With Quote