Source code of Windows XP (NT5)
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.

226 lines
7.0 KiB

  1. /* aviffmt.h
  2. *
  3. * This header file describes the AVI File Format.
  4. *
  5. * Initial version: David Maymudes 1/7/91, based heavily on EricLe's avi0.h
  6. * Last updated: David Maymudes 12/5/91.
  7. *
  8. * Prerequisites: <windows.h>, <mmsystem.h>
  9. *
  10. * An AVI file is the following RIFF form:
  11. *
  12. * RIFF('AVI'
  13. * LIST('hdrl')
  14. * hdra(<AVIFileHdr>)
  15. * dibh(<BITMAPINFO>)
  16. * [ wavf(<WAVEFORMAT>) ]
  17. * [ vidc(<COMPRESSIONINFO>) ]
  18. * [ audc(<COMPRESSIONINFO>) ]
  19. * [ JUNK(<padding>) ]
  20. * LIST('movi'
  21. * { LIST('rec'
  22. * SubChunk...
  23. * )
  24. * | SubChunk } ....
  25. * )
  26. * [ <AVIIndex> ]
  27. * )
  28. *
  29. * SubChunk = { dibh(<AVI DIB header>)
  30. * | dibb(<AVI DIB bits>)
  31. * | dibc(<AVI compressed DIB bits>)
  32. * | palc(<AVI Palette Change>)
  33. * | wavb(<AVI WAVE bytes>)
  34. * | wavs(<AVI Silence record>)
  35. * | midi(<MIDI data>)
  36. * | additonal custom chunks }
  37. *
  38. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  39. * We need a better description of the AVI file header here.
  40. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  41. *
  42. *
  43. * The grouping into LIST 'rec' chunks implies only that the contents of
  44. * the chunk should be read into memory at the same time. This
  45. * grouping is only necessary for interleaved files.
  46. *
  47. * For loading efficiency, the beginning of each LIST 'rec' chunk may
  48. * be aligned on a 2K boundary. (Actually, the beginning of the LIST
  49. * chunk should be 12 bytes before a 2K boundary, so that the data chunks
  50. * inside the LIST chunk are aligned.)
  51. *
  52. * If the AVI file is being played from CD-ROM in, it is recommended that
  53. * the file be padded.
  54. *
  55. *
  56. * Limitations for the Alpha release:
  57. * If the AVI file has audio, each record LIST must contain exactly
  58. * one audio chunk, which must be the first chunk.
  59. * Each record must contain exactly one video chunk (possibly preceded
  60. * by one or more palette change chunks).
  61. * No wave format or DIB header chunks may occur outside of the header.
  62. */
  63. #ifndef mmioFOURCC
  64. #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
  65. ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
  66. ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
  67. #endif
  68. /* form types, list types, and chunk types */
  69. #define formtypeAVI mmioFOURCC('A', 'V', 'I', ' ')
  70. #define listtypeAVIHEADER mmioFOURCC('h', 'd', 'r', 'l')
  71. #define listtypeAVIRECORD mmioFOURCC('r', 'e', 'c', ' ')
  72. #define listtypeAVIMOVIE mmioFOURCC('m', 'o', 'v', 'i')
  73. #define ckidAVIHDR mmioFOURCC('h', 'd', 'r', 'a')
  74. #define ckidAVIINDEX mmioFOURCC('i', 'n', 'd', 'x')
  75. #define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1')
  76. #define ckidAVIAuthorInfo mmioFOURCC('a', 'v', 'i', 'a')
  77. #define ckidAVIVideoCompInfo mmioFOURCC('v', 'i', 'd', 'c')
  78. #define ckidAVIAudioCompInfo mmioFOURCC('a', 'u', 'd', 'c')
  79. #define ckidAVIAdditionalInfo mmioFOURCC('i', 'n', 'f', 'o')
  80. #define ckidDIBheader mmioFOURCC('d', 'i', 'b', 'h')
  81. #define ckidPALchange mmioFOURCC('p', 'a', 'l', 'c')
  82. #define ckidDIBbits mmioFOURCC('d', 'i', 'b', 'b')
  83. #define ckidDIBcompressed mmioFOURCC('d', 'i', 'b', 'c')
  84. #define ckidDIBhalfframe mmioFOURCC('d', 'i', 'b', 'x')
  85. #define ckidCCCbits mmioFOURCC('C', 'C', 'C', 'b')
  86. #define BI_CCC 0x20434343
  87. #define ckidWAVEformat mmioFOURCC('w', 'a', 'v', 'f')
  88. #define ckidWAVEbytes mmioFOURCC('w', 'a', 'v', 'b')
  89. #define ckidWAVEsilence mmioFOURCC('w', 'a', 'v', 's')
  90. #define ckidMIDIdata mmioFOURCC('m', 'i', 'd', 'i')
  91. #define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K')
  92. #define ckidOLDPADDING mmioFOURCC('p', 'a', 'd', 'd')
  93. // #define comptypeCCC mmioFOURCC('C','C','C',' ')
  94. #define comptypeRLE0 mmioFOURCC('R','L','E','0')
  95. #define comptypeRLE mmioFOURCC('R','L','E',' ')
  96. #define comptypeDIB mmioFOURCC('D','I','B',' ')
  97. #define comptypeNONE mmioFOURCC('N','O','N','E')
  98. #define comptypePCM mmioFOURCC('P','C','M',' ')
  99. #define OLDRLEF_MERGECOLORS 0x0010
  100. #define OLDRLEF_SKIPSINGLE 0x0020
  101. #define OLDRLEF_ADAPTIVE 0x0040
  102. /* flags for use in <dwFlags> in AVIFileHdr */
  103. #define AVIF_HASWAVE 0x00000001
  104. #define AVIF_HASMIDI 0x00000002
  105. #define AVIF_HASINDEX 0x00000010 // Index at end of file?
  106. #define AVIF_ISINTERLEAVED 0x00000100
  107. #define AVIF_VARIABLESIZEREC 0x00000200
  108. #define AVIF_NOPADDING 0x00000400
  109. #define AVIF_ONEPALETTE 0x00001000 // No palette changes?
  110. /* The AVI File Header LIST chunk should be padded to this size */
  111. #define AVI_HEADERSIZE 2048 // size of AVI header list
  112. typedef struct _AVIFileHdr
  113. {
  114. DWORD dwMicroSecPerFrame; // frame display rate (or 0L)
  115. DWORD dwMaxBytesPerSec; // max. transfer rate
  116. DWORD dwPaddingGranularity; // pad to multiples of this
  117. // size; normally 2K.
  118. DWORD dwFlags; // the ever-present flags
  119. DWORD dwTotalFrames; // # frames in file
  120. DWORD dwInitialVideoFrames;
  121. DWORD dwNumAudioChunks;
  122. DWORD dwAudioOffsetFrames; // how many frames is audio
  123. // ahead of video in file?
  124. } AVIFileHdr;
  125. typedef struct _AVIWAVEheader
  126. {
  127. PCMWAVEFORMAT waveformat; // or some other format
  128. } AVIWAVEheader;
  129. #ifndef WIN32
  130. /*
  131. * this section not used and causes warnings on NT (zero-length arrays
  132. * are disallowed).
  133. */
  134. // Note: no time information here: wave audio always starts at time 0,
  135. // and continues without stopping.
  136. typedef struct _AVIWAVEbytes
  137. {
  138. BYTE abBits[0]; // bits of audio
  139. } AVIWAVEbytes;
  140. typedef struct _AVIWAVEsilence
  141. {
  142. DWORD dwSamples; // # samples with no sound
  143. } AVIWAVEsilence;
  144. /* Possibly, we shouldn't have a whole BITMAPINFOHEADER here. */
  145. typedef struct _AVIDIBheader
  146. {
  147. BITMAPINFOHEADER bih; // DIB header to use
  148. RGBQUAD argbq[0]; // optional colors
  149. } AVIDIBheader;
  150. typedef struct _AVIDIBbits
  151. {
  152. BYTE abBits[0]; // bits of video
  153. } AVIDIBbits;
  154. typedef struct _AVIPALchange
  155. {
  156. BYTE bFirstEntry; /* first entry to change */
  157. BYTE bNumEntries; /* # entries to change (0 if 256) */
  158. WORD wFlags; /* Mostly to preserve alignment... */
  159. PALETTEENTRY peNew[]; /* New color specifications */
  160. } AVIPALchange;
  161. typedef struct _MIDIdata
  162. {
  163. BYTE abData[0]; // Raw MIDI data
  164. } MIDIdata;
  165. #endif //WIN32
  166. #define AVIIF_LIST 0x00000001L
  167. #define AVIIF_KEYFRAME 0x00000010L
  168. typedef struct _AVIIndexEntry
  169. {
  170. DWORD ckid;
  171. DWORD dwFlags;
  172. DWORD dwChunkOffset; // Position of chunk
  173. DWORD dwChunkLength; // Length of chunk
  174. } AVIIndexEntry;
  175. #ifndef WIN32
  176. typedef struct tagCOMPRESSIONINFO
  177. {
  178. DWORD fccCompType; /* Which compressor to use */
  179. BYTE abData[]; /* Compressor-dependent data */
  180. } COMPRESSIONINFO;
  181. /* OBSOLETE BELOW THIS LINE */
  182. /* flags for use in <dwAuthorFlags> in AVIAuthorInfo */
  183. #define AVIF_PADTOMAX 0x0001 // pad records to maximum size
  184. #define AVIF_IDENTITY 0x0002 // translate to identity palette
  185. #define AVIF_MERGECOLORS 0x0010 // use <wInterFrameThreshold>
  186. #define AVIF_SKIPSINGLE 0x0020
  187. #define AVIF_FILTERFRAMES 0x0100 // use <wIntraFrameThreshold>
  188. typedef struct _AVIAuthorInfo
  189. {
  190. DWORD dwAuthorFlags; // flags provided at author time
  191. WORD wInterFrameThreshold;
  192. WORD wIntraFrameThreshold;
  193. } AVIAuthorInfo;
  194. #endif //WIN32
  195.