// (c) 2003-2006 Criterion Software Limited and its licensors. All Rights Reserved

struct AVIINDXStruct
{
    int Identifier;
    int Flags;
    int Offset;
    int Length;
};

#define AVI_KEYFRAME 0x00000010L

typedef struct /* BITMAPINFOHEADER */
{
    int Size;
    int Width;
    int Height;
    short Planes;
    short BitCount;
    int Compression;
    int ImageSize;
    int XpelsMeter;
    int YpelsMeter;
    int NumberOfColours;
    int ImportantColours;

} AVIbmiStruct;


typedef struct /*RGBQUAD */
{
    unsigned char    rgbBlue;
    unsigned char    rgbGreen;
    unsigned char    rgbRed;
    unsigned char    rgbReserved;
} AVIrgbStruct;


typedef struct /* BITMAPINFO */
{
    AVIbmiStruct    bmiHeader;
    AVIrgbStruct    bmiColours[256];
} AVIVIDSStruct;


/*
typedef struct {
    short   wFormatTag;
    short   nChannels;
    int     nSamplesPerSec;
    int     nAvgBytesPerSec;
    short   nBlockAlign;
    short   wBitsPerSample;
    short   cbSize;
} AVIwavStruct;
*/




typedef struct
{
    /* AVIH AVI Header structure */
    int TimeBetweenFrames;
    int MaxBps;
    int PaddingGranularity;
    int Flags;
    int TotalFrames;
    int InitFrames;
    int Streams;
    int SuggestedBufferSize;
    int Width;
    int Height;
    int TimeScale;
    int DataRate;
    int StartTime;
    int DataLength;

} AVIHStruct;

/* AVIAVIHStruct Flags */

#define AVIHASINDEX            0x00000010   /* Has an index Chunk */
#define AVIUSEINDEX            0x00000020   /* Must use index Chunk */
#define AVIISINTERLEAVED       0x00000100    /* File is interleaved */
#define AVIWASCAPTUREFILE      0x00010000   /* Optimized for live video capture */
#define AVICOPYRIGHTED         0x00020000    /* contains copyrighted data */
#define AVITRUSTCKTYPE         0x00000800   /* Use CKType to find key frames? ie, the 2CC code 'db' in '00db'*/

typedef struct
{
    /* STRH Stream header chunk */
    int DataType;       /* vids */
    int DataHandler;    /* msvc, rle */
    int Flags;
    int Priority;
    int InitialFrames;
    int TimeScale;
    int DataRate;
    int StartTime;
    int DataLength;
    int SuggestedBufferSize;
    int Quality;
    int SampleSize;

} AVISTRHStruct;


#if 0
typedef struct
{
/* allow for a total of 4 streams per AVI file, currently only 1 video and 1 audio stream recognized */
    short vidsHeaderIndex;
    short audsHeaderIndex;
    short stream3index;
    short stream4index;

    AVISTRHStruct streamheaders[4]; // stream headers (strh), same for all types of streams: vids, auds, etc.
    AVIVIDSStruct biinfo;
    AVIwavStruct waveHeader;

} AVIStreamFormatStruct;

#endif
