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 win32.vfw; 11 pragma(lib, "vfw32.lib"); 12 13 private import 14 win32.commdlg, 15 win32.wingdi, 16 win32.mmsystem, 17 win32.unknwn, 18 win32.w32api, 19 win32.windef, 20 win32.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 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 szName[16]; 190 WCHAR szDescription[128]; 191 WCHAR szDriver[128]; 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 ICSendMessage(hic, ICM_ABOUT, cast(UINT)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 ICSendMessage(hic, ICM_CONFIGURE, cast(UINT)hwnd, 0); 395 } 396 397 DWORD ICGetState(HIC hic, LPVOID pv, DWORD_PTR cb) { 398 return ICSendMessage(hic, ICM_GETSTATE, cast(DWORD)pv, cast(DWORD)cb); 399 } 400 401 DWORD ICSetState(HIC hic, LPVOID pv, DWORD_PTR cb) { 402 return ICSendMessage(hic, ICM_SETSTATE, cast(DWORD)pv, cast(DWORD)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 ICSendMessage(hic, ICM_DRAW_WINDOW, cast(DWORD)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 alias 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 dwReserved[4]; 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 peNew[]; 865 } 866 867 const AVIGETFRAMEF_BESTDISPLAYFMT = 1; 868 869 struct AVISTREAMINFOW { 870 DWORD fccType; 871 DWORD fccHandler; 872 DWORD dwFlags; 873 DWORD dwCaps; 874 WORD wPriority; 875 WORD wLanguage; 876 DWORD dwScale; 877 DWORD dwRate; 878 DWORD dwStart; 879 DWORD dwLength; 880 DWORD dwInitialFrames; 881 DWORD dwSuggestedBufferSize; 882 DWORD dwQuality; 883 DWORD dwSampleSize; 884 RECT rcFrame; 885 DWORD dwEditCount; 886 DWORD dwFormatChangeCount; 887 WCHAR szName[64]; 888 } 889 alias AVISTREAMINFOW* LPAVISTREAMINFOW; 890 891 struct AVISTREAMINFOA { 892 DWORD fccType; 893 DWORD fccHandler; 894 DWORD dwFlags; 895 DWORD dwCaps; 896 WORD wPriority; 897 WORD wLanguage; 898 DWORD dwScale; 899 DWORD dwRate; 900 DWORD dwStart; 901 DWORD dwLength; 902 DWORD dwInitialFrames; 903 DWORD dwSuggestedBufferSize; 904 DWORD dwQuality; 905 DWORD dwSampleSize; 906 RECT rcFrame; 907 DWORD dwEditCount; 908 DWORD dwFormatChangeCount; 909 char szName[64]; 910 } 911 alias AVISTREAMINFOA* LPAVISTREAMINFOA; 912 913 version(Unicode) { 914 alias AVISTREAMINFOW AVISTREAMINFO; 915 alias LPAVISTREAMINFOW LPAVISTREAMINFO; 916 } else { // Unicode 917 alias AVISTREAMINFOA AVISTREAMINFO; 918 alias LPAVISTREAMINFOA LPAVISTREAMINFO; 919 } 920 921 const AVISTREAMINFO_DISABLED = 0x00000001; 922 const AVISTREAMINFO_FORMATCHANGES = 0x00010000; 923 924 struct AVIFILEINFOW { 925 DWORD dwMaxBytesPerSec; 926 DWORD dwFlags; 927 DWORD dwCaps; 928 DWORD dwStreams; 929 DWORD dwSuggestedBufferSize; 930 DWORD dwWidth; 931 DWORD dwHeight; 932 DWORD dwScale; 933 DWORD dwRate; 934 DWORD dwLength; 935 DWORD dwEditCount; 936 WCHAR szFileType[64]; 937 } 938 alias AVIFILEINFOW* LPAVIFILEINFOW; 939 940 struct AVIFILEINFOA { 941 DWORD dwMaxBytesPerSec; 942 DWORD dwFlags; 943 DWORD dwCaps; 944 DWORD dwStreams; 945 DWORD dwSuggestedBufferSize; 946 DWORD dwWidth; 947 DWORD dwHeight; 948 DWORD dwScale; 949 DWORD dwRate; 950 DWORD dwLength; 951 DWORD dwEditCount; 952 char szFileType[64]; 953 } 954 alias AVIFILEINFOA* LPAVIFILEINFOA; 955 956 version(Unicode) { 957 alias AVIFILEINFOW AVIFILEINFO; 958 alias LPAVIFILEINFOW LPAVIFILEINFO; 959 } else { // Unicode 960 alias AVIFILEINFOA AVIFILEINFO; 961 alias LPAVIFILEINFOA LPAVIFILEINFO; 962 } 963 964 enum { 965 AVIFILEINFO_HASINDEX = 0x00000010, 966 AVIFILEINFO_MUSTUSEINDEX = 0x00000020, 967 AVIFILEINFO_ISINTERLEAVED = 0x00000100, 968 AVIFILEINFO_WASCAPTUREFILE = 0x00010000, 969 AVIFILEINFO_COPYRIGHTED = 0x00020000, 970 } 971 972 enum { 973 AVIFILECAPS_CANREAD = 0x00000001, 974 AVIFILECAPS_CANWRITE = 0x00000002, 975 AVIFILECAPS_ALLKEYFRAMES = 0x00000010, 976 AVIFILECAPS_NOCOMPRESSION = 0x00000020, 977 } 978 979 extern (Windows) { 980 alias BOOL function(int) AVISAVECALLBACK; 981 } 982 983 struct AVICOMPRESSOPTIONS { 984 DWORD fccType; 985 DWORD fccHandler; 986 DWORD dwKeyFrameEvery; 987 DWORD dwQuality; 988 DWORD dwBytesPerSecond; 989 DWORD dwFlags; 990 LPVOID lpFormat; 991 DWORD cbFormat; 992 LPVOID lpParms; 993 DWORD cbParms; 994 DWORD dwInterleaveEvery; 995 } 996 alias AVICOMPRESSOPTIONS* LPAVICOMPRESSOPTIONS; 997 998 enum { 999 AVICOMPRESSF_INTERLEAVE = 0x00000001, 1000 AVICOMPRESSF_DATARATE = 0x00000002, 1001 AVICOMPRESSF_KEYFRAMES = 0x00000004, 1002 AVICOMPRESSF_VALID = 0x00000008, 1003 } 1004 1005 /+ TODO: 1006 DECLARE_INTERFACE_(IAVIStream, IUnknown) 1007 { 1008 STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE; 1009 STDMETHOD_(ULONG,AddRef) (THIS) PURE; 1010 STDMETHOD_(ULONG,Release) (THIS) PURE; 1011 1012 STDMETHOD(Create) (THIS_ LPARAM lParam1, LPARAM lParam2) PURE ; 1013 STDMETHOD(Info) (THIS_ AVISTREAMINFOW FAR * psi, LONG lSize) PURE ; 1014 STDMETHOD_(LONG, FindSample)(THIS_ LONG lPos, LONG lFlags) PURE ; 1015 STDMETHOD(ReadFormat) (THIS_ LONG lPos, 1016 LPVOID lpFormat, LONG FAR *lpcbFormat) PURE ; 1017 STDMETHOD(SetFormat) (THIS_ LONG lPos, 1018 LPVOID lpFormat, LONG cbFormat) PURE ; 1019 STDMETHOD(Read) (THIS_ LONG lStart, LONG lSamples, 1020 LPVOID lpBuffer, LONG cbBuffer, 1021 LONG FAR * plBytes, LONG FAR * plSamples) PURE ; 1022 STDMETHOD(Write) (THIS_ LONG lStart, LONG lSamples, 1023 LPVOID lpBuffer, LONG cbBuffer, 1024 DWORD dwFlags, 1025 LONG FAR *plSampWritten, 1026 LONG FAR *plBytesWritten) PURE ; 1027 STDMETHOD(Delete) (THIS_ LONG lStart, LONG lSamples) PURE; 1028 STDMETHOD(ReadData) (THIS_ DWORD fcc, LPVOID lp, LONG FAR *lpcb) PURE ; 1029 STDMETHOD(WriteData) (THIS_ DWORD fcc, LPVOID lp, LONG cb) PURE ; 1030 #ifdef _WIN32 1031 STDMETHOD(SetInfo) (THIS_ AVISTREAMINFOW FAR * lpInfo, 1032 LONG cbInfo) PURE; 1033 #else 1034 STDMETHOD(Reserved1) (THIS) PURE; 1035 STDMETHOD(Reserved2) (THIS) PURE; 1036 STDMETHOD(Reserved3) (THIS) PURE; 1037 STDMETHOD(Reserved4) (THIS) PURE; 1038 STDMETHOD(Reserved5) (THIS) PURE; 1039 #endif 1040 }; 1041 1042 typedef IAVIStream FAR* PAVISTREAM; 1043 1044 #undef INTERFACE 1045 #define INTERFACE IAVIStreaming 1046 1047 DECLARE_INTERFACE_(IAVIStreaming, IUnknown) 1048 { 1049 STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE; 1050 STDMETHOD_(ULONG,AddRef) (THIS) PURE; 1051 STDMETHOD_(ULONG,Release) (THIS) PURE; 1052 1053 STDMETHOD(Begin) (THIS_ 1054 LONG lStart, 1055 LONG lEnd, 1056 LONG lRate) PURE; 1057 STDMETHOD(End) (THIS) PURE; 1058 }; 1059 1060 typedef IAVIStreaming FAR* PAVISTREAMING; 1061 1062 1063 #undef INTERFACE 1064 #define INTERFACE IAVIEditStream 1065 1066 DECLARE_INTERFACE_(IAVIEditStream, IUnknown) 1067 { 1068 STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE; 1069 STDMETHOD_(ULONG,AddRef) (THIS) PURE; 1070 STDMETHOD_(ULONG,Release) (THIS) PURE; 1071 1072 STDMETHOD(Cut) (THIS_ LONG FAR *plStart, 1073 LONG FAR *plLength, 1074 PAVISTREAM FAR * ppResult) PURE; 1075 STDMETHOD(Copy) (THIS_ LONG FAR *plStart, 1076 LONG FAR *plLength, 1077 PAVISTREAM FAR * ppResult) PURE; 1078 STDMETHOD(Paste) (THIS_ LONG FAR *plPos, 1079 LONG FAR *plLength, 1080 PAVISTREAM pstream, 1081 LONG lStart, 1082 LONG lEnd) PURE; 1083 STDMETHOD(Clone) (THIS_ PAVISTREAM FAR *ppResult) PURE; 1084 STDMETHOD(SetInfo) (THIS_ AVISTREAMINFOW FAR * lpInfo, 1085 LONG cbInfo) PURE; 1086 }; 1087 1088 typedef IAVIEditStream FAR* PAVIEDITSTREAM; 1089 1090 #undef INTERFACE 1091 #define INTERFACE IAVIPersistFile 1092 1093 DECLARE_INTERFACE_(IAVIPersistFile, IPersistFile) 1094 { 1095 STDMETHOD(Reserved1)(THIS) PURE; 1096 }; 1097 1098 typedef IAVIPersistFile FAR* PAVIPERSISTFILE; 1099 1100 #undef INTERFACE 1101 #define INTERFACE IAVIFile 1102 #define PAVIFILE IAVIFile FAR* 1103 1104 DECLARE_INTERFACE_(IAVIFile, IUnknown) 1105 { 1106 STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE; 1107 STDMETHOD_(ULONG,AddRef) (THIS) PURE; 1108 STDMETHOD_(ULONG,Release) (THIS) PURE; 1109 1110 STDMETHOD(Info) (THIS_ 1111 AVIFILEINFOW FAR * pfi, 1112 LONG lSize) PURE; 1113 STDMETHOD(GetStream) (THIS_ 1114 PAVISTREAM FAR * ppStream, 1115 DWORD fccType, 1116 LONG lParam) PURE; 1117 STDMETHOD(CreateStream) (THIS_ 1118 PAVISTREAM FAR * ppStream, 1119 AVISTREAMINFOW FAR * psi) PURE; 1120 STDMETHOD(WriteData) (THIS_ 1121 DWORD ckid, 1122 LPVOID lpData, 1123 LONG cbData) PURE; 1124 STDMETHOD(ReadData) (THIS_ 1125 DWORD ckid, 1126 LPVOID lpData, 1127 LONG FAR *lpcbData) PURE; 1128 STDMETHOD(EndRecord) (THIS) PURE; 1129 STDMETHOD(DeleteStream) (THIS_ 1130 DWORD fccType, 1131 LONG lParam) PURE; 1132 }; 1133 1134 #undef PAVIFILE 1135 typedef IAVIFile FAR* PAVIFILE; 1136 1137 #undef INTERFACE 1138 #define INTERFACE IGetFrame 1139 #define PGETFRAME IGetFrame FAR* 1140 1141 DECLARE_INTERFACE_(IGetFrame, IUnknown) 1142 { 1143 STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE; 1144 STDMETHOD_(ULONG,AddRef) (THIS) PURE; 1145 STDMETHOD_(ULONG,Release) (THIS) PURE; 1146 1147 STDMETHOD_(LPVOID,GetFrame) (THIS_ LONG lPos) PURE; 1148 1149 STDMETHOD(Begin) (THIS_ LONG lStart, LONG lEnd, LONG lRate) PURE; 1150 STDMETHOD(End) (THIS) PURE; 1151 1152 STDMETHOD(SetFormat) (THIS_ LPBITMAPINFOHEADER lpbi, LPVOID lpBits, int x, int y, int dx, int dy) PURE; 1153 }; 1154 1155 #undef PGETFRAME 1156 typedef IGetFrame FAR* PGETFRAME; 1157 1158 #define DEFINE_AVIGUID(name, l, w1, w2) DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46) 1159 1160 DEFINE_AVIGUID(IID_IAVIFile, 0x00020020, 0, 0); 1161 DEFINE_AVIGUID(IID_IAVIStream, 0x00020021, 0, 0); 1162 DEFINE_AVIGUID(IID_IAVIStreaming, 0x00020022, 0, 0); 1163 DEFINE_AVIGUID(IID_IGetFrame, 0x00020023, 0, 0); 1164 DEFINE_AVIGUID(IID_IAVIEditStream, 0x00020024, 0, 0); 1165 DEFINE_AVIGUID(IID_IAVIPersistFile, 0x00020025, 0, 0); 1166 #ifndef UNICODE 1167 DEFINE_AVIGUID(CLSID_AVISimpleUnMarshal, 0x00020009, 0, 0); 1168 #endif 1169 1170 DEFINE_AVIGUID(CLSID_AVIFile, 0x00020000, 0, 0); 1171 1172 #define AVIFILEHANDLER_CANREAD 0x0001 1173 #define AVIFILEHANDLER_CANWRITE 0x0002 1174 #define AVIFILEHANDLER_CANACCEPTNONRGB 0x0004 1175 1176 STDAPI_(void) AVIFileInit(void); 1177 STDAPI_(void) AVIFileExit(void); 1178 1179 STDAPI_(ULONG) AVIFileAddRef (PAVIFILE pfile); 1180 STDAPI_(ULONG) AVIFileRelease (PAVIFILE pfile); 1181 1182 #ifdef _WIN32 1183 STDAPI AVIFileOpenA (PAVIFILE FAR * ppfile, LPCSTR szFile, 1184 UINT uMode, LPCLSID lpHandler); 1185 STDAPI AVIFileOpenW (PAVIFILE FAR * ppfile, LPCWSTR szFile, 1186 UINT uMode, LPCLSID lpHandler); 1187 #ifdef UNICODE 1188 #define AVIFileOpen AVIFileOpenW 1189 #else 1190 #define AVIFileOpen AVIFileOpenA 1191 #endif 1192 #else 1193 STDAPI AVIFileOpen (PAVIFILE FAR * ppfile, LPCSTR szFile, 1194 UINT uMode, LPCLSID lpHandler); 1195 #define AVIFileOpenW AVIFileOpen 1196 #endif 1197 1198 #ifdef _WIN32 1199 STDAPI AVIFileInfoW (PAVIFILE pfile, LPAVIFILEINFOW pfi, LONG lSize); 1200 STDAPI AVIFileInfoA (PAVIFILE pfile, LPAVIFILEINFOA pfi, LONG lSize); 1201 #ifdef UNICODE 1202 #define AVIFileInfo AVIFileInfoW 1203 #else 1204 #define AVIFileInfo AVIFileInfoA 1205 #endif 1206 #else 1207 STDAPI AVIFileInfo (PAVIFILE pfile, LPAVIFILEINFO pfi, LONG lSize); 1208 #define AVIFileInfoW AVIFileInfo 1209 #endif 1210 1211 1212 STDAPI AVIFileGetStream (PAVIFILE pfile, PAVISTREAM FAR * ppavi, DWORD fccType, LONG lParam); 1213 1214 1215 #ifdef _WIN32 1216 STDAPI AVIFileCreateStreamW (PAVIFILE pfile, PAVISTREAM FAR *ppavi, AVISTREAMINFOW FAR * psi); 1217 STDAPI AVIFileCreateStreamA (PAVIFILE pfile, PAVISTREAM FAR *ppavi, AVISTREAMINFOA FAR * psi); 1218 #ifdef UNICODE 1219 #define AVIFileCreateStream AVIFileCreateStreamW 1220 #else 1221 #define AVIFileCreateStream AVIFileCreateStreamA 1222 #endif 1223 #else 1224 STDAPI AVIFileCreateStream(PAVIFILE pfile, PAVISTREAM FAR *ppavi, AVISTREAMINFO FAR * psi); 1225 #define AVIFileCreateStreamW AVIFileCreateStream 1226 #endif 1227 1228 STDAPI AVIFileWriteData (PAVIFILE pfile, 1229 DWORD ckid, 1230 LPVOID lpData, 1231 LONG cbData); 1232 STDAPI AVIFileReadData (PAVIFILE pfile, 1233 DWORD ckid, 1234 LPVOID lpData, 1235 LONG FAR *lpcbData); 1236 STDAPI AVIFileEndRecord (PAVIFILE pfile); 1237 1238 STDAPI_(ULONG) AVIStreamAddRef (PAVISTREAM pavi); 1239 STDAPI_(ULONG) AVIStreamRelease (PAVISTREAM pavi); 1240 1241 STDAPI AVIStreamInfoW (PAVISTREAM pavi, LPAVISTREAMINFOW psi, LONG lSize); 1242 STDAPI AVIStreamInfoA (PAVISTREAM pavi, LPAVISTREAMINFOA psi, LONG lSize); 1243 #ifdef UNICODE 1244 #define AVIStreamInfo AVIStreamInfoW 1245 #else 1246 #define AVIStreamInfo AVIStreamInfoA 1247 #endif 1248 1249 STDAPI_(LONG) AVIStreamFindSample(PAVISTREAM pavi, LONG lPos, LONG lFlags); 1250 STDAPI AVIStreamReadFormat (PAVISTREAM pavi, LONG lPos,LPVOID lpFormat,LONG FAR *lpcbFormat); 1251 STDAPI AVIStreamSetFormat (PAVISTREAM pavi, LONG lPos,LPVOID lpFormat,LONG cbFormat); 1252 STDAPI AVIStreamReadData (PAVISTREAM pavi, DWORD fcc, LPVOID lp, LONG FAR *lpcb); 1253 STDAPI AVIStreamWriteData (PAVISTREAM pavi, DWORD fcc, LPVOID lp, LONG cb); 1254 1255 STDAPI AVIStreamRead (PAVISTREAM pavi, 1256 LONG lStart, 1257 LONG lSamples, 1258 LPVOID lpBuffer, 1259 LONG cbBuffer, 1260 LONG FAR * plBytes, 1261 LONG FAR * plSamples); 1262 #define AVISTREAMREAD_CONVENIENT (-1L) 1263 1264 STDAPI AVIStreamWrite (PAVISTREAM pavi, 1265 LONG lStart, LONG lSamples, 1266 LPVOID lpBuffer, LONG cbBuffer, DWORD dwFlags, 1267 LONG FAR *plSampWritten, 1268 LONG FAR *plBytesWritten); 1269 1270 STDAPI_(LONG) AVIStreamStart (PAVISTREAM pavi); 1271 STDAPI_(LONG) AVIStreamLength (PAVISTREAM pavi); 1272 STDAPI_(LONG) AVIStreamTimeToSample (PAVISTREAM pavi, LONG lTime); 1273 STDAPI_(LONG) AVIStreamSampleToTime (PAVISTREAM pavi, LONG lSample); 1274 1275 1276 STDAPI AVIStreamBeginStreaming(PAVISTREAM pavi, LONG lStart, LONG lEnd, LONG lRate); 1277 STDAPI AVIStreamEndStreaming(PAVISTREAM pavi); 1278 1279 STDAPI_(PGETFRAME) AVIStreamGetFrameOpen(PAVISTREAM pavi, 1280 LPBITMAPINFOHEADER lpbiWanted); 1281 STDAPI_(LPVOID) AVIStreamGetFrame(PGETFRAME pg, LONG lPos); 1282 STDAPI AVIStreamGetFrameClose(PGETFRAME pg); 1283 1284 STDAPI AVIStreamOpenFromFileA(PAVISTREAM FAR *ppavi, LPCSTR szFile, 1285 DWORD fccType, LONG lParam, 1286 UINT mode, CLSID FAR *pclsidHandler); 1287 STDAPI AVIStreamOpenFromFileW(PAVISTREAM FAR *ppavi, LPCWSTR szFile, 1288 DWORD fccType, LONG lParam, 1289 UINT mode, CLSID FAR *pclsidHandler); 1290 #ifdef UNICODE 1291 #define AVIStreamOpenFromFile AVIStreamOpenFromFileW 1292 #else 1293 #define AVIStreamOpenFromFile AVIStreamOpenFromFileA 1294 #endif 1295 1296 STDAPI AVIStreamCreate(PAVISTREAM FAR *ppavi, LONG lParam1, LONG lParam2, 1297 CLSID FAR *pclsidHandler); 1298 1299 1300 1301 #define FIND_DIR 0x0000000FL 1302 #define FIND_NEXT 0x00000001L 1303 #define FIND_PREV 0x00000004L 1304 #define FIND_FROM_START 0x00000008L 1305 1306 #define FIND_TYPE 0x000000F0L 1307 #define FIND_KEY 0x00000010L 1308 #define FIND_ANY 0x00000020L 1309 #define FIND_FORMAT 0x00000040L 1310 1311 #define FIND_RET 0x0000F000L 1312 #define FIND_POS 0x00000000L 1313 #define FIND_LENGTH 0x00001000L 1314 #define FIND_OFFSET 0x00002000L 1315 #define FIND_SIZE 0x00003000L 1316 #define FIND_INDEX 0x00004000L 1317 1318 #define AVIStreamFindKeyFrame AVIStreamFindSample 1319 #define FindKeyFrame FindSample 1320 1321 #define AVIStreamClose AVIStreamRelease 1322 #define AVIFileClose AVIFileRelease 1323 #define AVIStreamInit AVIFileInit 1324 #define AVIStreamExit AVIFileExit 1325 1326 #define SEARCH_NEAREST FIND_PREV 1327 #define SEARCH_BACKWARD FIND_PREV 1328 #define SEARCH_FORWARD FIND_NEXT 1329 #define SEARCH_KEY FIND_KEY 1330 #define SEARCH_ANY FIND_ANY 1331 1332 #define AVIStreamSampleToSample(pavi1, pavi2, l) AVIStreamTimeToSample(pavi1,AVIStreamSampleToTime(pavi2, l)) 1333 1334 #define AVIStreamNextSample(pavi, l) AVIStreamFindSample(pavi,l+1,FIND_NEXT|FIND_ANY) 1335 1336 #define AVIStreamPrevSample(pavi, l) AVIStreamFindSample(pavi,l-1,FIND_PREV|FIND_ANY) 1337 1338 #define AVIStreamNearestSample(pavi, l) AVIStreamFindSample(pavi,l,FIND_PREV|FIND_ANY) 1339 1340 #define AVIStreamNextKeyFrame(pavi,l) AVIStreamFindSample(pavi,l+1,FIND_NEXT|FIND_KEY) 1341 1342 #define AVIStreamPrevKeyFrame(pavi, l) AVIStreamFindSample(pavi,l-1,FIND_PREV|FIND_KEY) 1343 1344 #define AVIStreamNearestKeyFrame(pavi, l) AVIStreamFindSample(pavi,l,FIND_PREV|FIND_KEY) 1345 1346 #define AVIStreamIsKeyFrame(pavi, l) (AVIStreamNearestKeyFrame(pavi,l) == l) 1347 1348 #define AVIStreamPrevSampleTime(pavi, t) AVIStreamSampleToTime(pavi, AVIStreamPrevSample(pavi,AVIStreamTimeToSample(pavi,t))) 1349 1350 #define AVIStreamNextSampleTime(pavi, t) AVIStreamSampleToTime(pavi, AVIStreamNextSample(pavi,AVIStreamTimeToSample(pavi,t))) 1351 1352 #define AVIStreamNearestSampleTime(pavi, t) AVIStreamSampleToTime(pavi, AVIStreamNearestSample(pavi,AVIStreamTimeToSample(pavi,t))) 1353 1354 #define AVIStreamNextKeyFrameTime(pavi, t) AVIStreamSampleToTime(pavi, AVIStreamNextKeyFrame(pavi,AVIStreamTimeToSample(pavi, t))) 1355 1356 #define AVIStreamPrevKeyFrameTime(pavi, t) AVIStreamSampleToTime(pavi, AVIStreamPrevKeyFrame(pavi,AVIStreamTimeToSample(pavi, t))) 1357 1358 #define AVIStreamNearestKeyFrameTime(pavi, t) AVIStreamSampleToTime(pavi, AVIStreamNearestKeyFrame(pavi,AVIStreamTimeToSample(pavi, t))) 1359 1360 #define AVIStreamStartTime(pavi) AVIStreamSampleToTime(pavi, AVIStreamStart(pavi)) 1361 1362 #define AVIStreamLengthTime(pavi) AVIStreamSampleToTime(pavi, AVIStreamLength(pavi)) 1363 1364 #define AVIStreamEnd(pavi) (AVIStreamStart(pavi) + AVIStreamLength(pavi)) 1365 1366 #define AVIStreamEndTime(pavi) AVIStreamSampleToTime(pavi, AVIStreamEnd(pavi)) 1367 1368 #define AVIStreamSampleSize(pavi, lPos, plSize) AVIStreamRead(pavi,lPos,1,NULL,0,plSize,NULL) 1369 1370 #define AVIStreamFormatSize(pavi, lPos, plSize) AVIStreamReadFormat(pavi,lPos,NULL,plSize) 1371 1372 #define AVIStreamDataSize(pavi, fcc, plSize) AVIStreamReadData(pavi,fcc,NULL,plSize) 1373 1374 #ifndef comptypeDIB 1375 #define comptypeDIB mmioFOURCC('D', 'I', 'B', ' ') 1376 #endif 1377 1378 STDAPI AVIMakeCompressedStream( 1379 PAVISTREAM FAR * ppsCompressed, 1380 PAVISTREAM ppsSource, 1381 AVICOMPRESSOPTIONS FAR * lpOptions, 1382 CLSID FAR *pclsidHandler); 1383 1384 EXTERN_C HRESULT CDECL AVISaveA (LPCSTR szFile, 1385 CLSID FAR *pclsidHandler, 1386 AVISAVECALLBACK lpfnCallback, 1387 int nStreams, 1388 PAVISTREAM pfile, 1389 LPAVICOMPRESSOPTIONS lpOptions, 1390 ...); 1391 1392 STDAPI AVISaveVA(LPCSTR szFile, 1393 CLSID FAR *pclsidHandler, 1394 AVISAVECALLBACK lpfnCallback, 1395 int nStreams, 1396 PAVISTREAM FAR * ppavi, 1397 LPAVICOMPRESSOPTIONS FAR *plpOptions); 1398 EXTERN_C HRESULT CDECL AVISaveW (LPCWSTR szFile, 1399 CLSID FAR *pclsidHandler, 1400 AVISAVECALLBACK lpfnCallback, 1401 int nStreams, 1402 PAVISTREAM pfile, 1403 LPAVICOMPRESSOPTIONS lpOptions, 1404 ...); 1405 1406 STDAPI AVISaveVW(LPCWSTR szFile, 1407 CLSID FAR *pclsidHandler, 1408 AVISAVECALLBACK lpfnCallback, 1409 int nStreams, 1410 PAVISTREAM FAR * ppavi, 1411 LPAVICOMPRESSOPTIONS FAR *plpOptions); 1412 #ifdef UNICODE 1413 #define AVISave AVISaveW 1414 #define AVISaveV AVISaveVW 1415 #else 1416 #define AVISave AVISaveA 1417 #define AVISaveV AVISaveVA 1418 #endif 1419 1420 1421 1422 STDAPI_(INT_PTR) AVISaveOptions(HWND hwnd, 1423 UINT uiFlags, 1424 int nStreams, 1425 PAVISTREAM FAR *ppavi, 1426 LPAVICOMPRESSOPTIONS FAR *plpOptions); 1427 1428 STDAPI AVISaveOptionsFree(int nStreams, 1429 LPAVICOMPRESSOPTIONS FAR *plpOptions); 1430 1431 STDAPI AVIBuildFilterW(LPWSTR lpszFilter, LONG cbFilter, BOOL fSaving); 1432 STDAPI AVIBuildFilterA(LPSTR lpszFilter, LONG cbFilter, BOOL fSaving); 1433 #ifdef UNICODE 1434 #define AVIBuildFilter AVIBuildFilterW 1435 #else 1436 #define AVIBuildFilter AVIBuildFilterA 1437 #endif 1438 STDAPI AVIMakeFileFromStreams(PAVIFILE FAR * ppfile, 1439 int nStreams, 1440 PAVISTREAM FAR * papStreams); 1441 1442 STDAPI AVIMakeStreamFromClipboard(UINT cfFormat, HANDLE hGlobal, PAVISTREAM FAR *ppstream); 1443 1444 STDAPI AVIPutFileOnClipboard(PAVIFILE pf); 1445 1446 STDAPI AVIGetFromClipboard(PAVIFILE FAR * lppf); 1447 1448 STDAPI AVIClearClipboard(void); 1449 1450 STDAPI CreateEditableStream( 1451 PAVISTREAM FAR * ppsEditable, 1452 PAVISTREAM psSource); 1453 1454 STDAPI EditStreamCut(PAVISTREAM pavi, LONG FAR *plStart, LONG FAR *plLength, PAVISTREAM FAR * ppResult); 1455 1456 STDAPI EditStreamCopy(PAVISTREAM pavi, LONG FAR *plStart, LONG FAR *plLength, PAVISTREAM FAR * ppResult); 1457 1458 STDAPI EditStreamPaste(PAVISTREAM pavi, LONG FAR *plPos, LONG FAR *plLength, PAVISTREAM pstream, LONG lStart, LONG lEnd); 1459 1460 STDAPI EditStreamClone(PAVISTREAM pavi, PAVISTREAM FAR *ppResult); 1461 1462 1463 STDAPI EditStreamSetNameA(PAVISTREAM pavi, LPCSTR lpszName); 1464 STDAPI EditStreamSetNameW(PAVISTREAM pavi, LPCWSTR lpszName); 1465 STDAPI EditStreamSetInfoW(PAVISTREAM pavi, LPAVISTREAMINFOW lpInfo, LONG cbInfo); 1466 STDAPI EditStreamSetInfoA(PAVISTREAM pavi, LPAVISTREAMINFOA lpInfo, LONG cbInfo); 1467 #ifdef UNICODE 1468 #define EditStreamSetInfo EditStreamSetInfoW 1469 #define EditStreamSetName EditStreamSetNameW 1470 #else 1471 #define EditStreamSetInfo EditStreamSetInfoA 1472 #define EditStreamSetName EditStreamSetNameA 1473 #endif 1474 +/ 1475 const AVIERR_OK = 0L; 1476 1477 SCODE MAKE_AVIERR(DWORD error) { 1478 return MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x4000 + error); 1479 } 1480 1481 const AVIERR_UNSUPPORTED = MAKE_AVIERR(101); 1482 const AVIERR_BADFORMAT = MAKE_AVIERR(102); 1483 const AVIERR_MEMORY = MAKE_AVIERR(103); 1484 const AVIERR_INTERNAL = MAKE_AVIERR(104); 1485 const AVIERR_BADFLAGS = MAKE_AVIERR(105); 1486 const AVIERR_BADPARAM = MAKE_AVIERR(106); 1487 const AVIERR_BADSIZE = MAKE_AVIERR(107); 1488 const AVIERR_BADHANDLE = MAKE_AVIERR(108); 1489 const AVIERR_FILEREAD = MAKE_AVIERR(109); 1490 const AVIERR_FILEWRITE = MAKE_AVIERR(110); 1491 const AVIERR_FILEOPEN = MAKE_AVIERR(111); 1492 const AVIERR_COMPRESSOR = MAKE_AVIERR(112); 1493 const AVIERR_NOCOMPRESSOR = MAKE_AVIERR(113); 1494 const AVIERR_READONLY = MAKE_AVIERR(114); 1495 const AVIERR_NODATA = MAKE_AVIERR(115); 1496 const AVIERR_BUFFERTOOSMALL = MAKE_AVIERR(116); 1497 const AVIERR_CANTCOMPRESS = MAKE_AVIERR(117); 1498 const AVIERR_USERABORT = MAKE_AVIERR(198); 1499 const AVIERR_ERROR = MAKE_AVIERR(199); 1500 1501 const TCHAR[] MCIWND_WINDOW_CLASS = "MCIWndClass"; 1502 1503 extern (Windows) { 1504 HWND MCIWndCreateA(HWND hwndParent, HINSTANCE hInstance, DWORD dwStyle, LPCSTR szFile); 1505 HWND MCIWndCreateW(HWND hwndParent, HINSTANCE hInstance, DWORD dwStyle, LPCWSTR szFile); 1506 } 1507 1508 version(Unicode) { 1509 alias MCIWndCreateW MCIWndCreate; 1510 } else { // Unicode 1511 alias MCIWndCreateA MCIWndCreate; 1512 } 1513 1514 extern(Windows) { 1515 BOOL MCIWndRegisterClass(); 1516 } 1517 1518 enum { 1519 MCIWNDOPENF_NEW = 0x0001, 1520 MCIWNDF_NOAUTOSIZEWINDOW = 0x0001, 1521 MCIWNDF_NOPLAYBAR = 0x0002, 1522 MCIWNDF_NOAUTOSIZEMOVIE = 0x0004, 1523 MCIWNDF_NOMENU = 0x0008, 1524 MCIWNDF_SHOWNAME = 0x0010, 1525 MCIWNDF_SHOWPOS = 0x0020, 1526 MCIWNDF_SHOWMODE = 0x0040, 1527 MCIWNDF_SHOWALL = 0x0070, 1528 MCIWNDF_NOTIFYMODE = 0x0100, 1529 MCIWNDF_NOTIFYPOS = 0x0200, 1530 MCIWNDF_NOTIFYSIZE = 0x0400, 1531 MCIWNDF_NOTIFYERROR = 0x1000, 1532 MCIWNDF_NOTIFYALL = 0x1F00, 1533 MCIWNDF_NOTIFYANSI = 0x0080, 1534 MCIWNDF_NOTIFYMEDIAA = 0x0880, 1535 MCIWNDF_NOTIFYMEDIAW = 0x0800, 1536 } 1537 1538 version(Unicode) { 1539 alias MCIWNDF_NOTIFYMEDIAW MCIWNDF_NOTIFYMEDIA; 1540 } else { // Unicode 1541 alias MCIWNDF_NOTIFYMEDIAA MCIWNDF_NOTIFYMEDIA; 1542 } 1543 1544 enum { 1545 MCIWNDF_RECORD = 0x2000, 1546 MCIWNDF_NOERRORDLG = 0x4000, 1547 MCIWNDF_NOOPEN = 0x8000, 1548 } 1549 1550 // can macros 1551 1552 BOOL MCIWndCanPlay(HWND hwnd) 1553 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_CAN_PLAY, 0, 0); } 1554 BOOL MCIWndCanRecord(HWND hwnd) 1555 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_CAN_RECORD, 0, 0); } 1556 BOOL MCIWndCanSave(HWND hwnd) 1557 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_CAN_SAVE, 0, 0); } 1558 BOOL MCIWndCanWindow(HWND hwnd) 1559 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_CAN_WINDOW, 0, 0); } 1560 BOOL MCIWndCanEject(HWND hwnd) 1561 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_CAN_EJECT, 0, 0); } 1562 BOOL MCIWndCanConfig(HWND hwnd) 1563 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_CAN_CONFIG, 0, 0); } 1564 BOOL MCIWndPaletteKick(HWND hwnd) 1565 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_PALETTEKICK, 0, 0); } 1566 LONG MCIWndSave(HWND hwnd, LPVOID szFile) 1567 { return cast(LONG)SendMessage(hwnd, MCI_SAVE, 0, cast(LPARAM)szFile); } 1568 LONG MCIWndSaveDialog(HWND hwnd) 1569 { return MCIWndSave(hwnd, cast(LPVOID)-1); } 1570 LONG MCIWndNew(HWND hwnd, LPVOID lp) 1571 { return cast(LONG)SendMessage(hwnd, MCIWNDM_NEW, 0, cast(LPARAM)lp); } 1572 LONG MCIWndRecord(HWND hwnd) 1573 { return cast(LONG)SendMessage(hwnd, MCI_RECORD, 0, 0); } 1574 LONG MCIWndOpen(HWND hwnd, LPVOID sz, UINT f) 1575 { return cast(LONG)SendMessage(hwnd, MCIWNDM_OPEN, cast(WPARAM)f, cast(LPARAM)sz); } 1576 LONG MCIWndOpenDialog(HWND hwnd) 1577 { return MCIWndOpen(hwnd, cast(LPVOID)-1, 0); } 1578 LONG MCIWndClose(HWND hwnd) 1579 { return cast(LONG)SendMessage(hwnd, MCI_CLOSE, 0, 0); } 1580 LONG MCIWndPlay(HWND hwnd) 1581 { return cast(LONG)SendMessage(hwnd, MCI_PLAY, 0, 0); } 1582 LONG MCIWndStop(HWND hwnd) 1583 { return cast(LONG)SendMessage(hwnd, MCI_STOP, 0, 0); } 1584 LONG MCIWndPause(HWND hwnd) 1585 { return cast(LONG)SendMessage(hwnd, MCI_PAUSE, 0, 0); } 1586 LONG MCIWndResume(HWND hwnd) 1587 { return cast(LONG)SendMessage(hwnd, MCI_RESUME, 0, 0); } 1588 LONG MCIWndSeek(HWND hwnd, LONG lPos) 1589 { return cast(LONG)SendMessage(hwnd, MCI_SEEK, 0, cast(LPARAM)lPos); } 1590 LONG MCIWndHome(HWND hwnd) 1591 { return MCIWndSeek(hwnd, MCIWND_START); } 1592 LONG MCIWndEnd(HWND hwnd) 1593 { return MCIWndSeek(hwnd, MCIWND_END); } 1594 LONG MCIWndEject(HWND hwnd) 1595 { return cast(LONG)SendMessage(hwnd, MCIWNDM_EJECT, 0, 0); } 1596 LONG MCIWndGetSource(HWND hwnd, LPRECT prc) 1597 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GET_SOURCE, 0, cast(LPARAM)prc); } 1598 LONG MCIWndPutSource(HWND hwnd, LPRECT prc) 1599 { return cast(LONG)SendMessage(hwnd, MCIWNDM_PUT_SOURCE, 0, cast(LPARAM)prc); } 1600 LONG MCIWndGetDest(HWND hwnd, LPRECT prc) 1601 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GET_DEST, 0, cast(LPARAM)prc); } 1602 LONG MCIWndPutDest(HWND hwnd, LPRECT prc) 1603 { return cast(LONG)SendMessage(hwnd, MCIWNDM_PUT_DEST, 0, cast(LPARAM)prc); } 1604 LONG MCIWndPlayReverse(HWND hwnd) 1605 { return cast(LONG)SendMessage(hwnd, MCIWNDM_PLAYREVERSE, 0, 0); } 1606 LONG MCIWndPlayFrom(HWND hwnd, LONG lPos) 1607 { return cast(LONG)SendMessage(hwnd, MCIWNDM_PLAYFROM, 0, cast(LPARAM)lPos); } 1608 LONG MCIWndPlayTo(HWND hwnd, LONG lPos) 1609 { return cast(LONG)SendMessage(hwnd, MCIWNDM_PLAYTO, 0, cast(LPARAM)lPos); } 1610 LONG MCIWndPlayFromTo(HWND hwnd, LONG lStart, LONG lEnd) 1611 { MCIWndSeek(hwnd, lStart); return MCIWndPlayTo(hwnd, lEnd); } 1612 UINT MCIWndGetDeviceID(HWND hwnd) 1613 { return cast(UINT)SendMessage(hwnd, MCIWNDM_GETDEVICEID, 0, 0); } 1614 UINT MCIWndGetAlias(HWND hwnd) 1615 { return cast(UINT)SendMessage(hwnd, MCIWNDM_GETALIAS, 0, 0); } 1616 LONG MCIWndGetMode(HWND hwnd, LPTSTR lp, UINT len) 1617 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETMODE, cast(WPARAM)len, cast(LPARAM)lp); } 1618 LONG MCIWndGetPosition(HWND hwnd) 1619 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETPOSITION, 0, 0); } 1620 LONG MCIWndGetPositionString(HWND hwnd, LPTSTR lp, UINT len) 1621 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETPOSITION, cast(WPARAM)len, cast(LPARAM)lp); } 1622 LONG MCIWndGetStart(HWND hwnd) 1623 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETSTART, 0, 0); } 1624 LONG MCIWndGetLength(HWND hwnd) 1625 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETLENGTH, 0, 0); } 1626 LONG MCIWndGetEnd(HWND hwnd) 1627 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETEND, 0, 0); } 1628 LONG MCIWndStep(HWND hwnd, LONG n) 1629 { return cast(LONG)SendMessage(hwnd, MCI_STEP, 0, cast(LPARAM)n); } 1630 void MCIWndDestroy(HWND hwnd) 1631 { SendMessage(hwnd, WM_CLOSE, 0, 0); } 1632 void MCIWndSetZoom(HWND hwnd, UINT iZoom) 1633 { SendMessage(hwnd, MCIWNDM_SETZOOM, 0, cast(LPARAM)iZoom); } 1634 UINT MCIWndGetZoom(HWND hwnd) 1635 { return cast(UINT)SendMessage(hwnd, MCIWNDM_GETZOOM, 0, 0); } 1636 LONG MCIWndSetVolume(HWND hwnd, UINT iVol) 1637 { return cast(LONG)SendMessage(hwnd, MCIWNDM_SETVOLUME, 0, cast(LPARAM)iVol); } 1638 LONG MCIWndGetVolume(HWND hwnd) 1639 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETVOLUME, 0, 0); } 1640 LONG MCIWndSetSpeed(HWND hwnd, UINT iSpeed) 1641 { return cast(LONG)SendMessage(hwnd, MCIWNDM_SETSPEED, 0, cast(LPARAM)iSpeed); } 1642 LONG MCIWndGetSpeed(HWND hwnd) 1643 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETSPEED, 0, 0); } 1644 LONG MCIWndSetTimeFormat(HWND hwnd, LPTSTR lp) 1645 { return cast(LONG)SendMessage(hwnd, MCIWNDM_SETTIMEFORMAT, 0, cast(LPARAM)lp); } 1646 LONG MCIWndUseFrames(HWND hwnd) 1647 { return MCIWndSetTimeFormat(hwnd, (cast(TCHAR[])"frames").ptr); } 1648 LONG MCIWndUseTime(HWND hwnd) 1649 { return MCIWndSetTimeFormat(hwnd, (cast(TCHAR[])"ms").ptr); } 1650 LONG MCIWndGetTimeFormat(HWND hwnd, LPTSTR lp, UINT len) 1651 { return cast(LONG)SendMessage(hwnd, MCIWNDM_GETTIMEFORMAT, cast(WPARAM)len, cast(LPARAM)lp); } 1652 void MCIWndValidateMedia(HWND hwnd) 1653 { SendMessage(hwnd, MCIWNDM_VALIDATEMEDIA, 0, 0); } 1654 void MCIWndSetRepeat(HWND hwnd, BOOL f) 1655 { SendMessage(hwnd, MCIWNDM_SETREPEAT, 0, cast(LPARAM)f); } 1656 BOOL MCIWndGetRepeat(HWND hwnd) 1657 { return cast(BOOL)SendMessage(hwnd, MCIWNDM_GETREPEAT, 0, 0); } 1658 void MCIWndSetActiveTimer(HWND hwnd, UINT active) 1659 { SendMessage(hwnd, MCIWNDM_SETACTIVETIMER, cast(WPARAM)active, 0); } 1660 void MCIWndSetInactiveTimer(HWND hwnd, UINT inactive) 1661 { SendMessage(hwnd, MCIWNDM_SETINACTIVETIMER, cast(WPARAM)inactive, 0); } 1662 void MCIWndSetTimers(HWND hwnd, UINT active, UINT inactive) 1663 { SendMessage(hwnd, MCIWNDM_SETTIMERS, cast(WPARAM)active, cast(LPARAM)inactive); } 1664 UINT MCIWndGetActiveTimer(HWND hwnd) 1665 { return cast(UINT)SendMessage(hwnd, MCIWNDM_GETACTIVETIMER, 0, 0); } 1666 UINT MCIWndGetInactiveTimer(HWND hwnd) 1667 { return cast(UINT)SendMessage(hwnd, MCIWNDM_GETINACTIVETIMER, 0, 0); } 1668 LONG MCIWndRealize(HWND hwnd, BOOL fBkgnd) 1669 { return SendMessage(hwnd, MCIWNDM_REALIZE, cast(WPARAM)fBkgnd, 0); } 1670 LONG MCIWndSendString(HWND hwnd, LPTSTR sz) 1671 { return SendMessage(hwnd, MCIWNDM_SENDSTRING, 0, cast(LPARAM)sz); } 1672 LONG MCIWndReturnString(HWND hwnd, LPVOID lp, UINT len) 1673 { return SendMessage(hwnd, MCIWNDM_RETURNSTRING, cast(WPARAM)len, cast(LPARAM)lp); } 1674 LONG MCIWndGetError(HWND hwnd, LPVOID lp, UINT len) 1675 { return SendMessage(hwnd, MCIWNDM_GETERROR, cast(WPARAM)len, cast(LPARAM)lp); } 1676 HPALETTE MCIWndGetPalette(HWND hwnd) 1677 { return cast(HPALETTE)SendMessage(hwnd, MCIWNDM_GETPALETTE, 0, 0); } 1678 LONG MCIWndSetPalette(HWND hwnd, HPALETTE hpal) 1679 { return SendMessage(hwnd, MCIWNDM_SETPALETTE, cast(WPARAM)hpal, 0); } 1680 LONG MCIWndGetFileName(HWND hwnd, LPVOID lp, UINT len) 1681 { return SendMessage(hwnd, MCIWNDM_GETFILENAME, cast(WPARAM)len, cast(LPARAM)lp); } 1682 LONG MCIWndGetDevice(HWND hwnd, LPVOID lp, UINT len) 1683 { return SendMessage(hwnd, MCIWNDM_GETDEVICE, cast(WPARAM)len, cast(LPARAM)lp); } 1684 UINT MCIWndGetStyles(HWND hwnd) 1685 { return SendMessage(hwnd, MCIWNDM_GETSTYLES, 0, 0); } 1686 LONG MCIWndChangeStyles(HWND hwnd, UINT mask, LONG value) 1687 { return SendMessage(hwnd, MCIWNDM_CHANGESTYLES, cast(WPARAM)mask, cast(LPARAM)value); } 1688 LONG MCIWndOpenInterface(HWND hwnd, LPUNKNOWN pUnk) 1689 { return SendMessage(hwnd, MCIWNDM_OPENINTERFACE, 0, cast(LPARAM)cast(void*)pUnk); } 1690 LONG MCIWndSetOwner(HWND hwnd, HWND hwndP) 1691 { return SendMessage(hwnd, MCIWNDM_SETOWNER, cast(WPARAM)hwndP, 0); } 1692 1693 enum { 1694 MCIWNDM_GETDEVICEID = WM_USER + 100, 1695 MCIWNDM_SENDSTRINGA = WM_USER + 101, 1696 MCIWNDM_GETPOSITIONA = WM_USER + 102, 1697 MCIWNDM_GETSTART = WM_USER + 103, 1698 MCIWNDM_GETLENGTH = WM_USER + 104, 1699 MCIWNDM_GETEND = WM_USER + 105, 1700 MCIWNDM_GETMODEA = WM_USER + 106, 1701 MCIWNDM_EJECT = WM_USER + 107, 1702 MCIWNDM_SETZOOM = WM_USER + 108, 1703 MCIWNDM_GETZOOM = WM_USER + 109, 1704 MCIWNDM_SETVOLUME = WM_USER + 110, 1705 MCIWNDM_GETVOLUME = WM_USER + 111, 1706 MCIWNDM_SETSPEED = WM_USER + 112, 1707 MCIWNDM_GETSPEED = WM_USER + 113, 1708 MCIWNDM_SETREPEAT = WM_USER + 114, 1709 MCIWNDM_GETREPEAT = WM_USER + 115, 1710 MCIWNDM_REALIZE = WM_USER + 118, 1711 MCIWNDM_SETTIMEFORMATA = WM_USER + 119, 1712 MCIWNDM_GETTIMEFORMATA = WM_USER + 120, 1713 MCIWNDM_VALIDATEMEDIA = WM_USER + 121, 1714 MCIWNDM_PLAYFROM = WM_USER + 122, 1715 MCIWNDM_PLAYTO = WM_USER + 123, 1716 MCIWNDM_GETFILENAMEA = WM_USER + 124, 1717 MCIWNDM_GETDEVICEA = WM_USER + 125, 1718 MCIWNDM_GETPALETTE = WM_USER + 126, 1719 MCIWNDM_SETPALETTE = WM_USER + 127, 1720 MCIWNDM_GETERRORA = WM_USER + 128, 1721 MCIWNDM_SETTIMERS = WM_USER + 129, 1722 MCIWNDM_SETACTIVETIMER = WM_USER + 130, 1723 MCIWNDM_SETINACTIVETIMER = WM_USER + 131, 1724 MCIWNDM_GETACTIVETIMER = WM_USER + 132, 1725 MCIWNDM_GETINACTIVETIMER = WM_USER + 133, 1726 MCIWNDM_NEWA = WM_USER + 134, 1727 MCIWNDM_CHANGESTYLES = WM_USER + 135, 1728 MCIWNDM_GETSTYLES = WM_USER + 136, 1729 MCIWNDM_GETALIAS = WM_USER + 137, 1730 MCIWNDM_RETURNSTRINGA = WM_USER + 138, 1731 MCIWNDM_PLAYREVERSE = WM_USER + 139, 1732 MCIWNDM_GET_SOURCE = WM_USER + 140, 1733 MCIWNDM_PUT_SOURCE = WM_USER + 141, 1734 MCIWNDM_GET_DEST = WM_USER + 142, 1735 MCIWNDM_PUT_DEST = WM_USER + 143, 1736 MCIWNDM_CAN_PLAY = WM_USER + 144, 1737 MCIWNDM_CAN_WINDOW = WM_USER + 145, 1738 MCIWNDM_CAN_RECORD = WM_USER + 146, 1739 MCIWNDM_CAN_SAVE = WM_USER + 147, 1740 MCIWNDM_CAN_EJECT = WM_USER + 148, 1741 MCIWNDM_CAN_CONFIG = WM_USER + 149, 1742 MCIWNDM_PALETTEKICK = WM_USER + 150, 1743 MCIWNDM_OPENINTERFACE = WM_USER + 151, 1744 MCIWNDM_SETOWNER = WM_USER + 152, 1745 MCIWNDM_OPENA = WM_USER + 153, 1746 MCIWNDM_SENDSTRINGW = WM_USER + 201, 1747 MCIWNDM_GETPOSITIONW = WM_USER + 202, 1748 MCIWNDM_GETMODEW = WM_USER + 206, 1749 MCIWNDM_SETTIMEFORMATW = WM_USER + 219, 1750 MCIWNDM_GETTIMEFORMATW = WM_USER + 220, 1751 MCIWNDM_GETFILENAMEW = WM_USER + 224, 1752 MCIWNDM_GETDEVICEW = WM_USER + 225, 1753 MCIWNDM_GETERRORW = WM_USER + 228, 1754 MCIWNDM_NEWW = WM_USER + 234, 1755 MCIWNDM_RETURNSTRINGW = WM_USER + 238, 1756 MCIWNDM_OPENW = WM_USER + 252, 1757 } 1758 1759 version(Unicode) { 1760 alias MCIWNDM_SENDSTRINGW MCIWNDM_SENDSTRING; 1761 alias MCIWNDM_GETPOSITIONW MCIWNDM_GETPOSITION; 1762 alias MCIWNDM_GETMODEW MCIWNDM_GETMODE; 1763 alias MCIWNDM_SETTIMEFORMATW MCIWNDM_SETTIMEFORMAT; 1764 alias MCIWNDM_GETTIMEFORMATW MCIWNDM_GETTIMEFORMAT; 1765 alias MCIWNDM_GETFILENAMEW MCIWNDM_GETFILENAME; 1766 alias MCIWNDM_GETDEVICEW MCIWNDM_GETDEVICE; 1767 alias MCIWNDM_GETERRORW MCIWNDM_GETERROR; 1768 alias MCIWNDM_NEWW MCIWNDM_NEW; 1769 alias MCIWNDM_RETURNSTRINGW MCIWNDM_RETURNSTRING; 1770 alias MCIWNDM_OPENW MCIWNDM_OPEN; 1771 } else { // Unicode 1772 alias MCIWNDM_SENDSTRINGA MCIWNDM_SENDSTRING; 1773 alias MCIWNDM_GETPOSITIONA MCIWNDM_GETPOSITION; 1774 alias MCIWNDM_GETMODEA MCIWNDM_GETMODE; 1775 alias MCIWNDM_SETTIMEFORMATA MCIWNDM_SETTIMEFORMAT; 1776 alias MCIWNDM_GETTIMEFORMATA MCIWNDM_GETTIMEFORMAT; 1777 alias MCIWNDM_GETFILENAMEA MCIWNDM_GETFILENAME; 1778 alias MCIWNDM_GETDEVICEA MCIWNDM_GETDEVICE; 1779 alias MCIWNDM_GETERRORA MCIWNDM_GETERROR; 1780 alias MCIWNDM_NEWA MCIWNDM_NEW; 1781 alias MCIWNDM_RETURNSTRINGA MCIWNDM_RETURNSTRING; 1782 alias MCIWNDM_OPENA MCIWNDM_OPEN; 1783 } 1784 1785 enum { 1786 MCIWNDM_NOTIFYMODE = WM_USER + 200, 1787 MCIWNDM_NOTIFYPOS = WM_USER + 201, 1788 MCIWNDM_NOTIFYSIZE = WM_USER + 202, 1789 MCIWNDM_NOTIFYMEDIA = WM_USER + 203, 1790 MCIWNDM_NOTIFYERROR = WM_USER + 205, 1791 } 1792 1793 const MCIWND_START = -1; 1794 const MCIWND_END = -2; 1795 1796 enum { 1797 MCI_CLOSE = 0x0804, 1798 MCI_PLAY = 0x0806, 1799 MCI_SEEK = 0x0807, 1800 MCI_STOP = 0x0808, 1801 MCI_PAUSE = 0x0809, 1802 MCI_STEP = 0x080E, 1803 MCI_RECORD = 0x080F, 1804 MCI_SAVE = 0x0813, 1805 MCI_CUT = 0x0851, 1806 MCI_COPY = 0x0852, 1807 MCI_PASTE = 0x0853, 1808 MCI_RESUME = 0x0855, 1809 MCI_DELETE = 0x0856, 1810 } 1811 1812 enum { 1813 MCI_MODE_NOT_READY = 524, 1814 MCI_MODE_STOP, 1815 MCI_MODE_PLAY, 1816 MCI_MODE_RECORD, 1817 MCI_MODE_SEEK, 1818 MCI_MODE_PAUSE, 1819 MCI_MODE_OPEN, 1820 } 1821 1822 alias HANDLE HVIDEO; 1823 alias HVIDEO* LPHVIDEO; 1824 1825 // Error Return Values 1826 1827 enum { 1828 DV_ERR_OK = 0, 1829 DV_ERR_BASE = 1, 1830 DV_ERR_NONSPECIFIC = DV_ERR_BASE, 1831 DV_ERR_BADFORMAT = DV_ERR_BASE + 1, 1832 DV_ERR_STILLPLAYING = DV_ERR_BASE + 2, 1833 DV_ERR_UNPREPARED = DV_ERR_BASE + 3, 1834 DV_ERR_SYNC = DV_ERR_BASE + 4, 1835 DV_ERR_TOOMANYCHANNELS = DV_ERR_BASE + 5, 1836 DV_ERR_NOTDETECTED = DV_ERR_BASE + 6, 1837 DV_ERR_BADINSTALL = DV_ERR_BASE + 7, 1838 DV_ERR_CREATEPALETTE = DV_ERR_BASE + 8, 1839 DV_ERR_SIZEFIELD = DV_ERR_BASE + 9, 1840 DV_ERR_PARAM1 = DV_ERR_BASE + 10, 1841 DV_ERR_PARAM2 = DV_ERR_BASE + 11, 1842 DV_ERR_CONFIG1 = DV_ERR_BASE + 12, 1843 DV_ERR_CONFIG2 = DV_ERR_BASE + 13, 1844 DV_ERR_FLAGS = DV_ERR_BASE + 14, 1845 DV_ERR_13 = DV_ERR_BASE + 15, 1846 DV_ERR_NOTSUPPORTED = DV_ERR_BASE + 16, 1847 DV_ERR_NOMEM = DV_ERR_BASE + 17, 1848 DV_ERR_ALLOCATED = DV_ERR_BASE + 18, 1849 DV_ERR_BADDEVICEID = DV_ERR_BASE + 19, 1850 DV_ERR_INVALHANDLE = DV_ERR_BASE + 20, 1851 DV_ERR_BADERRNUM = DV_ERR_BASE + 21, 1852 DV_ERR_NO_BUFFERS = DV_ERR_BASE + 22, 1853 DV_ERR_MEM_CONFLICT = DV_ERR_BASE + 23, 1854 DV_ERR_IO_CONFLICT = DV_ERR_BASE + 24, 1855 DV_ERR_DMA_CONFLICT = DV_ERR_BASE + 25, 1856 DV_ERR_INT_CONFLICT = DV_ERR_BASE + 26, 1857 DV_ERR_PROTECT_ONLY = DV_ERR_BASE + 27, 1858 DV_ERR_LASTERROR = DV_ERR_BASE + 27, 1859 DV_ERR_USER_MSG = DV_ERR_BASE + 1000, 1860 } 1861 1862 // Callback Messages 1863 1864 enum { 1865 MM_DRVM_OPEN = 0x3D0, 1866 MM_DRVM_CLOSE, 1867 MM_DRVM_DATA, 1868 MM_DRVM_ERROR, 1869 } 1870 1871 enum { 1872 DV_VM_OPEN = MM_DRVM_OPEN, 1873 DV_VM_CLOSE = MM_DRVM_CLOSE, 1874 DV_VM_DATA = MM_DRVM_DATA, 1875 DV_VM_ERROR = MM_DRVM_ERROR, 1876 } 1877 1878 /** 1879 * Structures 1880 */ 1881 1882 struct VIDEOHDR { 1883 LPBYTE lpData; 1884 DWORD dwBufferLength; 1885 DWORD dwBytesUsed; 1886 DWORD dwTimeCaptured; 1887 DWORD_PTR dwUser; 1888 DWORD dwFlags; 1889 DWORD_PTR dwReserved[4]; 1890 } 1891 alias VIDEOHDR* PVIDEOHDR, LPVIDEOHDR; 1892 1893 enum { 1894 VHDR_DONE = 0x00000001, 1895 VHDR_PREPARED = 0x00000002, 1896 VHDR_INQUEUE = 0x00000004, 1897 VHDR_KEYFRAME = 0x00000008, 1898 VHDR_VALID = 0x0000000F, 1899 } 1900 1901 struct CHANNEL_CAPS { 1902 DWORD dwFlags; 1903 DWORD dwSrcRectXMod; 1904 DWORD dwSrcRectYMod; 1905 DWORD dwSrcRectWidthMod; 1906 DWORD dwSrcRectHeightMod; 1907 DWORD dwDstRectXMod; 1908 DWORD dwDstRectYMod; 1909 DWORD dwDstRectWidthMod; 1910 DWORD dwDstRectHeightMod; 1911 } 1912 alias CHANNEL_CAPS* PCHANNEL_CAPS, LPCHANNEL_CAPS; 1913 1914 enum { 1915 VCAPS_OVERLAY = 0x00000001, 1916 VCAPS_SRC_CAN_CLIP = 0x00000002, 1917 VCAPS_DST_CAN_CLIP = 0x00000004, 1918 VCAPS_CAN_SCALE = 0x00000008, 1919 } 1920 1921 /** 1922 * API Flags 1923 */ 1924 1925 enum { 1926 VIDEO_EXTERNALIN = 0x0001, 1927 VIDEO_EXTERNALOUT = 0x0002, 1928 VIDEO_IN = 0x0004, 1929 VIDEO_OUT = 0x0008, 1930 VIDEO_DLG_QUERY = 0x0010, 1931 } 1932 1933 enum { 1934 VIDEO_CONFIGURE_QUERYSIZE = 0x0001, 1935 VIDEO_CONFIGURE_CURRENT = 0x0010, 1936 VIDEO_CONFIGURE_NOMINAL = 0x0020, 1937 VIDEO_CONFIGURE_MIN = 0x0040, 1938 VIDEO_CONFIGURE_MAX = 0x0080, 1939 VIDEO_CONFIGURE_SET = 0x1000, 1940 VIDEO_CONFIGURE_GET = 0x2000, 1941 VIDEO_CONFIGURE_QUERY = 0x8000, 1942 } 1943 1944 /** 1945 * CONFIGURE MESSAGES 1946 */ 1947 1948 enum { 1949 DVM_USER = 0x4000, 1950 DVM_CONFIGURE_START = 0x1000, 1951 DVM_CONFIGURE_END = 0x1FFF, 1952 DVM_PALETTE = DVM_CONFIGURE_START + 1, 1953 DVM_FORMAT = DVM_CONFIGURE_START + 2, 1954 DVM_PALETTERGB555 = DVM_CONFIGURE_START + 3, 1955 DVM_SRC_RECT = DVM_CONFIGURE_START + 4, 1956 DVM_DST_RECT = DVM_CONFIGURE_START + 5, 1957 } 1958 1959 /** 1960 * AVICap window class 1961 */ 1962 1963 LRESULT AVICapSM(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { 1964 if (IsWindow(hWnd)) { 1965 return SendMessage(hWnd, msg, wParam, lParam); 1966 } 1967 return 0; 1968 } 1969 1970 enum { 1971 WM_CAP_START = WM_USER, 1972 WM_CAP_UNICODE_START = WM_USER + 100, 1973 1974 WM_CAP_GET_CAPSTREAMPTR = WM_CAP_START + 1, 1975 WM_CAP_SET_CALLBACK_ERRORA = WM_CAP_START + 2, 1976 WM_CAP_SET_CALLBACK_STATUSA = WM_CAP_START + 3, 1977 1978 WM_CAP_SET_CALLBACK_ERRORW = WM_CAP_UNICODE_START + 2, 1979 WM_CAP_SET_CALLBACK_STATUSW = WM_CAP_UNICODE_START + 3, 1980 } 1981 1982 version(Unicode) { 1983 alias WM_CAP_SET_CALLBACK_ERRORW WM_CAP_SET_CALLBACK_ERROR; 1984 alias WM_CAP_SET_CALLBACK_STATUSW WM_CAP_SET_CALLBACK_STATUS; 1985 } else { // Unicode 1986 alias WM_CAP_SET_CALLBACK_ERRORA WM_CAP_SET_CALLBACK_ERROR; 1987 alias WM_CAP_SET_CALLBACK_STATUSA WM_CAP_SET_CALLBACK_STATUS; 1988 } 1989 1990 enum { 1991 WM_CAP_SET_CALLBACK_YIELD = WM_CAP_START + 4, 1992 WM_CAP_SET_CALLBACK_FRAME = WM_CAP_START + 5, 1993 WM_CAP_SET_CALLBACK_VIDEOSTREAM = WM_CAP_START + 6, 1994 WM_CAP_SET_CALLBACK_WAVESTREAM = WM_CAP_START + 7, 1995 WM_CAP_GET_USER_DATA = WM_CAP_START + 8, 1996 WM_CAP_SET_USER_DATA = WM_CAP_START + 9, 1997 WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10, 1998 WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11, 1999 WM_CAP_DRIVER_GET_NAMEA = WM_CAP_START + 12, 2000 WM_CAP_DRIVER_GET_VERSIONA = WM_CAP_START + 13, 2001 2002 WM_CAP_DRIVER_GET_NAMEW = WM_CAP_UNICODE_START + 12, 2003 WM_CAP_DRIVER_GET_VERSIONW = WM_CAP_UNICODE_START + 13, 2004 } 2005 2006 version(Unicode) { 2007 alias WM_CAP_DRIVER_GET_NAMEW WM_CAP_DRIVER_GET_NAME; 2008 alias WM_CAP_DRIVER_GET_VERSIONW WM_CAP_DRIVER_GET_VERSION; 2009 } else { // Unicode 2010 alias WM_CAP_DRIVER_GET_NAMEA WM_CAP_DRIVER_GET_NAME; 2011 alias WM_CAP_DRIVER_GET_VERSIONA WM_CAP_DRIVER_GET_VERSION; 2012 } 2013 2014 enum { 2015 WM_CAP_DRIVER_GET_CAPS = WM_CAP_START + 14, 2016 WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20, 2017 WM_CAP_FILE_GET_CAPTURE_FILEA = WM_CAP_START + 21, 2018 WM_CAP_FILE_SAVEASA = WM_CAP_START + 23, 2019 WM_CAP_FILE_SAVEDIBA = WM_CAP_START + 25, 2020 2021 WM_CAP_FILE_SET_CAPTURE_FILEW = WM_CAP_UNICODE_START + 20, 2022 WM_CAP_FILE_GET_CAPTURE_FILEW = WM_CAP_UNICODE_START + 21, 2023 WM_CAP_FILE_SAVEASW = WM_CAP_UNICODE_START + 23, 2024 WM_CAP_FILE_SAVEDIBW = WM_CAP_UNICODE_START + 25, 2025 } 2026 2027 version(Unicode) { 2028 alias WM_CAP_FILE_SET_CAPTURE_FILEW WM_CAP_FILE_SET_CAPTURE_FILE; 2029 alias WM_CAP_FILE_GET_CAPTURE_FILEW WM_CAP_FILE_GET_CAPTURE_FILE; 2030 alias WM_CAP_FILE_SAVEASW WM_CAP_FILE_SAVEAS; 2031 alias WM_CAP_FILE_SAVEDIBW WM_CAP_FILE_SAVEDIB; 2032 } else { // Unicode 2033 alias WM_CAP_FILE_SET_CAPTURE_FILEA WM_CAP_FILE_SET_CAPTURE_FILE; 2034 alias WM_CAP_FILE_GET_CAPTURE_FILEA WM_CAP_FILE_GET_CAPTURE_FILE; 2035 alias WM_CAP_FILE_SAVEASA WM_CAP_FILE_SAVEAS; 2036 alias WM_CAP_FILE_SAVEDIBA WM_CAP_FILE_SAVEDIB; 2037 } 2038 2039 enum { 2040 WM_CAP_FILE_ALLOCATE = WM_CAP_START + 22, 2041 WM_CAP_FILE_SET_INFOCHUNK = WM_CAP_START + 24, 2042 WM_CAP_EDIT_COPY = WM_CAP_START + 30, 2043 WM_CAP_SET_AUDIOFORMAT = WM_CAP_START + 35, 2044 WM_CAP_GET_AUDIOFORMAT = WM_CAP_START + 36, 2045 WM_CAP_DLG_VIDEOFORMAT = WM_CAP_START + 41, 2046 WM_CAP_DLG_VIDEOSOURCE = WM_CAP_START + 42, 2047 WM_CAP_DLG_VIDEODISPLAY = WM_CAP_START + 43, 2048 WM_CAP_GET_VIDEOFORMAT = WM_CAP_START + 44, 2049 WM_CAP_SET_VIDEOFORMAT = WM_CAP_START + 45, 2050 WM_CAP_DLG_VIDEOCOMPRESSION = WM_CAP_START + 46, 2051 WM_CAP_SET_PREVIEW = WM_CAP_START + 50, 2052 WM_CAP_SET_OVERLAY = WM_CAP_START + 51, 2053 WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52, 2054 WM_CAP_SET_SCALE = WM_CAP_START + 53, 2055 WM_CAP_GET_STATUS = WM_CAP_START + 54, 2056 WM_CAP_SET_SCROLL = WM_CAP_START + 55, 2057 WM_CAP_GRAB_FRAME = WM_CAP_START + 60, 2058 WM_CAP_GRAB_FRAME_NOSTOP = WM_CAP_START + 61, 2059 WM_CAP_SEQUENCE = WM_CAP_START + 62, 2060 WM_CAP_SEQUENCE_NOFILE = WM_CAP_START + 63, 2061 WM_CAP_SET_SEQUENCE_SETUP = WM_CAP_START + 64, 2062 WM_CAP_GET_SEQUENCE_SETUP = WM_CAP_START + 65, 2063 WM_CAP_SET_MCI_DEVICEA = WM_CAP_START + 66, 2064 WM_CAP_GET_MCI_DEVICEA = WM_CAP_START + 67, 2065 2066 WM_CAP_SET_MCI_DEVICEW = WM_CAP_UNICODE_START + 66, 2067 WM_CAP_GET_MCI_DEVICEW = WM_CAP_UNICODE_START + 67, 2068 } 2069 2070 version(Unicode) { 2071 alias WM_CAP_SET_MCI_DEVICEW WM_CAP_SET_MCI_DEVICE; 2072 alias WM_CAP_GET_MCI_DEVICEW WM_CAP_GET_MCI_DEVICE; 2073 } else { // Unicode 2074 alias WM_CAP_SET_MCI_DEVICEA WM_CAP_SET_MCI_DEVICE; 2075 alias WM_CAP_GET_MCI_DEVICEA WM_CAP_GET_MCI_DEVICE; 2076 } 2077 2078 enum { 2079 WM_CAP_STOP = WM_CAP_START + 68, 2080 WM_CAP_ABORT = WM_CAP_START + 69, 2081 WM_CAP_SINGLE_FRAME_OPEN = WM_CAP_START + 70, 2082 WM_CAP_SINGLE_FRAME_CLOSE = WM_CAP_START + 71, 2083 WM_CAP_SINGLE_FRAME = WM_CAP_START + 72, 2084 WM_CAP_PAL_OPENA = WM_CAP_START + 80, 2085 WM_CAP_PAL_SAVEA = WM_CAP_START + 81, 2086 2087 WM_CAP_PAL_OPENW = WM_CAP_UNICODE_START + 80, 2088 WM_CAP_PAL_SAVEW = WM_CAP_UNICODE_START + 81, 2089 } 2090 2091 version(Unicode) { 2092 alias WM_CAP_PAL_OPENW WM_CAP_PAL_OPEN; 2093 alias WM_CAP_PAL_SAVEW WM_CAP_PAL_SAVE; 2094 } else { // Unicode 2095 alias WM_CAP_PAL_OPENA WM_CAP_PAL_OPEN; 2096 alias WM_CAP_PAL_SAVEA WM_CAP_PAL_SAVE; 2097 } 2098 2099 enum { 2100 WM_CAP_PAL_PASTE = WM_CAP_START + 82, 2101 WM_CAP_PAL_AUTOCREATE = WM_CAP_START + 83, 2102 WM_CAP_PAL_MANUALCREATE = WM_CAP_START + 84, 2103 WM_CAP_SET_CALLBACK_CAPCONTROL = WM_CAP_START + 85, 2104 WM_CAP_UNICODE_END = WM_CAP_PAL_SAVEW, 2105 WM_CAP_END = WM_CAP_UNICODE_END, 2106 } 2107 2108 /** 2109 * message wrapper 2110 */ 2111 2112 BOOL capSetCallbackOnError(HWND hWnd, LPVOID fpProc) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_CALLBACK_ERROR, 0, cast(LPARAM)fpProc); } 2113 BOOL capSetCallbackOnStatus(HWND hWnd, LPVOID fpProc) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_CALLBACK_STATUS, 0, cast(LPARAM)fpProc); } 2114 BOOL capSetCallbackOnYield(HWND hWnd, LPVOID fpProc) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_CALLBACK_YIELD, 0, cast(LPARAM)fpProc); } 2115 BOOL capSetCallbackOnFrame(HWND hWnd, LPVOID fpProc) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_CALLBACK_FRAME, 0, cast(LPARAM)fpProc); } 2116 BOOL capSetCallbackOnVideoStream(HWND hWnd, LPVOID fpProc) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, cast(LPARAM)fpProc); } 2117 BOOL capSetCallbackOnWaveStream(HWND hWnd, LPVOID fpProc) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_CALLBACK_WAVESTREAM, 0, cast(LPARAM)fpProc); } 2118 BOOL capSetCallbackOnCapControl(HWND hWnd, LPVOID fpProc) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_CALLBACK_CAPCONTROL, 0, cast(LPARAM)fpProc); } 2119 2120 BOOL capSetUserData(HWND hWnd, LPARAM lUser) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_USER_DATA, 0, lUser); } 2121 BOOL capGetUserData(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_GET_USER_DATA, 0, 0); } 2122 2123 BOOL capDriverConnect(HWND hWnd, WPARAM i) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DRIVER_CONNECT, i, 0); } 2124 BOOL capDriverDisconnect(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DRIVER_DISCONNECT, 0, 0); } 2125 BOOL capDriverGetName(HWND hWnd, LPTSTR szName, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DRIVER_GET_NAME, wSize, cast(LPARAM)szName); } 2126 BOOL capDriverGetVersion(HWND hWnd, LPTSTR szVer, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DRIVER_GET_VERSION, wSize, cast(LPARAM)szVer); } 2127 BOOL capDriverGetCaps(HWND hWnd, LPCAPDRIVERCAPS s, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DRIVER_GET_CAPS, wSize, cast(LPARAM)s); } 2128 2129 BOOL capFileSetCaptureFile(HWND hWnd, LPTSTR szName) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_FILE_SET_CAPTURE_FILE, 0, cast(LPARAM)szName); } 2130 BOOL capFileGetCaptureFile(HWND hWnd, LPTSTR szName, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_FILE_GET_CAPTURE_FILE, wSize, cast(LPARAM)szName); } 2131 BOOL capFileAlloc(HWND hWnd, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_FILE_ALLOCATE, wSize, 0); } 2132 BOOL capFileSaveAs(HWND hWnd, LPTSTR szName) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_FILE_SAVEAS, 0, cast(LPARAM)szName); } 2133 BOOL capFileSetInfoChunk(HWND hWnd, LPCAPINFOCHUNK lpInfoChunk) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_FILE_SET_INFOCHUNK, 0, cast(LPARAM)lpInfoChunk); } 2134 BOOL capFileSaveDIB(HWND hWnd, LPTSTR szName) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_FILE_SAVEDIB, 0, cast(LPARAM)szName); } 2135 2136 BOOL capEditCopy(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_EDIT_COPY, 0, 0); } 2137 2138 BOOL capSetAudioFormat(HWND hWnd, LPWAVEFORMATEX s, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_AUDIOFORMAT, wSize, cast(LPARAM)s); } 2139 DWORD capGetAudioFormat(HWND hWnd, LPWAVEFORMATEX s, WPARAM wSize) { return cast(DWORD)AVICapSM(hWnd, WM_CAP_GET_AUDIOFORMAT, wSize, cast(LPARAM)s); } 2140 DWORD capGetAudioFormatSize(HWND hWnd) { return cast(DWORD)AVICapSM(hWnd, WM_CAP_GET_AUDIOFORMAT, 0, 0); } 2141 2142 BOOL capDlgVideoFormat(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DLG_VIDEOFORMAT, 0, 0); } 2143 BOOL capDlgVideoSource(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DLG_VIDEOSOURCE, 0, 0); } 2144 BOOL capDlgVideoDisplay(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DLG_VIDEODISPLAY, 0, 0); } 2145 BOOL capDlgVideoCompression(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_DLG_VIDEOCOMPRESSION, 0, 0); } 2146 2147 DWORD capGetVideoFormat(HWND hWnd, void* s, WPARAM wSize) { return cast(DWORD)AVICapSM(hWnd, WM_CAP_GET_VIDEOFORMAT, wSize, cast(LPARAM)s); } 2148 DWORD capGetVideoFormatSize(HWND hWnd) { return cast(DWORD)AVICapSM(hWnd, WM_CAP_GET_VIDEOFORMAT, 0, 0); } 2149 BOOL capSetVideoFormat(HWND hWnd, void* s, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_VIDEOFORMAT, wSize, cast(LPARAM)s); } 2150 2151 BOOL capPreview(HWND hWnd, BOOL f) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_PREVIEW, cast(WPARAM)f, 0); } 2152 BOOL capPreviewRate(HWND hWnd, WPARAM wMS) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_PREVIEWRATE, wMS, 0); } 2153 BOOL capOverlay(HWND hWnd, BOOL f) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_OVERLAY, cast(WPARAM)f, 0); } 2154 BOOL capPreviewScale(HWND hWnd, BOOL f) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_SCALE, cast(WPARAM)f, 0); } 2155 BOOL capGetStatus(HWND hWnd, LPCAPSTATUS s, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_GET_STATUS, wSize, cast(LPARAM)s); } 2156 BOOL capSetScrollPos(HWND hWnd, LPPOINT lpP) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_SCROLL, 0, cast(LPARAM)lpP); } 2157 2158 BOOL capGrabFrame(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_GRAB_FRAME, 0, 0); } 2159 BOOL capGrabFrameNoStop(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_GRAB_FRAME_NOSTOP, 0, 0); } 2160 2161 BOOL capCaptureSequence(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SEQUENCE, 0, 0); } 2162 BOOL capCaptureSequenceNoFile(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SEQUENCE_NOFILE, 0, 0); } 2163 BOOL capCaptureStop(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_STOP, 0, 0); } 2164 BOOL capCaptureAbort(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_ABORT, 0, 0); } 2165 2166 BOOL capCaptureSingleFrameOpen(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SINGLE_FRAME_OPEN, 0, 0); } 2167 BOOL capCaptureSingleFrameClose(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SINGLE_FRAME_CLOSE, 0, 0); } 2168 BOOL capCaptureSingleFrame(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SINGLE_FRAME, 0, 0); } 2169 2170 BOOL capCaptureGetSetup(HWND hWnd, LPCAPTUREPARMS s, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_GET_SEQUENCE_SETUP, wSize, cast(LPARAM)s); } 2171 BOOL capCaptureSetSetup(HWND hWnd, LPCAPTUREPARMS s, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_SEQUENCE_SETUP, wSize, cast(LPARAM)s); } 2172 2173 BOOL capSetMCIDeviceName(HWND hWnd, LPTSTR szName) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_SET_MCI_DEVICE, 0, cast(LPARAM)szName); } 2174 BOOL capGetMCIDeviceName(HWND hWnd, LPTSTR szName, WPARAM wSize) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_GET_MCI_DEVICE, wSize, cast(LPARAM)szName); } 2175 2176 BOOL capPaletteOpen(HWND hWnd, LPTSTR szName) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_PAL_OPEN, 0, cast(LPARAM)szName); } 2177 BOOL capPaletteSave(HWND hWnd, LPTSTR szName) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_PAL_SAVE, 0, cast(LPARAM)szName); } 2178 BOOL capPalettePaste(HWND hWnd) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_PAL_PASTE, 0, 0); } 2179 BOOL capPaletteAuto(HWND hWnd, WPARAM iFrames, LPARAM iColors) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_PAL_AUTOCREATE, iFrames, iColors); } 2180 BOOL capPaletteManual(HWND hWnd, WPARAM fGrab, LPARAM iColors) { return cast(BOOL)AVICapSM(hWnd, WM_CAP_PAL_MANUALCREATE, fGrab, iColors); } 2181 2182 /** 2183 * structs 2184 */ 2185 2186 struct CAPDRIVERCAPS { 2187 UINT wDeviceIndex; 2188 BOOL fHasOverlay; 2189 BOOL fHasDlgVideoSource; 2190 BOOL fHasDlgVideoFormat; 2191 BOOL fHasDlgVideoDisplay; 2192 BOOL fCaptureInitialized; 2193 BOOL fDriverSuppliesPalettes; 2194 HANDLE hVideoIn; 2195 HANDLE hVideoOut; 2196 HANDLE hVideoExtIn; 2197 HANDLE hVideoExtOut; 2198 } 2199 alias CAPDRIVERCAPS* PCAPDRIVERCAPS, LPCAPDRIVERCAPS; 2200 2201 struct CAPSTATUS { 2202 UINT uiImageWidth; 2203 UINT uiImageHeight; 2204 BOOL fLiveWindow; 2205 BOOL fOverlayWindow; 2206 BOOL fScale; 2207 POINT ptScroll; 2208 BOOL fUsingDefaultPalette; 2209 BOOL fAudioHardware; 2210 BOOL fCapFileExists; 2211 DWORD dwCurrentVideoFrame; 2212 DWORD dwCurrentVideoFramesDropped; 2213 DWORD dwCurrentWaveSamples; 2214 DWORD dwCurrentTimeElapsedMS; 2215 HPALETTE hPalCurrent; 2216 BOOL fCapturingNow; 2217 DWORD dwReturn; 2218 UINT wNumVideoAllocated; 2219 UINT wNumAudioAllocated; 2220 } 2221 alias CAPSTATUS* PCAPSTATUS, LPCAPSTATUS; 2222 2223 struct CAPTUREPARMS { 2224 DWORD dwRequestMicroSecPerFrame; 2225 BOOL fMakeUserHitOKToCapture; 2226 UINT wPercentDropForError; 2227 BOOL fYield; 2228 DWORD dwIndexSize; 2229 UINT wChunkGranularity; 2230 BOOL fUsingDOSMemory; 2231 UINT wNumVideoRequested; 2232 BOOL fCaptureAudio; 2233 UINT wNumAudioRequested; 2234 UINT vKeyAbort; 2235 BOOL fAbortLeftMouse; 2236 BOOL fAbortRightMouse; 2237 BOOL fLimitEnabled; 2238 UINT wTimeLimit; 2239 BOOL fMCIControl; 2240 BOOL fStepMCIDevice; 2241 DWORD dwMCIStartTime; 2242 DWORD dwMCIStopTime; 2243 BOOL fStepCaptureAt2x; 2244 UINT wStepCaptureAverageFrames; 2245 DWORD dwAudioBufferSize; 2246 BOOL fDisableWriteCache; 2247 UINT AVStreamMaster; 2248 } 2249 alias CAPTUREPARMS* PCAPTUREPARMS, LPCAPTUREPARMS; 2250 2251 const AVSTREAMMASTER_AUDIO = 0; 2252 const AVSTREAMMASTER_NONE = 1; 2253 2254 struct CAPINFOCHUNK { 2255 FOURCC fccInfoID; 2256 LPVOID lpData; 2257 LONG cbData; 2258 } 2259 alias CAPINFOCHUNK* PCAPINFOCHUNK, LPCAPINFOCHUNK; 2260 2261 // Callback Definitions 2262 2263 extern (Windows) { 2264 alias LRESULT function(HWND hWnd) CAPYIELDCALLBACK; 2265 alias LRESULT function(HWND hWnd, int nID, LPCWSTR lpsz) CAPSTATUSCALLBACKW; 2266 alias LRESULT function(HWND hWnd, int nID, LPCWSTR lpsz) CAPERRORCALLBACKW; 2267 alias LRESULT function(HWND hWnd, int nID, LPCSTR lpsz) CAPSTATUSCALLBACKA; 2268 alias LRESULT function(HWND hWnd, int nID, LPCSTR lpsz) CAPERRORCALLBACKA; 2269 } 2270 2271 version(Unicode) { 2272 alias CAPSTATUSCALLBACKW CAPSTATUSCALLBACK; 2273 alias CAPERRORCALLBACKW CAPERRORCALLBACK; 2274 } else { // Unicode 2275 alias CAPSTATUSCALLBACKA CAPSTATUSCALLBACK; 2276 alias CAPERRORCALLBACKA CAPERRORCALLBACK; 2277 } 2278 2279 extern (Windows) { 2280 alias LRESULT function(HWND hWnd, LPVIDEOHDR lpVHdr) CAPVIDEOCALLBACK; 2281 alias LRESULT function(HWND hWnd, LPWAVEHDR lpWHdr) CAPWAVECALLBACK; 2282 alias LRESULT function(HWND hWnd, int nState) CAPCONTROLCALLBACK; 2283 } 2284 2285 // CapControlCallback states 2286 const CONTROLCALLBACK_PREROLL = 1; 2287 const CONTROLCALLBACK_CAPTURING = 2; 2288 2289 extern (Windows) { 2290 HWND capCreateCaptureWindowA(LPCSTR lpszWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hwndParent, int nID); 2291 BOOL capGetDriverDescriptionA(UINT wDriverIndex, LPSTR lpszName, int cbName, LPSTR lpszVer, int cbVer); 2292 HWND capCreateCaptureWindowW(LPCWSTR lpszWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hwndParent, int nID); 2293 BOOL capGetDriverDescriptionW(UINT wDriverIndex, LPWSTR lpszName, int cbName, LPWSTR lpszVer, int cbVer); 2294 } 2295 2296 version(Unicode) { 2297 alias capCreateCaptureWindowW capCreateCaptureWindow; 2298 alias capGetDriverDescriptionW capGetDriverDescription; 2299 } else { // Unicode 2300 alias capCreateCaptureWindowA capCreateCaptureWindow; 2301 alias capGetDriverDescriptionA capGetDriverDescription; 2302 } 2303 2304 // New Information chunk IDs 2305 const infotypeDIGITIZATION_TIME = mmioFOURCC!('I', 'D', 'I', 'T'); 2306 const infotypeSMPTE_TIME = mmioFOURCC!('I', 'S', 'M', 'P'); 2307 2308 // status and error callbacks 2309 enum { 2310 IDS_CAP_BEGIN = 300, 2311 IDS_CAP_END = 301, 2312 2313 IDS_CAP_INFO = 401, 2314 IDS_CAP_OUTOFMEM = 402, 2315 IDS_CAP_FILEEXISTS = 403, 2316 IDS_CAP_ERRORPALOPEN = 404, 2317 IDS_CAP_ERRORPALSAVE = 405, 2318 IDS_CAP_ERRORDIBSAVE = 406, 2319 IDS_CAP_DEFAVIEXT = 407, 2320 IDS_CAP_DEFPALEXT = 408, 2321 IDS_CAP_CANTOPEN = 409, 2322 IDS_CAP_SEQ_MSGSTART = 410, 2323 IDS_CAP_SEQ_MSGSTOP = 411, 2324 2325 IDS_CAP_VIDEDITERR = 412, 2326 IDS_CAP_READONLYFILE = 413, 2327 IDS_CAP_WRITEERROR = 414, 2328 IDS_CAP_NODISKSPACE = 415, 2329 IDS_CAP_SETFILESIZE = 416, 2330 IDS_CAP_SAVEASPERCENT = 417, 2331 2332 IDS_CAP_DRIVER_ERROR = 418, 2333 2334 IDS_CAP_WAVE_OPEN_ERROR = 419, 2335 IDS_CAP_WAVE_ALLOC_ERROR = 420, 2336 IDS_CAP_WAVE_PREPARE_ERROR = 421, 2337 IDS_CAP_WAVE_ADD_ERROR = 422, 2338 IDS_CAP_WAVE_SIZE_ERROR = 423, 2339 2340 IDS_CAP_VIDEO_OPEN_ERROR = 424, 2341 IDS_CAP_VIDEO_ALLOC_ERROR = 425, 2342 IDS_CAP_VIDEO_PREPARE_ERROR = 426, 2343 IDS_CAP_VIDEO_ADD_ERROR = 427, 2344 IDS_CAP_VIDEO_SIZE_ERROR = 428, 2345 2346 IDS_CAP_FILE_OPEN_ERROR = 429, 2347 IDS_CAP_FILE_WRITE_ERROR = 430, 2348 IDS_CAP_RECORDING_ERROR = 431, 2349 IDS_CAP_RECORDING_ERROR2 = 432, 2350 IDS_CAP_AVI_INIT_ERROR = 433, 2351 IDS_CAP_NO_FRAME_CAP_ERROR = 434, 2352 IDS_CAP_NO_PALETTE_WARN = 435, 2353 IDS_CAP_MCI_CONTROL_ERROR = 436, 2354 IDS_CAP_MCI_CANT_STEP_ERROR = 437, 2355 IDS_CAP_NO_AUDIO_CAP_ERROR = 438, 2356 IDS_CAP_AVI_DRAWDIB_ERROR = 439, 2357 IDS_CAP_COMPRESSOR_ERROR = 440, 2358 IDS_CAP_AUDIO_DROP_ERROR = 441, 2359 IDS_CAP_AUDIO_DROP_COMPERROR = 442, 2360 2361 IDS_CAP_STAT_LIVE_MODE = 500, 2362 IDS_CAP_STAT_OVERLAY_MODE = 501, 2363 IDS_CAP_STAT_CAP_INIT = 502, 2364 IDS_CAP_STAT_CAP_FINI = 503, 2365 IDS_CAP_STAT_PALETTE_BUILD = 504, 2366 IDS_CAP_STAT_OPTPAL_BUILD = 505, 2367 IDS_CAP_STAT_I_FRAMES = 506, 2368 IDS_CAP_STAT_L_FRAMES = 507, 2369 IDS_CAP_STAT_CAP_L_FRAMES = 508, 2370 IDS_CAP_STAT_CAP_AUDIO = 509, 2371 IDS_CAP_STAT_VIDEOCURRENT = 510, 2372 IDS_CAP_STAT_VIDEOAUDIO = 511, 2373 IDS_CAP_STAT_VIDEOONLY = 512, 2374 IDS_CAP_STAT_FRAMESDROPPED = 513, 2375 } 2376 2377 /** 2378 * FilePreview dialog. 2379 */ 2380 2381 extern (Windows) { 2382 BOOL GetOpenFileNamePreviewA(LPOPENFILENAMEA lpofn); 2383 BOOL GetSaveFileNamePreviewA(LPOPENFILENAMEA lpofn); 2384 BOOL GetOpenFileNamePreviewW(LPOPENFILENAMEW lpofn); 2385 BOOL GetSaveFileNamePreviewW(LPOPENFILENAMEW lpofn); 2386 } 2387 2388 version(Unicode) { 2389 alias GetOpenFileNamePreviewW GetOpenFileNamePreview; 2390 alias GetSaveFileNamePreviewW GetSaveFileNamePreview; 2391 } else { // Unicode 2392 alias GetOpenFileNamePreviewA GetOpenFileNamePreview; 2393 alias GetSaveFileNamePreviewA GetSaveFileNamePreview; 2394 }