//////////////////////////////////////////////////////////////////////////////////
// $Source: /cvsroot/cdx/cdx3.0/addons/CDXAVI/CDXAVI.H,v $
// $Author: hebertjo $
//
// $Log: CDXAVI.H,v $
// Revision 1.1.1.1  2000/04/22 16:51:13  hebertjo
// Initial checkin of v3.0 to SourceForge CVS.
//
// Revision 1.2  1999/07/19 16:46:36  Mindcry
// I fixed a lot:
// .Now it plays also the AVI's that have no sound
// .Speeded up some parts (but it's still to slow for me ;)
// .Changed a lot with the Releasing stuff
//
// Revision 1.1.1.1  1999/05/04 23:59:24  bsimser
// Imported addons
//
// $Revision: 1.1.1.1 $
//////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////
// CDXAvi Class
//////////////////////////////////////////////////////////////////////////////////
class CDXAvi : public CDXSurface
{
public:
	CDXAvi(void);
	~CDXAvi(void);

	BOOL Create(CDXScreen* pScreen, CDXSound* pSound, const char* Filename, BOOL bLoop = FALSE);
	BOOL Start(void);
	void Stop(void);
	void NextFrame(void);
	void ReadFrame(LONG Frame);
	BOOL GetSound(void);
	HRESULT DrawBuffer(void);

	virtual HRESULT Draw(CDXSurface* Dest);
	virtual HRESULT DrawFast(int X, int Y, CDXSurface* Dest);

public:
	BOOL m_bPlaying;
	BOOL m_bLoop;
	LONG m_Index;
	LONG m_nFrames;
	DWORD m_Fps;
	int m_TimerID;
	int m_TimeTick;

	PAVIFILE m_AviFile;
	CRITICAL_SECTION m_AccessBuffer;
	PAVISTREAM m_AviStream;
	AVISTREAMINFO m_StreamInfo;
	LPBYTE m_Input;
	LPBYTE m_Output;
	HIC  m_Decompressor;
	LONG m_Length;
	LONG m_LinePitch;
	LPBITMAPINFOHEADER m_InputFormat;
	LPBITMAPV4HEADER m_TargetFormat;

	PAVISTREAM m_AviSound;
	AVISTREAMINFO m_SoundInfo;
	WAVEFORMATEX* m_SoundFormat;
	LPDIRECTSOUNDBUFFER m_SoundBuffer;
	DWORD m_LoadPos;
	DWORD m_LoadSize;
	int m_SoundFramesAhead;
};

