home *** CD-ROM | disk | FTP | other *** search
/ You're the Director / You're The Director.iso / pc / inc / qtcodec.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-19  |  15.5 KB  |  349 lines

  1.  
  2.  
  3. // ---------------------------------------------------------------------
  4. //
  5. // QTCODEC.H - QuickTime for Windows C and C++ Bindings
  6. //
  7. //             Version 2.0
  8. //
  9. //             (c) Copyright 1988-1994 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 WORD ( FAR CDECL * HDWDISP)( ...) ;
  42.  
  43. // Data
  44. enum VID_DISPATCH { VDSP_SETBANK      =  1
  45.                   , VDSP_SLIDEWINDOW  =  2
  46.                   , VDSP_SAVECONTEXT  =  3
  47.                   , VDSP_RESTCONTEXT  =  4
  48.                   , VDSP_SETTARGET    =  5
  49.                   , VDSP_IDENTIFY     = 21
  50.                   , VDSP_VERSION      = 22
  51.                   , VDSP_BANKTABLE    = 23
  52.                   , VDSP_BITBLTTYPE   = 24
  53.                   , VDSP_SCANWIDTH    = 25
  54.                   , VDSP_READWRITE    = 41
  55.                   , VDSP_TERMINATE    = 86
  56.                   } ;
  57. enum OPT_TYPE { OPT_UNINIT = 0              // field uninitialized
  58.               , OPT_RAW    = 1              // decompress to raw buffer
  59.               , OPT_BMP    = 2              // decompress to BMP
  60.               , OPT_HDW    = 3              // decompress to video adapter
  61.               } ;
  62. enum BMP_TYPE { BMP_NONE      =  0          // unknown type
  63.               , BMP_DIB       =  1          // DIB
  64.               , BMP_MONO      =  2          // monochrome
  65.               , BMP_PACKED_4  =  3          // packed 4 bit, e.g., Fahrenheit
  66.               , BMP_PLANAR_4  =  4          // VGA or SVGA
  67.               , BMP_INDEX_8   =  5          // palettized driver
  68.               , BMP_5_5_5     =  6          // 32,768 colors
  69.               , BMP_5_6_5     =  7          // XGA, Intel order
  70.               , BMP_PLANAR_16 =  8          // two planes of one byte each
  71.               , BMP_8_8_8_RGB =  9          // true color RGB
  72.               , BMP_MEMERR    = 10          // insufficient memory for buffers
  73.               , BMP_8_8_8_BGR = 11          // true color BGR
  74.               , BMP_5_6_5_M   = 12          // XGA, Motorola order
  75.               } ;
  76. typedef LONG ImageSequence ;
  77. // We regard as a limiting case a 1,600 x 1,200 screen with 3 bytes
  78. // per pixel and a pixel pitch that is a power of 2, thus 8,192.
  79. // This gives a bank break every 8 lines, for a total of 150 bank
  80. // breaks.
  81. #define MAXBANKBREAKS 150
  82. #if !defined _MATRIX
  83. #define _MATRIX
  84. typedef LONG LFRACT ;
  85. #define MAKELFRACT(value, fract) ((((DWORD)(fract))>>2) | (((DWORD)((WORD)(value))) << 30))
  86. typedef struct {                            // Hungarian: mtrx
  87.   struct {
  88.     LFIXED lfxCol1 ;
  89.     LFIXED lfxCol2 ;
  90.     LFRACT lfrCol3 ;
  91.   } Row[ 3] ;
  92. } MATRIX, FAR * LPMATRIX ;
  93. #endif                                      // !defined _MATRIX
  94. #define ostypeAPPL  QTFOURCC( 'a', 'p', 'p', 'l')
  95. #define ostypeCVID  QTFOURCC( 'c', 'v', 'i', 'd')
  96. #define ostypeDCMP  QTFOURCC( 'd', 'c', 'm', 'p')
  97. #define ostypeJPEG  QTFOURCC( 'j', 'p', 'e', 'g')
  98. #define ostypeRAW   QTFOURCC( 'r', 'a', 'w', ' ')
  99. #define ostypeRLE   QTFOURCC( 'r', 'l', 'e', ' ')
  100. #define ostypeRPZA  QTFOURCC( 'r', 'p', 'z', 'a')
  101. #define ostypeRT21  QTFOURCC( 'r', 't', '2', '1')
  102. #define ostypeIV31  QTFOURCC( 'i', 'v', '3', '1')
  103. #define ostypeIV32  QTFOURCC( 'i', 'v', '3', '2')
  104. #define ostypeSMC   QTFOURCC( 's', 'm', 'c', ' ')
  105.  
  106. /* Codec function selectors
  107.    Codec selectors 0-127 are reserved by Apple
  108.    Codec selectors 128-191 are subtype specific
  109.    Codec selectors 192-255 are vendor specific
  110.    Codec selectors 256-32767 are reserved by Apple
  111.    Negative selectors are reserved by the Component Manager
  112. */
  113. enum CODEC_SELECTOR { codecGetCodecInfo           =  0
  114.                     , codecGetCompressionTime     =  1
  115.                     , codecGetMaxCompressionSize  =  2
  116.                     , codecPreCompress            =  3
  117.                     , codecBandCompress           =  4
  118.                     , codecPreDecompress          =  5
  119.                     , codecBandDecompress         =  6
  120.                     , codecCDSequenceBusy         =  7
  121.                     , codecGetCompressedImageSize =  8
  122.                     , codecGetSimilarity          =  9
  123.                     , codecTrimImage              = 10
  124.                     } ;
  125.  
  126.  
  127. typedef struct tagCODECCAPABILITIES {
  128.   LONG     lFlags ;
  129.   WORD     wWantedPixelSize ;
  130.   WORD     wExtendWidth ;                   // extra bytes after last row
  131.   WORD     wExtendHeight ;                  // number of rows per compress unit
  132.   WORD     wBandMin ;
  133.   WORD     wBandInc ;
  134.   WORD     wPad ;
  135.   WORD     wTime ;
  136.                                             // new fields for Windows version
  137.   OPT_TYPE optt ;                           // the supported optimization
  138. } CODECCAPABILITIES, FAR * LPCODECCAPABILITIES ;
  139.  
  140. typedef struct tagMASKBITS  {
  141.   LPVOID lpBits ;                           // pointer to the bits
  142.   WORD wRowBytes ;                          // pixel pitch or BMP pitch
  143.   RECT rectBounds ;                         // clip rectangle
  144. } MASKBITS, FAR * LPMASKBITS ;
  145.  
  146. // flags for lFlags in CODECCAPABILITIES
  147. #define codecCanScale             (1L <<  0)
  148. #define codecCanMask              (1L <<  1)
  149. #define codecCanMatte             (1L <<  2)
  150. #define codecCanTransform         (1L <<  3)
  151. #define codecCanTransferMode      (1L <<  4)
  152. #define codecCanCopyPrev          (1L <<  5)
  153. #define codecCanSpool             (1L <<  6)
  154. #define codecCanClipVertical      (1L <<  7)
  155. #define codecCanClipRectangular   (1L <<  8)
  156. #define codecCanRemapColor        (1L <<  9)
  157. #define codecCanFastDither        (1L << 10)
  158. #define codecCanSrcExtract        (1L << 11)
  159. #define codecCanCopyPrevComp      (1L << 12)
  160. #define codecCanAsync             (1L << 13)
  161. #define codecCanMakeMask          (1L << 14)
  162. #define codecCanShift             (1L << 15)
  163.  
  164. // flags for lConditionFlags in CODECDECOMPRESSPARAMETERS
  165. #define codecConditionFirstBand         (1L <<  0)
  166. #define codecConditionLastBand          (1L <<  1)
  167. #define codecConditionCodecChangedMask  (1L << 31)
  168.  
  169. typedef struct tagCODECDECOMPRESSPARAMS {
  170.   LONG lSequenceID ;                        // number of first frame
  171.   ImageDescription FAR * lpim ;             // pointer to image description
  172.   LPVOID lpCompressed ;                     // pointer to compressed data
  173.   LONG lBufferSize ;                        // no image buffer size
  174.   LONG lFrameNumber ;                       // within the sequence
  175.   LONG lStartLine ;                         // starting line of band
  176.   LONG lStopLine ;                          // ending line of band
  177.   LONG lConditionFlags ;                    // how component has been called
  178.   LONG lCallerFlags ;                       // further control information
  179.   LPCODECCAPABILITIES lpCapabilities ;      // filled out by PreDecompress
  180.   LPVOID lpvProgressProc ;                  // no progress proc
  181.   LPVOID lpvCompletionProc ;                // no completion proc
  182.   LPVOID lpvDataProc ;                      // no data loading proc
  183.   HDC hdc ;                                 // instead of CGrafPtr
  184.   LPVOID lpUncompressed ;                   // pointer to offscreen buffer
  185.   LPMASKBITS lpMaskBits ;                   // mask bits structure
  186.   LPVOID lpMattePixMap ;                    // blend matte (unused)
  187.   RECT rectSample ;                         // subset of sample to decompress
  188.   LPMATRIX lpMatrix ;                       // target transformation matrix
  189.   BYTE bAccuracy ;                          // requested accuracy
  190.   BYTE bAlign ;                             // for alignment only
  191.   WORD wRop2 ;                              // usually R2_COPYPEN
  192.   WORD wMatrixType ;                        // identify 0.5X, 2X, 4X
  193.   RECT rectDest ;                           // destination rectangle
  194.   // new fields for Windows version
  195.   LONG lCompressedSize ;                    // size of compressed data
  196.   BMP_TYPE bmpt ;                           // BMP type
  197.   LPVOID lpDitherTable ;                    // pointer to dither table
  198.   WORD wClutSeed ;                          // track CLUT changes
  199.   OPT_TYPE optt ;                           // optimization type
  200.   HDWDISP lpvHardware ;                     // addr of adapter dispatch routine
  201.   LPWORD lpwBankBoundaries ;                // adapter's bank boundary table
  202.   LPWORD lpwBitSmear ;                      // bit smearing table
  203.   WORD wRowsPerFullSegment ;                // banding will obsolete this
  204.   LPVOID lpOffScreen ;                      // offscreen handling of bank splits
  205.   DWORD dwReserved[ 1] ;                    // room for expansion
  206. }  CODECDECOMPRESSPARAMS, FAR * LPCODECDECOMPRESSPARAMS ;
  207.  
  208. typedef struct tagCODECINFO {
  209.   char szTypeName[ 32] ;                    // name of codec type
  210.   WORD wVersion ;
  211.   WORD wRevLevel ;
  212.   DWORD dwVendor ;
  213.   DWORD dwDecompressFlags ;
  214.   DWORD dwCompressFlags ;
  215.   DWORD dwFormatFlags ;
  216.   BYTE bDecompressionAccuracy ;
  217.   WORD wCompressionSpeed ;
  218.   WORD wDecompressionSpeed ;
  219.   BYTE bCompressionLevel ;
  220.   BYTE bReserved ;
  221.   WORD wMinimumHeight ;
  222.   WORD wMinimumWidth ;
  223.   WORD wDecompressPipelineLatency ;
  224.   WORD wCompressPipelineLatency ;
  225.   DWORD dwPrivateData ;
  226. }  CODECINFO, FAR * LPCODECINFO ;
  227.  
  228. // flags for dwComponentFlags in ComponentDescription structure
  229. // flags for dwDecompressFlags and dwCompressFlags in CODECINFO
  230. // The depths refer to target depths supported.
  231. #define codecInfoDoes1           (1L <<  0)
  232. #define codecInfoDoes4           (1L <<  1)
  233. #define codecInfoDoes8           (1L <<  2)
  234. #define codecInfoDoes16          (1L <<  3)
  235. #define codecInfoDoes24          (1L <<  4)
  236. #define codecInfoDoes32          (1L <<  5)
  237. #define codecInfoDoesDither      (1L <<  6)
  238. #define codecInfoDoesStretch     (1L <<  7)
  239. #define codecInfoDoesShrink      (1L <<  8)
  240. #define codecInfoDoesMask        (1L <<  9)
  241. #define codecInfoDoesTemporal    (1L << 10)
  242. #define codecInfoDoesDouble      (1L << 11)
  243. #define codecInfoDoesQuad        (1L << 12)
  244. #define codecInfoDoesHalf        (1L << 13)
  245. #define codecInfoDoesQuarter     (1L << 14)
  246. #define codecInfoDoesRotate      (1L << 15)
  247. #define codecInfoDoesHorizFlip   (1L << 16)
  248. #define codecInfoDoesVertFlip    (1L << 17)
  249. #define codecInfoDoesSkew        (1L << 18)
  250. #define codecInfoDoesBlend       (1L << 19)
  251. #define codecInfoDoesWarp        (1L << 20)
  252. #define codecInfoDoesRecompress  (1L << 21)
  253. #define codecInfoDoesSpool       (1L << 22)
  254.  
  255. // flags for dwFormatFlags in CODECINFO
  256. // The depths refer to source depths supported.
  257. #define codecInfoDepth1          (1L <<  0)
  258. #define codecInfoDepth2          (1L <<  1)
  259. #define codecInfoDepth4          (1L <<  2)
  260. #define codecInfoDepth8          (1L <<  3)
  261. #define codecInfoDepth16         (1L <<  4)
  262. #define codecInfoDepth24         (1L <<  5)
  263. #define codecInfoDepth32         (1L <<  6)
  264. #define codecInfoDepth33         (1L <<  7)
  265. #define codecInfoDepth34         (1L <<  8)
  266. #define codecInfoDepth36         (1L <<  9)
  267. #define codecInfoDepth40         (1L << 10)
  268. #define codecInfoStoresClut      (1L << 11)
  269. #define codecInfoDoesLossless    (1L << 12)
  270. #define codecInfoSeqSensitive    (1L << 13)
  271.  
  272. // Functions
  273. #if defined __cplusplus
  274. extern "C" {
  275. #endif
  276. ComponentResult QTAPI cfBandDecompress( STKOFF_CMP so
  277.                                       , LPVOID lpvStorage
  278.                                       , LPCODECDECOMPRESSPARAMS lpdecomp
  279.                                       ) ;
  280. ComponentResult QTAPI cfCanDoSelect( STKOFF_CMP so, LONG lFunctionSelector) ;
  281. ComponentResult QTAPI cfCloseSelect( STKOFF_CMP so, ComponentInstance ci) ;
  282. ComponentResult QTAPI cfGetCodecInfo( STKOFF_CMP so
  283.                                     , LPVOID lpvStorage
  284.                                     , LPCODECINFO lpinfo
  285.                                     ) ;
  286. ComponentResult QTAPI cfOpenSelect( STKOFF_CMP so, ComponentInstance ci) ;
  287. ComponentResult QTAPI cfPreDecompress( STKOFF_CMP so
  288.                                      , LPVOID lpvStorage
  289.                                      , LPCODECDECOMPRESSPARAMS lpdecomp
  290.                                      ) ;
  291. ComponentResult QTAPI cfRegisterSelect( STKOFF_CMP so, ComponentInstance ci) ;
  292. ComponentResult QTAPI cfSequenceBusy( STKOFF_CMP so
  293.                                     , LPVOID lpvStorage
  294.                                     , ImageSequence seq
  295.                                     ) ;
  296. ComponentResult QTAPI cfTargetSelect( STKOFF_CMP so, ComponentInstance ci) ;
  297. ComponentResult QTAPI cfVersionSelect( STKOFF_CMP so, ComponentInstance ci) ;
  298.  
  299. DWORD QTAPI CodecEntry( VOID) ;
  300. WORD QTAPI Flip16( WORD wValue) ;
  301. VOID QTAPI Flip16Many( LPVOID lpSource, DWORD dwNbrWords) ;
  302. LONG QTAPI Flip32( LONG lValue) ;
  303. VOID QTAPI Flip32Many( LPVOID lpSource, DWORD dwNbrDwords) ;
  304. BOOL QTAPI FreeMemory( LPVOID lpvMem) ;
  305. LPVOID QTAPI GetMemory( LONG lSize) ;
  306. LPVOID QTAPI ReallocateMemory( LPVOID lpvMem, LONG lSize) ;
  307. VOID QTAPI CopyMemory( HPVOID hpvDest, HPVOID hpvSource, LONG cbCopy) ;
  308. OSType FAR PASCAL THNGIDENTIFY( LPCID FAR *lplpcid) ;
  309. VOID QTAPI VidComputeBankBoundaries1( LPWORD lpSourceTable
  310.                                     , LPWORD lpTargetTable
  311.                                     , WORD wLeft
  312.                                     , WORD wTop
  313.                                     , WORD wRight
  314.                                     , WORD wBottom
  315.                                     ) ;
  316. VOID QTAPI VidComputeBankBoundaries2( LPWORD lpSourceTable
  317.                                     , LPWORD lpTargetTable
  318.                                     , WORD wLeft
  319.                                     , WORD wTop
  320.                                     , WORD wRight
  321.                                     , WORD wBottom
  322.                                     ) ;
  323. VOID QTAPI VidComputeBankBoundaries4( LPWORD lpSourceTable
  324.                                     , LPWORD lpTargetTable
  325.                                     , WORD wLeft
  326.                                     , WORD wTop
  327.                                     , WORD wRight
  328.                                     , WORD wBottom
  329.                                     ) ;
  330. VOID QTAPI VidComputeBankBoundaries81( LPWORD lpSourceTable
  331.                                      , LPWORD lpTargetTable
  332.                                      , WORD wLeft
  333.                                      , WORD wTop
  334.                                      , WORD wRight
  335.                                      , WORD wBottom
  336.                                      ) ;
  337. VOID QTAPI VidComputeBankBoundaries82( LPWORD lpSourceTable
  338.                                      , LPWORD lpTargetTable
  339.                                      , WORD wLeft
  340.                                      , WORD wTop
  341.                                      , WORD wRight
  342.                                      , WORD wBottom
  343.                                      ) ;
  344. #if defined __cplusplus
  345. }                                           // defined __cplusplus
  346. #endif
  347.  
  348. #endif                                      // !defined __QTCODEC_H
  349.