Playing AVI Files with DirectX.

General Information:

CAviSurface implements an interface to play a true- or highcolor AVI- file into a DirectDrawSurface. CAviSurfaceWithSound extends this to play the sound simultaniously into a streaming DirectSoundBuffer.
To use the classes you have to use DirectDraw in a 16-Bit or 24-Bit colormodus. 8-Bit Colordepth is currently not supported, neighter as sourceformat nor as targetformat. This is partially due to the usally installed AVI - Decompressors and partially due to my own laziness. .
To use the class you simply have to use the following codefrags:


The class interface

CAviSurface(char *lpszFilename,LPDIRECTDRAW lpDDraw,BOOL bLoop=FALSE)

HRESULT SetColorKey(DWORD dwColorKey)

HRESULT BlitTo(int x,int y,LPDIRECTDRAWSURFACE lpddsTarget)

HRESULT StretchBlitTo(RECT *rcTarget,LPDIRECTDRAWSURFACE lpddsTarget)

virtual BOOL Start()

virtual BOOL Stop()


CAviSurfaceWithSound(char *lpszFilename,LPDIRECTDRAW lpDDraw,LPDIRECTSOUND lpDS,BOOL bLoop)

~CAviSurfaceWithSound()

virtual BOOL Start()

virtual BOOL Stop()

For more information see the headerfile "avisurfave.h"


download avisurface.zip (64k)

Files in the archive:

The sources compile fine under VC++ 4.2, but it should be easy to convert to other compilers. - (Sometimes I will switch back to Borland)

Remember to run the program in an 16 or 24 bit colordepth environment, because it works in a window, and only supports the high/truecolor target.


To Do:


LEGAL ISSUES ============

I don't promise that this software works and in no case I will be liable th any damage, this software does. (But if you find any bugs, please let me know!) You can use this software for whatever you want. You don't have to pay me. If you use it in a program, please credit me, send a postcard (or a copy of the programm :-)).

Gert Wollny
Henricistr. 29
04177 Leipzig
Germany