home *** CD-ROM | disk | FTP | other *** search
/ Dream 44 / Amiga_Dream_44.iso / Linux / Apps / xanim.tgz / xanim / xanim27064 / xa_avi.h < prev    next >
C/C++ Source or Header  |  1997-01-26  |  9KB  |  284 lines

  1.  
  2. /*
  3.  * xa_avi.h
  4.  *
  5.  * Copyright (C) 1993,1994,1995,1996,1997 by Mark Podlipec. 
  6.  * All rights reserved.
  7.  *
  8.  * This software may be freely copied, modified and redistributed without
  9.  * fee for non-commerical purposes provided that this copyright notice is
  10.  * preserved intact on all copies and modified copies.
  11.  * 
  12.  * There is no warranty or other guarantee of fitness of this software.
  13.  * It is provided solely "as is". The author(s) disclaim(s) all
  14.  * responsibility and liability with respect to this software's usage
  15.  * or its effect upon hardware or computer systems.
  16.  *
  17.  */
  18.  
  19. /* The following copyright applies to all Ultimotion Segments of the Code:
  20.  *
  21.  * "Copyright International Business Machines Corporation 1994, All rights
  22.  *  reserved. This product uses Ultimotion(tm) IBM video technology."
  23.  *
  24.  */
  25.  
  26.  
  27. #include "xanim.h"
  28.  
  29. #define RIFF_RIFF 0x52494646
  30. #define RIFF_LIST 0x4C495354
  31. #define RIFF_avih 0x61766968
  32. #define RIFF_strd 0x73747264
  33. #define RIFF_strh 0x73747268
  34. #define RIFF_strf 0x73747266
  35. #define RIFF_vedt 0x76656474
  36. #define RIFF_JUNK 0x4A554E4B
  37. #define RIFF_idx1 0x69647831
  38. /*********List Types ***************/
  39. #define RIFF_movi 0x6D6F7669
  40. #define RIFF_hdrl 0x6864726C
  41. #define RIFF_strl 0x7374726C
  42. /*********Chunk Names***************/
  43. #define RIFF_FF00 0xFFFF0000
  44. #define RIFF_00   0x30300000
  45. #define RIFF_01   0x30310000
  46. #define RIFF_02   0x30320000
  47. #define RIFF_03   0x30330000
  48. #define RIFF_04   0x30340000
  49. #define RIFF_05   0x30350000
  50. #define RIFF_06   0x30360000
  51. #define RIFF_07   0x30370000
  52. #define RIFF_00pc 0x30307063
  53. #define RIFF_01pc 0x30317063
  54. #define RIFF_00dc 0x30306463
  55. #define RIFF_00dx 0x30306478
  56. #define RIFF_00db 0x30306462
  57. #define RIFF_00xx 0x30307878
  58. #define RIFF_00id 0x30306964
  59. #define RIFF_00rt 0x30307274
  60. #define RIFF_0021 0x30303231
  61. #define RIFF_00iv 0x30306976
  62. #define RIFF_0031 0x30303331
  63. #define RIFF_0032 0x30303332
  64. #define RIFF_00vc 0x30305643
  65. #define RIFF_00xm 0x3030786D
  66. #define RIFF_01wb 0x30317762
  67. #define RIFF_01dc 0x30306463
  68. /*********VIDEO CODECS**************/
  69. #define RIFF_cram 0x6372616D
  70. #define RIFF_CRAM 0x4352414D
  71. #define RIFF_wham 0x7768616d
  72. #define RIFF_WHAM 0x5748414d
  73. #define RIFF_rgb  0x00000000
  74. #define RIFF_RGB  0x52474220
  75. #define RIFF_rle8 0x01000000
  76. #define RIFF_RLE8 0x524c4538
  77. #define RIFF_rle4 0x02000000
  78. #define RIFF_RLE4 0x524c4534
  79. #define RIFF_none 0x0000FFFF
  80. #define RIFF_NONE 0x4e4f4e45
  81. #define RIFF_pack 0x0100FFFF
  82. #define RIFF_PACK 0x5041434b
  83. #define RIFF_tran 0x0200FFFF
  84. #define RIFF_TRAN 0x5452414e
  85. #define RIFF_ccc  0x0300FFFF
  86. #define RIFF_CCC  0x43434320
  87. #define RIFF_cyuv 0x63797576
  88. #define RIFF_CYUV 0x43595556
  89. #define RIFF_jpeg 0x0400FFFF
  90. #define RIFF_JPEG 0x4A504547
  91. #define RIFF_MJPG 0x4d4a5047
  92. #define RIFF_mJPG 0x6d4a5047
  93. #define RIFF_IJPG 0x494a5047
  94. #define RIFF_rt21 0x72743231
  95. #define RIFF_RT21 0x52543231
  96. #define RIFF_iv31 0x69763331
  97. #define RIFF_IV31 0x49563331
  98. #define RIFF_iv32 0x69763332
  99. #define RIFF_IV32 0x49563332
  100. #define RIFF_iv41 0x69763431
  101. #define RIFF_IV41 0x49563431
  102. #define RIFF_cvid 0x63766964
  103. #define RIFF_CVID 0x43564944
  104. #define RIFF_ulti 0x554c5449
  105. #define RIFF_ULTI 0x756c7469
  106. #define RIFF_YUV9 0x59565539
  107. #define RIFF_YVU9 0x59555639
  108. #define RIFF_XMPG 0x584D5047
  109. #define RIFF_xmpg 0x786D7067
  110. #define RIFF_VDOW 0x56444f57
  111. #define RIFF_MVI1 0x4D564931
  112. #define RIFF_mvi1 0x6D766931
  113. #define RIFF_MPIX 0x04006931        /* MotionPixels munged their id */
  114. #define RIFF_rpza 0x72707a61
  115. /* And this there's the mistakes that need to be supported */
  116. #define RIFF_azpr 0x617a7072    /* recognize Apple's rpza mangled? */
  117. /*********** WAV file stuff *************/
  118. #define RIFF_fmt  0x666D7420
  119. #define RIFF_data 0x64617461
  120. /*********** FND in MJPG **********/
  121. #define RIFF_ISFT 0x49534654
  122. #define RIFF_IDIT 0x49444954
  123.  
  124. #define RIFF_00AM 0x3030414d
  125. #define RIFF_DISP 0x44495350
  126. #define RIFF_ISBJ 0x4953424a
  127.  
  128. #define RIFF_rec    72656320
  129. /* RIFF Types */
  130. #define RIFF_AVI  0x41564920
  131. #define RIFF_WAVE 0x57415645
  132.  
  133. /* fcc Types */
  134. #define RIFF_vids 0x76696473
  135. #define RIFF_auds 0x61756473
  136. #define RIFF_pads 0x70616473
  137. #define RIFF_txts 0x74787473
  138.  
  139. /* fcc handlers */
  140. #define RIFF_RLE  0x524c4520
  141. #define RIFF_msvc 0x6D737663
  142. #define RIFF_MSVC 0x4d535643
  143.  
  144. typedef struct
  145. {
  146.   xaULONG ckid;
  147.   xaULONG flags;
  148.   xaULONG offset;   /* position of chunk rel to movi list include 8b hdr*/
  149.   xaULONG size;     /* length of chunk excluding 8 bytes for RIFF hdr */
  150. } AVI_INDEX_ENTRY;
  151.  
  152. /* Flags for AVI_INDEX_ENTRY */
  153. #define AVIIF_LIST          0x00000001L
  154. #define AVIIF_TWOCC         0x00000002L
  155.         /* keyframe doesn't need previous info to be decompressed */
  156. #define AVIIF_KEYFRAME      0x00000010L
  157.         /* this chunk needs the frames following it to be used */
  158. #define AVIIF_FIRSTPART     0x00000020L
  159.         /* this chunk needs the frames before it to be used */
  160. #define AVIIF_LASTPART      0x00000040L
  161. #define AVIIF_MIDPART       (AVIIF_LASTPART|AVIIF_FIRSTPART)
  162.         /* this chunk doesn't affect timing ie palette change */
  163. #define AVIIF_NOTIME        0x00000100L
  164. #define AVIIF_COMPUSE       0x0FFF0000L
  165.  
  166. typedef struct
  167. {
  168.   xaULONG us_frame;       /* MicroSecPerFrame - timing between frames */
  169.   xaULONG max_bps;        /* MaxBytesPerSec - approx bps system must handle */
  170.   xaULONG pad_gran;       /* */
  171.   xaULONG flags;          /* Flags */
  172.   xaULONG tot_frames;     /* TotalFrames */
  173.   xaULONG init_frames;    /* InitialFrames - initial frame before interleaving */
  174.   xaULONG streams;        /* Streams */
  175.   xaULONG sug_bsize;      /* SuggestedBufferSize */
  176.   xaULONG width;          /* Width */
  177.   xaULONG height;         /* Height */
  178.   xaULONG scale;          /* Scale */
  179.   xaULONG rate;           /* Rate */
  180.   xaULONG start;          /* Start */
  181.   xaULONG length;         /* Length */
  182. } AVI_HDR;
  183.  
  184. /* AVI_HDR Flags */
  185.         /* had idx1 chunk */
  186. #define AVIF_HASINDEX           0x00000010
  187.         /* must use idx1 chunk to determine order */
  188. #define AVIF_MUSTUSEINDEX       0x00000020
  189.         /* AVI file is interleaved */
  190. #define AVIF_ISINTERLEAVED      0x00000100
  191.         /* specially allocated used for capturing real time video */
  192. #define AVIF_WASCAPTUREFILE     0x00010000
  193.         /* contains copyrighted data */
  194. #define AVIF_COPYRIGHTED        0x00020000
  195.  
  196.  
  197. typedef struct
  198. {
  199.   xaULONG fcc_type;       /* fccType  {vids} */
  200.   xaULONG fcc_handler;    /* fccHandler {msvc,RLE} */
  201.   xaULONG flags;          /* Flags */
  202.   xaULONG priority;       /* Priority*/
  203.   xaULONG init_frames;    /* InitialFrames */
  204.   xaULONG scale;          /* Scale */
  205.   xaULONG rate;           /* Rate */
  206.   xaULONG start;          /* Start */
  207.   xaULONG length;         /* Length In units above...*/
  208.   xaULONG sug_bsize;      /* SuggestedBufferSize */
  209.   xaULONG quality;        /* Quality */
  210.   xaULONG samp_size;      /* SampleSize */
  211. } AVI_STREAM_HDR;
  212. /* AVI_STREAM_HDR Flags */
  213. #define AVISF_DISABLED                  0x00000001
  214. #define AVISF_VIDEO_PALCHANGES          0x00010000
  215.  
  216.  
  217. typedef struct /* BitMapInfoHeader */
  218. {
  219.   xaULONG size;           /* Size */
  220.   xaULONG width;          /* Width */
  221.   xaULONG height;         /* Height */
  222.   xaULONG planes;         /* short Planes */
  223.   xaULONG bit_cnt;        /* short BitCount */
  224.   xaULONG compression;    /* Compression {1} */
  225.   xaULONG image_size;     /* SizeImage */
  226.   xaULONG xpels_meter;    /* XPelsPerMeter */
  227.   xaULONG ypels_meter;    /* XPelsPerMeter */
  228.   xaULONG num_colors;     /* ClrUsed */
  229.   xaULONG imp_colors;     /* ClrImportant */
  230. } VIDS_HDR;
  231.  
  232.  
  233. typedef struct AVI_FRAME_STRUCT
  234. {
  235.   xaULONG time;
  236.   xaULONG timelo;
  237.   XA_ACTION *act;
  238.   struct AVI_FRAME_STRUCT *next;
  239. } AVI_FRAME;
  240.  
  241. /* used by MSADPCM */
  242. typedef struct WAVE_COEF_SET_STRUCT 
  243. {
  244.   xaSHORT    coef1;            /* S coef 1 */
  245.   xaSHORT    coef2;            /* S coef 2 */
  246. } WAVE_COEF_SET;
  247.  
  248. typedef struct /* BitMapInfoHeader */
  249. {
  250.   xaULONG format;         /* S format */
  251.   xaULONG channels;       /* S channels */
  252.   xaULONG rate;           /* L rate */
  253.   xaULONG av_bps;         /* L average bytes/sec */
  254.   xaULONG blockalign;      /* S block size of data */
  255.   xaULONG size;           /* S size */
  256.   xaULONG ext_size;       /* S size of following extenions - if any */
  257.   xaULONG samps_block;      /* S Used by MSADPCM and Intel DVI */
  258.   xaULONG num_coefs;      /* S Used by MSADPCM  num of follow sets */
  259.   WAVE_COEF_SET *coefs;      /* Used by MSADPCM  coef1, coef2 */
  260.   xaULONG style;          /* - SIGN2 or unsigned */
  261.   xaULONG byte_cnt;      /* used to keep track of length */
  262. } AUDS_HDR;
  263.  
  264.  
  265.  
  266. /**** from public Microsoft RIFF docs ******/
  267. #define WAVE_FORMAT_UNKNOWN        (0x0000)
  268. #define WAVE_FORMAT_PCM            (0x0001)
  269. #define WAVE_FORMAT_ADPCM        (0x0002)
  270. #define WAVE_FORMAT_IBM_CVSD        (0x0005)
  271. #define WAVE_FORMAT_ALAW        (0x0006)
  272. #define WAVE_FORMAT_MULAW        (0x0007)
  273. #define WAVE_FORMAT_OKI_ADPCM        (0x0010)
  274. #define WAVE_FORMAT_DVI_ADPCM        (0x0011)
  275. #define WAVE_FORMAT_DIGISTD        (0x0015)
  276. #define WAVE_FORMAT_DIGIFIX        (0x0016)
  277. #define WAVE_FORMAT_YAMAHA_ADPCM        (0x0020)
  278. #define WAVE_FORMAT_DSP_TRUESPEECH      (0x0022)
  279. #define IBM_FORMAT_MULAW        (0x0101)
  280. #define IBM_FORMAT_ALAW            (0x0102)
  281. #define IBM_FORMAT_ADPCM        (0x0103)
  282. /*********************/
  283.  
  284.