Leaked source code of windows server 2003
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.

320 lines
9.1 KiB

  1. /*
  2. * @DEC_COPYRIGHT@
  3. */
  4. /*
  5. * HISTORY
  6. * $Log: h26x_int.h,v $
  7. * $EndLog$
  8. */
  9. /*
  10. **++
  11. ** FACILITY: Workstation Multimedia (WMM) v1.0
  12. **
  13. ** FILE NAME: h26x_int.h
  14. ** MODULE NAME: h26x_int.h
  15. **
  16. ** MODULE DESCRIPTION: Internal H.261/H.263 header - used by h26x.c
  17. **
  18. ** DESIGN OVERVIEW:
  19. **
  20. **--
  21. */
  22. #ifndef _H26X_INT_H_
  23. #define _H26X_INT_H_
  24. #if !defined(_DEBUG) && defined(WIN32)
  25. #define HANDLE_EXCEPTIONS
  26. // #define EXCEPTION_MESSAGES /* dialog boxes appear on critical exceptions */
  27. #endif
  28. #ifdef __osf__ /* NOT needed for NT */
  29. /*
  30. * For loading .so.
  31. */
  32. #include <stdlib.h>
  33. #include <dlfcn.h>
  34. #endif
  35. #define _huge
  36. #define _loadds
  37. #include <windows.h>
  38. #include <VFW.H>
  39. // #include "cmm.h"
  40. #include "slib.h"
  41. // #include "SR.h"
  42. #include "dech26x.h"
  43. #ifdef H261_SUPPORT
  44. #define H26X_FOURCC VIDEO_FORMAT_DIGITAL_H261
  45. #ifdef WIN32
  46. #define H26X_NAME L"Digital H.261"
  47. #define H26X_DESCRIPTION L"Digital H261 Video CODEC"
  48. #define H26X_DRIVER L"dech261.dll"
  49. #else /* !WIN32 */
  50. #define H26X_NAME "Digital H.261"
  51. #define H26X_DESCRIPTION "Digital H.261 Video CODEC"
  52. #define H26X_DRIVER "libh261.so"
  53. #endif
  54. #define H26X_KEYNAME "vidc.d261"
  55. #define H26X_KEYNAME_PRE "vidc"
  56. #define H26X_KEYNAME_POST "d261"
  57. #else /* H263 */
  58. #define H26X_FOURCC VIDEO_FORMAT_DIGITAL_H263
  59. #ifdef WIN32
  60. #define H26X_NAME L"Digital H.263"
  61. #define H26X_DESCRIPTION L"Digital H263 Video CODEC"
  62. #define H26X_DRIVER L"dech263.dll"
  63. #else /* !WIN32 */
  64. #define H26X_NAME "Digital H.263"
  65. #define H26X_DESCRIPTION "Digital H.263 Video CODEC"
  66. #define H26X_DRIVER "libh263.so"
  67. #endif
  68. #define H26X_KEYNAME "vidc.d263"
  69. #define H26X_KEYNAME_PRE "vidc"
  70. #define H26X_KEYNAME_POST "d263"
  71. #endif /* H263 */
  72. #define H26X_VERSION 0x001
  73. #define H26X_DEFAULT_SATURATION 5000.0
  74. #define H26X_DEFAULT_CONTRAST 5000.0
  75. #define H26X_DEFAULT_BRIGHTNESS 5000.0
  76. #define H26X_DEFAULT_QUALITY 5000
  77. #define H26X_DEFAULT_FRAMERATE 15.0F
  78. #define H26X_DEFAULT_BITRATE 0 /* 57344*2 */
  79. #define H26X_DEFAULT_MODE 0 /* PARAM_ALGFLAG_UMV|PARAM_ALGFLAG_ADVANCED */
  80. #define H26X_DEFAULT_PACKETSIZE 512
  81. #define H26X_DEFAULT_RTP EC_RTP_MODE_OFF
  82. #define H26X_DEFAULT_SQCIF_QI 8
  83. #define H26X_DEFAULT_SQCIF_QP 8
  84. #define H26X_DEFAULT_QCIF_QI 9
  85. #define H26X_DEFAULT_QCIF_QP 9
  86. #define H26X_DEFAULT_CIF_QI 14
  87. #define H26X_DEFAULT_CIF_QP 14
  88. #define IsH263Codec(h) ((_ICMGetType(h) == VIDEO_FORMAT_DIGITAL_H263) ? TRUE : FALSE)
  89. #define IsH261Codec(h) ((_ICMGetType(h) == VIDEO_FORMAT_DIGITAL_H261) ? TRUE : FALSE)
  90. /*
  91. * For the loading of the .so (H26X_DRIVER)
  92. */
  93. #define H26X_LDLIB_PATH_COMP "mmeserver"
  94. #define H26X_DRIVERPROC_ENTRY "ICH263Message"
  95. #define H26X_OPENPROC_ENTRY "ICH263Open"
  96. /*
  97. ** Standard Image sizes
  98. */
  99. #define FULL_WIDTH 640
  100. #define FULL_HEIGHT 480
  101. #define NTSC_WIDTH 320
  102. #define NTSC_HEIGHT 240
  103. #define SIF_WIDTH 352
  104. #define SIF_HEIGHT 240
  105. #define CIF_WIDTH 352
  106. #define CIF_HEIGHT 288
  107. #define SQCIF_WIDTH 128
  108. #define SQCIF_HEIGHT 96
  109. #define QCIF_WIDTH 176
  110. #define QCIF_HEIGHT 144
  111. #define CIF4_WIDTH (CIF_WIDTH*2)
  112. #define CIF4_HEIGHT (CIF_HEIGHT*2)
  113. #define CIF16_WIDTH (CIF_WIDTH*4)
  114. #define CIF16_HEIGHT (CIF_HEIGHT*4)
  115. typedef struct SvH261_T_BSINFO_TRAILER{
  116. unsigned dword dwVersion;
  117. unsigned dword dwFlags;
  118. unsigned dword dwUniqueCode;
  119. unsigned dword dwCompressedSize;
  120. unsigned dword dwNumberOfPackets;
  121. unsigned char SourceFormat;
  122. unsigned char TR;
  123. unsigned char TRB;
  124. unsigned char DBQ;
  125. } RTPTRAILER_t;
  126. typedef struct SvH263_T_EX_BITSTREAM_INFO{
  127. unsigned dword dwFlag;
  128. unsigned dword dwBitOffset;
  129. unsigned char Mode;
  130. unsigned char MBA;
  131. unsigned char Quant;
  132. unsigned char GOBN;
  133. char HMV1;
  134. char VMV1;
  135. char HMV2;
  136. char VMV2;
  137. } SvH263BITSTREAM_INFO;
  138. typedef struct SvH261_T_EX_BITSTREAM_INFO{
  139. unsigned dword dwFlag;
  140. unsigned dword dwBitOffset;
  141. unsigned char MBAP;
  142. unsigned char Quant;
  143. unsigned char GOBN;
  144. char HMV;
  145. char VMV;
  146. char padding0;
  147. short padding1;
  148. } SvH261BITSTREAM_INFO;
  149. typedef struct _h26Xinfo
  150. {
  151. struct _h26Xinfo *next;
  152. HIC hic;
  153. BOOL bCompressBegun;
  154. BOOL bDecompressBegun;
  155. BOOL bPaletteInitialized;
  156. BOOL bUsesCodec;
  157. BOOL bUsesRender;
  158. DWORD fccType;
  159. DWORD fccHandler;
  160. SlibHandle_t Sh;
  161. LPBITMAPINFOHEADER lpbiOut;
  162. LPBITMAPINFOHEADER lpbiIn;
  163. void *client;
  164. BOOL clientGone;
  165. DWORD openFlags;
  166. DWORD dwMaxCompBytes;
  167. /****** Frame-by-frame Modified Params ******/
  168. DWORD dwMaxQuality;
  169. DWORD dwMaxQi;
  170. DWORD dwMaxQp;
  171. DWORD dwQi;
  172. DWORD dwQp;
  173. /********* Custom Settings ******/
  174. float fFrameRate;
  175. long lastFrameNum;
  176. DWORD lastCompBytes;
  177. DWORD dwQuality;
  178. DWORD dwBitrate;
  179. DWORD dwPacketSize;
  180. DWORD dwRTP;
  181. DWORD dwBrightness;
  182. DWORD dwContrast;
  183. DWORD dwSaturation;
  184. } H26XINFO;
  185. extern H26XINFO *IChic2info(HIC hic);
  186. extern H26XINFO *ICclient2info(void *client);
  187. extern BOOL ICclientGone(void *client);
  188. extern MMRESULT CALLBACK ICH263Message(DWORD_PTR driverHandle,
  189. UINT uiMessage,
  190. LPARAM lParam1,
  191. LPARAM lParam2,
  192. H26XINFO *info);
  193. extern HIC ICH263Open(void *client);
  194. extern void ICH263Close(H26XINFO *info, BOOL postreply);
  195. extern BOOL ICH263QueryConfigure(H26XINFO *info);
  196. extern MMRESULT ICH263Configure(H26XINFO *info);
  197. extern BOOL ICH263QueryAbout(H26XINFO *info);
  198. extern MMRESULT ICH263About(H26XINFO *info);
  199. extern MMRESULT ICH263GetInfo(H26XINFO *info, ICINFO * pic, DWORD dwSize);
  200. extern MMRESULT ICH263GetDefaultQuality(H26XINFO *info, DWORD *lParam1);
  201. extern MMRESULT ICH263GetQuality(H26XINFO *info, DWORD *lParam1);
  202. extern MMRESULT ICH263SetQuality(H26XINFO *info, DWORD lParam1);
  203. extern MMRESULT ICH263CompressQuery(H26XINFO *info,
  204. LPBITMAPINFOHEADER lpbiIn,
  205. LPBITMAPINFOHEADER lpbiOut);
  206. extern MMRESULT ICH263CompressBegin(H26XINFO *info,
  207. LPBITMAPINFOHEADER lpbiIn,
  208. LPBITMAPINFOHEADER lpbiOut);
  209. extern MMRESULT ICH263CompressGetFormat(H26XINFO *info,
  210. LPBITMAPINFOHEADER lpbiIn,
  211. LPBITMAPINFOHEADER lpbiOut);
  212. extern DWORD ICH263CompressGetSize(LPBITMAPINFOHEADER lpbiIn);
  213. extern MMRESULT ICH263Compress(H26XINFO *info,
  214. ICCOMPRESS *icCompress,
  215. DWORD dwSize);
  216. extern MMRESULT ICH263CompressEnd(H26XINFO *info);
  217. extern MMRESULT ICH263DecompressQuery(H26XINFO *info,
  218. LPBITMAPINFOHEADER lpbiIn,
  219. LPBITMAPINFOHEADER lpbiOut);
  220. extern MMRESULT ICH263DecompressBegin(H26XINFO *info,
  221. LPBITMAPINFOHEADER lpbiIn,
  222. LPBITMAPINFOHEADER lpbiOut);
  223. extern MMRESULT ICH263DecompressGetFormat(H26XINFO *info,
  224. LPBITMAPINFOHEADER lpbiIn,
  225. LPBITMAPINFOHEADER lpbiOut);
  226. extern MMRESULT ICH263DecompressGetSize(H26XINFO *info,
  227. LPBITMAPINFOHEADER lpbiIn,
  228. LPBITMAPINFOHEADER lpbiOut);
  229. extern MMRESULT ICH263Decompress(H26XINFO *info,
  230. ICDECOMPRESS *icDecompress,
  231. DWORD dwSize);
  232. extern MMRESULT ICH263DecompressEnd(H26XINFO *info);
  233. extern MMRESULT ICH263PrepareHeader(H26XINFO *info,
  234. ICDECOMPRESS *icDecompress,
  235. DWORD dwSize);
  236. extern MMRESULT ICH263UnprepareHeader(H26XINFO *info,
  237. ICDECOMPRESS *icDecompress,
  238. DWORD dwSize);
  239. extern MMRESULT ICH263SetQuality(H26XINFO *info, DWORD dwValue);
  240. extern MMRESULT ICH263CustomEncoder (H26XINFO *info, DWORD lParam1, DWORD lParam2);
  241. extern void WaitMsec(long waitTimeInMsec);
  242. extern int TerminateH263();
  243. extern int DriverPostReply(void *client, DWORD ret, DWORD arg);
  244. /*
  245. * Windows NT debugging.
  246. */
  247. #ifdef _SLIBDEBUG_
  248. #include <stdio.h>
  249. static int ScDebugPrintf(char *fmtstr, ...)
  250. {
  251. int cnt;
  252. if (fmtstr)
  253. {
  254. char text[255];
  255. va_list argptr;
  256. va_start(argptr, fmtstr);
  257. cnt=vsprintf(text, fmtstr, argptr);
  258. va_end(argptr);
  259. OutputDebugString(text);
  260. }
  261. return(cnt);
  262. }
  263. static char *BMHtoString(LPBITMAPINFOHEADER lpbi)
  264. {
  265. static char text[255];
  266. if (lpbi)
  267. {
  268. DWORD format=lpbi->biCompression;
  269. if (format==BI_RGB)
  270. sprintf(text, "%dx%d,%d bits (RGB)",
  271. lpbi->biWidth, lpbi->biHeight, lpbi->biBitCount);
  272. else if (format==BI_BITFIELDS)
  273. sprintf(text, "%dx%d,%d bits (BITFIELDS)",
  274. lpbi->biWidth, lpbi->biHeight, lpbi->biBitCount);
  275. else
  276. sprintf(text, "%dx%d,%d bits (%c%c%c%c)",
  277. lpbi->biWidth, lpbi->biHeight, lpbi->biBitCount,
  278. (char)(format&0xFF), (char)((format>>8)&0xFF),
  279. (char)((format>>16)&0xFF), (char)((format>>24)&0xFF));
  280. }
  281. else
  282. sprintf(text, "NULL");
  283. return(text);
  284. }
  285. #define DPF ScDebugPrintf
  286. #define DPF2 ScDebugPrintf
  287. #else
  288. #define DPF
  289. #define DPF2
  290. #endif
  291. #endif /* _H26X_INT_H_ */
  292.