Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

251 lines
8.5 KiB

  1. /****************************************************************************/
  2. /* */
  3. /* AVIFMT.H - Include file for working with AVI files */
  4. /* */
  5. /* Note: You must include WINDOWS.H and MMSYSTEM.H before */
  6. /* including this file. */
  7. /* */
  8. /* Copyright (c) 1991-1998, Microsoft Corp. All rights reserved. */
  9. /* */
  10. /* */
  11. /****************************************************************************/
  12. #ifndef _INC_AVIFMT
  13. #define _INC_AVIFMT 100 /* version number * 100 + revision */
  14. #ifdef __cplusplus
  15. extern "C" { /* Assume C declarations for C++ */
  16. #endif /* __cplusplus */
  17. // begin_vfw32
  18. #ifdef _MSC_VER
  19. #pragma warning(disable:4200)
  20. #endif
  21. /* The following is a short description of the AVI file format. Please
  22. * see the accompanying documentation for a full explanation.
  23. *
  24. * An AVI file is the following RIFF form:
  25. *
  26. * RIFF('AVI'
  27. * LIST('hdrl'
  28. * avih(<MainAVIHeader>)
  29. * LIST ('strl'
  30. * strh(<Stream header>)
  31. * strf(<Stream format>)
  32. * ... additional header data
  33. * LIST('movi'
  34. * { LIST('rec'
  35. * SubChunk...
  36. * )
  37. * | SubChunk } ....
  38. * )
  39. * [ <AVIIndex> ]
  40. * )
  41. *
  42. * The main file header specifies how many streams are present. For
  43. * each one, there must be a stream header chunk and a stream format
  44. * chunk, enlosed in a 'strl' LIST chunk. The 'strf' chunk contains
  45. * type-specific format information; for a video stream, this should
  46. * be a BITMAPINFO structure, including palette. For an audio stream,
  47. * this should be a WAVEFORMAT (or PCMWAVEFORMAT) structure.
  48. *
  49. * The actual data is contained in subchunks within the 'movi' LIST
  50. * chunk. The first two characters of each data chunk are the
  51. * stream number with which that data is associated.
  52. *
  53. * Some defined chunk types:
  54. * Video Streams:
  55. * ##db: RGB DIB bits
  56. * ##dc: RLE8 compressed DIB bits
  57. * ##pc: Palette Change
  58. *
  59. * Audio Streams:
  60. * ##wb: waveform audio bytes
  61. *
  62. * The grouping into LIST 'rec' chunks implies only that the contents of
  63. * the chunk should be read into memory at the same time. This
  64. * grouping is used for files specifically intended to be played from
  65. * CD-ROM.
  66. *
  67. * The index chunk at the end of the file should contain one entry for
  68. * each data chunk in the file.
  69. *
  70. * Limitations for the current software:
  71. * Only one video stream and one audio stream are allowed.
  72. * The streams must start at the beginning of the file.
  73. *
  74. *
  75. * To register codec types please obtain a copy of the Multimedia
  76. * Developer Registration Kit from:
  77. *
  78. * Microsoft Corporation
  79. * Multimedia Systems Group
  80. * Product Marketing
  81. * One Microsoft Way
  82. * Redmond, WA 98052-6399
  83. *
  84. */
  85. #ifndef mmioFOURCC
  86. #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
  87. ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
  88. ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
  89. #endif
  90. /* Macro to make a TWOCC out of two characters */
  91. #ifndef aviTWOCC
  92. #define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
  93. #endif
  94. typedef WORD TWOCC;
  95. /* form types, list types, and chunk types */
  96. #define formtypeAVI mmioFOURCC('A', 'V', 'I', ' ')
  97. #define listtypeAVIHEADER mmioFOURCC('h', 'd', 'r', 'l')
  98. #define ckidAVIMAINHDR mmioFOURCC('a', 'v', 'i', 'h')
  99. #define listtypeSTREAMHEADER mmioFOURCC('s', 't', 'r', 'l')
  100. #define ckidSTREAMHEADER mmioFOURCC('s', 't', 'r', 'h')
  101. #define ckidSTREAMFORMAT mmioFOURCC('s', 't', 'r', 'f')
  102. #define ckidSTREAMHANDLERDATA mmioFOURCC('s', 't', 'r', 'd')
  103. #define ckidSTREAMNAME mmioFOURCC('s', 't', 'r', 'n')
  104. #define listtypeAVIMOVIE mmioFOURCC('m', 'o', 'v', 'i')
  105. #define listtypeAVIRECORD mmioFOURCC('r', 'e', 'c', ' ')
  106. #define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1')
  107. /*
  108. ** Stream types for the <fccType> field of the stream header.
  109. */
  110. #define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
  111. #define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
  112. #define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's')
  113. #define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's')
  114. /* Basic chunk types */
  115. #define cktypeDIBbits aviTWOCC('d', 'b')
  116. #define cktypeDIBcompressed aviTWOCC('d', 'c')
  117. #define cktypePALchange aviTWOCC('p', 'c')
  118. #define cktypeWAVEbytes aviTWOCC('w', 'b')
  119. /* Chunk id to use for extra chunks for padding. */
  120. #define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K')
  121. /*
  122. ** Useful macros
  123. **
  124. ** Warning: These are nasty macro, and MS C 6.0 compiles some of them
  125. ** incorrectly if optimizations are on. Ack.
  126. */
  127. /* Macro to get stream number out of a FOURCC ckid */
  128. #define FromHex(n) (((n) >= 'A') ? ((n) + 10 - 'A') : ((n) - '0'))
  129. #define StreamFromFOURCC(fcc) ((WORD) ((FromHex(LOBYTE(LOWORD(fcc))) << 4) + \
  130. (FromHex(HIBYTE(LOWORD(fcc))))))
  131. /* Macro to get TWOCC chunk type out of a FOURCC ckid */
  132. #define TWOCCFromFOURCC(fcc) HIWORD(fcc)
  133. /* Macro to make a ckid for a chunk out of a TWOCC and a stream number
  134. ** from 0-255.
  135. */
  136. #define ToHex(n) ((BYTE) (((n) > 9) ? ((n) - 10 + 'A') : ((n) + '0')))
  137. #define MAKEAVICKID(tcc, stream) \
  138. MAKELONG((ToHex((stream) & 0x0f) << 8) | \
  139. (ToHex(((stream) & 0xf0) >> 4)), tcc)
  140. /*
  141. ** Main AVI File Header
  142. */
  143. /* flags for use in <dwFlags> in AVIFileHdr */
  144. #define AVIF_HASINDEX 0x00000010 // Index at end of file
  145. #define AVIF_MUSTUSEINDEX 0x00000020
  146. #define AVIF_ISINTERLEAVED 0x00000100
  147. #define AVIF_TRUSTCKTYPE 0x00000800 // Use CKType to find key frames
  148. #define AVIF_WASCAPTUREFILE 0x00010000
  149. #define AVIF_COPYRIGHTED 0x00020000
  150. /* The AVI File Header LIST chunk should be padded to this size */
  151. #define AVI_HEADERSIZE 2048 // size of AVI header list
  152. typedef struct
  153. {
  154. DWORD dwMicroSecPerFrame; // frame display rate (or 0L)
  155. DWORD dwMaxBytesPerSec; // max. transfer rate
  156. DWORD dwPaddingGranularity; // pad to multiples of this
  157. // size; normally 2K.
  158. DWORD dwFlags; // the ever-present flags
  159. DWORD dwTotalFrames; // # frames in file
  160. DWORD dwInitialFrames;
  161. DWORD dwStreams;
  162. DWORD dwSuggestedBufferSize;
  163. DWORD dwWidth;
  164. DWORD dwHeight;
  165. DWORD dwReserved[4];
  166. } MainAVIHeader;
  167. /*
  168. ** Stream header
  169. */
  170. #define AVISF_DISABLED 0x00000001
  171. #define AVISF_VIDEO_PALCHANGES 0x00010000
  172. typedef struct {
  173. FOURCC fccType;
  174. FOURCC fccHandler;
  175. DWORD dwFlags; /* Contains AVITF_* flags */
  176. WORD wPriority;
  177. WORD wLanguage;
  178. DWORD dwInitialFrames;
  179. DWORD dwScale;
  180. DWORD dwRate; /* dwRate / dwScale == samples/second */
  181. DWORD dwStart;
  182. DWORD dwLength; /* In units above... */
  183. DWORD dwSuggestedBufferSize;
  184. DWORD dwQuality;
  185. DWORD dwSampleSize;
  186. RECT rcFrame;
  187. } AVIStreamHeader;
  188. /* Flags for index */
  189. #define AVIIF_LIST 0x00000001L // chunk is a 'LIST'
  190. #define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame.
  191. #define AVIIF_NOTIME 0x00000100L // this frame doesn't take any time
  192. #define AVIIF_COMPUSE 0x0FFF0000L // these bits are for compressor use
  193. typedef struct
  194. {
  195. DWORD ckid;
  196. DWORD dwFlags;
  197. DWORD dwChunkOffset; // Position of chunk
  198. DWORD dwChunkLength; // Length of chunk
  199. } AVIINDEXENTRY;
  200. /*
  201. ** Palette change chunk
  202. **
  203. ** Used in video streams.
  204. */
  205. typedef struct
  206. {
  207. BYTE bFirstEntry; /* first entry to change */
  208. BYTE bNumEntries; /* # entries to change (0 if 256) */
  209. WORD wFlags; /* Mostly to preserve alignment... */
  210. PALETTEENTRY peNew[]; /* New color specifications */
  211. } AVIPALCHANGE;
  212. // end_vfw32
  213. #ifdef __cplusplus
  214. } /* End of extern "C" { */
  215. #endif /* __cplusplus */
  216. #endif /* _INC_AVIFMT */