1
0

duck_dxl.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. //==========================================================================
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. // PURPOSE.
  7. //
  8. // Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------
  11. #ifndef _duck_dxl_h
  12. #define _duck_dxl_h
  13. /******************************************************************************\
  14. * *
  15. * duck_dxl.h - TrueMotion include file for decompression libraries *
  16. * *
  17. * Version: 6.0.0 *
  18. * Created: 3/3/98 *
  19. * *
  20. \******************************************************************************/
  21. #if defined(__cplusplus)
  22. extern "C" {
  23. #endif
  24. /* enumerated data types */
  25. typedef enum BLITQUALITY {
  26. DXBLIT_SAME = 0, /* Blit directly, w/o stretching */
  27. DXBLIT_R1,
  28. DXBLIT_R2,
  29. DXBLIT_STRETCH, /* double horizontally, skip lines vertically */
  30. DXBLIT_R3,
  31. DXBLIT_STRETCH_BRIGHT, /* double horizontally, interpolate vertically */
  32. DXBLIT_R4,
  33. DXBLIT_R5,
  34. DXBLIT_R6,
  35. DXBLIT_NONE,
  36. DXBLITMAX
  37. } dxvBlitQuality ;
  38. typedef enum BITDEPTH {
  39. DXRGBNULL = 0,
  40. DXRGB8 = 1,
  41. DXRGB16_555 = 2,
  42. DXRGB24 = 3,
  43. DXRGB_UNUSED = 4,
  44. DXRGB16VESA = 5,
  45. DXRGB8VESA = 6,
  46. DXRGB16_565 = 7,
  47. DXYUY2 = 8,
  48. DXYVU9 = 9,
  49. DXYV12 = 10,
  50. DXUYVY = 11,
  51. DXRGB32 = 12,
  52. DXRGB16VESA_565 = 13,
  53. DXHALFTONE8 =14,
  54. DXMAX
  55. } dxvBitDepth ;
  56. #define DXRGB16 DXRGB16_555
  57. #define DXRGB24CHAR DXRGB24
  58. typedef enum OFFSETXY {
  59. DXL_ABSOLUTE = 0,
  60. DXL_RELATIVE
  61. } dxvOffsetMode;
  62. typedef enum IMAGETYPE {
  63. DXL_INTRAFRAME = 0,
  64. DXL_INTERFRAME,
  65. DXL_SPRITE
  66. } dxvImageType;
  67. typedef enum DXL_ERR{
  68. DXL_LOW_ERR = -32000,
  69. DXL_INVALID_REQUEST = -8,
  70. DXL_VERSION_CONFLICT = -7,
  71. DXL_INVALID_DATA = -7,
  72. DXL_INVALID_BLIT = -6,
  73. DXL_BAD_DATA = -5,
  74. DXL_ALLOC_FAILED = -4,
  75. DXL_NULL_FRAME = -3,
  76. DXL_NULLSOURCE = -2,
  77. DXL_NOTINUSE = -1,
  78. DXL_OK = 0,
  79. DXL_HOLD_FRAME = 1
  80. } dxvError ;
  81. typedef enum BGMODE /* sprite drawing modes
  82. v1.0.2 supports NORM & NO_BACKGROUND */{
  83. NORM = 0, /* normal sprite mode, blend edges w/background */
  84. NO_BACKGROUND = 1,/* transparant sprite mode 1,
  85. sets all background data transparant no blending */
  86. NORM_TRANS = 2, /* transparant sprite mode 2,
  87. blend edges (alphas) w/separate background buffer,
  88. set sprite background to trans */
  89. RGB_OPAQUE = 3, /* blend edges to sprColor, set background to sprColor*/
  90. RGB_TRANS = 4 /* blend edges w/sprColor, set background to trans */
  91. } dxvBackgroundMode ;
  92. /*********************************************************/
  93. /* definition of data handles */
  94. typedef struct vScreen *DXL_VSCREEN_HANDLE;
  95. typedef struct tXImage *DXL_XIMAGE_HANDLE;
  96. typedef struct tXAudioSource *DXL_XAUDIOSRC_HANDLE;
  97. typedef struct tAudioBuff *DXL_AUDIODST_HANDLE;
  98. /* main video decompression init, exit and query */
  99. int DXL_InitVideo(int maxScreens,int maxImages);
  100. void DXL_ExitVideo(void);
  101. /*get pointer to NULL terminated
  102. array of supported fourCCs */
  103. unsigned long *DXL_GetFourCCList(void);
  104. /* create an xImage (decompressor) object,
  105. based on the provided compressed data */
  106. DXL_XIMAGE_HANDLE DXL_CreateXImage(
  107. unsigned char *data
  108. );
  109. int DXL_SetXImageCSize(DXL_XIMAGE_HANDLE xImage, int compressedSize);
  110. int DXL_InitVideoEx(int lmaxScreens, int lmaxImages);
  111. /* create an xImage (decompressor) object
  112. of a specific type */
  113. DXL_XIMAGE_HANDLE DXL_CreateXImageOfType(
  114. unsigned char *data,
  115. unsigned long fccType
  116. );
  117. /* destroy the specified xImage */
  118. void DXL_DestroyXImage(DXL_XIMAGE_HANDLE src);
  119. /* feed the xImage new data, get ready to decompress */
  120. int DXL_AlterXImageData(
  121. DXL_XIMAGE_HANDLE src,
  122. unsigned char *ptrData
  123. );
  124. /* explicitly alter attributes of an xImage */
  125. DXL_XIMAGE_HANDLE DXL_AlterXImage(
  126. DXL_XIMAGE_HANDLE ,
  127. unsigned char *ptrData,
  128. int xImType,
  129. dxvBitDepth bitDepth ,
  130. int maxWidth,int maxHeight
  131. );
  132. /* get xImage target bounding rectangle */
  133. int DXL_GetXImageDirtyXYWH(
  134. DXL_XIMAGE_HANDLE ,
  135. int *,int *,int *,int *
  136. );
  137. /* force decompressor to refresh all destination pixels */
  138. int DXL_SetXImageBlitAll(
  139. DXL_XIMAGE_HANDLE xImage
  140. );
  141. /* if available, get pointer to internal frameBuffer */
  142. void *DXL_GetXImageFrameBuffer(
  143. DXL_XIMAGE_HANDLE src
  144. );
  145. long DXL_GetXImageCSize(
  146. DXL_XIMAGE_HANDLE src
  147. );
  148. /* change x,y, offset at which to decompress image */
  149. int DXL_MoveXImage(
  150. DXL_XIMAGE_HANDLE src,
  151. dxvOffsetMode mode,
  152. int x,int y
  153. );
  154. /* set sprite transparency mode (SegaSaturn only) */
  155. int DXL_AlterXImageSpriteModes(
  156. DXL_XIMAGE_HANDLE src,
  157. int sprMode, int sprColor
  158. );
  159. /* get application specified x,y offset,
  160. and overall decompressed width and height */
  161. int DXL_GetXImageXYWH(
  162. DXL_XIMAGE_HANDLE src,
  163. int *x,int *y,int *w, int *h
  164. );
  165. int DXL_GetXImageType(DXL_XIMAGE_HANDLE src);
  166. int DXL_GetXImageColorDepth(DXL_XIMAGE_HANDLE src);
  167. int DXL_IsXImageKeyFrame(DXL_XIMAGE_HANDLE src);
  168. /* decompress and blit as a single process */
  169. int DXL_dxImageToVScreen(
  170. DXL_XIMAGE_HANDLE src,
  171. DXL_VSCREEN_HANDLE dst
  172. );
  173. /* compatibility check prior between
  174. decompressor and destination */
  175. int DXL_CheckdxImageToVScreen(
  176. DXL_XIMAGE_HANDLE src,
  177. DXL_VSCREEN_HANDLE dst
  178. );
  179. /* blit from xImage internal "working area" to vScreen */
  180. int DXL_BlitXImageToVScreen(
  181. DXL_XIMAGE_HANDLE src,
  182. DXL_VSCREEN_HANDLE dst
  183. );
  184. /* vscreen management functions */
  185. /* create a virtual screen target for decompression (renderer?) */
  186. DXL_VSCREEN_HANDLE DXL_CreateVScreen(
  187. unsigned char *addr,
  188. dxvBitDepth colorMode,
  189. short bytePitch,
  190. short height
  191. );
  192. /* alter attributes of an existing vScreen */
  193. int DXL_AlterVScreen(
  194. DXL_VSCREEN_HANDLE dst,
  195. unsigned char *addr,
  196. dxvBitDepth colorMode,
  197. int bytePitch,
  198. int height
  199. );
  200. void DXL_VScreenSetInfoDotsFlag(DXL_VSCREEN_HANDLE vScreen, int showDots);
  201. /* alter clipping rectangle of vScreen */
  202. /* not supported by all decompressors */
  203. int DXL_AlterVScreenClip(
  204. DXL_VSCREEN_HANDLE dst,
  205. int x,int y,
  206. int w,int h
  207. );
  208. /* alter viewport rectangle of vScreen */
  209. /* width/height not supported by all decompressors */
  210. int DXL_AlterVScreenView(
  211. DXL_VSCREEN_HANDLE dst,
  212. int x,int y,
  213. int w,int h
  214. );
  215. /* destroy a vScreen object/struct */
  216. void DXL_DestroyVScreen(
  217. DXL_VSCREEN_HANDLE dst
  218. );
  219. /* set blit mode/quality of a vScreen
  220. same (normal), stretch (black lined)
  221. stretch bright (stretched w/interpolation) */
  222. int DXL_SetVScreenBlitQuality(
  223. DXL_VSCREEN_HANDLE dest,
  224. dxvBlitQuality bq
  225. );
  226. /* get vScreens current blit mode/quality */
  227. dxvBlitQuality DXL_GetVScreenBlitQuality(
  228. DXL_VSCREEN_HANDLE
  229. );
  230. /* alter spite background associated with a vscreen */
  231. /* used only by SegaSaturn for hardware sprite support */
  232. int DXL_AlterVScreenBackground(
  233. DXL_VSCREEN_HANDLE ,
  234. unsigned char *,
  235. dxvBitDepth bd ,int ,int ,int ,int
  236. );
  237. /* set DOS VESA mode for vScreen (DOS only) */
  238. int DXL_AlterVScreenVESAMode(
  239. DXL_VSCREEN_HANDLE ,
  240. int vesaMode
  241. );
  242. /* set physical screen to vScreen's vesa mode */
  243. int DXL_ActivateVScreenVESAMode(DXL_VSCREEN_HANDLE);
  244. /* get vScreen (generally physical) vesa mode */
  245. int DXL_GetVScreenVESAMode(DXL_VSCREEN_HANDLE );
  246. void DXL_EraseVScreen(DXL_VSCREEN_HANDLE );
  247. void DXL_BlackLineVScreen(DXL_VSCREEN_HANDLE );
  248. /* copy one vScreen to another */
  249. /* provides support for offscreen compositing,
  250. 16 bit and 8 bit modes only */
  251. int DXL_BlitVScreenToVScreen(
  252. DXL_VSCREEN_HANDLE fromVScreen,
  253. DXL_VSCREEN_HANDLE toVScreen
  254. );
  255. /* get attributes of the vScreen */
  256. int DXL_GetVScreenAttributes(
  257. DXL_VSCREEN_HANDLE vScreen,
  258. void **addr,
  259. dxvBlitQuality *bq,
  260. short *pitch,
  261. short *height
  262. );
  263. char *DXL_GetXImageStats(DXL_XIMAGE_HANDLE xImage,char *storage);
  264. /* get vScreen's current viewport rectangle
  265. a viewport represents an x,y, offset and
  266. a clipping width and height */
  267. int DXL_GetVScreenView(
  268. DXL_VSCREEN_HANDLE dst,
  269. int *x,int *y,int *w,int *h
  270. );
  271. /* get vScreen's current clipping rectangle */
  272. int DXL_GetVScreenClip(
  273. DXL_VSCREEN_HANDLE dst,
  274. int *x,int *y,int *w,int *h
  275. );
  276. /* provide Color lookup tables for 8 bit support */
  277. int DXL_SetVScreenCLUTs(
  278. DXL_VSCREEN_HANDLE vScr,
  279. unsigned char *clpt,
  280. unsigned char *clpt2,
  281. int exp
  282. );
  283. /* return the palette currently used */
  284. int DXL_GetBitDepthPalette(dxvBitDepth colorMode,
  285. unsigned char **pal);
  286. /* relinquish color lookup table structures */
  287. void DXL_ResetVScreenCLUTs(
  288. DXL_VSCREEN_HANDLE vScr
  289. );
  290. /* check to see if a blit mode is supported */
  291. int DXL_CheckVScreenBlit(DXL_VSCREEN_HANDLE dst,unsigned long fourcc);
  292. int DXL_CheckVScreenXImageBlit(DXL_VSCREEN_HANDLE dst,DXL_XIMAGE_HANDLE src);
  293. /* audio function prototypes */
  294. int DXL_InitAudio(int srcs,int dsts);
  295. void DXL_ExitAudio(void);
  296. typedef struct tDKWAVEFORM *DKWAVEFORMPTR; /* place holder pointer */
  297. /* create a compressed audio source (decompressor) */
  298. DXL_XAUDIOSRC_HANDLE DXL_CreateXAudioSrc(
  299. DKWAVEFORMPTR wv,
  300. unsigned char *addr,int length
  301. );
  302. /* feed an audio decompressor new data (w/o decompressing) */
  303. void DXL_AlterXAudioData(
  304. DXL_XAUDIOSRC_HANDLE xSource,
  305. unsigned char *addr,int length
  306. );
  307. /* destroy an audio decompressor */
  308. void DXL_DestroyXAudioSrc(DXL_XAUDIOSRC_HANDLE xSource);
  309. /* create a audio destination description */
  310. DXL_AUDIODST_HANDLE DXL_CreateAudioDst(
  311. void *addrL,void *addrR,
  312. int length,int bitDepth,
  313. int numChannels,
  314. int sampleRate
  315. );
  316. /* change characteristics of audio destination descriptor */
  317. void DXL_AlterAudioDst(
  318. DXL_AUDIODST_HANDLE dst,
  319. void *addrL,void *addrR,
  320. int length,int bitDepth,
  321. int numChannels,
  322. int sampleRate
  323. );
  324. /* destroy audio destination description struct */
  325. void DXL_DestroyAudioDst(DXL_AUDIODST_HANDLE dst);
  326. /* decompress up to maxSamplesToDecompress */
  327. /* function returns the actual number of
  328. samples decompressed */
  329. int DXL_dxAudio(
  330. DXL_XAUDIOSRC_HANDLE src,
  331. DXL_AUDIODST_HANDLE dst,
  332. int maxSamplesToDecompress
  333. );
  334. /* windows 95 dll system abstraction functions */
  335. /* set memory allocator function */
  336. void DXV_Setmalloc(
  337. void *(*mallocFuncPtr)(unsigned int size)
  338. );
  339. /* set cleared memory allocator function */
  340. void DXV_Setcalloc(
  341. void *(*callocFuncPtr)(unsigned int size, unsigned int number)
  342. );
  343. /*set memory free function */
  344. void DXV_Setfree(
  345. void (*freeFuncPtr)(void *)
  346. );
  347. /* can only have a max of 32 cpu specific features */
  348. typedef enum tCPU_FEATURES
  349. {
  350. NO_FEATURES = 0,
  351. MMX_SUPPORTED = 1
  352. } CPU_FEATURES;
  353. CPU_FEATURES DXL_GetCPUFeatures(void);
  354. unsigned long DXL_GetXImageFOURCC(DXL_XIMAGE_HANDLE src);
  355. void vp31_SetParameter(DXL_XIMAGE_HANDLE src,int Command, unsigned long Parameter );
  356. //int DXL_RegisteredAudioDXerGet(DXL_AUDIO_REGISTRATION *oneRegistration);
  357. typedef struct tFrameInfo
  358. {
  359. int KeyFrame;
  360. int Version;
  361. int Quality;
  362. int vp30Flag;
  363. } FrameInfo;
  364. void vp31_GetInfo(unsigned char * source, FrameInfo * frameInfo);
  365. #if defined(__cplusplus)
  366. }
  367. #endif
  368. #endif /* include guards */