Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

avifmt.h

00001 /****************************************************************************
00002  *
00003  *  AVIFMT - AVI file format definitions
00004  *
00005  ****************************************************************************/
00006 #ifndef AVIFMT 
00007 #define AVIFMT
00008 
00009 #ifndef NOAVIFMT 
00010 
00011 #ifndef  __WINE_WINDEF_H
00012 #include "wine/windef.h"
00013 #endif
00014 
00015 #ifndef __WINE_MMSYSTEM_H
00016 #ifndef __WINE_MSACM_H
00017 typedef DWORD FOURCC;
00018 #endif
00019 #endif
00020 
00021 
00022 #ifdef _MSC_VER
00023 #pragma warning(disable:4200)
00024 #endif
00025     
00026 /* The following is a short description of the AVI file format.  Please
00027  * see the accompanying documentation for a full explanation.
00028  *
00029  * An AVI file is the following RIFF form:
00030  *
00031  *      RIFF('AVI' 
00032  *            LIST('hdrl'
00033  *                  avih(<MainAVIHeader>)
00034  *                  LIST ('strl'
00035  *                      strh(<Stream header>)
00036  *                      strf(<Stream format>)
00037  *                      ... additional header data
00038  *            LIST('movi'        
00039  *                { LIST('rec' 
00040  *                            SubChunk...
00041  *                         )
00042  *                    | SubChunk } ....     
00043  *            )
00044  *            [ <AVIIndex> ]
00045  *      )
00046  *
00047  *      The main file header specifies how many streams are present.  For
00048  *      each one, there must be a stream header chunk and a stream format
00049  *      chunk, enlosed in a 'strl' LIST chunk.  The 'strf' chunk contains
00050  *      type-specific format information; for a video stream, this should
00051  *      be a BITMAPINFO structure, including palette.  For an audio stream,
00052  *      this should be a WAVEFORMAT (or PCMWAVEFORMAT) structure.
00053  *
00054  *      The actual data is contained in subchunks within the 'movi' LIST 
00055  *      chunk.  The first two characters of each data chunk are the
00056  *      stream number with which that data is associated.
00057  *
00058  *      Some defined chunk types:
00059  *           Video Streams:
00060  *                  ##db:       RGB DIB bits
00061  *                  ##dc:       RLE8 compressed DIB bits
00062  *                  ##pc:       Palette Change
00063  *
00064  *           Audio Streams:
00065  *                  ##wb:       waveform audio bytes
00066  *
00067  * The grouping into LIST 'rec' chunks implies only that the contents of
00068  *   the chunk should be read into memory at the same time.  This
00069  *   grouping is used for files specifically intended to be played from 
00070  *   CD-ROM.
00071  *
00072  * The index chunk at the end of the file should contain one entry for 
00073  *   each data chunk in the file.
00074  *       
00075  * Limitations for the current software:
00076  *      Only one video stream and one audio stream are allowed.
00077  *      The streams must start at the beginning of the file.
00078  *
00079  * 
00080  * To register codec types please obtain a copy of the Multimedia
00081  * Developer Registration Kit from:
00082  *
00083  *  Microsoft Corporation
00084  *  Multimedia Systems Group
00085  *  Product Marketing
00086  *  One Microsoft Way
00087  *  Redmond, WA 98052-6399
00088  *
00089  */
00090 
00091 #ifndef mmioFOURCC
00092 #define mmioFOURCC( ch0, ch1, ch2, ch3 )                                \
00093                 ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) |    \
00094                 ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
00095 #endif
00096 
00097 /* Macro to make a TWOCC out of two characters */
00098 #ifndef aviTWOCC
00099 #define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
00100 #endif
00101 
00102 typedef WORD TWOCC;
00103 
00104 /* form types, list types, and chunk types */
00105 #define formtypeAVI             mmioFOURCC('A', 'V', 'I', ' ')
00106 #define listtypeAVIHEADER       mmioFOURCC('h', 'd', 'r', 'l')
00107 #define ckidAVIMAINHDR          mmioFOURCC('a', 'v', 'i', 'h')
00108 #define listtypeSTREAMHEADER    mmioFOURCC('s', 't', 'r', 'l')
00109 #define ckidSTREAMHEADER        mmioFOURCC('s', 't', 'r', 'h')
00110 #define ckidSTREAMFORMAT        mmioFOURCC('s', 't', 'r', 'f')
00111 #define ckidSTREAMHANDLERDATA   mmioFOURCC('s', 't', 'r', 'd')
00112 #define ckidSTREAMNAME          mmioFOURCC('s', 't', 'r', 'n')
00113 
00114 #define listtypeAVIMOVIE        mmioFOURCC('m', 'o', 'v', 'i')
00115 #define listtypeAVIRECORD       mmioFOURCC('r', 'e', 'c', ' ')
00116 
00117 #define ckidAVINEWINDEX         mmioFOURCC('i', 'd', 'x', '1')
00118 
00119 /*
00120 ** Stream types for the <fccType> field of the stream header.
00121 */
00122 #define streamtypeVIDEO         mmioFOURCC('v', 'i', 'd', 's')
00123 #define streamtypeAUDIO         mmioFOURCC('a', 'u', 'd', 's')
00124 #define streamtypeMIDI          mmioFOURCC('m', 'i', 'd', 's')
00125 #define streamtypeTEXT          mmioFOURCC('t', 'x', 't', 's')
00126 
00127 /* Basic chunk types */
00128 #define cktypeDIBbits           aviTWOCC('d', 'b')
00129 #define cktypeDIBcompressed     aviTWOCC('d', 'c')
00130 #define cktypePALchange         aviTWOCC('p', 'c')
00131 #define cktypeWAVEbytes         aviTWOCC('w', 'b')
00132 
00133 /* Chunk id to use for extra chunks for padding. */
00134 #define ckidAVIPADDING          mmioFOURCC('J', 'U', 'N', 'K')
00135 
00136 /*
00137 ** Useful macros
00138 **
00139 ** Warning: These are nasty macro, and MS C 6.0 compiles some of them
00140 ** incorrectly if optimizations are on.  Ack.
00141 */
00142 
00143 /* Macro to get stream number out of a FOURCC ckid */
00144 #define FromHex(n)      (((n) >= 'A') ? ((n) + 10 - 'A') : ((n) - '0'))
00145 #define StreamFromFOURCC(fcc) ((WORD) ((FromHex(LOBYTE(LOWORD(fcc))) << 4) + \
00146                                              (FromHex(HIBYTE(LOWORD(fcc))))))
00147 
00148 /* Macro to get TWOCC chunk type out of a FOURCC ckid */
00149 #define TWOCCFromFOURCC(fcc)    HIWORD(fcc)
00150 
00151 /* Macro to make a ckid for a chunk out of a TWOCC and a stream number
00152 ** from 0-255.
00153 */
00154 #define ToHex(n)        ((BYTE) (((n) > 9) ? ((n) - 10 + 'A') : ((n) + '0')))
00155 #define MAKEAVICKID(tcc, stream) \
00156         MAKELONG((ToHex((stream) & 0x0f) << 8) | \
00157                             (ToHex(((stream) & 0xf0) >> 4)), tcc)
00158 
00159 /*
00160 ** Main AVI File Header 
00161 */           
00162                      
00163 /* flags for use in <dwFlags> in AVIFileHdr */
00164 #define AVIF_HASINDEX           0x00000010      // Index at end of file?
00165 #define AVIF_MUSTUSEINDEX       0x00000020
00166 #define AVIF_ISINTERLEAVED      0x00000100
00167 #define AVIF_TRUSTCKTYPE        0x00000800      // Use CKType to find key frames?
00168 #define AVIF_WASCAPTUREFILE     0x00010000
00169 #define AVIF_COPYRIGHTED        0x00020000
00170 
00171 /* The AVI File Header LIST chunk should be padded to this size */
00172 #define AVI_HEADERSIZE  2048                    // size of AVI header list
00173 
00174 typedef struct
00175 {
00176     DWORD               dwMicroSecPerFrame;     // frame display rate (or 0L)
00177     DWORD               dwMaxBytesPerSec;       // max. transfer rate
00178     DWORD               dwPaddingGranularity;   // pad to multiples of this
00179                                                 // size; normally 2K.
00180     DWORD               dwFlags;                // the ever-present flags
00181     DWORD               dwTotalFrames;          // # frames in file
00182     DWORD               dwInitialFrames;
00183     DWORD               dwStreams;
00184     DWORD               dwSuggestedBufferSize;
00185     
00186     DWORD               dwWidth;
00187     DWORD               dwHeight;
00188     
00189     DWORD               dwReserved[4];
00190 } MainAVIHeader;
00191 
00192 /*
00193 ** Stream header
00194 */
00195 
00196 #define AVISF_DISABLED                  0x00000001
00197 
00198 #define AVISF_VIDEO_PALCHANGES          0x00010000
00199 
00200   
00201 typedef struct {
00202     FOURCC              fccType;
00203     FOURCC              fccHandler;
00204     DWORD               dwFlags;        /* Contains AVITF_* flags */
00205     WORD                wPriority;
00206     WORD                wLanguage;
00207     DWORD               dwInitialFrames;
00208     DWORD               dwScale;        
00209     DWORD               dwRate; /* dwRate / dwScale == samples/second */
00210     DWORD               dwStart;
00211     DWORD               dwLength; /* In units above... */
00212     DWORD               dwSuggestedBufferSize;
00213     DWORD               dwQuality;
00214     DWORD               dwSampleSize;
00215     RECT                rcFrame;
00216 } AVIStreamHeader;
00217 
00218 /* Flags for index */
00219 #define AVIIF_LIST          0x00000001L // chunk is a 'LIST'
00220 #define AVIIF_KEYFRAME      0x00000010L // this frame is a key frame.
00221 
00222 #define AVIIF_NOTIME        0x00000100L // this frame doesn't take any time
00223 #define AVIIF_COMPUSE       0x0FFF0000L // these bits are for compressor use
00224 
00225 #define FOURCC_RIFF     mmioFOURCC('R', 'I', 'F', 'F')
00226 #define FOURCC_LIST     mmioFOURCC('L', 'I', 'S', 'T')
00227 
00228 typedef struct
00229 {
00230     DWORD               ckid;
00231     DWORD               dwFlags;
00232     DWORD               dwChunkOffset;          // Position of chunk
00233     DWORD               dwChunkLength;          // Length of chunk
00234 } AVIINDEXENTRY;
00235 
00236 #define AVISTREAMREAD_CONVENIENT        (-1L)
00237 
00238 /*
00239 ** Palette change chunk
00240 **
00241 ** Used in video streams.
00242 */
00243 #endif /* NOAVIFMT */
00244 #endif

Generated on Tue Dec 20 10:14:22 2005 for vlc-0.8.4a by  doxygen 1.4.2