home *** CD-ROM | disk | FTP | other *** search
/ cyber.net 2 / cybernet2.ISO / qtw111 / inc / qtcodec.h < prev    next >
C/C++ Source or Header  |  1993-11-22  |  15KB  |  334 lines

  1.  
  2.  
  3. // ---------------------------------------------------------------------
  4. //
  5. // QTCODEC.H - QuickTime for Windows C and C++ Bindings
  6. //
  7. //             Version 1.1
  8. //
  9. //             (c) 1988-1993 Apple Computer, Inc. All Rights Reserved.
  10. //
  11. // ---------------------------------------------------------------------
  12.  
  13.  
  14. #if !defined __QTCODEC_H
  15. #define __QTCODEC_H
  16.  
  17. // Header files
  18. #include <qtw.h>
  19. #include <compmgr.h>
  20.  
  21. // Macros
  22. #define ADDOFFSET(a,b) (LPBYTE)((char _huge *)(a)+(b))
  23. #define SUBOFFSET(a,b) (LPBYTE)((char _huge *)(a)-(b))
  24. #define HUGESUM(a,b,c) ADDOFFSET(a,FIELDOFFSET(b,c))
  25. #define ROUNDUP(a,b) (((a)+(b-1))&(~(b-1)))
  26. #define ROUNDDOWN(a,b) ((a)&(~(b-1)))
  27. #define ROUNDDOWNSLOW(a,b) ((a)-((a)%(b)))
  28. #define LOCAL static _near
  29. #define GlobalDeref(a) GlobalLock(a)
  30.  
  31. // Data types
  32. typedef short * PSHORT ;
  33. typedef short FAR * LPSHORT ;
  34. typedef BOOL * PBOOL ;
  35. typedef BOOL FAR * LPBOOL ;
  36. #define HUGE _huge
  37. typedef char HUGE * HPSTR ;
  38. typedef unsigned char HUGE * HPBYTE ;
  39. typedef void HUGE * HPVOID ;
  40. typedef LONG HUGE * HPLONG ;
  41. typedef VOID ( FAR CDECL * HDWDISP)( ...) ;
  42.  
  43. // Data
  44. enum OPT_TYPE { OPT_UNINIT = 0              // field uninitialized
  45.               , OPT_RAW    = 1              // decompress to raw buffer
  46.               , OPT_BMP    = 2              // decompress to BMP
  47.               , OPT_HDW    = 3              // decompress to video adapter
  48.               } ;
  49. enum BMP_TYPE { BMP_NONE      =  0          // unknown type
  50.               , BMP_DIB       =  1          // DIB
  51.               , BMP_MONO      =  2          // monochrome
  52.               , BMP_PACKED_4  =  3          // packed 4 bit, e.g., Fahrenheit
  53.               , BMP_PLANAR_4  =  4          // VGA or SVGA
  54.               , BMP_INDEX_8   =  5          // palettized driver
  55.               , BMP_5_5_5     =  6          // 32,768 colors
  56.               , BMP_5_6_5     =  7          // XGA, Intel order
  57.               , BMP_PLANAR_16 =  8          // two planes of one byte each
  58.               , BMP_8_8_8_RGB =  9          // true color RGB
  59.               , BMP_MEMERR    = 10          // insufficient memory for buffers
  60.               , BMP_8_8_8_BGR = 11          // true color BGR
  61.               , BMP_5_6_5_M   = 12          // XGA, Motorola order
  62.               } ;
  63. typedef LONG ImageSequence ;
  64. // We regard as a limiting case a 1,600 x 1,200 screen with 3 bytes
  65. // per pixel and a pixel pitch that is a power of 2, thus 8,192.
  66. // This gives a bank break every 8 lines, for a total of 150 bank
  67. // breaks.
  68. #define MAXBANKBREAKS 150
  69. #if !defined _MATRIX
  70. #define _MATRIX
  71. typedef LONG LFRACT ;
  72. #define MAKELFRACT(value, fract) ((((DWORD)(fract))>>2) | (((DWORD)((WORD)(value))) << 30))
  73. typedef struct {                            // Hungarian: mtrx
  74.   struct {
  75.     LFIXED lfxCol1 ;
  76.     LFIXED lfxCol2 ;
  77.     LFRACT lfrCol3 ;
  78.   } Row[ 3] ;
  79. } MATRIX, FAR * LPMATRIX ;
  80. #endif                                      // !defined _MATRIX
  81. #define ostypeAPPL  QTFOURCC( 'a', 'p', 'p', 'l')
  82. #define ostypeCVID  QTFOURCC( 'c', 'v', 'i', 'd')
  83. #define ostypeDCMP  QTFOURCC( 'd', 'c', 'm', 'p')
  84. #define ostypeJPEG  QTFOURCC( 'j', 'p', 'e', 'g')
  85. #define ostypeRAW   QTFOURCC( 'r', 'a', 'w', ' ')
  86. #define ostypeRLE   QTFOURCC( 'r', 'l', 'e', ' ')
  87. #define ostypeRPZA  QTFOURCC( 'r', 'p', 'z', 'a')
  88. #define ostypeRT21  QTFOURCC( 'r', 't', '2', '1')
  89. #define ostypeSMC   QTFOURCC( 's', 'm', 'c', ' ')
  90.  
  91. /* Codec function selectors
  92.    Codec selectors 0-127 are reserved by Apple
  93.    Codec selectors 128-191 are subtype specific
  94.    Codec selectors 192-255 are vendor specific
  95.    Codec selectors 256-32767 are reserved by Apple
  96.    Negative selectors are reserved by the Component Manager
  97. */
  98. enum CODEC_SELECTOR { codecGetCodecInfo           =  0
  99.                     , codecGetCompressionTime     =  1
  100.                     , codecGetMaxCompressionSize  =  2
  101.                     , codecPreCompress            =  3
  102.                     , codecBandCompress           =  4
  103.                     , codecPreDecompress          =  5
  104.                     , codecBandDecompress         =  6
  105.                     , codecCDSequenceBusy         =  7
  106.                     , codecGetCompressedImageSize =  8
  107.                     , codecGetSimilarity          =  9
  108.                     , codecTrimImage              = 10
  109.                     } ;
  110.  
  111. typedef struct tagCODECCAPABILITIES {
  112.   LONG     lFlags ;
  113.   WORD     wWantedPixelSize ;
  114.   WORD     wExtendWidth ;                   // extra bytes after last row
  115.   WORD     wExtendHeight ;                  // number of rows per compress unit
  116.   WORD     wBandMin ;
  117.   WORD     wBandInc ;
  118.   WORD     wPad ;
  119.   WORD     wTime ;
  120.                                             // new fields for Windows version
  121.   OPT_TYPE optt ;                           // the supported optimization
  122. } CODECCAPABILITIES, FAR * LPCODECCAPABILITIES ;
  123.  
  124. typedef struct tagMASKBITS  {
  125.   LPVOID lpBits ;                           // pointer to the bits
  126.   WORD wRowBytes ;                          // pixel pitch or BMP pitch
  127.   RECT rectBounds ;                         // clip rectangle
  128. } MASKBITS, FAR * LPMASKBITS ;
  129.  
  130. // flags for lFlags in CODECCAPABILITIES
  131. #define codecCanScale             (1L <<  0)
  132. #define codecCanMask              (1L <<  1)
  133. #define codecCanMatte             (1L <<  2)
  134. #define codecCanTransform         (1L <<  3)
  135. #define codecCanTransferMode      (1L <<  4)
  136. #define codecCanCopyPrev          (1L <<  5)
  137. #define codecCanSpool             (1L <<  6)
  138. #define codecCanClipVertical      (1L <<  7)
  139. #define codecCanClipRectangular   (1L <<  8)
  140. #define codecCanRemapColor        (1L <<  9)
  141. #define codecCanFastDither        (1L << 10)
  142. #define codecCanSrcExtract        (1L << 11)
  143. #define codecCanCopyPrevComp      (1L << 12)
  144. #define codecCanAsync             (1L << 13)
  145. #define codecCanMakeMask          (1L << 14)
  146. #define codecCanShift             (1L << 15)
  147.  
  148. // flags for lConditionFlags in CODECDECOMPRESSPARAMETERS
  149. #define codecConditionFirstBand         (1L <<  0)
  150. #define codecConditionLastBand          (1L <<  1)
  151. #define codecConditionCatchUp           (1L <<  2)
  152. #define codecConditionCodecChangedMask  (1L << 31)
  153.  
  154. typedef struct tagCODECDECOMPRESSPARAMS {
  155.   LONG lSequenceID ;                        // number of first frame
  156.   ImageDescription FAR * lpim ;             // pointer to image description
  157.   LPVOID lpCompressed ;                     // pointer to compressed data
  158.   LONG lBufferSize ;                        // no image buffer size
  159.   LONG lFrameNumber ;                       // within the sequence
  160.   LONG lStartLine ;                         // starting line of band
  161.   LONG lStopLine ;                          // ending line of band
  162.   LONG lConditionFlags ;                    // how component has been called
  163.   LONG lCallerFlags ;                       // further control information
  164.   LPCODECCAPABILITIES lpCapabilities ;      // filled out by PreDecompress
  165.   LPVOID lpvProgressProc ;                  // no progress proc
  166.   LPVOID lpvCompletionProc ;                // no completion proc
  167.   LPVOID lpvDataProc ;                      // no data loading proc
  168.   HDC hdc ;                                 // instead of CGrafPtr
  169.   LPVOID lpUncompressed ;                   // pointer to offscreen buffer
  170.   LPMASKBITS lpMaskBits ;                   // mask bits structure
  171.   LPVOID lpMattePixMap ;                    // blend matte (unused)
  172.   RECT rectSample ;                         // subset of sample to decompress
  173.   LPMATRIX lpMatrix ;                       // target transformation matrix
  174.   BYTE bAccuracy ;                          // requested accuracy
  175.   BYTE bAlign ;                             // for alignment only
  176.   WORD wRop2 ;                              // usually R2_COPYPEN
  177.   WORD wMatrixType ;                        // identify 0.5X, 2X, 4X
  178.   RECT rectDest ;                           // destination rectangle
  179.   // new fields for Windows version
  180.   LONG lCompressedSize ;                    // size of compressed data
  181.   BMP_TYPE bmpt ;                           // BMP type
  182.   LPVOID lpDitherTable ;