/* ##H_FILE#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FILE :          AviFunc.h

DESCRIPTION :  Include file of VDO module

	       How to keep permanently the control of the sound driver when an avi is playing
		2 solutions to play "AVI" are used here
		    - interlaced "AVI", where video and audio are interlacing each other
		    - "AVI" et "MPD" memory storage of the totality of a sound file and
		      picture synchronisation of a file of pictures  
		

VERSION :       1.00/Nicolas Meyer/Creation

		Nota Bene : This file is only portable on PC platform
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/


#ifndef _AVIFUNC_H_
#define _AVIFUNC_H_

/* ##INCLUDE#----------------------------------------------------------------------------
                          Includes Files
---------------------------------------------------------------------------------------*/
#include <stdlib.h>
#include <string.h>

#include <windows.h>
#include <windef.h>
#include <wingdi.h>	/* Definition of "BITMAPINFOHEADER" */

#if defined( __WATCOMC__ ) && ( __WATCOMC__ < 1100 )
#define __inline 
#endif

#include <vfw.h>	/* Functions "DrawDib..." for management of AVI "Video For Windows" */
#include <mmsystem.h>
#include <msacm.h>
#include <process.h>

#include "MMG.h"
#include "ERM.h"
#include "SCR.h"
#include "SND.h"
#include "VDO.h"
#include "SND.h"

#ifdef _DEBUG/*===================================== BEGIN _DEBUG =================================*/
#include <crtdbg.h>			/* "CRT" Debugging function  */
#endif/*============================================ END   _DEBUG =================================*/

#ifdef _USE_DECOMPRESS/*============================ BEGIN _USE_DECOMPRESS =================================*/
#include "DecompressFunc.h"
#endif/*============================================ END   _USE_DECOMPRESS =================================*/

#ifdef _USE_WINDOWS_DISPLAY/*======================= BEGIN _USE_WINDOWS_DISPLAY =================================*/
#include "UserMessage.h"
#endif/*============================================ END   _USE_WINDOWS_DISPLAY =================================*/

#ifndef VDO_FOR_F1/*================================ BEGIN VDO_FOR_F1 =================================*/
#include "GLD.h"
#else
#include "drawlib.h"
#endif/*============================================ END   VDO_FOR_F1 =================================*/

/* ##CONSTANTE#--------------------------------------------------------------------------
                          Constantes declaration
---------------------------------------------------------------------------------------*/
#define			MAX_STREAM_TYPE				10	/* Maximum number of type of stream maximal (for example 1 video channel + 5 audio channels )*/
#define			MAX_DRIVER_ACM_ADPCM			10	/* maximum number of drivers ACM which are able to convert ADPCM */
#define			NB_STREAM_PERTYPE			8
#define			SIZE_BUFFER_SAMPLE_CONVERT		1024	/* Size (in samples) of the rotating buffer of conversion */
#define			NB_BUFFERS_CONVERT			20	/* MUST BE GREATER THAN 1 */
#define			SIZE_ALL_BUFFERS			( SIZE_BUFFER_SAMPLE_CONVERT * NB_BUFFERS_CONVERT )
#define			TIME_RESOLUTION				1	/* Temporal resolution of 1 ms */
#define			TIME_SLICE				20	/* Time (in milliseconds) between 2 slices */

/* type of game
//================================================================================================
// Definition realised in the VDO module
//================================================================================================ */
/*
#define			AVI_SYNCH_NOSOUND				0
#define			AVI_SYNCH_OBJECT				1
#define			AVI_SYNCH_STREAM				2
*/
// Set the index of the sound bank which corresponds to the AVI
#define			NB_BANK_BNM						200


/* ##FUNCDEF#----------------------------------------------------------------------------
                          Functions definition
---------------------------------------------------------------------------------------*/
/* DECLARATION OF PRIVATE FUNCTIONS
//================================================================================================
// High level functions defined in the VDO module
//================================================================================================*/
/*
ACP_tdxBool		VDO_fn_bIsRunningAVI( );
void			VDO_fn_xDesInitAVI( );
void			VDO_fn_xInitAVI( );
void			VDO_fn_xPlayVideoAVI( char* szFilename );
void			VDO_fn_xSetDirectoryAVI( char* szDirectory );
void			VDO_fn_xStopVideoAVI(  );
*/
/*================================================================================================*/

void			VDO_fn_xSetBankIndice( unsigned short nIndice );


/* Get datas functions */
SIZE			AviGetVideoDimensions( );
unsigned long	AviGetVideoHeight( );
unsigned long	AviGetVideoWidth( );

/* Init functions, parameters modifications, and desinitialisation */
void			AviDesInitModule( );
BOOL			AviInitModule( char* szFilename );
void __stdcall	AviPlayVideo( char* szFilename, unsigned long nType );


#endif	//	_AVIFUNC_H_