1 /***********************************************************************\ 2 * vfw.d * 3 * * 4 * Windows API header module * 5 * written in the D programming language * 6 * * 7 * Placed into public domain * 8 \***********************************************************************/ 9 10 module windows.vfw; 11 pragma(lib, "vfw32"); 12 nothrow: 13 private import 14 windows.commdlg, 15 windows.wingdi, 16 windows.mmsystem, 17 windows.unknwn, 18 windows.w32api, 19 windows.windef, 20 windows.winuser; 21 22 extern(Windows) { 23 DWORD VideoForWindowsVersion(); 24 LONG InitVFW(); 25 LONG TermVFW(); 26 } 27 28 DWORD MKFOURCC(char ch0, char ch1, char ch2, char ch3) { 29 return (cast(DWORD)ch0) | ((cast(DWORD)ch1) << 8) | ((cast(DWORD)ch2) << 16) | ((cast(DWORD)ch3) << 24); 30 } 31 32 /** 33 * COMPMAN - Installable Compression Manager. 34 */ 35 36 const ICVERSION = 0x0104; 37 38 alias TypeDef!(HANDLE) HIC; 39 40 const BI_1632 = 0x32333631; 41 42 template aviTWOCC(char c0, char c1) { 43 const WORD aviTWOCC = c0 | (c1 << 8); 44 } 45 46 const ICTYPE_VIDEO = mmioFOURCC!('v', 'i', 'd', 'c'); 47 const ICTYPE_AUDIO = mmioFOURCC!('a', 'u', 'd', 'c'); 48 49 enum { 50 ICERR_OK = 0, 51 ICERR_DONTDRAW = 1, 52 ICERR_NEWPALETTE = 2, 53 ICERR_GOTOKEYFRAME = 3, 54 ICERR_STOPDRAWING = 4, 55 } 56 57 const ICERR_UNSUPPORTED = -1; 58 const ICERR_BADFORMAT = -2; 59 const ICERR_MEMORY = -3; 60 const ICERR_INTERNAL = -4; 61 const ICERR_BADFLAGS = -5; 62 const ICERR_BADPARAM = -6; 63 const ICERR_BADSIZE = -7; 64 const ICERR_BADHANDLE = -8; 65 const ICERR_CANTUPDATE = -9; 66 const ICERR_ABORT = -10; 67 const ICERR_ERROR = -100; 68 const ICERR_BADBITDEPTH = -200; 69 const ICERR_BADIMAGESIZE = -201; 70 71 const ICERR_CUSTOM = -400; 72 73 enum { 74 ICMODE_COMPRESS = 1, 75 ICMODE_DECOMPRESS, 76 ICMODE_FASTDECOMPRESS, 77 ICMODE_QUERY, 78 ICMODE_FASTCOMPRESS, 79 ICMODE_DRAW = 8, 80 } 81 82 const ICMODE_INTERNALF_FUNCTION32 = 0x8000; 83 const ICMODE_INTERNALF_MASK = 0x8000; 84 85 enum { 86 AVIIF_LIST = 0x00000001, 87 AVIIF_TWOCC = 0x00000002, 88 AVIIF_KEYFRAME = 0x00000010, 89 } 90 91 const ICQUALITY_LOW = 0; 92 const ICQUALITY_HIGH = 10000; 93 const ICQUALITY_DEFAULT = -1; 94 95 enum { 96 ICM_USER = DRV_USER + 0x0000, 97 ICM_RESERVED_LOW = DRV_USER + 0x1000, 98 ICM_RESERVED_HIGH = DRV_USER + 0x2000, 99 ICM_RESERVED = ICM_RESERVED_LOW, 100 } 101 102 // messages 103 104 enum { 105 ICM_GETSTATE = ICM_RESERVED + 0, 106 ICM_SETSTATE = ICM_RESERVED + 1, 107 ICM_GETINFO = ICM_RESERVED + 2, 108 ICM_CONFIGURE = ICM_RESERVED + 10, 109 ICM_ABOUT = ICM_RESERVED + 11, 110 ICM_GETERRORTEXT = ICM_RESERVED + 12, 111 ICM_GETFORMATNAME = ICM_RESERVED + 20, 112 ICM_ENUMFORMATS = ICM_RESERVED + 21, 113 ICM_GETDEFAULTQUALITY = ICM_RESERVED + 30, 114 ICM_GETQUALITY = ICM_RESERVED + 31, 115 ICM_SETQUALITY = ICM_RESERVED + 32, 116 ICM_SET = ICM_RESERVED + 40, 117 ICM_GET = ICM_RESERVED + 41, 118 } 119 120 const ICM_FRAMERATE = mmioFOURCC!('F','r','m','R'); 121 const ICM_KEYFRAMERATE = mmioFOURCC!('K','e','y','R'); 122 123 // ICM specific messages. 124 125 enum { 126 ICM_COMPRESS_GET_FORMAT = ICM_USER + 4, 127 ICM_COMPRESS_GET_SIZE = ICM_USER + 5, 128 ICM_COMPRESS_QUERY = ICM_USER + 6, 129 ICM_COMPRESS_BEGIN = ICM_USER + 7, 130 ICM_COMPRESS = ICM_USER + 8, 131 ICM_COMPRESS_END = ICM_USER + 9, 132 ICM_DECOMPRESS_GET_FORMAT = ICM_USER + 10, 133 ICM_DECOMPRESS_QUERY = ICM_USER + 11, 134 ICM_DECOMPRESS_BEGIN = ICM_USER + 12, 135 ICM_DECOMPRESS = ICM_USER + 13, 136 ICM_DECOMPRESS_END = ICM_USER + 14, 137 ICM_DECOMPRESS_SET_PALETTE = ICM_USER + 29, 138 ICM_DECOMPRESS_GET_PALETTE = ICM_USER + 30, 139 ICM_DRAW_QUERY = ICM_USER + 31, 140 ICM_DRAW_BEGIN = ICM_USER + 15, 141 ICM_DRAW_GET_PALETTE = ICM_USER + 16, 142 ICM_DRAW_UPDATE = ICM_USER + 17, 143 ICM_DRAW_START = ICM_USER + 18, 144 ICM_DRAW_STOP = ICM_USER + 19, 145 ICM_DRAW_BITS = ICM_USER + 20, 146 ICM_DRAW_END = ICM_USER + 21, 147 ICM_DRAW_GETTIME = ICM_USER + 32, 148 ICM_DRAW = ICM_USER + 33, 149 ICM_DRAW_WINDOW = ICM_USER + 34, 150 ICM_DRAW_SETTIME = ICM_USER + 35, 151 ICM_DRAW_REALIZE = ICM_USER + 36, 152 ICM_DRAW_FLUSH = ICM_USER + 37, 153 ICM_DRAW_RENDERBUFFER = ICM_USER + 38, 154 ICM_DRAW_START_PLAY = ICM_USER + 39, 155 ICM_DRAW_STOP_PLAY = ICM_USER + 40, 156 ICM_DRAW_SUGGESTFORMAT = ICM_USER + 50, 157 ICM_DRAW_CHANGEPALETTE = ICM_USER + 51, 158 ICM_DRAW_IDLE = ICM_USER + 52, 159 ICM_GETBUFFERSWANTED = ICM_USER + 41, 160 ICM_GETDEFAULTKEYFRAMERATE = ICM_USER + 42, 161 ICM_DECOMPRESSEX_BEGIN = ICM_USER + 60, 162 ICM_DECOMPRESSEX_QUERY = ICM_USER + 61, 163 ICM_DECOMPRESSEX = ICM_USER + 62, 164 ICM_DECOMPRESSEX_END = ICM_USER + 63, 165 ICM_COMPRESS_FRAMES_INFO = ICM_USER + 70, 166 ICM_COMPRESS_FRAMES = ICM_USER + 71, 167 ICM_SET_STATUS_PROC = ICM_USER + 72, 168 } 169 170 struct ICOPEN { 171 DWORD dwSize; 172 DWORD fccType; 173 DWORD fccHandler; 174 DWORD dwVersion; 175 DWORD dwFlags; 176 LRESULT dwError; 177 LPVOID pV1Reserved; 178 LPVOID pV2Reserved; 179 DWORD dnDevNode; 180 } 181 182 struct ICINFO { 183 DWORD dwSize; 184 DWORD fccType; 185 DWORD fccHandler; 186 DWORD dwFlags; 187 DWORD dwVersion; 188 DWORD dwVersionICM; 189 WCHAR[16] szName; 190 WCHAR[128] szDescription; 191 WCHAR[128] szDriver; 192 } 193 194 enum { 195 VIDCF_QUALITY = 0x0001, 196 VIDCF_CRUNCH = 0x0002, 197 VIDCF_TEMPORAL = 0x0004, 198 VIDCF_COMPRESSFRAMES = 0x0008, 199 VIDCF_DRAW = 0x0010, 200 VIDCF_FASTTEMPORALC = 0x0020, 201 VIDCF_FASTTEMPORALD = 0x0080, 202 } 203 204 const ICCOMPRESS_KEYFRAME = 0x00000001L; 205 206 struct ICCOMPRESS { 207 DWORD dwFlags; 208 LPBITMAPINFOHEADER lpbiOutput; 209 LPVOID lpOutput; 210 LPBITMAPINFOHEADER lpbiInput; 211 LPVOID lpInput; 212 LPDWORD lpckid; 213 LPDWORD lpdwFlags; 214 LONG lFrameNum; 215 DWORD dwFrameSize; 216 DWORD dwQuality; 217 LPBITMAPINFOHEADER lpbiPrev; 218 LPVOID lpPrev; 219 } 220 221 const ICCOMPRESSFRAMES_PADDING = 0x00000001; 222 223 struct ICCOMPRESSFRAMES { 224 DWORD dwFlags; 225 LPBITMAPINFOHEADER lpbiOutput; 226 LPARAM lOutput; 227 LPBITMAPINFOHEADER lpbiInput; 228 LPARAM lInput; 229 LONG lStartFrame; 230 LONG lFrameCount; 231 LONG lQuality; 232 LONG lDataRate; 233 LONG lKeyRate; 234 DWORD dwRate; 235 DWORD dwScale; DWORD dwOverheadPerFrame; 236 DWORD dwReserved2; 237 238 LONG function(LPARAM lInput, LONG lFrame, LPVOID lpBits, LONG len) GetData; 239 LONG function(LPARAM lOutput, LONG lFrame, LPVOID lpBits, LONG len) PutData; 240 } 241 242 enum { 243 ICSTATUS_START = 0, 244 ICSTATUS_STATUS = 1, 245 ICSTATUS_END = 2, 246 ICSTATUS_ERROR = 3, 247 ICSTATUS_YIELD = 4, 248 } 249 250 struct ICSETSTATUSPROC { 251 DWORD dwFlags; 252 LPARAM lParam; 253 LONG function(LPARAM lParam, UINT message, LONG l) Status; 254 } 255 256 enum { 257 ICDECOMPRESS_NOTKEYFRAME = 0x08000000, 258 ICDECOMPRESS_NULLFRAME = 0x10000000, 259 ICDECOMPRESS_PREROLL = 0x20000000, 260 ICDECOMPRESS_UPDATE = 0x40000000, 261 ICDECOMPRESS_HURRYUP = 0x80000000, 262 } 263 264 struct ICDECOMPRESS { 265 DWORD dwFlags; 266 LPBITMAPINFOHEADER lpbiInput; 267 LPVOID lpInput; 268 LPBITMAPINFOHEADER lpbiOutput; 269 LPVOID lpOutput; 270 DWORD ckid; 271 } 272 273 struct ICDECOMPRESSEX { 274 DWORD dwFlags; 275 LPBITMAPINFOHEADER lpbiSrc; 276 LPVOID lpSrc; 277 LPBITMAPINFOHEADER lpbiDst; 278 LPVOID lpDst; 279 int xDst; 280 int yDst; 281 int dxDst; 282 int dyDst; 283 int xSrc; 284 int ySrc; 285 int dxSrc; 286 int dySrc; 287 } 288 289 enum { 290 ICDRAW_QUERY = 0x00000001, 291 ICDRAW_FULLSCREEN = 0x00000002, 292 ICDRAW_HDC = 0x00000004, 293 ICDRAW_ANIMATE = 0x00000008, 294 ICDRAW_CONTINUE = 0x00000010, 295 ICDRAW_MEMORYDC = 0x00000020, 296 ICDRAW_UPDATING = 0x00000040, 297 ICDRAW_RENDER = 0x00000080, 298 ICDRAW_BUFFER = 0x00000100, 299 } 300 301 struct ICDRAWBEGIN { 302 DWORD dwFlags; 303 HPALETTE hpal; 304 HWND hwnd; 305 HDC hdc; 306 int xDst; 307 int yDst; 308 int dxDst; 309 int dyDst; 310 LPBITMAPINFOHEADER lpbi; 311 int xSrc; 312 int ySrc; 313 int dxSrc; 314 int dySrc; 315 DWORD dwRate; 316 DWORD dwScale; 317 } 318 319 enum { 320 ICDRAW_NOTKEYFRAME = 0x08000000, 321 ICDRAW_NULLFRAME = 0x10000000, 322 ICDRAW_PREROLL = 0x20000000, 323 ICDRAW_UPDATE = 0x40000000, 324 ICDRAW_HURRYUP = 0x80000000, 325 } 326 327 struct ICDRAW { 328 DWORD dwFlags; 329 LPVOID lpFormat; 330 LPVOID lpData; 331 DWORD cbData; 332 LONG lTime; 333 } 334 335 struct ICDRAWSUGGEST { 336 LPBITMAPINFOHEADER lpbiIn; 337 LPBITMAPINFOHEADER lpbiSuggest; 338 int dxSrc; 339 int dySrc; 340 int dxDst; 341 int dyDst; 342 HIC hicDecompressor; 343 } 344 345 struct ICPALETTE { 346 DWORD dwFlags; 347 int iStart; 348 int iLen; 349 LPPALETTEENTRY lppe; 350 } 351 352 353 /** 354 * ICM function declarations 355 */ 356 357 extern (Windows) { 358 BOOL ICInfo(DWORD fccType, DWORD fccHandler, ICINFO *lpicinfo); 359 BOOL ICInstall(DWORD fccType, DWORD fccHandler, LPARAM lParam, LPSTR szDesc, UINT wFlags); 360 BOOL ICRemove(DWORD fccType, DWORD fccHandler, UINT wFlags); 361 LRESULT ICGetInfo(HIC hic, ICINFO *picinfo, DWORD cb); 362 HIC ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode); 363 HIC ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, FARPROC lpfnHandler); 364 LRESULT ICClose(HIC hic); 365 LRESULT ICSendMessage(HIC hic, UINT msg, DWORD_PTR dw1, DWORD_PTR dw2); 366 } 367 368 enum { 369 ICINSTALL_FUNCTION = 0x0001, 370 ICINSTALL_DRIVER = 0x0002, 371 ICINSTALL_HDRV = 0x0004, 372 ICINSTALL_UNICODE = 0x8000, 373 ICINSTALL_DRIVERW = 0x8002, 374 } 375 376 // query macros 377 378 const ICMF_CONFIGURE_QUERY = 0x00000001; 379 const ICMF_ABOUT_QUERY = 0x00000001; 380 381 DWORD ICQueryAbout(HIC hic) { 382 return ICSendMessage(hic, ICM_ABOUT, -1, ICMF_ABOUT_QUERY) == ICERR_OK; 383 } 384 385 DWORD ICAbout(HIC hic, HWND hwnd) { 386 return cast(DWORD) ICSendMessage(hic, ICM_ABOUT, cast(DWORD_PTR) cast(UINT_PTR) hwnd, 0); 387 } 388 389 DWORD ICQueryConfigure(HIC hic) { 390 return (ICSendMessage(hic, ICM_CONFIGURE, -1, ICMF_CONFIGURE_QUERY) == ICERR_OK); 391 } 392 393 DWORD ICConfigure(HIC hic, HWND hwnd) { 394 return cast(DWORD) ICSendMessage(hic, ICM_CONFIGURE, cast(DWORD_PTR) cast(UINT_PTR) hwnd, 0); 395 } 396 397 DWORD ICGetState(HIC hic, LPVOID pv, DWORD_PTR cb) { 398 return cast(DWORD) ICSendMessage(hic, ICM_GETSTATE, cast(DWORD_PTR) pv, cb); 399 } 400 401 DWORD ICSetState(HIC hic, LPVOID pv, DWORD_PTR cb) { 402 return cast(DWORD) ICSendMessage(hic, ICM_SETSTATE, cast(DWORD_PTR) pv, cb); 403 } 404 405 DWORD ICGetStateSize(HIC hic) { 406 return ICGetState(hic, null, 0); 407 } 408 409 DWORD dwICValue; 410 411 DWORD ICGetDefaultQuality(HIC hic) { 412 ICSendMessage(hic, ICM_GETDEFAULTQUALITY, cast(DWORD_PTR)&dwICValue, DWORD.sizeof); 413 return dwICValue; 414 } 415 416 DWORD ICGetDefaultKeyFrameRate(HIC hic) { 417 ICSendMessage(hic, ICM_GETDEFAULTKEYFRAMERATE, cast(DWORD_PTR)&dwICValue, DWORD.sizeof); 418 return dwICValue; 419 } 420 421 DWORD ICDrawWindow(HIC hic, LPVOID prc) { 422 return cast(DWORD) ICSendMessage(hic, ICM_DRAW_WINDOW, cast(DWORD_PTR) prc, RECT.sizeof); 423 } 424 425 extern (Windows) { 426 DWORD ICCompress(HIC hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiOutput, LPVOID lpData, 427 LPBITMAPINFOHEADER lpbiInput, LPVOID lpBits, LPDWORD lpckid, LPDWORD lpdwFlags, 428 LONG lFrameNum, DWORD dwFrameSize, DWORD dwQuality, LPBITMAPINFOHEADER lpbiPrev, LPVOID lpPrev); 429 } 430 431 LRESULT ICCompressBegin(HIC hic, LPVOID lpbiInput, LPVOID lpbiOutput) { 432 return ICSendMessage(hic, ICM_COMPRESS_BEGIN, cast(DWORD_PTR)lpbiInput, cast(DWORD_PTR)lpbiOutput); 433 } 434 LRESULT ICCompressQuery(HIC hic, LPVOID lpbiInput, LPVOID lpbiOutput) { 435 return ICSendMessage(hic, ICM_COMPRESS_QUERY, cast(DWORD_PTR)lpbiInput, cast(DWORD_PTR)lpbiOutput); 436 } 437 LRESULT ICCompressGetFormat(HIC hic, LPVOID lpbiInput, LPVOID lpbiOutput) { 438 return ICSendMessage(hic, ICM_COMPRESS_GET_FORMAT, cast(DWORD_PTR)lpbiInput, cast(DWORD_PTR)lpbiOutput); 439 } 440 DWORD ICCompressGetFormatSize(HIC hic, LPVOID lpbi) { 441 return cast(DWORD)ICCompressGetFormat(hic, lpbi, null); 442 } 443 DWORD ICCompressGetSize(HIC hic, LPVOID lpbiInput, LPVOID lpbiOutput) { 444 return cast(DWORD)ICSendMessage(hic, ICM_COMPRESS_GET_SIZE, cast(DWORD_PTR)lpbiInput, cast(DWORD_PTR)lpbiOutput); 445 } 446 LRESULT ICCompressEnd(HIC hic) { 447 return ICSendMessage(hic, ICM_COMPRESS_END, 0, 0); 448 } 449 450 extern (Windows) { 451 DWORD ICDecompress(HIC hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiFormat, LPVOID lpData, LPBITMAPINFOHEADER lpbi, LPVOID lpBits); 452 } 453 454 LRESULT ICDecompressBegin(HIC hic, LPVOID lpbiInput, LPVOID lpbiOutput) { 455 return ICSendMessage(hic, ICM_DECOMPRESS_BEGIN, cast(DWORD_PTR)lpbiInput, cast(DWORD_PTR)lpbiOutput); 456 } 457 LRESULT ICDecompressQuery(HIC hic, LPVOID lpbiInput, LPVOID lpbiOutput) { 458 return ICSendMessage(hic, ICM_DECOMPRESS_QUERY, cast(DWORD_PTR)lpbiInput, cast(DWORD_PTR)lpbiOutput); 459 } 460 LONG ICDecompressGetFormat(HIC hic, LPVOID lpbiInput, LPVOID lpbiOutput) { 461 return cast(LONG)ICSendMessage(hic, ICM_DECOMPRESS_GET_FORMAT, cast(DWORD_PTR)lpbiInput, cast(DWORD_PTR)lpbiOutput); 462 } 463 LONG ICDecompressGetFormatSize(HIC hic, LPVOID lpbi) { 464 return ICDecompressGetFormat(hic, lpbi, null); 465 } 466 LRESULT ICDecompressGetPalette(HIC hic, LPVOID lpbiInput, LPVOID lpbiOutput) { 467 return ICSendMessage(hic, ICM_DECOMPRESS_GET_PALETTE, cast(DWORD_PTR)lpbiInput, cast(DWORD_PTR)lpbiOutput); 468 } 469 LRESULT ICDecompressSetPalette(HIC hic, LPVOID lpbiPalette) { 470 return ICSendMessage(hic, ICM_DECOMPRESS_SET_PALETTE, cast(DWORD_PTR)lpbiPalette, 0); 471 } 472 LRESULT ICDecompressEnd(HIC hic) { 473 return ICSendMessage(hic, ICM_DECOMPRESS_END, 0, 0); 474 } 475 476 LRESULT ICDecompressEx(HIC hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiSrc, 477 LPVOID lpSrc, int xSrc, int ySrc, int dxSrc, int dySrc, LPBITMAPINFOHEADER lpbiDst, 478 LPVOID lpDst, int xDst, int yDst, int dxDst, int dyDst) { 479 ICDECOMPRESSEX ic; 480 481 ic.dwFlags = dwFlags; 482 ic.lpbiSrc = lpbiSrc; 483 ic.lpSrc = lpSrc; 484 ic.xSrc = xSrc; 485 ic.ySrc = ySrc; 486 ic.dxSrc = dxSrc; 487 ic.dySrc = dySrc; 488 ic.lpbiDst = lpbiDst; 489 ic.lpDst = lpDst; 490 ic.xDst = xDst; 491 ic.yDst = yDst; 492 ic.dxDst = dxDst; 493 ic.dyDst = dyDst; 494 495 return ICSendMessage(hic, ICM_DECOMPRESSEX, cast(DWORD_PTR)&ic, ic.sizeof); 496 } 497 498 LRESULT ICDecompressExBegin(HIC hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiSrc, 499 LPVOID lpSrc, int xSrc, int ySrc, int dxSrc, int dySrc, LPBITMAPINFOHEADER lpbiDst, 500 LPVOID lpDst, int xDst, int yDst, int dxDst, int dyDst) { 501 ICDECOMPRESSEX ic; 502 503 ic.dwFlags = dwFlags; 504 ic.lpbiSrc = lpbiSrc; 505 ic.lpSrc = lpSrc; 506 ic.xSrc = xSrc; 507 ic.ySrc = ySrc; 508 ic.dxSrc = dxSrc; 509 ic.dySrc = dySrc; 510 ic.lpbiDst = lpbiDst; 511 ic.lpDst = lpDst; 512 ic.xDst = xDst; 513 ic.yDst = yDst; 514 ic.dxDst = dxDst; 515 ic.dyDst = dyDst; 516 517 return ICSendMessage(hic, ICM_DECOMPRESSEX_BEGIN, cast(DWORD_PTR)&ic, ic.sizeof); 518 } 519 520 LRESULT ICDecompressExQuery(HIC hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiSrc, 521 LPVOID lpSrc, int xSrc, int ySrc, int dxSrc, int dySrc, LPBITMAPINFOHEADER lpbiDst, 522 LPVOID lpDst, int xDst, int yDst, int dxDst, int dyDst) { 523 ICDECOMPRESSEX ic; 524 525 ic.dwFlags = dwFlags; 526 ic.lpbiSrc = lpbiSrc; 527 ic.lpSrc = lpSrc; 528 ic.xSrc = xSrc; 529 ic.ySrc = ySrc; 530 ic.dxSrc = dxSrc; 531 ic.dySrc = dySrc; 532 ic.lpbiDst = lpbiDst; 533 ic.lpDst = lpDst; 534 ic.xDst = xDst; 535 ic.yDst = yDst; 536 ic.dxDst = dxDst; 537 ic.dyDst = dyDst; 538 539 return ICSendMessage(hic, ICM_DECOMPRESSEX_QUERY, cast(DWORD_PTR)&ic, ic.sizeof); 540 } 541 542 LRESULT ICDecompressExEnd(HIC hic) { 543 return ICSendMessage(hic, ICM_DECOMPRESSEX_END, 0, 0); 544 } 545 546 extern (Windows) { 547 DWORD ICDrawBegin(HIC hic, DWORD dwFlags, HPALETTE hpal, HWND hwnd, HDC hdc, 548 int xDst, int yDst, int dxDst, int dyDst, LPBITMAPINFOHEADER lpbi, 549 int xSrc, int ySrc, int dxSrc, int dySrc, DWORD dwRate, DWORD dwScale); 550 } 551 552 extern (Windows) { 553 DWORD ICDraw(HIC hic, DWORD dwFlags, LPVOID lpFormat, LPVOID lpData, DWORD cbData, LONG lTime); 554 } 555 556 LRESULT ICDrawSuggestFormat(HIC hic, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, 557 int dxSrc, int dySrc, int dxDst, int dyDst, HIC hicDecomp) { 558 ICDRAWSUGGEST ic; 559 560 ic.lpbiIn = lpbiIn; 561 ic.lpbiSuggest = lpbiOut; 562 ic.dxSrc = dxSrc; 563 ic.dySrc = dySrc; 564 ic.dxDst = dxDst; 565 ic.dyDst = dyDst; 566 ic.hicDecompressor = hicDecomp; 567 568 return ICSendMessage(hic, ICM_DRAW_SUGGESTFORMAT, cast(DWORD_PTR)&ic, ic.sizeof); 569 } 570 571 LRESULT ICDrawQuery(HIC hic, LPVOID lpbiInput) { 572 return ICSendMessage(hic, ICM_DRAW_QUERY, cast(DWORD_PTR)lpbiInput, 0L); 573 } 574 LRESULT ICDrawChangePalette(HIC hic, LPVOID lpbiInput) { 575 return ICSendMessage(hic, ICM_DRAW_CHANGEPALETTE, cast(DWORD_PTR)lpbiInput, 0L); 576 } 577 LRESULT ICGetBuffersWanted(HIC hic, LPVOID lpdwBuffers) { 578 return ICSendMessage(hic, ICM_GETBUFFERSWANTED, cast(DWORD_PTR)lpdwBuffers, 0); 579 } 580 LRESULT ICDrawEnd(HIC hic) { 581 return ICSendMessage(hic, ICM_DRAW_END, 0, 0); 582 } 583 LRESULT ICDrawStart(HIC hic) { 584 return ICSendMessage(hic, ICM_DRAW_START, 0, 0); 585 } 586 LRESULT ICDrawStartPlay(HIC hic, DWORD lFrom, DWORD lTo) { 587 return ICSendMessage(hic, ICM_DRAW_START_PLAY, cast(DWORD_PTR)lFrom, cast(DWORD_PTR)lTo); 588 } 589 LRESULT ICDrawStop(HIC hic) { 590 return ICSendMessage(hic, ICM_DRAW_STOP, 0, 0); 591 } 592 LRESULT ICDrawStopPlay(HIC hic) { 593 return ICSendMessage(hic, ICM_DRAW_STOP_PLAY, 0, 0); 594 } 595 LRESULT ICDrawGetTime(HIC hic, LPVOID lplTime) { 596 return ICSendMessage(hic, ICM_DRAW_GETTIME, cast(DWORD_PTR)lplTime, 0); 597 } 598 LRESULT ICDrawSetTime(HIC hic, DWORD lTime) { 599 return ICSendMessage(hic, ICM_DRAW_SETTIME, cast(DWORD_PTR)lTime, 0); 600 } 601 LRESULT ICDrawRealize(HIC hic, HDC hdc, BOOL fBackground) { 602 return ICSendMessage(hic, ICM_DRAW_REALIZE, cast(DWORD_PTR)hdc, cast(DWORD_PTR)fBackground); 603 } 604 LRESULT ICDrawFlush(HIC hic) { 605 return ICSendMessage(hic, ICM_DRAW_FLUSH, 0, 0); 606 } 607 LRESULT ICDrawRenderBuffer(HIC hic) { 608 return ICSendMessage(hic, ICM_DRAW_RENDERBUFFER, 0, 0); 609 } 610 611 LRESULT ICSetStatusProc(HIC hic, DWORD dwFlags, LRESULT lParam, LONG function(LPARAM, UINT, LONG) fpfnStatus) { 612 ICSETSTATUSPROC ic; 613 614 ic.dwFlags = dwFlags; 615 ic.lParam = lParam; 616 ic.Status = fpfnStatus; 617 618 return ICSendMessage(hic, ICM_SET_STATUS_PROC, cast(DWORD_PTR)&ic, ic.sizeof); 619 } 620 621 HIC ICDecompressOpen(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut) { 622 return ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, ICMODE_DECOMPRESS); 623 } 624 625 HIC ICDrawOpen(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn) { 626 return ICLocate(fccType, fccHandler, lpbiIn, null, ICMODE_DRAW); 627 } 628 629 extern (Windows) { 630 HIC ICLocate(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wFlags); 631 HIC ICGetDisplayFormat(HIC hic, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, int BitDepth, int dx, int dy); 632 HANDLE ICImageCompress(HIC hic, UINT uiFlags, LPBITMAPINFO lpbiIn, LPVOID lpBits, LPBITMAPINFO lpbiOut, LONG lQuality, LONG* plSize); 633 HANDLE ICImageDecompress(HIC hic, UINT uiFlags, LPBITMAPINFO lpbiIn, LPVOID lpBits, LPBITMAPINFO lpbiOut); 634 } 635 636 struct COMPVARS { 637 LONG cbSize = this.sizeof; 638 DWORD dwFlags; 639 HIC hic; 640 DWORD fccType; 641 DWORD fccHandler; 642 LPBITMAPINFO lpbiIn; 643 LPBITMAPINFO lpbiOut; 644 LPVOID lpBitsOut; 645 LPVOID lpBitsPrev; 646 LONG lFrame; 647 LONG lKey; 648 LONG lDataRate; 649 LONG lQ; 650 LONG lKeyCount; 651 LPVOID lpState; 652 LONG cbState; 653 } 654 alias COMPVARS* PCOMPVARS; 655 656 const ICMF_COMPVARS_VALID = 0x00000001; 657 658 extern (Windows) { 659 BOOL ICCompressorChoose(HWND hwnd, UINT uiFlags, LPVOID pvIn, LPVOID lpData, PCOMPVARS pc, LPSTR lpszTitle); 660 } 661 662 enum { 663 ICMF_CHOOSE_KEYFRAME = 0x0001, 664 ICMF_CHOOSE_DATARATE = 0x0002, 665 ICMF_CHOOSE_PREVIEW = 0x0004, 666 ICMF_CHOOSE_ALLCOMPRESSORS = 0x0008, 667 } 668 669 extern (Windows) { 670 BOOL ICSeqCompressFrameStart(PCOMPVARS pc, LPBITMAPINFO lpbiIn); 671 void ICSeqCompressFrameEnd(PCOMPVARS pc); 672 LPVOID ICSeqCompressFrame(PCOMPVARS pc, UINT uiFlags, LPVOID lpBits, BOOL* pfKey, LONG* plSize); 673 void ICCompressorFree(PCOMPVARS pc); 674 } 675 676 mixin DECLARE_HANDLE!("HDRAWDIB"); 677 678 enum { 679 DDF_0001 = 0x0001, 680 DDF_UPDATE = 0x0002, 681 DDF_SAME_HDC = 0x0004, 682 DDF_SAME_DRAW = 0x0008, 683 DDF_DONTDRAW = 0x0010, 684 DDF_ANIMATE = 0x0020, 685 DDF_BUFFER = 0x0040, 686 DDF_JUSTDRAWIT = 0x0080, 687 DDF_FULLSCREEN = 0x0100, 688 DDF_BACKGROUNDPAL = 0x0200, 689 DDF_NOTKEYFRAME = 0x0400, 690 DDF_HURRYUP = 0x0800, 691 DDF_HALFTONE = 0x1000, 692 DDF_2000 = 0x2000, 693 DDF_PREROLL = DDF_DONTDRAW, 694 DDF_SAME_DIB = DDF_SAME_DRAW, 695 DDF_SAME_SIZE = DDF_SAME_DRAW, 696 } 697 698 extern (Windows) { 699 BOOL DrawDibInit(); 700 HDRAWDIB DrawDibOpen(); 701 BOOL DrawDibClose(HDRAWDIB hdd); 702 LPVOID DrawDibGetBuffer(HDRAWDIB hdd, LPBITMAPINFOHEADER lpbi, DWORD dwSize, DWORD dwFlags); 703 UINT DrawDibError(HDRAWDIB hdd); 704 HPALETTE DrawDibGetPalette(HDRAWDIB hdd); 705 BOOL DrawDibSetPalette(HDRAWDIB hdd, HPALETTE hpal); 706 BOOL DrawDibChangePalette(HDRAWDIB hdd, int iStart, int iLen, LPPALETTEENTRY lppe); 707 UINT DrawDibRealize(HDRAWDIB hdd, HDC hdc, BOOL fBackground); 708 BOOL DrawDibStart(HDRAWDIB hdd, DWORD rate); 709 BOOL DrawDibStop(HDRAWDIB hdd); 710 BOOL DrawDibBegin(HDRAWDIB hdd, HDC hdc, int dxDst, int dyDst, LPBITMAPINFOHEADER lpbi, int dxSrc, int dySrc, UINT wFlags); 711 BOOL DrawDibDraw(HDRAWDIB hdd, HDC hdc, int xDst, int yDst, int dxDst, int dyDst, LPBITMAPINFOHEADER lpbi, 712 LPVOID lpBits, int xSrc, int ySrc, int dxSrc, int dySrc, UINT wFlags); 713 } 714 715 BOOL DrawDibUpdate(HDRAWDIB hdd, HDC hdc, int x, int y) { 716 return DrawDibDraw(hdd, hdc, x, y, 0, 0, null, null, 0, 0, 0, 0, DDF_UPDATE); 717 } 718 719 extern (Windows) { 720 BOOL DrawDibEnd(HDRAWDIB hdd); 721 } 722 723 struct DRAWDIBTIME { 724 LONG timeCount; 725 LONG timeDraw; 726 LONG timeDecompress; 727 LONG timeDither; 728 LONG timeStretch; 729 LONG timeBlt; 730 LONG timeSetDIBits; 731 } 732 alias DRAWDIBTIME* LPDRAWDIBTIME; 733 734 extern (Windows) { 735 BOOL DrawDibTime(HDRAWDIB hdd, LPDRAWDIBTIME lpddtime); 736 } 737 738 enum { 739 PD_CAN_DRAW_DIB = 0x0001, 740 PD_CAN_STRETCHDIB = 0x0002, 741 PD_STRETCHDIB_1_1_OK = 0x0004, 742 PD_STRETCHDIB_1_2_OK = 0x0008, 743 PD_STRETCHDIB_1_N_OK = 0x0010, 744 } 745 746 extern (Windows) { 747 LRESULT DrawDibProfileDisplay(LPBITMAPINFOHEADER lpbi); 748 void StretchDIB(LPBITMAPINFOHEADER biDst, LPVOID lpDst, int DstX, int DstY, 749 int DstXE, int DstYE, LPBITMAPINFOHEADER biSrc, LPVOID lpSrc, 750 int SrcX, int SrcY, int SrcXE, int SrcYE); 751 } 752 753 alias DWORD FOURCC; 754 755 alias WORD TWOCC; 756 757 const formtypeAVI = mmioFOURCC!('A', 'V', 'I', ' '); 758 const listtypeAVIHEADER = mmioFOURCC!('h', 'd', 'r', 'l'); 759 const ckidAVIMAINHDR = mmioFOURCC!('a', 'v', 'i', 'h'); 760 const listtypeSTREAMHEADER = mmioFOURCC!('s', 't', 'r', 'l'); 761 const ckidSTREAMHEADER = mmioFOURCC!('s', 't', 'r', 'h'); 762 const ckidSTREAMFORMAT = mmioFOURCC!('s', 't', 'r', 'f'); 763 const ckidSTREAMHANDLERDATA = mmioFOURCC!('s', 't', 'r', 'd'); 764 const ckidSTREAMNAME = mmioFOURCC!('s', 't', 'r', 'n'); 765 const listtypeAVIMOVIE = mmioFOURCC!('m', 'o', 'v', 'i'); 766 const listtypeAVIRECORD = mmioFOURCC!('r', 'e', 'c', ' '); 767 const ckidAVINEWINDEX = mmioFOURCC!('i', 'd', 'x', '1'); 768 const streamtypeVIDEO = mmioFOURCC!('v', 'i', 'd', 's'); 769 const streamtypeAUDIO = mmioFOURCC!('a', 'u', 'd', 's'); 770 const streamtypeMIDI = mmioFOURCC!('m', 'i', 'd', 's'); 771 const streamtypeTEXT = mmioFOURCC!('t', 'x', 't', 's'); 772 773 const cktypeDIBbits = aviTWOCC!('d', 'b'); 774 const cktypeDIBcompressed = aviTWOCC!('d', 'c'); 775 const cktypePALchange = aviTWOCC!('p', 'c'); 776 const cktypeWAVEbytes = aviTWOCC!('w', 'b'); 777 778 const ckidAVIPADDING = mmioFOURCC!('J', 'U', 'N', 'K'); 779 780 DWORD FromHex(char n) { 781 return (n >= 'A') ? n + 10 - 'A' : n - '0'; 782 } 783 784 WORD StreamFromFOURCC(DWORD fcc) { 785 return cast(WORD)((FromHex(LOBYTE(LOWORD(fcc))) << 4) + (FromHex(HIBYTE(LOWORD(fcc))))); 786 } 787 788 WORD TWOCCFromFOURCC(DWORD fcc) { 789 return HIWORD(fcc); 790 } 791 792 BYTE ToHex(DWORD n) { 793 return cast(BYTE)((n > 9) ? n - 10 + 'A' : n + '0'); 794 } 795 796 DWORD MAKEAVICKID(WORD tcc, WORD stream) { 797 return MAKELONG(cast(WORD)((ToHex(stream & 0x0f) << 8) | (ToHex((stream & 0xf0) >> 4))), tcc); 798 } 799 800 enum { 801 AVIF_HASINDEX = 0x00000010, 802 AVIF_MUSTUSEINDEX = 0x00000020, 803 AVIF_ISINTERLEAVED = 0x00000100, 804 AVIF_WASCAPTUREFILE = 0x00010000, 805 AVIF_COPYRIGHTED = 0x00020000, 806 } 807 808 const AVI_HEADERSIZE = 2048; 809 810 struct MainAVIHeader { 811 DWORD dwMicroSecPerFrame; 812 DWORD dwMaxBytesPerSec; 813 DWORD dwPaddingGranularity; 814 DWORD dwFlags; 815 DWORD dwTotalFrames; 816 DWORD dwInitialFrames; 817 DWORD dwStreams; 818 DWORD dwSuggestedBufferSize; 819 DWORD dwWidth; 820 DWORD dwHeight; 821 DWORD[4] dwReserved; 822 } 823 824 const AVISF_DISABLED = 0x00000001; 825 826 const AVISF_VIDEO_PALCHANGES = 0x00010000; 827 828 struct AVIStreamHeader { 829 FOURCC fccType; 830 FOURCC fccHandler; 831 DWORD dwFlags; 832 WORD wPriority; 833 WORD wLanguage; 834 DWORD dwInitialFrames; 835 DWORD dwScale; 836 DWORD dwRate; 837 DWORD dwStart; 838 DWORD dwLength; 839 DWORD dwSuggestedBufferSize; 840 DWORD dwQuality; 841 DWORD dwSampleSize; 842 RECT rcFrame; 843 } 844 845 enum { 846 AVIIF_FIRSTPART = 0x00000020L, 847 AVIIF_LASTPART = 0x00000040L, 848 AVIIF_MIDPART = (AVIIF_LASTPART|AVIIF_FIRSTPART), 849 AVIIF_NOTIME = 0x00000100L, 850 AVIIF_COMPUSE = 0x0FFF0000L, 851 } 852 853 struct AVIINDEXENTRY { 854 DWORD ckid; 855 DWORD dwFlags; 856 DWORD dwChunkOffset; 857 DWORD dwChunkLength; 858 } 859 860 struct AVIPALCHANGE { 861 BYTE bFirstEntry; 862 BYTE bNumEntries; 863 WORD wFlags; 864 PALETTEENTRY[1] _peNew; 865 PALETTEENTRY* peNew() { return _peNew.ptr; } 866 } 867 868 const AVIGETFRAMEF_BESTDISPLAYFMT = 1; 869 870 struct AVISTREAMINFOW { 871 DWORD fccType; 872 DWORD fccHandler; 873 DWORD dwFlags; 874 DWORD dwCaps; 875 WORD wPriority; 876 WORD wLanguage; 877 DWORD dwScale; 878 DWORD dwRate; 879 DWORD dwStart; 880 DWORD dwLength; 881 DWORD dwInitialFrames; 882 DWORD dwSuggestedBufferSize; 883 DWORD dwQuality; 884 DWORD dwSampleSize; 885 RECT rcFrame; 886 DWORD dwEditCount; 887 DWORD dwFormatChangeCount; 888 WCHAR[64] szName; 889 } 890 alias AVISTREAMINFOW* LPAVISTREAMINFOW; 891 892 struct AVISTREAMINFOA { 893 DWORD fccType; 894 DWORD fccHandler; 895 DWORD dwFlags; 896 DWORD dwCaps; 897 WORD wPriority; 898 WORD wLanguage; 899 DWORD dwScale; 900 DWORD dwRate; 901 DWORD dwStart; 902 DWORD dwLength; 903 DWORD dwInitialFrames; 904 DWORD dwSuggestedBufferSize; 905 DWORD dwQuality; 906 DWORD dwSampleSize; 907 RECT rcFrame; 908 DWORD dwEditCount; 909 DWORD dwFormatChangeCount; 910 char[64] szName; 911 } 912 alias AVISTREAMINFOA* LPAVISTREAMINFOA; 913 914 version(Unicode) { 915 alias AVISTREAMINFOW AVISTREAMINFO; 916 alias LPAVISTREAMINFOW LPAVISTREAMINFO; 917 } else { // Unicode 918 alias AVISTREAMINFOA AVISTREAMINFO; 919 alias LPAVISTREAMINFOA LPAVISTREAMINFO; 920 } 921 922 const AVISTREAMINFO_DISABLED = 0x00000001; 923 const AVISTREAMINFO_FORMATCHANGES = 0x00010000; 924 925 struct AVIFILEINFOW { 926 DWORD dwMaxBytesPerSec; 927 DWORD dwFlags; 928 DWORD dwCaps; 929 DWORD dwStreams; 930 DWORD dwSuggestedBufferSize; 931 DWORD dwWidth; 932 DWORD dwHeight; 933 DWORD dwScale; 934 DWORD dwRate; 935 DWORD dwLength; 936 DWORD dwEditCount; 937 WCHAR[64] szFileType; 938 } 939 alias AVIFILEINFOW* LPAVIFILEINFOW; 940 941 struct AVIFILEINFOA { 942 DWORD dwMaxBytesPerSec; 943 DWORD dwFlags; 944 DWORD dwCaps; 945 DWORD dwStreams; 946 DWORD dwSuggestedBufferSize; 947 DWORD dwWidth; 948 DWORD dwHeight; 949 DWORD dwScale; 950 DWORD dwRate; 951 DWORD dwLength; 952 DWORD dwEditCount; 953 char[64] szFileType; 954 } 955 alias AVIFILEINFOA* LPAVIFILEINFOA; 956 957 version(Unicode) { 958 alias AVIFILEINFOW AVIFILEINFO; 959 alias LPAVIFILEINFOW LPAVIFILEINFO; 960 } else { // Unicode 961 alias AVIFILEINFOA AVIFILEINFO; 962 alias LPAVIFILEINFOA LPAVIFILEINFO; 963 } 964 965 enum { 966 AVIFILEINFO_HASINDEX = 0x00000010, 967 AVIFILEINFO_MUSTUSEINDEX = 0x00000020, 968 AVIFILEINFO_ISINTERLEAVED = 0x00000100, 969 AVIFILEINFO_WASCAPTUREFILE = 0x00010000, 970 AVIFILEINFO_COPYRIGHTED = 0x00020000, 971 } 972 973 enum { 974 AVIFILECAPS_CANREAD = 0x00000001, 975 AVIFILECAPS_CANWRITE = 0x00000002, 976 AVIFILECAPS_ALLKEYFRAMES = 0x00000010, 977 AVIFILECAPS_NOCOMPRESSION = 0x00000020, 978 } 979 980 extern (Windows) { 981 alias BOOL function(int) AVISAVECALLBACK; 982 } 983 984 struct AVICOMPRESSOPTIONS { 985 DWORD fccType; 986 DWORD fccHandler; 987 DWORD dwKeyFrameEvery; 988 DWORD dwQuality; 989 DWORD dwBytesPerSecond; 990 DWORD dwFlags; 991 LPVOID lpFormat; 992 DWORD cbFormat; 993 LPVOID lpParms; 994 DWORD cbParms; 995 DWORD dwInterleaveEvery; 996 } 997 alias AVICOMPRESSOPTIONS* LPAVICOMPRESSOPTIONS; 998 999 enum { 1000 AVICOMPRESSF_INTERLEAVE = 0x00000001, 1001 AVICOMPRESSF_DATARATE = 0x00000002, 1002 AVICOMPRESSF_KEYFRAMES = 0x00000004, 1003 AVICOMPRESSF_VALID = 0x00000008, 1004 } 1005 1006 /+ TODO: 1007 DECLARE_INTERFACE_(IAVIStream, IUnknown) 1008 { 1009 STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE; 1010 STDMETHOD_(ULONG,AddRef) (THIS) PURE; 1011 STDMETHOD_(ULONG,Release) (THIS) PURE; 1012 1013 STDMETHOD(Create) (THIS_ LPARAM lParam1, LPARAM lParam2) PURE ; 1014 STDMETHOD(Info) (THIS_ AVISTREAMINFOW FAR * psi, LONG lSize) PURE ; 1015 STDMETHOD_(LONG, FindSample)(THIS_ LONG lPos, LONG lFlags) PURE ; 1016 STDMETHOD(ReadFormat) (THIS_ LONG lPos, 1017 LPVOID lpFormat, LONG FAR *lpcbFormat) PURE ; 1018 STDMETHOD(SetFormat) (THIS_ LONG lPos, 1019 LPVOID lpFormat, LONG cbFormat) PURE ; 1020 STDMETHOD(Read) (THIS_ LONG lStart, LONG lSamples, 1021 LPVOID lpBuffer, LONG cbBuffer, 1022 LONG FAR * plBytes, LONG FAR * plSamples) PURE ; 1023 STDMETHOD(Write) (THIS_ LONG lStart, LONG lSamples, 1024 LPVOID lpBuffer, LONG cbBuffer, 1025 DWORD dwFlags, 1026 LONG FAR *plSampWritten, 1027 LONG FAR *plBytesWritten) PURE ; 1028 STDMETHOD(Delete) (THIS_ LONG lStart, LONG lSamples) PURE; 1029 STDMETHOD(ReadData) (THIS_ DWORD fcc, LPVOID lp, LONG FAR *lpcb) PURE ; 1030 STDMETHOD(WriteData) (THIS_ DWORD fcc, LPVOID lp, LONG cb) PURE ; 1031 #ifdef _WIN32 1032 STDMETHOD(SetInfo) (THIS_ AVISTREAMINFOW FAR * lpInfo, 1033 LONG cbInfo) PURE; 1034 #else 1035 STDMETHOD(Reserved1) (THIS) PURE; 1036 STDMETHOD(Reserved2) (THIS) PURE; 1037 STDMETHOD(Reserved3) (THIS) PURE; 1038 STDMETHOD(Reserved4) (THIS) PURE; 1039 STDMETHOD(Reserved5) (THIS) PURE; 1040 #endif 1041 }; 1042 1043 alias TypeDef!(IAVIStream FAR*) PAVISTREAM; 1044 1045 #undef INTERFACE 1046 #define INTERFACE IAVIStreaming 1047 1048 DECLARE_INTERFACE_(IAVIStreaming, IUnknown) 1049 { 1050 STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE; 1051 STDMETHOD_(ULONG,AddRef) (THIS) PURE; 1052 STDMETHOD_(ULONG,Release) (THIS) PURE; 1053 1054 STDMETHOD(Begin) (THIS_ 1055 LONG lStart, 1056 LONG lEnd, 1057 LONG lRate) PURE; 1058 STDMETHOD(End) (THIS) PURE; 1059 }; 1060 1061 alias TypeDef!(IAVIStreaming FAR*) PAVISTREAMING; 1062 1063 1064 #undef INTERFACE 1065 #define INTERFACE IAVIEditStream 1066 1067 DECLARE_INTERFACE_(IAVIEditStream, IUnknown) 1068 { 1069 STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE; 1070 STDMETHOD_(ULONG,AddRef) (THIS) PURE; 1071 STDMETHOD_(ULONG,Release) (THIS) PURE; 1072 1073 STDMETHOD(Cut) (THIS_ LONG FAR *plStart, 1074 LONG FAR *plLength, 1075 PAVISTREAM FAR * ppResult) PURE; 1076 STDMETHOD(Copy) (THIS_ LONG FAR *plStart, 1077 LONG FAR *plLength, 1078 PAVISTREAM FAR * ppResult) PURE; 1079 STDMETHOD(Paste) (THIS_ LONG FAR *plPos, 1080 LONG FAR *plLength, 1081 PAVISTREAM pstream, 1082 LONG lStart, 1083 LONG lEnd) PURE; 1084 STDMETHOD(Clone) (THIS_ PAVISTREAM FAR *ppResult) PURE; 1085 STDMETHOD(SetInfo) (THIS_ AVISTREAMINFOW FAR * lpInfo, 1086 LONG cbInfo) PURE; 1087 }; 1088 1089 alias TypeDef!(IAVIEditStream FAR*) PAVIEDITSTREAM; 1090 1091 #undef INTERFACE 1092 #define INTERFACE IAVIPersistFile 1093 1094 DECLARE_INTERFACE_(IAVIPersistFile, IPersistFile) 1095 { 1096 STDMETHOD(Reserved1)(THIS) PURE; 1097 }; 1098 1099 alias TypeDef!(IAVIPersistFile FAR*) PAVIPERSISTFILE; 1100 1101 #undef INTERFACE 1102 #define INTERFACE IAVIFile 1103 #define PAVIFILE IAVIFile FAR* 1104 1105 DECLARE_INTERFACE_(IAVIFile, IUnknown) 1106 { 1107 STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE; 1108 STDMETHOD_(ULONG,AddRef) (THIS) PURE; 1109 STDMETHOD_(ULONG,Release) (THIS) PURE; 1110 1111 STDMETHOD(Info) (THIS_ 1112 AVIFILEINFOW FAR * pfi, 1113 LONG lSize) PURE; 1114 STDMETHOD(GetStream) (THIS_ 1115 PAVISTREAM FAR * ppStream, 1116 DWORD fccType, 1117 LONG lParam) PURE; 1118 STDMETHOD(CreateStream) (THIS_ 1119 PAVISTREAM FAR * ppStream, 1120 AVISTREAMINFOW FAR * psi) PURE; 1121 STDMETHOD(WriteData) (THIS_ 1122 DWORD ckid, 1123 LPVOID lpData, 1124 LONG cbData) PURE; 1125 STDMETHOD(ReadData) (THIS_ 1126 DWORD ckid, 1127 LPVOID lpData, 1128 LONG FAR *lpcbData) PURE; 1129 STDMETHOD(EndRecord) (THIS) PURE; 1130 STDMETHOD(DeleteStream) (THIS_ 1131 DWORD fccType, 1132 LONG lParam) PURE; 1133 }; 1134 1135 #undef PAVIFILE 1136 alias TypeDef!(IAVIFile FAR*) PAVIFILE; 1137 1138 #undef INTERFACE 1139 #define INTERFACE IGetFrame 1140 #define PGETFRAME IGetFrame FAR* 1141 1142 DECLARE_INTERFACE_(IGetFrame, IUnknown) 1143 { 1144 STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE; 1145 STDMETHOD_(ULONG,AddRef) (THIS) PURE; 1146 STDMETHOD_(ULONG,Release) (THIS) PURE; 1147 1148 STDMETHOD_(LPVOID,GetFrame) (THIS_ LONG lPos) PURE; 1149 1150 STDMETHOD(Begin) (THIS_ LONG lStart, LONG lEnd, LONG lRate) PURE; 1151 STDMETHOD(End) (THIS) PURE; 1152 1153 STDMETHOD(SetFormat) (THIS_ LPBITMAPINFOHEADER lpbi, LPVOID lpBits, int x, int y, int dx, int dy) PURE; 1154 }; 1155 1156 #undef PGETFRAME 1157 alias TypeDef!(IGetFrame FAR*) PGETFRAME; 1158 1159 #define DEFINE_AVIGUID(name, l, w1, w2) DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46) 1160 1161 DEFINE_AVIGUID(IID_IAVIFile, 0x00020020, 0, 0); 1162 DEFINE_AVIGUID(IID_IAVIStream, 0x00020021, 0, 0); 1163 DEFINE_AVIGUID(IID_IAVIStreaming, 0x00020022, 0, 0); 1164 DEFINE_AVIGUID(IID_IGetFrame, 0x00020023, 0, 0); 1165 DEFINE_AVIGUID(IID_IAVIEditStream, 0x00020024, 0, 0); 1166 DEFINE_AVIGUID(IID_IAVIPersistFile, 0x00020025, 0, 0); 1167 #ifndef UNICODE 1168 DEFINE_AVIGUID(CLSID_AVISimpleUnMarshal, 0x00020009, 0, 0); 1169 #endif 1170 1171 DEFINE_AVIGUID(CLSID_AVIFile, 0x00020000, 0, 0); 1172 1173 #define AVIFILEHANDLER_CANREAD 0x0001 1174 #define AVIFILEHANDLER_CANWRITE 0x0002 1175 #define AVIFILEHANDLER_CANACCEPTNONRGB 0x0004 1176 1177 STDAPI_(void) AVIFileInit(void); 1178 STDAPI_(void) AVIFileExit(void); 1179 1180 STDAPI_(ULONG) AVIFileAddRef (PAVIFILE pfile); 1181 STDAPI_(ULONG) AVIFileRelease (PAVIFILE pfile); 1182 1183 #ifdef _WIN32 1184 STDAPI AVIFileOpenA (PAVIFILE FAR * ppfile, LPCSTR szFile, 1185 UINT uMode, LPCLSID lpHandler); 1186 STDAPI AVIFileOpenW (PAVIFILE FAR * ppfile, LPCWSTR szFile, 1187 UINT uMode, LPCLSID lpHandler); 1188 #ifdef UNICODE 1189 #define AVIFileOpen AVIFileOpenW 1190 #else 1191 #define AVIFileOpen AVIFileOpenA 1192 #endif 1193 #else 1194 STDAPI AVIFileOpen (PAVIFILE FAR * ppfile, LPCSTR szFile, 1195 UINT uMode, LPCLSID lpHandler); 1196 #define AVIFileOpenW AVIFileOpen 1197 #endif 1198 1199 #ifdef _WIN32 1200 STDAPI AVIFileInfoW (PAVIFILE pfile, LPAVIFILEINFOW pfi, LONG lSize); 1201 STDAPI AVIFileInfoA (PAVIFILE pfile, LPAVIFILEINFOA pfi, LONG lSize); 1202 #ifdef UNICODE 1203 #define AVIFileInfo AVIFileInfoW 1204 #else 1205 #define AVIFileInfo AVIFileInfoA 1206 #endif 1207 #else 1208 STDAPI AVIFileInfo (PAVIFILE pfile, LPAVIFILEINFO pfi, LONG lSize); 1209 #define AVIFileInfoW AVIFileInfo 1210 #endif 1211 1212 1213 STDAPI AVIFileGetStream (PAVIFILE pfile, PAVISTREAM FAR * ppavi, DWORD fccType, LONG lParam); 1214 1215 1216 #ifdef _WIN32 1217 STDAPI AVIFileCreateStreamW (PAVIFILE pfile, PAVISTREAM FAR *ppavi, AVISTREAMINFOW FAR * psi); 1218 STDAPI AVIFileCreateStreamA (PAVIFILE pfile, PAVISTREAM FAR *ppavi, AVISTREAMINFOA FAR * psi); 1219 #ifdef UNICODE 1220 #define AVIFileCreateStream AVIFileCreateStreamW 1221 #else 1222 #define AVIFileCreateStream AVIFileCreateStreamA 1223 #endif 1224 #else 1225 STDAPI AVIFileCreateStream(PAVIFILE pfile, PAVISTREAM FAR *ppavi, AVISTREAMINFO FAR * psi); 1226 #define AVIFileCreateStreamW AVIFileCreateStream 1227 #endif 1228 1229 STDAPI AVIFileWriteData (PAVIFILE pfile, 1230 DWORD ckid, 1231 LPVOID lpData, 1232 LONG cbData); 1233 STDAPI AVIFileReadData (PAVIFILE pfile, 1234 DWORD ckid, 1235 LPVOID lpData, 1236 LONG FAR *lpcbData); 1237 STDAPI AVIFileEndRecord (PAVIFILE pfile); 1238 1239 STDAPI_(ULONG) AVIStreamAddRef (PAVISTREAM pavi); 1240 STDAPI_(ULONG) AVIStreamRelease (PAVISTREAM pavi); 1241 1242 STDAPI AVIStreamInfoW (PAVISTREAM pavi, LPAVISTREAMINFOW psi, LONG lSize); 1243 STDAPI AVIStreamInfoA (PAVISTREAM pavi, LPAVISTREAMINFOA psi, LONG lSize); 1244 #ifdef UNICODE 1245 #define AVIStreamInfo AVIStreamInfoW 1246 #else 1247 #define AVIStreamInfo AVIStreamInfoA 1248 #endif 1249 1250 STDAPI_(LONG) AVIStreamFindSample(PAVISTREAM pavi, LONG lPos, LONG lFlags); 1251 STDAPI AVIStreamReadFormat (PAVISTREAM pavi, LONG lPos,LPVOID lpFormat,LONG FAR *lpcbFormat); 1252 STDAPI AVIStreamSetFormat (PAVISTREAM pavi, LONG lPos,LPVOID lpFormat,LONG cbFormat); 1253 STDAPI AVIStreamReadData (PAVISTREAM pavi, DWORD fcc, LPVOID lp, LONG FAR *lpcb); 1254 STDAPI AVIStreamWriteData (PAVISTREAM pavi, DWORD fcc, LPVOID lp, LONG cb); 1255 1256 STDAPI AVIStreamRead (PAVISTREAM pavi, 1257 LONG lStart, 1258 LONG lSamples, 1259 LPVOID lpBuffer, 1260 LONG cbBuffer, 1261 LONG FAR * plBytes, 1262 LONG FAR * plSamples); 1263 #define AVISTREAMREAD_CONVENIENT (-1L) 1264 1265 STDAPI AVIStreamWrite (PAVISTREAM pavi, 1266 LONG lStart, LONG lSamples, 1267 LPVOID lpBuffer, LONG cbBuffer, DWORD dwFlags, 1268 LONG FAR *plSampWritten, 1269 LONG FAR *plBytesWritten); 1270 1271 STDAPI_(LONG) AVIStreamStart (PAVISTREAM pavi); 1272 STDAPI_(LONG) AVIStreamLength (PAVISTREAM pavi); 1273 STDAPI_(LONG) AVIStreamTimeToSample (PAVISTREAM pavi, LONG lTime); 1274 STDAPI_(LONG) AVIStreamSampleToTime (PAVISTREAM pavi, LONG lSample); 1275 1276 1277 STDAPI AVIStreamBeginStreaming(PAVISTREAM pavi, LONG lStart, LONG lEnd, LONG lRate); 1278 STDAPI AVIStreamEndStreaming(PAVISTREAM pavi); 1279 1280 STDAPI_(PGETFRAME) AVIStreamGetFrameOpen(PAVISTREAM pavi, 1281 LPBITMAPINFOHEADER lpbiWanted); 1282 STDAPI_(LPVOID) AVIStreamGetFrame(PGETFRAME pg, LONG lPos); 1283 STDAPI AVIStreamGetFrameClose(PGETFRAME pg); 1284 1285 STDAPI AVIStreamOpenFromFileA(PAVISTREAM FAR *ppavi, LPCSTR szFile, 1286 DWORD fccType, LONG lParam, 1287 UINT mode, CLSID FAR *pclsidHandler); 1288 STDAPI AVIStreamOpenFromFileW(PAVISTREAM FAR *ppavi, LPCWSTR szFile, 1289 DWORD fccType, LONG lParam, 1290 UINT mode, CLSID FAR *pclsidHandler); 1291 #ifdef UNICODE 1292 #define AVIStreamOpenFromFile AVIStreamOpenFromFileW 1293 #else 1294 #define AVIStreamOpenFromFile AVIStreamOpenFromFileA 1295 #endif 1296 1297 STDAPI AVIStreamCreate(PAVISTREAM FAR *ppavi, LONG lParam1, LONG lParam2, 1298 CLSID FAR *pclsidHandler); 1299 1300 1301 1302 #define FIND_DIR 0x0000000FL 1303 #define FIND_NEXT 0x00000001L 1304 #define FIND_PREV 0x00000004L 1305 #define FIND_FROM_START 0x00000008L 1306 1307 #define FIND_TYPE 0x000000F0L 1308 #define FIND_KEY 0x00000010L 1309 #define FIND_ANY 0x00000020L 1310 #define FIND_FORMAT 0x00000040L 1311 1312 #define FIND_RET 0x0000F000L 1313 #define FIND_POS 0x00000000L 1314 #define FIND_LENGTH 0x00001000L 1315 #define FIND_OFFSET 0x00002000L 1316 #define FIND_SIZE 0x00003000L 1317 #define FIND_INDEX 0x00004000L 1318 1319 #define AVIStreamFindKeyFrame AVIStreamFindSample 1320 #define FindKeyFrame FindSample 1321 1322 #define AVIStreamClose AVIStreamRelease 1323 #define AVIFileClose AVIFileRelease 1324 #define AVIStreamInit AVIFileInit 1325 #define AVIStreamExit AVIFileExit 1326 1327 #define SEARCH_NEAREST FIND_PREV 1328 #define SEARCH_BACKWARD FIND_PREV 1329 #define SEARCH_FORWARD FIND_NEXT 1330 #define SEARCH_KEY FIND_KEY 1331 #define SEARCH_ANY FIND_ANY 1332 1333 #define AVIStreamSampleToSample(pavi1, pavi2, l) AVIStreamTimeToSample(pavi1,AVIStreamSampleToTime(pavi2, l)) 1334 1335 #define AVIStreamNextSample(pavi, l) AVIStreamFindSample(pavi,l+1,FIND_NEXT|FIND_ANY) 1336 1337 #define AVIStreamPrevSample(pavi, l) AVIStreamFindSample(pavi,l-1,FIND_PREV|FIND_ANY) 1338 1339 #define AVIStreamNearestSample(pavi, l) AVIStreamFindSample(pavi,l,FIND_PREV|FIND_ANY) 1340 1341 #define AVIStreamNextKeyFrame(pavi,l) AVIStreamFindSample(pavi,l+1,FIND_NEXT|FIND_KEY) 1342 1343 #define AVIStreamPrevKeyFrame(pavi, l) AVIStreamFindSample(pavi,l-1,FIND_PREV|FIND_KEY) 1344 1345 #define AVIStreamNearestKeyFrame(pavi, l) AVIStreamFindSample(pavi,l,FIND_PREV|FIND_KEY) 1346 1347 #define AVIStreamIsKeyFrame(pavi, l) (AVIStreamNearestKeyFrame(pavi,l) == l) 1348 1349 #define AVIStreamPrevSampleTime(pavi, t) AVIStreamSampleToTime(pavi, AVIStreamPrevSample(pavi,AVIStreamTimeToSample(pavi,t))) 1350 1351 #define AVIStreamNextSampleTime(pavi, t) AVIStreamSampleToTime(pavi, AVIStreamNextSample(pavi,AVIStreamTimeToSample(pavi,t))) 1352 1353 #define AVIStreamNearestSampleTime(pavi, t) AVIStreamSampleToTime(pavi, AVIStreamNearestSample(pavi,AVIStreamTimeToSample(pavi,t))) 1354 1355 #define AVIStreamNextKeyFrameTime(pavi, t) AVIStreamSampleToTime(pavi, AVIStreamNextKeyFrame(pavi,AVIStreamTimeToSample(pavi, t))) 1356 1357 #define AVIStreamPrevKeyFrameTime(pavi, t) AVIStreamSampleToTime(pavi, AVIStreamPrevKeyFrame(pavi,AVIStreamTimeToSample(pavi, t))) 1358 1359 #define AVIStreamNearestKeyFrameTime(pavi, t) AVIStreamSampleToTime(pavi, AVIStreamNearestKeyFrame(pavi,AVIStreamTimeToSample(pavi, t))) 1360 1361 #define AVIStreamStartTime(pavi) AVIStreamSampleToTime(pavi, AVIStreamStart(pavi)) 1362 1363 #define AVIStreamLengthTime(pavi) AVIStreamSampleToTime(pavi, AVIStreamLength(pavi)) 1364 1365 #define AVIStreamEnd(pavi) (AVIStreamStart(pavi) + AVIStreamLength(pavi)) 1366 1367 #define AVIStreamEndTime(pavi) AVIStreamSampleToTime(pavi, AVIStreamEnd(pavi)) 1368 1369 #define AVIStreamSampleSize(pavi, lPos, plSize) AVIStreamRead(pavi,lPos,1,NULL,0,plSize,NULL) 1370 1371 #define AVIStreamFormatSize(pavi, lPos, plSize) AVIStreamReadFormat(pavi,lPos,NULL,plSize) 1372 1373 #define AVIStreamDataSize(pavi, fcc, plSize) AVIStreamReadData(pavi,fcc,NULL,plSize) 1374 1375 #ifndef comptypeDIB 1376 #define comptypeDIB mmioFOURCC('D', 'I', 'B', ' ') 1377 #endif 1378 1379 STDAPI AVIMakeCompressedStream( 1380 PAVISTREAM FAR * ppsCompressed, 1381 PAVISTREAM ppsSource, 1382 AVICOMPRESSOPTIONS FAR * lpOptions, 1383 CLSID FAR *pclsidHandler); 1384 1385 EXTERN_C HRESULT CDECL AVISaveA (LPCSTR szFile, 1386 CLSID FAR *pclsidHandler, 1387 AVISAVECALLBACK lpfnCallback, 1388 int nStreams, 1389 PAVISTREAM pfile, 1390 LPAVICOMPRESSOPTIONS lpOptions, 1391 ...); 1392 1393 STDAPI AVISaveVA(LPCSTR szFile, 1394 CLSID FAR *pclsidHandler, 1395 AVISAVECALLBACK lpfnCallback, 1396 int nStreams, 1397 PAVISTREAM FAR * ppavi, 1398 LPAVICOMPRESSOPTIONS FAR *plpOptions); 1399 EXTERN_C HRESULT CDECL AVISaveW (LPCWSTR szFile, 1400 CLSID FAR *pclsidHandler, 1401 AVISAVECALLBACK lpfnCallback, 1402 int nStreams, 1403 PAVISTREAM pfile, 1404 LPAVICOMPRESSOPTIONS lpOptions, 1405 ...); 1406 1407 STDAPI AVISaveVW(LPCWSTR szFile, 1408 CLSID FAR *pclsidHandler, 1409 AVISAVECALLBACK lpfnCallback, 1410 int nStreams, 1411 PAVISTREAM FAR * ppavi, 1412 LPAVICOMPRESSOPTIONS FAR *plpOptions); 1413 #ifdef UNICODE 1414 #define AVISave AVISaveW 1415 #define AVISaveV AVISaveVW 1416 #else 1417 #define AVISave AVISaveA 1418 #define AVISaveV AVISaveVA 1419 #endif 1420 1421 1422 1423 STDAPI_(INT_PTR) AVISaveOptions(HWND hwnd, 1424 UINT uiFlags, 1425 int nStreams, 1426 PAVISTREAM FAR *ppavi, 1427 LPAVICOMPRESSOPTIONS FAR *plpOptions); 1428 1429 STDAPI AVISaveOptionsFree(int nStreams, 1430 LPAVICOMPRESSOPTIONS FAR *plpOptions); 1431 1432 STDAPI AVIBuildFilterW(LPWSTR lpszFilter, LONG cbFilter, BOOL fSaving); 1433 STDAPI AVIBuildFilterA(LPSTR lpszFilter, LONG cbFilter, BOOL fSaving); 1434 #ifdef UNICODE 1435 #define AVIBuildFilter AVIBuildFilterW 1436 #else 1437 #define AVIBuildFilter AVIBuildFilterA 1438 #endif 1439 STDAPI AVIMakeFileFromStreams(PAVIFILE FAR * ppfile, 1440 int nStreams, 1441 PAVISTREAM FAR * papStreams); 1442 1443 STDAPI AVIMakeStreamFromClipboard(UINT cfFormat, HANDLE hGlobal, PAVISTREAM FAR *ppstream); 1444 1445 STDAPI AVIPutFileOnClipboard(PAVIFILE pf); 1446 1447 STDAPI AVIGetFromClipboard(PAVIFILE FAR * lppf); 1448 1449 STDAPI AVIClearClipboard(void); 1450 1451 STDAPI CreateEditableStream( 1452 PAVISTREAM FAR * ppsEditable, 1453 PAVISTREAM psSource); 1454 1455 STDAPI EditStreamCut(PAVISTREAM pavi, LONG FAR *plStart, LONG FAR *plLength, PAVISTREAM FAR * ppResult); 1456 1457 STDAPI EditStreamCopy(PAVISTREAM pavi, LONG FAR *plStart, LONG FAR *plLength, PAVISTREAM FAR * ppResult); 1458 1459 STDAPI EditStreamPaste(PAVISTREAM pavi, LONG FAR *plPos, LONG FAR *plLength, PAVISTREAM pstream, LONG lStart, LONG lEnd); 1460 1461 STDAPI EditStreamClone(PAVISTREAM pavi, PAVISTREAM FAR *ppResult); 1462 1463 1464 STDAPI EditStreamSetNameA(PAVISTREAM pavi, LPCSTR lpszName); 1465 STDAPI EditStreamSetNameW(PAVISTREAM pavi, LPCWSTR lpszName); 1466 STDAPI EditStreamSetInfoW(PAVISTREAM pavi, LPAVISTREAMINFOW lpInfo, LONG cbInfo); 1467 STDAPI EditStreamSetInfoA(PAVISTREAM pavi, LPAVISTREAMINFOA lpInfo, LONG cbInfo); 1468 #ifdef UNICODE 1469 #define EditStreamSetInfo EditStreamSetInfoW 1470 #define EditStreamSetName EditStreamSetNameW 1471 #else 1472 #define EditStreamSetInfo EditStreamSetInfoA 1473 #define EditStreamSetName EditStreamSetNameA 1474 #endif 1475 +/ 1476 const AVIERR_OK = 0L; 1477 1478 SCODE MAKE_AVIERR(DWORD error) { 1479 return MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x4000 + error); 1480 } 1481 1482 const AVIERR_UNSUPPORTED = MAKE_AVIERR(101); 1483 const AVIERR_BADFORMAT = MAKE_AVIERR(102); 1484 const AVIERR_MEMORY = MAKE_AVIERR(103); 1485 const AVIERR_INTERNAL = MAKE_AVIERR(104); 1486 const AVIERR_BADFLAGS = MAKE_AVIERR(105); 1487 const AVIERR_BADPARAM = MAKE_AVIERR(106); 1488 const AVIERR_BADSIZE = MAKE_AVIERR(107); 1489 const AVIERR_BADHANDLE = MAKE_AVIERR(108); 1490 const AVIERR_FILEREAD = MAKE_AVIERR(109); 1491 const AVIERR_FILEWRITE = MAKE_AVIERR(110); 1492 const AVIERR_FILEOPEN = MAKE_AVIERR(111); 1493 const AVIERR_COMPRESSOR = MAKE_AVIERR(112); 1494 const AVIERR_NOCOMPRESSOR = MAKE_AVIERR(113); 1495 const AVIERR_READONLY = MAKE_AVIERR(114); 1496 const AVIERR_NODATA = MAKE_AVIERR(115); 1497 const AVIERR_BUFFERTOOSMALL = MAKE_AVIERR(116); 1498 const AVIERR_CANTCOMPRESS = MAKE_AVIERR(117); 1499 const AVIERR_USERABORT = MAKE_AVIERR(198); 1500 const AVIERR_ERROR = MAKE_AVIERR(199); 1501 1502 const TCHAR[] MCIWND_WINDOW_CLASS = "MCIWndClass"; 1503 1504 extern (Windows) { 1505 HWND MCIWndCreateA(HWND hwndParent, HINSTANCE hInstance, DWORD dwStyle, LPCSTR szFile); 1506 HWND MCIWndCreateW(HWND hwndParent, HINSTANCE hInstance, DWORD dwStyle, LPCWSTR szFile); 1507 } 1508 1509 version(Unicode) { 1510 alias MCIWndCreateW MCIWndCreate; 1511 } else { // Unicode 1512 alias MCIWndCreateA MCIWndCreate; 1513 } 1514 1515 extern(Windows) { 1516 BOOL MCIWndRegisterClass(); 1517 } 1518 1519 enum { 1520 MCIWNDOPENF_NEW = 0x0001, 1521 MCIWNDF_NOAUTOSIZEWINDOW = 0x0001, 1522 MCIWNDF_NOPLAYBAR = 0x0002, 1523 MCIWNDF_NOAUTOSIZEMOVIE = 0x0004, 1524 MCIWNDF_NOMENU = 0x0008, 1525 MCIWNDF_SHOWNAME = 0x0010, 1526 MCIWNDF_SHOWPOS = 0x0020, 1527 MCIWNDF_SHOWMODE = 0x0040, 1528 MCIWNDF_SHOWALL = 0x0070, 1529 MCIWNDF_NOTIFYMODE = 0x0100, 1530 MCIWNDF_NOTIFYPOS = 0x0200, 1531 MCIWNDF_NOTIFYSIZE = 0x0400, 1532 MCIWNDF_NOTIFYERROR = 0x1000, 1533 MCIWNDF_NOTIFYALL = 0x1F00, 1534 MCIWNDF_NOTIFYANSI = 0x0080, 1535 MCIWNDF_NOTIFYMEDIAA = 0x0880, 1536 MCIWNDF_NOTIFYMEDIAW = 0x0800, 1537 } 1538 1539 version(Unicode) { 1540 alias MCIWNDF_NOTIFYMEDIAW MCIWNDF_NOTIFYMEDIA; 1541 } else { // Unicode 1542 alias MCIWNDF_NOTIFYMEDIAA MCIWNDF_NOTIFYMEDIA; 1543 } 1544 1545 enum { 1546 MCIWNDF_RECORD = 0x2000, 1547 MCIWNDF_NOERRORDLG = 0x4000, 1548 MCIWNDF_NOOPEN = 0x8000, 1549 } 1550 1551 // can macros 1552 1553 BOOL MCIWndCanPlay(HWND hwnd) 1554 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_CAN_PLAY, 0, 0); } 1555 BOOL MCIWndCanRecord(HWND hwnd) 1556 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_CAN_RECORD, 0, 0); } 1557 BOOL MCIWndCanSave(HWND hwnd) 1558 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_CAN_SAVE, 0, 0); } 1559 BOOL MCIWndCanWindow(HWND hwnd) 1560 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_CAN_WINDOW, 0, 0); } 1561 BOOL MCIWndCanEject(HWND hwnd) 1562 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_CAN_EJECT, 0, 0); } 1563 BOOL MCIWndCanConfig(HWND hwnd) 1564 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_CAN_CONFIG, 0, 0); } 1565 BOOL MCIWndPaletteKick(HWND hwnd) 1566 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_PALETTEKICK, 0, 0); } 1567 LONG MCIWndSave(HWND hwnd, LPVOID szFile) 1568 { return cast(LONG)SendMessage(hwnd, MCI_SAVE, 0, cast(LPARAM)szFile); } 1569 LONG MCIWndSaveDialog(HWND hwnd) 1570 { return MCIWndSave(hwnd, cast(LPVOID)-1); } 1571 LONG MCIWndNew(HWND hwnd, LPVOID lp) 1572 { return cast(LONG)SendMessage(hwnd, MCIWNDM_NEW, 0, cast(LPARAM)lp); } 1573 LONG MCIWndRecord(HWND hwnd) 1574 { return cast(LONG)SendMessage(hwnd, MCI_RECORD, 0, 0); } 1575 LONG MCIWndOpen(HWND hwnd, LPVOID sz, UINT f) 1576 { return cast(LONG)SendMessage(hwnd, MCIWNDM_OPEN, cast(WPARAM)f, cast(LPARAM)sz); } 1577 LONG MCIWndOpenDialog(HWND hwnd) 1578 { return MCIWndOpen(hwnd, cast(LPVOID)-1, 0); } 1579 LONG MCIWndClose(HWND hwnd) 1580 { return cast(LONG)SendMessage(hwnd, MCI_CLOSE, 0, 0); } 1581 LONG MCIWndPlay(HWND hwnd) 1582 { return cast(LONG)SendMessage(hwnd, MCI_PLAY, 0, 0); } 1583 LONG MCIWndStop(HWND hwnd) 1584 { return cast(LONG)SendMessage(hwnd, MCI_STOP, 0, 0); } 1585 LONG MCIWndPause(HWND hwnd) 1586 { return cast(LONG)SendMessage(hwnd, MCI_PAUSE, 0, 0); } 1587 LONG MCIWndResume(HWND hwnd) 1588 { return cast(LONG)SendMessage(hwnd, MCI_RESUME, 0, 0); } 1589 LONG MCIWndSeek(HWND hwnd, LONG lPos) 1590 { return cast(LONG)SendMessage(hwnd, MCI_SEEK, 0, cast(LPARAM)lPos); } 1591 LONG MCIWndHome(HWND hwnd) 1592 { return MCIWndSeek(hwnd, MCIWND_START); } 1593 LONG MCIWndEnd(HWND hwnd) 1594 { return MCIWndSeek(hwnd, MCIWND_END); } 1595 LONG MCIWndEject(HWND hwnd) 1596 { return cast(LONG)SendMessage(hwnd, MCIWNDM_EJECT, 0, 0); } 1597 LONG MCIWndGetSource(HWND hwnd, LPRECT prc) 1598 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GET_SOURCE, 0, cast(LPARAM)prc); } 1599 LONG MCIWndPutSource(HWND hwnd, LPRECT prc) 1600 { return cast(LONG)SendMessage(hwnd, MCIWNDM_PUT_SOURCE, 0, cast(LPARAM)prc); } 1601 LONG MCIWndGetDest(HWND hwnd, LPRECT prc) 1602 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GET_DEST, 0, cast(LPARAM)prc); } 1603 LONG MCIWndPutDest(HWND hwnd, LPRECT prc) 1604 { return cast(LONG)SendMessage(hwnd, MCIWNDM_PUT_DEST, 0, cast(LPARAM)prc); } 1605 LONG MCIWndPlayReverse(HWND hwnd) 1606 { return cast(LONG)SendMessage(hwnd, MCIWNDM_PLAYREVERSE, 0, 0); } 1607 LONG MCIWndPlayFrom(HWND hwnd, LONG lPos) 1608 { return cast(LONG)SendMessage(hwnd, MCIWNDM_PLAYFROM, 0, cast(LPARAM)lPos); } 1609 LONG MCIWndPlayTo(HWND hwnd, LONG lPos) 1610 { return cast(LONG)SendMessage(hwnd, MCIWNDM_PLAYTO, 0, cast(LPARAM)lPos); } 1611 LONG MCIWndPlayFromTo(HWND hwnd, LONG lStart, LONG lEnd) 1612 { MCIWndSeek(hwnd, lStart); return MCIWndPlayTo(hwnd, lEnd); } 1613 UINT MCIWndGetDeviceID(HWND hwnd) 1614 { return cast(UINT)SendMessage(hwnd, MCIWNDM_GETDEVICEID, 0, 0); } 1615 UINT MCIWndGetAlias(HWND hwnd) 1616 { return cast(UINT)SendMessage(hwnd, MCIWNDM_GETALIAS, 0, 0); } 1617 LONG MCIWndGetMode(HWND hwnd, LPTSTR lp, UINT len) 1618 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETMODE, cast(WPARAM)len, cast(LPARAM)lp); } 1619 LONG MCIWndGetPosition(HWND hwnd) 1620 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETPOSITION, 0, 0); } 1621 LONG MCIWndGetPositionString(HWND hwnd, LPTSTR lp, UINT len) 1622 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETPOSITION, cast(WPARAM)len, cast(LPARAM)lp); } 1623 LONG MCIWndGetStart(HWND hwnd) 1624 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETSTART, 0, 0); } 1625 LONG MCIWndGetLength(HWND hwnd) 1626 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETLENGTH, 0, 0); } 1627 LONG MCIWndGetEnd(HWND hwnd) 1628 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETEND, 0, 0); } 1629 LONG MCIWndStep(HWND hwnd, LONG n) 1630 { return cast(LONG)SendMessage(hwnd, MCI_STEP, 0, cast(LPARAM)n); } 1631 void MCIWndDestroy(HWND hwnd) 1632 { SendMessage(hwnd, WM_CLOSE, 0, 0); } 1633 void MCIWndSetZoom(HWND hwnd, UINT iZoom) 1634 { SendMessage(hwnd, MCIWNDM_SETZOOM, 0, cast(LPARAM)iZoom); } 1635 UINT MCIWndGetZoom(HWND hwnd) 1636 { return cast(UINT)SendMessage(hwnd, MCIWNDM_GETZOOM, 0, 0); } 1637 LONG MCIWndSetVolume(HWND hwnd, UINT iVol) 1638 { return cast(LONG)SendMessage(hwnd, MCIWNDM_SETVOLUME, 0, cast(LPARAM)iVol); } 1639 LONG MCIWndGetVolume(HWND hwnd) 1640 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETVOLUME, 0, 0); } 1641 LONG MCIWndSetSpeed(HWND hwnd, UINT iSpeed) 1642 { return cast(LONG)SendMessage(hwnd, MCIWNDM_SETSPEED, 0, cast(LPARAM)iSpeed); } 1643 LONG MCIWndGetSpeed(HWND hwnd) 1644 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETSPEED, 0, 0); } 1645 LONG MCIWndSetTimeFormat(HWND hwnd, LPTSTR lp) 1646 { return cast(LONG)SendMessage(hwnd, MCIWNDM_SETTIMEFORMAT, 0, cast(LPARAM)lp); } 1647 LONG MCIWndUseFrames(HWND hwnd) 1648 { return MCIWndSetTimeFormat(hwnd, (cast(TCHAR[])"frames").ptr); } 1649 LONG MCIWndUseTime(HWND hwnd) 1650 { return MCIWndSetTimeFormat(hwnd, (cast(TCHAR[])"ms").ptr); } 1651 LONG MCIWndGetTimeFormat(HWND hwnd, LPTSTR lp, UINT len) 1652 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETTIMEFORMAT, cast(WPARAM)len, cast(LPARAM)lp); } 1653 void MCIWndValidateMedia(HWND hwnd) 1654 { SendMessage(hwnd, MCIWNDM_VALIDATEMEDIA, 0, 0); } 1655 void MCIWndSetRepeat(HWND hwnd, BOOL f) 1656 { SendMessage(hwnd, MCIWNDM_SETREPEAT, 0, cast(LPARAM)f); } 1657 BOOL MCIWndGetRepeat(HWND hwnd) 1658 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_GETREPEAT, 0, 0); } 1659 void MCIWndSetActiveTimer(HWND hwnd, UINT active) 1660 { SendMessage(hwnd, MCIWNDM_SETACTIVETIMER, cast(WPARAM)active, 0); } 1661 void MCIWndSetInactiveTimer(HWND hwnd, UINT inactive) 1662 { SendMessage(hwnd, MCIWNDM_SETINACTIVETIMER, cast(WPARAM)inactive, 0); } 1663 void MCIWndSetTimers(HWND hwnd, UINT active, UINT inactive) 1664 { SendMessage(hwnd, MCIWNDM_SETTIMERS, cast(WPARAM)active, cast(LPARAM)inactive); } 1665 UINT MCIWndGetActiveTimer(HWND hwnd) 1666 { return cast(UINT)SendMessage(hwnd, MCIWNDM_GETACTIVETIMER, 0, 0); } 1667 UINT MCIWndGetInactiveTimer(HWND hwnd) 1668 { return cast(UINT)SendMessage(hwnd, MCIWNDM_GETINACTIVETIMER, 0, 0); } 1669 LONG MCIWndRealize(HWND hwnd, BOOL fBkgnd) 1670 { return cast(LONG) SendMessage(hwnd, MCIWNDM_REALIZE, cast(WPARAM)fBkgnd, 0); } 1671 LONG MCIWndSendString(HWND hwnd, LPTSTR sz) 1672 { return cast(LONG) SendMessage(hwnd, MCIWNDM_SENDSTRING, 0, cast(LPARAM)sz); } 1673 LONG MCIWndReturnString(HWND hwnd, LPVOID lp, UINT len) 1674 { return cast(LONG) SendMessage(hwnd, MCIWNDM_RETURNSTRING, cast(WPARAM)len, cast(LPARAM)lp); } 1675 LONG MCIWndGetError(HWND hwnd, LPVOID lp, UINT len) 1676 { return cast(LONG) SendMessage(hwnd, MCIWNDM_GETERROR, cast(WPARAM)len, cast(LPARAM)lp); } 1677 HPALETTE MCIWndGetPalette(HWND hwnd) 1678 { return cast(HPALETTE)SendMessage(hwnd, MCIWNDM_GETPALETTE, 0, 0); } 1679 LONG MCIWndSetPalette(HWND hwnd, HPALETTE hpal) 1680 { return cast(LONG) SendMessage(hwnd, MCIWNDM_SETPALETTE, cast(WPARAM)hpal, 0); } 1681 LONG MCIWndGetFileName(HWND hwnd, LPVOID lp, UINT len) 1682 { return cast(LONG) SendMessage(hwnd, MCIWNDM_GETFILENAME, cast(WPARAM)len, cast(LPARAM)lp); } 1683 LONG MCIWndGetDevice(HWND hwnd, LPVOID lp, UINT len) 1684 { return cast(LONG) SendMessage(hwnd, MCIWNDM_GETDEVICE, cast(WPARAM)len, cast(LPARAM)lp); } 1685 UINT MCIWndGetStyles(HWND hwnd) 1686 { return cast(UINT) SendMessage(hwnd, MCIWNDM_GETSTYLES, 0, 0); } 1687 LONG MCIWndChangeStyles(HWND hwnd, UINT mask, LONG value) 1688 { return cast(LONG) SendMessage(hwnd, MCIWNDM_CHANGESTYLES, cast(WPARAM)mask, cast(LPARAM)value); } 1689 LONG MCIWndOpenInterface(HWND hwnd, LPUNKNOWN pUnk) 1690 { return cast(LONG) SendMessage(hwnd, MCIWNDM_OPENINTERFACE, 0, cast(LPARAM)cast(void*)pUnk); } 1691 LONG MCIWndSetOwner(HWND hwnd, HWND hwndP) 1692 { return cast(LONG) SendMessage(hwnd, MCIWNDM_SETOWNER, cast(WPARAM)hwndP, 0); } 1693 1694 enum { 1695 MCIWNDM_GETDEVICEID = WM_USER + 100, 1696 MCIWNDM_SENDSTRINGA = WM_USER + 101, 1697 MCIWNDM_GETPOSITIONA = WM_USER + 102, 1698 MCIWNDM_GETSTART = WM_USER + 103, 1699 MCIWNDM_GETLENGTH = WM_USER + 104, 1700 MCIWNDM_GETEND = WM_USER + 105, 1701 MCIWNDM_GETMODEA = WM_USER + 106, 1702 MCIWNDM_EJECT = WM_USER + 107, 1703 MCIWNDM_SETZOOM = WM_USER + 108, 1704 MCIWNDM_GETZOOM = WM_USER + 109, 1705 MCIWNDM_SETVOLUME = WM_USER + 110, 1706 MCIWNDM_GETVOLUME = WM_USER + 111, 1707 MCIWNDM_SETSPEED = WM_USER + 112, 1708 MCIWNDM_GETSPEED = WM_USER + 113, 1709 MCIWNDM_SETREPEAT = WM_USER + 114, 1710 MCIWNDM_GETREPEAT = WM_USER + 115, 1711 MCIWNDM_REALIZE = WM_USER + 118, 1712 MCIWNDM_SETTIMEFORMATA = WM_USER + 119, 1713 MCIWNDM_GETTIMEFORMATA = WM_USER + 120, 1714 MCIWNDM_VALIDATEMEDIA = WM_USER + 121, 1715 MCIWNDM_PLAYFROM = WM_USER + 122, 1716 MCIWNDM_PLAYTO = WM_USER + 123, 1717 MCIWNDM_GETFILENAMEA = WM_USER + 124, 1718 MCIWNDM_GETDEVICEA = WM_USER + 125, 1719 MCIWNDM_GETPALETTE = WM_USER + 126, 1720 MCIWNDM_SETPALETTE = WM_USER + 127, 1721 MCIWNDM_GETERRORA = WM_USER + 128, 1722 MCIWNDM_SETTIMERS = WM_USER + 129, 1723 MCIWNDM_SETACTIVETIMER = WM_USER + 130, 1724 MCIWNDM_SETINACTIVETIMER = WM_USER + 131, 1725 MCIWNDM_GETACTIVETIMER = WM_USER + 132, 1726 MCIWNDM_GETINACTIVETIMER = WM_USER + 133, 1727 MCIWNDM_NEWA = WM_USER + 134, 1728 MCIWNDM_CHANGESTYLES = WM_USER + 135, 1729 MCIWNDM_GETSTYLES = WM_USER + 136, 1730 MCIWNDM_GETALIAS = WM_USER + 137, 1731 MCIWNDM_RETURNSTRINGA = WM_USER + 138, 1732 MCIWNDM_PLAYREVERSE = WM_USER + 139, 1733 MCIWNDM_GET_SOURCE = WM_USER + 140, 1734 MCIWNDM_PUT_SOURCE = WM_USER + 141, 1735 MCIWNDM_GET_DEST = WM_USER + 142, 1736 MCIWNDM_PUT_DEST = WM_USER + 143, 1737 MCIWNDM_CAN_PLAY = WM_USER + 144, 1738 MCIWNDM_CAN_WINDOW = WM_USER + 145, 1739 MCIWNDM_CAN_RECORD = WM_USER + 146, 1740 MCIWNDM_CAN_SAVE = WM_USER + 147, 1741 MCIWNDM_CAN_EJECT = WM_USER + 148, 1742 MCIWNDM_CAN_CONFIG = WM_USER + 149, 1743 MCIWNDM_PALETTEKICK = WM_USER + 150, 1744 MCIWNDM_OPENINTERFACE = WM_USER + 151, 1745 MCIWNDM_SETOWNER = WM_USER + 152, 1746 MCIWNDM_OPENA = WM_USER + 153, 1747 MCIWNDM_SENDSTRINGW = WM_USER + 201, 1748 MCIWNDM_GETPOSITIONW = WM_USER + 202, 1749 MCIWNDM_GETMODEW = WM_USER + 206, 1750 MCIWNDM_SETTIMEFORMATW = WM_USER + 219, 1751 MCIWNDM_GETTIMEFORMATW = WM_USER + 220, 1752 MCIWNDM_GETFILENAMEW = WM_USER + 224, 1753 MCIWNDM_GETDEVICEW = WM_USER + 225, 1754 MCIWNDM_GETERRORW = WM_USER + 228, 1755 MCIWNDM_NEWW = WM_USER + 234, 1756 MCIWNDM_RETURNSTRINGW = WM_USER + 238, 1757 MCIWNDM_OPENW = WM_USER + 252, 1758 } 1759 1760 version(Unicode) { 1761 alias MCIWNDM_SENDSTRINGW MCIWNDM_SENDSTRING; 1762 alias MCIWNDM_GETPOSITIONW MCIWNDM_GETPOSITION; 1763 alias MCIWNDM_GETMODEW MCIWNDM_GETMODE; 1764 alias MCIWNDM_SETTIMEFORMATW MCIWNDM_SETTIMEFORMAT; 1765 alias MCIWNDM_GETTIMEFORMATW MCIWNDM_GETTIMEFORMAT; 1766 alias MCIWNDM_GETFILENAMEW MCIWNDM_GETFILENAME; 1767 alias MCIWNDM_GETDEVICEW MCIWNDM_GETDEVICE; 1768 alias MCIWNDM_GETERRORW MCIWNDM_GETERROR; 1769 alias MCIWNDM_NEWW MCIWNDM_NEW; 1770 alias MCIWNDM_RETURNSTRINGW MCIWNDM_RETURNSTRING; 1771 alias MCIWNDM_OPENW MCIWNDM_OPEN; 1772 } else { // Unicode 1773 alias MCIWNDM_SENDSTRINGA MCIWNDM_SENDSTRING; 1774 alias MCIWNDM_GETPOSITIONA MCIWNDM_GETPOSITION; 1775 alias MCIWNDM_GETMODEA MCIWNDM_GETMODE; 1776 alias MCIWNDM_SETTIMEFORMATA MCIWNDM_SETTIMEFORMAT; 1777 alias MCIWNDM_GETTIMEFORMATA MCIWNDM_GETTIMEFORMAT; 1778 alias MCIWNDM_GETFILENAMEA MCIWNDM_GETFILENAME; 1779 alias MCIWNDM_GETDEVICEA MCIWNDM_GETDEVICE; 1780 alias MCIWNDM_GETERRORA MCIWNDM_GETERROR; 1781 alias MCIWNDM_NEWA MCIWNDM_NEW; 1782 alias MCIWNDM_RETURNSTRINGA MCIWNDM_RETURNSTRING; 1783 alias MCIWNDM_OPENA MCIWNDM_OPEN; 1784 } 1785 1786 enum { 1787 MCIWNDM_NOTIFYMODE = WM_USER + 200, 1788 MCIWNDM_NOTIFYPOS = WM_USER + 201, 1789 MCIWNDM_NOTIFYSIZE = WM_USER + 202, 1790 MCIWNDM_NOTIFYMEDIA = WM_USER + 203, 1791 MCIWNDM_NOTIFYERROR = WM_USER + 205, 1792 } 1793 1794 const MCIWND_START = -1; 1795 const MCIWND_END = -2; 1796 1797 enum { 1798 MCI_CLOSE = 0x0804, 1799 MCI_PLAY = 0x0806, 1800 MCI_SEEK = 0x0807, 1801 MCI_STOP = 0x0808, 1802 MCI_PAUSE = 0x0809, 1803 MCI_STEP = 0x080E, 1804 MCI_RECORD = 0x080F, 1805 MCI_SAVE = 0x0813, 1806 MCI_CUT = 0x0851, 1807 MCI_COPY = 0x0852, 1808 MCI_PASTE = 0x0853, 1809 MCI_RESUME = 0x0855, 1810 MCI_DELETE = 0x0856, 1811 } 1812 1813 enum { 1814 MCI_MODE_NOT_READY = 524, 1815 MCI_MODE_STOP, 1816 MCI_MODE_PLAY, 1817 MCI_MODE_RECORD, 1818 MCI_MODE_SEEK, 1819 MCI_MODE_PAUSE, 1820 MCI_MODE_OPEN, 1821 } 1822 1823 alias TypeDef!(HANDLE) HVIDEO; 1824 alias HVIDEO* LPHVIDEO; 1825 1826 // Error Return Values 1827 1828 enum { 1829 DV_ERR_OK = 0, 1830 DV_ERR_BASE = 1, 1831 DV_ERR_NONSPECIFIC = DV_ERR_BASE, 1832 DV_ERR_BADFORMAT = DV_ERR_BASE + 1, 1833 DV_ERR_STILLPLAYING = DV_ERR_BASE + 2, 1834 DV_ERR_UNPREPARED = DV_ERR_BASE + 3, 1835 DV_ERR_SYNC = DV_ERR_BASE + 4, 1836 DV_ERR_TOOMANYCHANNELS = DV_ERR_BASE + 5, 1837 DV_ERR_NOTDETECTED = DV_ERR_BASE + 6, 1838 DV_ERR_BADINSTALL = DV_ERR_BASE + 7, 1839 DV_ERR_CREATEPALETTE = DV_ERR_BASE + 8, 1840 DV_ERR_SIZEFIELD = DV_ERR_BASE + 9, 1841 DV_ERR_PARAM1 = DV_ERR_BASE + 10, 1842 DV_ERR_PARAM2 = DV_ERR_BASE + 11, 1843 DV_ERR_CONFIG1 = DV_ERR_BASE + 12, 1844 DV_ERR_CONFIG2 = DV_ERR_BASE + 13, 1845 DV_ERR_FLAGS = DV_ERR_BASE + 14, 1846 DV_ERR_13 = DV_ERR_BASE + 15, 1847 DV_ERR_NOTSUPPORTED = DV_ERR_BASE + 16, 1848 DV_ERR_NOMEM = DV_ERR_BASE + 17, 1849 DV_ERR_ALLOCATED = DV_ERR_BASE + 18, 1850 DV_ERR_BADDEVICEID = DV_ERR_BASE + 19, 1851 DV_ERR_INVALHANDLE = DV_ERR_BASE + 20, 1852 DV_ERR_BADERRNUM = DV_ERR_BASE + 21, 1853 DV_ERR_NO_BUFFERS = DV_ERR_BASE + 22, 1854 DV_ERR_MEM_CONFLICT = DV_ERR_BASE + 23, 1855 DV_ERR_IO_CONFLICT = DV_ERR_BASE + 24, 1856 DV_ERR_DMA_CONFLICT = DV_ERR_BASE + 25, 1857 DV_ERR_INT_CONFLICT = DV_ERR_BASE + 26, 1858 DV_ERR_PROTECT_ONLY = DV_ERR_BASE + 27, 1859 DV_ERR_LASTERROR = DV_ERR_BASE + 27, 1860 DV_ERR_USER_MSG = DV_ERR_BASE + 1000, 1861 } 1862 1863 // Callback Messages 1864 1865 enum { 1866 MM_DRVM_OPEN = 0x3D0, 1867 MM_DRVM_CLOSE, 1868 MM_DRVM_DATA, 1869 MM_DRVM_ERROR, 1870 } 1871 1872 enum { 1873 DV_VM_OPEN = MM_DRVM_OPEN, 1874 DV_VM_CLOSE = MM_DRVM_CLOSE, 1875 DV_VM_DATA = MM_DRVM_DATA, 1876 DV_VM_ERROR = MM_DRVM_ERROR, 1877 } 1878 1879 /** 1880 * Structures 1881 */ 1882 1883 struct VIDEOHDR { 1884 LPBYTE lpData; 1885 DWORD dwBufferLength; 1886 DWORD dwBytesUsed; 1887 DWORD dwTimeCaptured; 1888 DWORD_PTR dwUser; 1889 DWORD dwFlags; 1890 DWORD_PTR[4]dwReserved; 1891 } 1892 alias VIDEOHDR* PVIDEOHDR, LPVIDEOHDR; 1893 1894 enum { 1895 VHDR_DONE = 0x00000001, 1896 VHDR_PREPARED = 0x00000002, 1897 VHDR_INQUEUE = 0x00000004, 1898 VHDR_KEYFRAME = 0x00000008, 1899 VHDR_VALID = 0x0000000F, 1900 } 1901 1902 struct CHANNEL_CAPS { 1903 DWORD dwFlags; 1904 DWORD dwSrcRectXMod; 1905 DWORD dwSrcRectYMod; 1906 DWORD dwSrcRectWidthMod; 1907 DWORD dwSrcRectHeightMod; 1908 DWORD dwDstRectXMod; 1909 DWORD dwDstRectYMod; 1910 DWORD dwDstRectWidthMod; 1911 DWORD dwDstRectHeightMod; 1912 } 1913 alias CHANNEL_CAPS* PCHANNEL_CAPS, LPCHANNEL_CAPS; 1914 1915 enum { 1916 VCAPS_OVERLAY = 0x00000001, 1917 VCAPS_SRC_CAN_CLIP = 0x00000002, 1918 VCAPS_DST_CAN_CLIP = 0x00000004, 1919 VCAPS_CAN_SCALE = 0x00000008, 1920 } 1921 1922 /** 1923 * API Flags 1924 */ 1925 1926 enum { 1927 VIDEO_EXTERNALIN = 0x0001, 1928 VIDEO_EXTERNALOUT = 0x0002, 1929 VIDEO_IN = 0x0004, 1930 VIDEO_OUT = 0x0008, 1931 VIDEO_DLG_QUERY = 0x0010, 1932 } 1933 1934 enum { 1935 VIDEO_CONFIGURE_QUERYSIZE = 0x0001, 1936 VIDEO_CONFIGURE_CURRENT = 0x0010, 1937 VIDEO_CONFIGURE_NOMINAL = 0x0020, 1938 VIDEO_CONFIGURE_MIN = 0x0040, 1939 VIDEO_CONFIGURE_MAX = 0x0080, 1940 VIDEO_CONFIGURE_SET = 0x1000, 1941 VIDEO_CONFIGURE_GET = 0x2000, 1942 VIDEO_CONFIGURE_QUERY = 0x8000, 1943 } 1944 1945 /** 1946 * CONFIGURE MESSAGES 1947 */ 1948 1949 enum { 1950 DVM_USER = 0x4000, 1951 DVM_CONFIGURE_START = 0x1000, 1952 DVM_CONFIGURE_END = 0x1FFF, 1953 DVM_PALETTE = DVM_CONFIGURE_START + 1, 1954 DVM_FORMAT = DVM_CONFIGURE_START + 2, 1955 DVM_PALETTERGB555 = DVM_CONFIGURE_START + 3, 1956 DVM_SRC_RECT = DVM_CONFIGURE_START + 4, 1957 DVM_DST_RECT = DVM_CONFIGURE_START + 5, 1958 } 1959 1960 /** 1961 * AVICap window class 1962 */ 1963 1964 LRESULT AVICapSM(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { 1965 if (IsWindow(hWnd)) { 1966 return SendMessage(hWnd, msg, wParam, lParam); 1967 } 1968 return 0; 1969 } 1970 1971 enum { 1972 WM_CAP_START = WM_USER, 1973 WM_CAP_UNICODE_START = WM_USER + 100, 1974 1975 WM_CAP_GET_CAPSTREAMPTR = WM_CAP_START + 1, 1976 WM_CAP_SET_CALLBACK_ERRORA = WM_CAP_START + 2, 1977 WM_CAP_SET_CALLBACK_STATUSA = WM_CAP_START + 3, 1978 1979 WM_CAP_SET_CALLBACK_ERRORW = WM_CAP_UNICODE_START + 2, 1980 WM_CAP_SET_CALLBACK_STATUSW = WM_CAP_UNICODE_START + 3, 1981 } 1982 1983 version(Unicode) { 1984 alias WM_CAP_SET_CALLBACK_ERRORW WM_CAP_SET_CALLBACK_ERROR; 1985 alias WM_CAP_SET_CALLBACK_STATUSW WM_CAP_SET_CALLBACK_STATUS; 1986 } else { // Unicode 1987 alias WM_CAP_SET_CALLBACK_ERRORA WM_CAP_SET_CALLBACK_ERROR; 1988 alias WM_CAP_SET_CALLBACK_STATUSA WM_CAP_SET_CALLBACK_STATUS; 1989 } 1990 1991 enum { 1992 WM_CAP_SET_CALLBACK_YIELD = WM_CAP_START + 4, 1993 WM_CAP_SET_CALLBACK_FRAME = WM_CAP_START + 5, 1994 WM_CAP_SET_CALLBACK_VIDEOSTREAM = WM_CAP_START + 6, 1995 WM_CAP_SET_CALLBACK_WAVESTREAM = WM_CAP_START + 7, 1996 WM_CAP_GET_USER_DATA = WM_CAP_START + 8, 1997 WM_CAP_SET_USER_DATA = WM_CAP_START + 9, 1998 WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10, 1999 WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11, 2000 WM_CAP_DRIVER_GET_NAMEA = WM_CAP_START + 12, 2001 WM_CAP_DRIVER_GET_VERSIONA = WM_CAP_START + 13, 2002 2003 WM_CAP_DRIVER_GET_NAMEW = WM_CAP_UNICODE_START + 12, 2004 WM_CAP_DRIVER_GET_VERSIONW = WM_CAP_UNICODE_START + 13, 2005 } 2006 2007 version(Unicode) { 2008 alias WM_CAP_DRIVER_GET_NAMEW WM_CAP_DRIVER_GET_NAME; 2009 alias WM_CAP_DRIVER_GET_VERSIONW WM_CAP_DRIVER_GET_VERSION; 2010 } else { // Unicode 2011 alias WM_CAP_DRIVER_GET_NAMEA WM_CAP_DRIVER_GET_NAME; 2012 alias WM_CAP_DRIVER_GET_VERSIONA WM_CAP_DRIVER_GET_VERSION; 2013 } 2014 2015 enum { 2016 WM_CAP_DRIVER_GET_CAPS = WM_CAP_START + 14, 2017 WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20, 2018 WM_CAP_FILE_GET_CAPTURE_FILEA = WM_CAP_START + 21, 2019 WM_CAP_FILE_SAVEASA = WM_CAP_START + 23, 2020 WM_CAP_FILE_SAVEDIBA = WM_CAP_START + 25, 2021 2022 WM_CAP_FILE_SET_CAPTURE_FILEW = WM_CAP_UNICODE_START + 20, 2023 WM_CAP_FILE_GET_CAPTURE_FILEW = WM_CAP_UNICODE_START + 21, 2024 WM_CAP_FILE_SAVEASW = WM_CAP_UNICODE_START + 23, 2025 WM_CAP_FILE_SAVEDIBW = WM_CAP_UNICODE_START + 25, 2026 } 2027 2028 version(Unicode) { 2029 alias WM_CAP_FILE_SET_CAPTURE_FILEW WM_CAP_FILE_SET_CAPTURE_FILE; 2030 alias WM_CAP_FILE_GET_CAPTURE_FILEW WM_CAP_FILE_GET_CAPTURE_FILE; 2031 alias WM_CAP_FILE_SAVEASW WM_CAP_FILE_SAVEAS; 2032 alias WM_CAP_FILE_SAVEDIBW WM_CAP_FILE_SAVEDIB; 2033 } else { // Unicode 2034 alias WM_CAP_FILE_SET_CAPTURE_FILEA WM_CAP_FILE_SET_CAPTURE_FILE; 2035 alias WM_CAP_FILE_GET_CAPTURE_FILEA WM_CAP_FILE_GET_CAPTURE_FILE; 2036 alias WM_CAP_FILE_SAVEASA WM_CAP_FILE_SAVEAS; 2037 alias WM_CAP_FILE_SAVEDIBA WM_CAP_FILE_SAVEDIB; 2038 } 2039 2040 enum { 2041 WM_CAP_FILE_ALLOCATE = WM_CAP_START + 22, 2042 WM_CAP_FILE_SET_INFOCHUNK = WM_CAP_START + 24, 2043 WM_CAP_EDIT_COPY = WM_CAP_START + 30, 2044 WM_CAP_SET_AUDIOFORMAT = WM_CAP_START + 35, 2045 WM_CAP_GET_AUDIOFORMAT = WM_CAP_START + 36, 2046 WM_CAP_DLG_VIDEOFORMAT = WM_CAP_START + 41, 2047 WM_CAP_DLG_VIDEOSOURCE = WM_CAP_START + 42, 2048 WM_CAP_DLG_VIDEODISPLAY = WM_CAP_START + 43, 2049 WM_CAP_GET_VIDEOFORMAT = WM_CAP_START + 44, 2050 WM_CAP_SET_VIDEOFORMAT = WM_CAP_START + 45, 2051 WM_CAP_DLG_VIDEOCOMPRESSION = WM_CAP_START + 46, 2052 WM_CAP_SET_PREVIEW = WM_CAP_START + 50, 2053 WM_CAP_SET_OVERLAY = WM_CAP_START + 51, 2054 WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52, 2055 WM_CAP_SET_SCALE = WM_CAP_START + 53, 2056 WM_CAP_GET_STATUS = WM_CAP_START + 54, 2057 WM_CAP_SET_SCROLL = WM_CAP_START + 55, 2058 WM_CAP_GRAB_FRAME = WM_CAP_START + 60, 2059 WM_CAP_GRAB_FRAME_NOSTOP = WM_CAP_START + 61, 2060 WM_CAP_SEQUENCE = WM_CAP_START + 62, 2061 WM_CAP_SEQUENCE_NOFILE = WM_CAP_START + 63, 2062 WM_CAP_SET_SEQUENCE_SETUP = WM_CAP_START + 64, 2063 WM_CAP_GET_SEQUENCE_SETUP = WM_CAP_START + 65, 2064 WM_CAP_SET_MCI_DEVICEA = WM_CAP_START + 66, 2065 WM_CAP_GET_MCI_DEVICEA = WM_CAP_START + 67, 2066 2067 WM_CAP_SET_MCI_DEVICEW = WM_CAP_UNICODE_START + 66, 2068 WM_CAP_GET_MCI_DEVICEW = WM_CAP_UNICODE_START + 67, 2069 } 2070 2071 version(Unicode) { 2072 alias WM_CAP_SET_MCI_DEVICEW WM_CAP_SET_MCI_DEVICE; 2073 alias WM_CAP_GET_MCI_DEVICEW WM_CAP_GET_MCI_DEVICE; 2074 } else { // Unicode 2075 alias WM_CAP_SET_MCI_DEVICEA WM_CAP_SET_MCI_DEVICE; 2076 alias WM_CAP_GET_MCI_DEVICEA WM_CAP_GET_MCI_DEVICE; 2077 } 2078 2079 enum { 2080 WM_CAP_STOP = WM_CAP_START + 68, 2081 WM_CAP_ABORT = WM_CAP_START + 69, 2082 WM_CAP_SINGLE_FRAME_OPEN = WM_CAP_START + 70, 2083 WM_CAP_SINGLE_FRAME_CLOSE = WM_CAP_START + 71, 2084 WM_CAP_SINGLE_FRAME = WM_CAP_START + 72, 2085 WM_CAP_PAL_OPENA = WM_CAP_START + 80, 2086 WM_CAP_PAL_SAVEA = WM_CAP_START + 81, 2087 2088 WM_CAP_PAL_OPENW = WM_CAP_UNICODE_START + 80, 2089 WM_CAP_PAL_SAVEW = WM_CAP_UNICODE_START + 81, 2090 } 2091 2092 version(Unicode) { 2093 alias WM_CAP_PAL_OPENW WM_CAP_PAL_OPEN; 2094 alias WM_CAP_PAL_SAVEW WM_CAP_PAL_SAVE; 2095 } else { // Unicode 2096 alias WM_CAP_PAL_OPENA WM_CAP_PAL_OPEN; 2097 alias WM_CAP_PAL_SAVEA WM_CAP_PAL_SAVE; 2098 } 2099 2100 enum { 2101 WM_CAP_PAL_PASTE = WM_CAP_START + 82, 2102 WM_CAP_PAL_AUTOCREATE = WM_CAP_START + 83, 2103 WM_CAP_PAL_MANUALCREATE = WM_CAP_START + 84, 2104 WM_CAP_SET_CALLBACK_CAPCONTROL = WM_CAP_START + 85, 2105 WM_CAP_UNICODE_END = WM_CAP_PAL_SAVEW, 2106 WM_CAP_END = WM_CAP_UNICODE_END, 2107 } 2108 2109 /** 2110 * message wrapper 2111 */ 2112 2113 BOOL capSetCallbackOnError(HWND hWnd, LPVOID fpProc) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_CALLBACK_ERROR, 0, cast(LPARAM)fpProc); } 2114 BOOL capSetCallbackOnStatus(HWND hWnd, LPVOID fpProc) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_CALLBACK_STATUS, 0, cast(LPARAM)fpProc); } 2115 BOOL capSetCallbackOnYield(HWND hWnd, LPVOID fpProc) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_CALLBACK_YIELD, 0, cast(LPARAM)fpProc); } 2116 BOOL capSetCallbackOnFrame(HWND hWnd, LPVOID fpProc) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_CALLBACK_FRAME, 0, cast(LPARAM)fpProc); } 2117 BOOL capSetCallbackOnVideoStream(HWND hWnd, LPVOID fpProc) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, cast(LPARAM)fpProc); } 2118 BOOL capSetCallbackOnWaveStream(HWND hWnd, LPVOID fpProc) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_CALLBACK_WAVESTREAM, 0, cast(LPARAM)fpProc); } 2119 BOOL capSetCallbackOnCapControl(HWND hWnd, LPVOID fpProc) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_CALLBACK_CAPCONTROL, 0, cast(LPARAM)fpProc); } 2120 2121 BOOL capSetUserData(HWND hWnd, LPARAM lUser) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_USER_DATA, 0, lUser); } 2122 BOOL capGetUserData(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_GET_USER_DATA, 0, 0); } 2123 2124 BOOL capDriverConnect(HWND hWnd, WPARAM i) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DRIVER_CONNECT, i, 0); } 2125 BOOL capDriverDisconnect(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DRIVER_DISCONNECT, 0, 0); } 2126 BOOL capDriverGetName(HWND hWnd, LPTSTR szName, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DRIVER_GET_NAME, wSize, cast(LPARAM)szName); } 2127 BOOL capDriverGetVersion(HWND hWnd, LPTSTR szVer, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DRIVER_GET_VERSION, wSize, cast(LPARAM)szVer); } 2128 BOOL capDriverGetCaps(HWND hWnd, LPCAPDRIVERCAPS s, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DRIVER_GET_CAPS, wSize, cast(LPARAM)s); } 2129 2130 BOOL capFileSetCaptureFile(HWND hWnd, LPTSTR szName) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_FILE_SET_CAPTURE_FILE, 0, cast(LPARAM)szName); } 2131 BOOL capFileGetCaptureFile(HWND hWnd, LPTSTR szName, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_FILE_GET_CAPTURE_FILE, wSize, cast(LPARAM)szName); } 2132 BOOL capFileAlloc(HWND hWnd, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_FILE_ALLOCATE, wSize, 0); } 2133 BOOL capFileSaveAs(HWND hWnd, LPTSTR szName) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_FILE_SAVEAS, 0, cast(LPARAM)szName); } 2134 BOOL capFileSetInfoChunk(HWND hWnd, LPCAPINFOCHUNK lpInfoChunk) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_FILE_SET_INFOCHUNK, 0, cast(LPARAM)lpInfoChunk); } 2135 BOOL capFileSaveDIB(HWND hWnd, LPTSTR szName) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_FILE_SAVEDIB, 0, cast(LPARAM)szName); } 2136 2137 BOOL capEditCopy(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_EDIT_COPY, 0, 0); } 2138 2139 BOOL capSetAudioFormat(HWND hWnd, LPWAVEFORMATEX s, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_AUDIOFORMAT, wSize, cast(LPARAM)s); } 2140 DWORD capGetAudioFormat(HWND hWnd, LPWAVEFORMATEX s, WPARAM wSize) { return cast(DWORD)AVICapSM(hWnd, WM_CAP_GET_AUDIOFORMAT, wSize, cast(LPARAM)s); } 2141 DWORD capGetAudioFormatSize(HWND hWnd) { return cast(DWORD)AVICapSM(hWnd, WM_CAP_GET_AUDIOFORMAT, 0, 0); } 2142 2143 BOOL capDlgVideoFormat(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DLG_VIDEOFORMAT, 0, 0); } 2144 BOOL capDlgVideoSource(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DLG_VIDEOSOURCE, 0, 0); } 2145 BOOL capDlgVideoDisplay(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DLG_VIDEODISPLAY, 0, 0); } 2146 BOOL capDlgVideoCompression(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DLG_VIDEOCOMPRESSION, 0, 0); } 2147 2148 DWORD capGetVideoFormat(HWND hWnd, void* s, WPARAM wSize) { return cast(DWORD)AVICapSM(hWnd, WM_CAP_GET_VIDEOFORMAT, wSize, cast(LPARAM)s); } 2149 DWORD capGetVideoFormatSize(HWND hWnd) { return cast(DWORD)AVICapSM(hWnd, WM_CAP_GET_VIDEOFORMAT, 0, 0); } 2150 BOOL capSetVideoFormat(HWND hWnd, void* s, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_VIDEOFORMAT, wSize, cast(LPARAM)s); } 2151 2152 BOOL capPreview(HWND hWnd, BOOL f) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_PREVIEW, cast(WPARAM)f, 0); } 2153 BOOL capPreviewRate(HWND hWnd, WPARAM wMS) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_PREVIEWRATE, wMS, 0); } 2154 BOOL capOverlay(HWND hWnd, BOOL f) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_OVERLAY, cast(WPARAM)f, 0); } 2155 BOOL capPreviewScale(HWND hWnd, BOOL f) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_SCALE, cast(WPARAM)f, 0); } 2156 BOOL capGetStatus(HWND hWnd, LPCAPSTATUS s, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_GET_STATUS, wSize, cast(LPARAM)s); } 2157 BOOL capSetScrollPos(HWND hWnd, LPPOINT lpP) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_SCROLL, 0, cast(LPARAM)lpP); } 2158 2159 BOOL capGrabFrame(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_GRAB_FRAME, 0, 0); } 2160 BOOL capGrabFrameNoStop(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_GRAB_FRAME_NOSTOP, 0, 0); } 2161 2162 BOOL capCaptureSequence(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SEQUENCE, 0, 0); } 2163 BOOL capCaptureSequenceNoFile(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SEQUENCE_NOFILE, 0, 0); } 2164 BOOL capCaptureStop(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_STOP, 0, 0); } 2165 BOOL capCaptureAbort(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_ABORT, 0, 0); } 2166 2167 BOOL capCaptureSingleFrameOpen(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SINGLE_FRAME_OPEN, 0, 0); } 2168 BOOL capCaptureSingleFrameClose(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SINGLE_FRAME_CLOSE, 0, 0); } 2169 BOOL capCaptureSingleFrame(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SINGLE_FRAME, 0, 0); } 2170 2171 BOOL capCaptureGetSetup(HWND hWnd, LPCAPTUREPARMS s, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_GET_SEQUENCE_SETUP, wSize, cast(LPARAM)s); } 2172 BOOL capCaptureSetSetup(HWND hWnd, LPCAPTUREPARMS s, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_SEQUENCE_SETUP, wSize, cast(LPARAM)s); } 2173 2174 BOOL capSetMCIDeviceName(HWND hWnd, LPTSTR szName) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_MCI_DEVICE, 0, cast(LPARAM)szName); } 2175 BOOL capGetMCIDeviceName(HWND hWnd, LPTSTR szName, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_GET_MCI_DEVICE, wSize, cast(LPARAM)szName); } 2176 2177 BOOL capPaletteOpen(HWND hWnd, LPTSTR szName) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_PAL_OPEN, 0, cast(LPARAM)szName); } 2178 BOOL capPaletteSave(HWND hWnd, LPTSTR szName) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_PAL_SAVE, 0, cast(LPARAM)szName); } 2179 BOOL capPalettePaste(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_PAL_PASTE, 0, 0); } 2180 BOOL capPaletteAuto(HWND hWnd, WPARAM iFrames, LPARAM iColors) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_PAL_AUTOCREATE, iFrames, iColors); } 2181 BOOL capPaletteManual(HWND hWnd, WPARAM fGrab, LPARAM iColors) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_PAL_MANUALCREATE, fGrab, iColors); } 2182 2183 /** 2184 * structs 2185 */ 2186 2187 struct CAPDRIVERCAPS { 2188 UINT wDeviceIndex; 2189 BOOL fHasOverlay; 2190 BOOL fHasDlgVideoSource; 2191 BOOL fHasDlgVideoFormat; 2192 BOOL fHasDlgVideoDisplay; 2193 BOOL fCaptureInitialized; 2194 BOOL fDriverSuppliesPalettes; 2195 HANDLE hVideoIn; 2196 HANDLE hVideoOut; 2197 HANDLE hVideoExtIn; 2198 HANDLE hVideoExtOut; 2199 } 2200 alias CAPDRIVERCAPS* PCAPDRIVERCAPS, LPCAPDRIVERCAPS; 2201 2202 struct CAPSTATUS { 2203 UINT uiImageWidth; 2204 UINT uiImageHeight; 2205 BOOL fLiveWindow; 2206 BOOL fOverlayWindow; 2207 BOOL fScale; 2208 POINT ptScroll; 2209 BOOL fUsingDefaultPalette; 2210 BOOL fAudioHardware; 2211 BOOL fCapFileExists; 2212 DWORD dwCurrentVideoFrame; 2213 DWORD dwCurrentVideoFramesDropped; 2214 DWORD dwCurrentWaveSamples; 2215 DWORD dwCurrentTimeElapsedMS; 2216 HPALETTE hPalCurrent; 2217 BOOL fCapturingNow; 2218 DWORD dwReturn; 2219 UINT wNumVideoAllocated; 2220 UINT wNumAudioAllocated; 2221 } 2222 alias CAPSTATUS* PCAPSTATUS, LPCAPSTATUS; 2223 2224 struct CAPTUREPARMS { 2225 DWORD dwRequestMicroSecPerFrame; 2226 BOOL fMakeUserHitOKToCapture; 2227 UINT wPercentDropForError; 2228 BOOL fYield; 2229 DWORD dwIndexSize; 2230 UINT wChunkGranularity; 2231 BOOL fUsingDOSMemory; 2232 UINT wNumVideoRequested; 2233 BOOL fCaptureAudio; 2234 UINT wNumAudioRequested; 2235 UINT vKeyAbort; 2236 BOOL fAbortLeftMouse; 2237 BOOL fAbortRightMouse; 2238 BOOL fLimitEnabled; 2239 UINT wTimeLimit; 2240 BOOL fMCIControl; 2241 BOOL fStepMCIDevice; 2242 DWORD dwMCIStartTime; 2243 DWORD dwMCIStopTime; 2244 BOOL fStepCaptureAt2x; 2245 UINT wStepCaptureAverageFrames; 2246 DWORD dwAudioBufferSize; 2247 BOOL fDisableWriteCache; 2248 UINT AVStreamMaster; 2249 } 2250 alias CAPTUREPARMS* PCAPTUREPARMS, LPCAPTUREPARMS; 2251 2252 const AVSTREAMMASTER_AUDIO = 0; 2253 const AVSTREAMMASTER_NONE = 1; 2254 2255 struct CAPINFOCHUNK { 2256 FOURCC fccInfoID; 2257 LPVOID lpData; 2258 LONG cbData; 2259 } 2260 alias CAPINFOCHUNK* PCAPINFOCHUNK, LPCAPINFOCHUNK; 2261 2262 // Callback Definitions 2263 2264 extern (Windows) { 2265 alias LRESULT function(HWND hWnd) CAPYIELDCALLBACK; 2266 alias LRESULT function(HWND hWnd, int nID, LPCWSTR lpsz) CAPSTATUSCALLBACKW; 2267 alias LRESULT function(HWND hWnd, int nID, LPCWSTR lpsz) CAPERRORCALLBACKW; 2268 alias LRESULT function(HWND hWnd, int nID, LPCSTR lpsz) CAPSTATUSCALLBACKA; 2269 alias LRESULT function(HWND hWnd, int nID, LPCSTR lpsz) CAPERRORCALLBACKA; 2270 } 2271 2272 version(Unicode) { 2273 alias CAPSTATUSCALLBACKW CAPSTATUSCALLBACK; 2274 alias CAPERRORCALLBACKW CAPERRORCALLBACK; 2275 } else { // Unicode 2276 alias CAPSTATUSCALLBACKA CAPSTATUSCALLBACK; 2277 alias CAPERRORCALLBACKA CAPERRORCALLBACK; 2278 } 2279 2280 extern (Windows) { 2281 alias LRESULT function(HWND hWnd, LPVIDEOHDR lpVHdr) CAPVIDEOCALLBACK; 2282 alias LRESULT function(HWND hWnd, LPWAVEHDR lpWHdr) CAPWAVECALLBACK; 2283 alias LRESULT function(HWND hWnd, int nState) CAPCONTROLCALLBACK; 2284 } 2285 2286 // CapControlCallback states 2287 const CONTROLCALLBACK_PREROLL = 1; 2288 const CONTROLCALLBACK_CAPTURING = 2; 2289 2290 extern (Windows) { 2291 HWND capCreateCaptureWindowA(LPCSTR lpszWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hwndParent, int nID); 2292 BOOL capGetDriverDescriptionA(UINT wDriverIndex, LPSTR lpszName, int cbName, LPSTR lpszVer, int cbVer); 2293 HWND capCreateCaptureWindowW(LPCWSTR lpszWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hwndParent, int nID); 2294 BOOL capGetDriverDescriptionW(UINT wDriverIndex, LPWSTR lpszName, int cbName, LPWSTR lpszVer, int cbVer); 2295 } 2296 2297 version(Unicode) { 2298 alias capCreateCaptureWindowW capCreateCaptureWindow; 2299 alias capGetDriverDescriptionW capGetDriverDescription; 2300 } else { // Unicode 2301 alias capCreateCaptureWindowA capCreateCaptureWindow; 2302 alias capGetDriverDescriptionA capGetDriverDescription; 2303 } 2304 2305 // New Information chunk IDs 2306 const infotypeDIGITIZATION_TIME = mmioFOURCC!('I', 'D', 'I', 'T'); 2307 const infotypeSMPTE_TIME = mmioFOURCC!('I', 'S', 'M', 'P'); 2308 2309 // status and error callbacks 2310 enum { 2311 IDS_CAP_BEGIN = 300, 2312 IDS_CAP_END = 301, 2313 2314 IDS_CAP_INFO = 401, 2315 IDS_CAP_OUTOFMEM = 402, 2316 IDS_CAP_FILEEXISTS = 403, 2317 IDS_CAP_ERRORPALOPEN = 404, 2318 IDS_CAP_ERRORPALSAVE = 405, 2319 IDS_CAP_ERRORDIBSAVE = 406, 2320 IDS_CAP_DEFAVIEXT = 407, 2321 IDS_CAP_DEFPALEXT = 408, 2322 IDS_CAP_CANTOPEN = 409, 2323 IDS_CAP_SEQ_MSGSTART = 410, 2324 IDS_CAP_SEQ_MSGSTOP = 411, 2325 2326 IDS_CAP_VIDEDITERR = 412, 2327 IDS_CAP_READONLYFILE = 413, 2328 IDS_CAP_WRITEERROR = 414, 2329 IDS_CAP_NODISKSPACE = 415, 2330 IDS_CAP_SETFILESIZE = 416, 2331 IDS_CAP_SAVEASPERCENT = 417, 2332 2333 IDS_CAP_DRIVER_ERROR = 418, 2334 2335 IDS_CAP_WAVE_OPEN_ERROR = 419, 2336 IDS_CAP_WAVE_ALLOC_ERROR = 420, 2337 IDS_CAP_WAVE_PREPARE_ERROR = 421, 2338 IDS_CAP_WAVE_ADD_ERROR = 422, 2339 IDS_CAP_WAVE_SIZE_ERROR = 423, 2340 2341 IDS_CAP_VIDEO_OPEN_ERROR = 424, 2342 IDS_CAP_VIDEO_ALLOC_ERROR = 425, 2343 IDS_CAP_VIDEO_PREPARE_ERROR = 426, 2344 IDS_CAP_VIDEO_ADD_ERROR = 427, 2345 IDS_CAP_VIDEO_SIZE_ERROR = 428, 2346 2347 IDS_CAP_FILE_OPEN_ERROR = 429, 2348 IDS_CAP_FILE_WRITE_ERROR = 430, 2349 IDS_CAP_RECORDING_ERROR = 431, 2350 IDS_CAP_RECORDING_ERROR2 = 432, 2351 IDS_CAP_AVI_INIT_ERROR = 433, 2352 IDS_CAP_NO_FRAME_CAP_ERROR = 434, 2353 IDS_CAP_NO_PALETTE_WARN = 435, 2354 IDS_CAP_MCI_CONTROL_ERROR = 436, 2355 IDS_CAP_MCI_CANT_STEP_ERROR = 437, 2356 IDS_CAP_NO_AUDIO_CAP_ERROR = 438, 2357 IDS_CAP_AVI_DRAWDIB_ERROR = 439, 2358 IDS_CAP_COMPRESSOR_ERROR = 440, 2359 IDS_CAP_AUDIO_DROP_ERROR = 441, 2360 IDS_CAP_AUDIO_DROP_COMPERROR = 442, 2361 2362 IDS_CAP_STAT_LIVE_MODE = 500, 2363 IDS_CAP_STAT_OVERLAY_MODE = 501, 2364 IDS_CAP_STAT_CAP_INIT = 502, 2365 IDS_CAP_STAT_CAP_FINI = 503, 2366 IDS_CAP_STAT_PALETTE_BUILD = 504, 2367 IDS_CAP_STAT_OPTPAL_BUILD = 505, 2368 IDS_CAP_STAT_I_FRAMES = 506, 2369 IDS_CAP_STAT_L_FRAMES = 507, 2370 IDS_CAP_STAT_CAP_L_FRAMES = 508, 2371 IDS_CAP_STAT_CAP_AUDIO = 509, 2372 IDS_CAP_STAT_VIDEOCURRENT = 510, 2373 IDS_CAP_STAT_VIDEOAUDIO = 511, 2374 IDS_CAP_STAT_VIDEOONLY = 512, 2375 IDS_CAP_STAT_FRAMESDROPPED = 513, 2376 } 2377 2378 /** 2379 * FilePreview dialog. 2380 */ 2381 2382 extern (Windows) { 2383 BOOL GetOpenFileNamePreviewA(LPOPENFILENAMEA lpofn); 2384 BOOL GetSaveFileNamePreviewA(LPOPENFILENAMEA lpofn); 2385 BOOL GetOpenFileNamePreviewW(LPOPENFILENAMEW lpofn); 2386 BOOL GetSaveFileNamePreviewW(LPOPENFILENAMEW lpofn); 2387 } 2388 2389 version(Unicode) { 2390 alias GetOpenFileNamePreviewW GetOpenFileNamePreview; 2391 alias GetSaveFileNamePreviewW GetSaveFileNamePreview; 2392 } else { // Unicode 2393 alias GetOpenFileNamePreviewA GetOpenFileNamePreview; 2394 alias GetSaveFileNamePreviewA GetSaveFileNamePreview; 2395 }