LZScene

Форк
0
/
GLSVfw.pas 
4681 строка · 186.4 Кб
1
//
2
// This unit is part of the GLScene Engine https://github.com/glscene
3
//
4
unit GLSVfw;
5

6
interface
7

8
{.$UNDEF UNICODE}
9
{$I GLScene.inc}
10

11
(****************************************************************************
12
 *
13
 *      VfW.H - Video for windows include file for WIN32
14
 *
15
 *      Copyright (c) 1991-1999, Microsoft Corp.  All rights reserved.
16
 *
17
 *      This include files defines interfaces to the following
18
 *      video components
19
 *
20
 *          COMPMAN         - Installable Compression Manager.
21
 *          DRAWDIB         - Routines for drawing to the display.
22
 *          VIDEO           - Video Capture Driver Interface
23
 *
24
 *          AVIFMT          - AVI File Format structure definitions.
25
 *          MMREG           - FOURCC and other things
26
 *
27
 *          AVIFile         - Interface for reading AVI Files and AVI Streams
28
 *          MCIWND          - MCI/AVI window class
29
 *          AVICAP          - AVI Capture Window class
30
 *
31
 *          MSACM           - Audio compression manager.
32
 *
33
 *      The following symbols control inclusion of various parts of this file:
34
 *
35
 *          NOCOMPMAN       - dont include COMPMAN
36
 *          NODRAWDIB       - dont include DRAWDIB
37
 *          NOVIDEO         - dont include video capture interface
38
 *
39
 *          NOAVIFMT        - dont include AVI file format structs
40
 *          NOMMREG         - dont include MMREG
41
 *
42
 *          NOAVIFILE       - dont include AVIFile interface
43
 *          NOMCIWND        - dont include AVIWnd class.
44
 *          NOAVICAP        - dont include AVICap class.
45
 *
46
 *          NOMSACM         - dont include ACM stuff.
47
 *
48
 ****************************************************************************)
49

50
(******************************************************************************)
51
(*                                                                            *)
52
(*  VFW.PAS Conversion by Ronald Dittrich                                     *)
53
(*                                                                            *)
54
(*  E-Mail: info@swiftsoft.de                                                 *)
55
(*  http://www.swiftsoft.de                                                   *)
56
(*                                                                            *)
57
(******************************************************************************)
58

59
(******************************************************************************)
60
(*                                                                            *)
61
(*  Modyfied: 25.April.2000                                                   *)
62
(*                                                                            *)
63
(*  E-Mail:                                                                   *)
64
(*  Ivo Steinmann: isteinmann@bluewin.ch                                      *)
65
(*                                                                            *)
66
(*  Please send all messages regarding specific errors and lacks of this unit *)
67
(*  to Ivo Steinmann                                                          *)
68
(*                                                                            *)
69
(******************************************************************************)
70

71
(******************************************************************************)
72
(*                                                                            *)
73
(*  Modyfied: 2000-12-07                                                      *)
74
(*                                                                            *)
75
(*  E-Mail:                                                                   *)
76
(*  Peter Haas: PeterJHaas@t-online.de                                        *)
77
(*                                                                            *)
78
(*  Only modified line 1380  ( TAVIPALCHANGE.peNew )                          *)
79
(*                                                                            *)
80
(******************************************************************************)
81

82
uses
83
    Windows,
84
    MMSystem,
85
    Messages,
86
    CommDlg,
87
    ActiveX,
88
    Dialogs;
89

90
(****************************************************************************
91
 *
92
 *  types
93
 *
94
 ***************************************************************************)
95

96
type
97
  PVOID = pointer;
98
  LONG  = longint;
99
  PLONG = ^LONG;
100
  int   = integer;
101

102
(****************************************************************************
103
 *
104
 *  VideoForWindowsVersion() - returns version of VfW
105
 *
106
 ***************************************************************************)
107

108
function VideoForWindowsVersion: DWORD; pascal;
109

110
(****************************************************************************
111
 *
112
 *  call these to start stop using VfW from your app.
113
 *
114
 ***************************************************************************)
115
                                {
116
function InitVFW: LONG; stdcall;
117
function TermVFW: LONG; stdcall;  }
118

119
(****************************************************************************/
120
/*                                                                          */
121
/*        Macros                                                            */
122
/*                                                                          */
123
/*  should we define this??                                                 */
124
/*                                                                          */
125
/****************************************************************************)
126

127
function MKFOURCC(ch0, ch1, ch2, ch3: AnsiChar): FOURCC;
128

129
(****************************************************************************
130
 *
131
 *  COMPMAN - Installable Compression Manager.
132
 *
133
 ****************************************************************************)
134

135
const
136
  ICVERSION                   = $0104 ;
137

138
type
139
  HIC                         = THandle;  // Handle to an Installable Compressor
140

141
//
142
// this code in biCompression means the DIB must be accesed via
143
// 48 bit pointers! using *ONLY* the selector given.
144
//
145
const
146
  BI_1632                     = $32333631;    // '1632'
147

148
function mmioFOURCC(ch0, ch1, ch2, ch3: AnsiChar): FOURCC;
149

150
type
151
  TWOCC                       = word;
152

153
function aviTWOCC(ch0, ch1: AnsiChar): TWOCC;
154

155
const
156
  ICTYPE_VIDEO                = $63646976;  {vidc}
157
  ICTYPE_AUDIO                = $63647561;  {audc}
158

159
const
160
  ICERR_OK                    = 0 ;
161
  ICERR_DONTDRAW              = 1 ;
162
  ICERR_NEWPALETTE            = 2 ;
163
  ICERR_GOTOKEYFRAME          = 3 ;
164
  ICERR_STOPDRAWING           = 4 ;
165

166
  ICERR_UNSUPPORTED           = -1 ;
167
  ICERR_BADFORMAT             = -2 ;
168
  ICERR_MEMORY                = -3 ;
169
  ICERR_INTERNAL              = -4 ;
170
  ICERR_BADFLAGS              = -5 ;
171
  ICERR_BADPARAM              = -6 ;
172
  ICERR_BADSIZE               = -7 ;
173
  ICERR_BADHANDLE             = -8 ;
174
  ICERR_CANTUPDATE            = -9 ;
175
  ICERR_ABORT                 = -10 ;
176
  ICERR_ERROR                 = -100 ;
177
  ICERR_BADBITDEPTH           = -200 ;
178
  ICERR_BADIMAGESIZE          = -201 ;
179

180
  ICERR_CUSTOM                = -400 ;    // errors less than ICERR_CUSTOM...
181

182
{-- Values for dwFlags of ICOpen() -------------------------------------------}
183

184
  ICMODE_COMPRESS             = 1 ;
185
  ICMODE_DECOMPRESS           = 2 ;
186
  ICMODE_FASTDECOMPRESS       = 3 ;
187
  ICMODE_QUERY                = 4 ;
188
  ICMODE_FASTCOMPRESS         = 5 ;
189
  ICMODE_DRAW                 = 8 ;
190

191
{-- Flags for AVI file index -------------------------------------------------}
192

193
  AVIIF_LIST                  = $00000001 ;
194
  AVIIF_TWOCC                 = $00000002 ;
195
  AVIIF_KEYFRAME              = $00000010 ;
196

197
{-- quality flags ------------------------------------------------------------}
198

199
  ICQUALITY_LOW               = 0 ;
200
  ICQUALITY_HIGH              = 10000 ;
201
  ICQUALITY_DEFAULT           = -1 ;
202

203
(************************************************************************
204
************************************************************************)
205

206
  ICM_USER                    = (DRV_USER+$0000) ;
207

208
  ICM_RESERVED_LOW            = (DRV_USER+$1000) ;
209
  ICM_RESERVED_HIGH           = (DRV_USER+$2000) ;
210
  ICM_RESERVED                = ICM_RESERVED_LOW ;
211

212
(************************************************************************
213

214
    messages.
215

216
************************************************************************)
217

218
  ICM_GETSTATE                = (ICM_RESERVED+0) ;    // Get compressor state
219
  ICM_SETSTATE                = (ICM_RESERVED+1) ;    // Set compressor state
220
  ICM_GETINFO                 = (ICM_RESERVED+2) ;    // Query info about the compressor
221

222
  ICM_CONFIGURE               = (ICM_RESERVED+10);    // show the configure dialog
223
  ICM_ABOUT                   = (ICM_RESERVED+11);    // show the about box
224

225
  ICM_GETDEFAULTQUALITY       = (ICM_RESERVED+30);    // get the default value for quality
226
  ICM_GETQUALITY              = (ICM_RESERVED+31);    // get the current value for quality
227
  ICM_SETQUALITY              = (ICM_RESERVED+32);    // set the default value for quality
228

229
  ICM_SET                     = (ICM_RESERVED+40);    // Tell the driver something
230
  ICM_GET                     = (ICM_RESERVED+41);    // Ask the driver something
231

232
{-- Constants for ICM_SET: ---------------------------------------------------}
233

234
  ICM_FRAMERATE               = $526D7246;  {FrmR}
235
  ICM_KEYFRAMERATE            = $5279654B;  {KeyR}
236

237
(************************************************************************
238

239
    ICM specific messages.
240

241
************************************************************************)
242

243
  ICM_COMPRESS_GET_FORMAT     = (ICM_USER+4)  ;   // get compress format or size
244
  ICM_COMPRESS_GET_SIZE       = (ICM_USER+5)  ;   // get output size
245
  ICM_COMPRESS_QUERY          = (ICM_USER+6)  ;   // query support for compress
246
  ICM_COMPRESS_BEGIN          = (ICM_USER+7)  ;   // begin a series of compress calls.
247
  ICM_COMPRESS                = (ICM_USER+8)  ;   // compress a frame
248
  ICM_COMPRESS_END            = (ICM_USER+9)  ;   // end of a series of compress calls.
249

250
  ICM_DECOMPRESS_GET_FORMAT   = (ICM_USER+10) ;   // get decompress format or size
251
  ICM_DECOMPRESS_QUERY        = (ICM_USER+11) ;   // query support for dempress
252
  ICM_DECOMPRESS_BEGIN        = (ICM_USER+12) ;   // start a series of decompress calls
253
  ICM_DECOMPRESS              = (ICM_USER+13) ;   // decompress a frame
254
  ICM_DECOMPRESS_END          = (ICM_USER+14) ;   // end a series of decompress calls
255
  ICM_DECOMPRESS_SET_PALETTE  = (ICM_USER+29) ;   // fill in the DIB color table
256
  ICM_DECOMPRESS_GET_PALETTE  = (ICM_USER+30) ;   // fill in the DIB color table
257

258
  ICM_DRAW_QUERY              = (ICM_USER+31) ;   // query support for dempress
259
  ICM_DRAW_BEGIN              = (ICM_USER+15) ;   // start a series of draw calls
260
  ICM_DRAW_GET_PALETTE        = (ICM_USER+16) ;   // get the palette needed for drawing
261
  ICM_DRAW_START              = (ICM_USER+18) ;   // start decompress clock
262
  ICM_DRAW_STOP               = (ICM_USER+19) ;   // stop decompress clock
263
  ICM_DRAW_END                = (ICM_USER+21) ;   // end a series of draw calls
264
  ICM_DRAW_GETTIME            = (ICM_USER+32) ;   // get value of decompress clock
265
  ICM_DRAW                    = (ICM_USER+33) ;   // generalized "render" message
266
  ICM_DRAW_WINDOW             = (ICM_USER+34) ;   // drawing window has moved or hidden
267
  ICM_DRAW_SETTIME            = (ICM_USER+35) ;   // set correct value for decompress clock
268
  ICM_DRAW_REALIZE            = (ICM_USER+36) ;   // realize palette for drawing
269
  ICM_DRAW_FLUSH              = (ICM_USER+37) ;   // clear out buffered frames
270
  ICM_DRAW_RENDERBUFFER       = (ICM_USER+38) ;   // draw undrawn things in queue
271

272
  ICM_DRAW_START_PLAY         = (ICM_USER+39) ;   // start of a play
273
  ICM_DRAW_STOP_PLAY          = (ICM_USER+40) ;   // end of a play
274

275
  ICM_DRAW_SUGGESTFORMAT      = (ICM_USER+50) ;   // Like ICGetDisplayFormat
276
  ICM_DRAW_CHANGEPALETTE      = (ICM_USER+51) ;   // for animating palette
277

278
  ICM_GETBUFFERSWANTED        = (ICM_USER+41) ;   // ask about prebuffering
279

280
  ICM_GETDEFAULTKEYFRAMERATE  = (ICM_USER+42) ;   // get the default value for key frames
281

282
  ICM_DECOMPRESSEX_BEGIN      = (ICM_USER+60) ;   // start a series of decompress calls
283
  ICM_DECOMPRESSEX_QUERY      = (ICM_USER+61) ;   // start a series of decompress calls
284
  ICM_DECOMPRESSEX            = (ICM_USER+62) ;   // decompress a frame
285
  ICM_DECOMPRESSEX_END        = (ICM_USER+63) ;   // end a series of decompress calls
286

287
  ICM_COMPRESS_FRAMES_INFO    = (ICM_USER+70) ;   // tell about compress to come
288
  ICM_SET_STATUS_PROC         = (ICM_USER+72) ;   // set status callback
289

290
(************************************************************************
291
************************************************************************)
292

293
type
294
  PICOPEN = ^TICOPEN;
295
  TICOPEN = packed record
296
    dwSize                  : DWORD   ; // sizeof(ICOPEN)
297
    fccType                 : DWORD   ; // 'vidc'
298
    fccHandler              : DWORD   ; //
299
    dwVersion               : DWORD   ; // version of compman opening you
300
    dwFlags                 : DWORD   ; // LOWORD is type specific
301
    dwError                 : DWORD   ; // error return.
302
    pV1Reserved             : PVOID   ; // Reserved
303
    pV2Reserved             : PVOID   ; // Reserved
304
    dnDevNode               : DWORD   ; // Devnode for PnP devices
305
  end;
306

307
(************************************************************************
308
************************************************************************)
309

310
  PICINFO = ^TICINFO;
311
  TICINFO = packed record
312
    dwSize                  : DWORD;    // sizeof(ICINFO)
313
    fccType                 : DWORD;    // compressor type     'vidc' 'audc'
314
    fccHandler              : DWORD;    // compressor sub-type 'rle ' 'jpeg' 'pcm '
315
    dwFlags                 : DWORD;    // flags LOWORD is type specific
316
    dwVersion               : DWORD;    // version of the driver
317
    dwVersionICM            : DWORD;    // version of the ICM used
318
    //
319
    // under Win32, the driver always returns UNICODE strings.
320
    //
321
    szName                  : array[0..15] of WChar  ; // short name
322
    szDescription           : array[0..127] of WChar ; // DWORD name
323
    szDriver                : array[0..127] of WChar ; // driver that contains compressor
324
  end;
325

326
{-- Flags for the <dwFlags> field of the <ICINFO> structure. ------------}
327

328
const
329
  VIDCF_QUALITY               = $0001 ;  // supports quality
330
  VIDCF_CRUNCH                = $0002 ;  // supports crunching to a frame size
331
  VIDCF_TEMPORAL              = $0004 ;  // supports inter-frame compress
332
  VIDCF_COMPRESSFRAMES        = $0008 ;  // wants the compress all frames message
333
  VIDCF_DRAW                  = $0010 ;  // supports drawing
334
  VIDCF_FASTTEMPORALC         = $0020 ;  // does not need prev frame on compress
335
  VIDCF_FASTTEMPORALD         = $0080 ;  // does not need prev frame on decompress
336
  //VIDCF_QUALITYTIME         = $0040 ;  // supports temporal quality
337

338
  //VIDCF_FASTTEMPORAL        = (VIDCF_FASTTEMPORALC or VIDCF_FASTTEMPORALD)
339

340
(************************************************************************
341
************************************************************************)
342

343
  ICCOMPRESS_KEYFRAME         = $00000001;
344

345
type
346
  PICCOMPRESS = ^TICCOMPRESS;
347
  TICCOMPRESS = packed record
348
    dwFlags                 : DWORD;                // flags
349

350
    lpbiOutput              : PBITMAPINFOHEADER ;   // output format
351
    lpOutput                : PVOID ;               // output data
352

353
    lpbiInput               : PBITMAPINFOHEADER ;   // format of frame to compress
354
    lpInput                 : PVOID ;               // frame data to compress
355

356
    lpckid                  : PDWORD ;              // ckid for data in AVI file
357
    lpdwFlags               : PDWORD;               // flags in the AVI index.
358
    lFrameNum               : LONG ;               // frame number of seq.
359
    dwFrameSize             : DWORD ;               // reqested size in bytes. (if non zero)
360

361
    dwQuality               : DWORD ;               // quality
362

363
    // these are new fields
364

365
    lpbiPrev                : PBITMAPINFOHEADER ;   // format of previous frame
366
    lpPrev                  : PVOID ;               // previous frame
367
  end;
368

369
(************************************************************************
370
************************************************************************)
371

372
const
373
  ICCOMPRESSFRAMES_PADDING    = $00000001 ;
374

375
type
376
  TICCompressProc    = function(lInputOutput: LPARAM; lFrame: DWORD; lpBits: PVOID; len: LONG): LONG; stdcall;
377

378
  PICCOMPRESSFRAMES  = ^TICCOMPRESSFRAMES;
379
  TICCOMPRESSFRAMES  = packed record
380
    dwFlags                 : DWORD ;               // flags
381

382
    lpbiOutput              : PBITMAPINFOHEADER ;   // output format
383
    lOutput                 : LPARAM ;              // output identifier
384

385
    lpbiInput               : PBITMAPINFOHEADER ;   // format of frame to compress
386
    lInput                  : LPARAM ;              // input identifier
387

388
    lStartFrame             : LONG ;                // start frame
389
    lFrameCount             : LONG ;                // # of frames
390

391
    lQuality                : LONG ;                // quality
392
    lDataRate               : LONG ;                // data rate
393
    lKeyRate                : LONG ;                // key frame rate
394

395
    dwRate                  : DWORD ;               // frame rate, as always
396
    dwScale                 : DWORD ;
397

398
    dwOverheadPerFrame      : DWORD ;
399
    dwReserved2             : DWORD ;
400

401
    GetData                 : TICCompressProc;
402
    PutData                 : TICCompressProc;
403
  end;
404

405
{-- Messages for Status callback ---------------------------------------------}
406

407
const
408
    ICSTATUS_START              = 0 ;
409
    ICSTATUS_STATUS             = 1 ;   // l = % done
410
    ICSTATUS_END                = 2 ;
411
    ICSTATUS_ERROR              = 3 ;   // l = error string (LPSTR)
412
    ICSTATUS_YIELD              = 4 ;
413

414
type
415
  // return nonzero means abort operation in progress
416
  TICStatusProc    = function(lParam: LPARAM; message: UINT; l: LONG): LONG; stdcall;
417

418
  PICSETSTATUSPROC = ^TICSETSTATUSPROC;
419
  TICSETSTATUSPROC = packed record
420
    dwFlags                 : DWORD ;
421
    lParam                  : LPARAM ;
422
    Status                  : TICStatusProc;
423
  end;
424

425
(************************************************************************
426
************************************************************************)
427

428
const
429
    ICDECOMPRESS_HURRYUP        = $80000000 ;   // don't draw just buffer (hurry up!)
430
    ICDECOMPRESS_UPDATE         = $40000000 ;   // don't draw just update screen
431
    ICDECOMPRESS_PREROLL        = $20000000 ;   // this frame is before real start
432
    ICDECOMPRESS_NULLFRAME      = $10000000 ;   // repeat last frame
433
    ICDECOMPRESS_NOTKEYFRAME    = $08000000 ;   // this frame is not a key frame
434

435
type
436
  PICDECOMPRESS = ^TICDECOMPRESS;
437
  TICDECOMPRESS = packed record
438
    dwFlags                 : DWORD ;               // flags (from AVI index...)
439
    lpbiInput               : PBITMAPINFOHEADER ;   // BITMAPINFO of compressed data
440
                                                        // biSizeImage has the chunk size
441
    lpInput                 : PVOID ;               // compressed data
442
    lpbiOutput              : PBITMAPINFOHEADER ;   // DIB to decompress to
443
    lpOutput                : PVOID ;
444
    ckid                    : DWORD ;               // ckid from AVI file
445
  end;
446

447
  PICDECOMPRESSEX = ^TICDECOMPRESSEX;
448
  TICDECOMPRESSEX = packed record
449

450
    //
451
    // same as ICM_DECOMPRESS
452
    //
453

454
    dwFlags                 : DWORD;
455
    lpbiSrc                 : PBITMAPINFOHEADER;    // BITMAPINFO of compressed data
456
    lpSrc                   : PVOID;                // compressed data
457
    lpbiDst                 : PBITMAPINFOHEADER;    // DIB to decompress to
458
    lpDst                   : PVOID;                // output data
459

460
    //
461
    // new for ICM_DECOMPRESSEX
462
    //
463

464
    xDst                    : int; // destination rectangle
465
    yDst                    : int;
466
    dxDst                   : int;
467
    dyDst                   : int;
468

469
    xSrc                    : int; // source rectangle
470
    ySrc                    : int;
471
    dxSrc                   : int;
472
    dySrc                   : int;
473
  end;
474

475
(************************************************************************
476
************************************************************************)
477

478
const
479
    ICDRAW_QUERY                = $00000001 ; // test for support
480
    ICDRAW_FULLSCREEN           = $00000002 ; // draw to full screen
481
    ICDRAW_HDC                  = $00000004 ; // draw to a HDC/HWND
482
    ICDRAW_ANIMATE              = $00000008 ;   // expect palette animation
483
    ICDRAW_CONTINUE             = $00000010 ;   // draw is a continuation of previous draw
484
    ICDRAW_MEMORYDC             = $00000020 ;   // DC is offscreen, by the way
485
    ICDRAW_UPDATING             = $00000040 ;   // We're updating, as opposed to playing
486
    ICDRAW_RENDER               = $00000080 ; // used to render data not draw it
487
    ICDRAW_BUFFER               = $00000100 ; // please buffer this data offscreen, we will need to update it
488

489
type
490
  PICDRAWBEGIN = ^TICDRAWBEGIN;
491
  TICDRAWBEGIN = packed record
492
    dwFlags                 : DWORD ;       // flags
493

494
    hpal                    : HPALETTE ;    // palette to draw with
495
    hwnd                    : HWND ;        // window to draw to
496
    hdc                     : HDC ;         // HDC to draw to
497

498
    xDst                    : int ;         // destination rectangle
499
    yDst                    : int ;
500
    dxDst                   : int ;
501
    dyDst                   : int ;
502

503
    lpbi                    : PBITMAPINFOHEADER ;
504
                                                // format of frame to draw
505

506
    xSrc                    : int ;         // source rectangle
507
    ySrc                    : int ;
508
    dxSrc                   : int ;
509
    dySrc                   : int ;
510

511
    dwRate                  : DWORD ;       // frames/second = (dwRate/dwScale)
512
    dwScale                 : DWORD ;
513
  end;
514

515
(************************************************************************
516
************************************************************************)
517

518
const
519
    ICDRAW_HURRYUP              = $80000000 ;   // don't draw just buffer (hurry up!)
520
    ICDRAW_UPDATE               = $40000000 ;   // don't draw just update screen
521
    ICDRAW_PREROLL              = $20000000 ;   // this frame is before real start
522
    ICDRAW_NULLFRAME            = $10000000 ;   // repeat last frame
523
    ICDRAW_NOTKEYFRAME          = $08000000 ;   // this frame is not a key frame
524

525
type
526
    PICDRAW                     = ^TICDRAW;
527
    TICDRAW                     = packed record
528
        dwFlags                 : DWORD ;   // flags
529
        lpFormat                : PVOID ;   // format of frame to decompress
530
        lpData                  : PVOID ;   // frame data to decompress
531
        cbData                  : DWORD ;
532
        lTime                   : LONG  ;   // time in drawbegin units (see dwRate and dwScale)
533
    end;
534

535
    PICDRAWSUGGEST              = ^TICDRAWSUGGEST;
536
    TICDRAWSUGGEST              = packed record
537
        lpbiIn                  : PBITMAPINFOHEADER ;   // format to be drawn
538
        lpbiSuggest             : PBITMAPINFOHEADER ;   // location for suggested format (or NULL to get size)
539
        dxSrc                   : int ;                 // source extent or 0
540
        dySrc                   : int ;
541
        dxDst                   : int ;                 // dest extent or 0
542
        dyDst                   : int ;
543
        hicDecompressor         : HIC ;                 // decompressor you can talk to
544
    end;
545

546
(************************************************************************
547
************************************************************************)
548

549
    PICPALETTE                  = ^TICPALETTE;
550
    TICPALETTE                  = packed record
551
        dwFlags                 : DWORD ;           // flags (from AVI index...)
552
        iStart                  : int ;             // first palette to change
553
        iLen                    : int ;             // count of entries to change.
554
        lppe                    : PPALETTEENTRY ;   // palette
555
    end;
556

557
(************************************************************************
558

559
    ICM function declarations
560

561
************************************************************************)
562

563
function    ICInfo(fccType, fccHandler: DWORD; lpicinfo: PICINFO) : BOOL ; stdcall ;
564
function    ICInstall(fccType, fccHandler: DWORD; lParam: LPARAM; szDesc: LPSTR; wFlags: UINT) : BOOL ; stdcall ;
565
function    ICRemove(fccType, fccHandler: DWORD; wFlags: UINT) : BOOL ; stdcall ;
566
function    ICGetInfo(hic: HIC; picinfo: PICINFO; cb: DWORD) : DWORD ; stdcall ;
567

568
function    ICOpen(fccType, fccHandler: DWORD; wMode: UINT) : HIC ; stdcall ;
569
function    ICOpenFunction(fccType, fccHandler: DWORD; wMode: UINT; lpfnHandler: TFarProc) : HIC ; stdcall ;
570
function    ICClose(hic: HIC) : DWORD; stdcall ;
571

572
function    ICSendMessage(hic: HIC; msg: UINT; dw1, dw2: DWORD) : DWORD ; stdcall ;
573

574
{-- Values for wFlags of ICInstall -------------------------------------------}
575

576
const
577
    ICINSTALL_UNICODE           = $8000 ;
578

579
    ICINSTALL_FUNCTION          = $0001 ; // lParam is a DriverProc (function ptr)
580
    ICINSTALL_DRIVER            = $0002 ; // lParam is a driver name (string)
581
    ICINSTALL_HDRV              = $0004 ; // lParam is a HDRVR (driver handle)
582

583
    ICINSTALL_DRIVERW           = $8002 ; // lParam is a unicode driver name
584

585
{-- Query macros -------------------------------------------------------------}
586

587
    ICMF_CONFIGURE_QUERY        = $00000001 ;
588
    ICMF_ABOUT_QUERY            = $00000001 ;
589

590
function    ICQueryAbout(hic: HIC): BOOL;
591
function    ICAbout(hic: HIC; hwnd: HWND): DWORD;
592
function    ICQueryConfigure(hic: HIC): BOOL;
593
function    ICConfigure(hic: HIC; hwnd: HWND): DWORD;
594

595
{-- Get/Set state macros -----------------------------------------------------}
596

597
function    ICGetState(hic: HIC; pv: PVOID; cb: DWORD): DWORD;
598
function    ICSetState(hic: HIC; pv: PVOID; cb: DWORD): DWORD;
599
function    ICGetStateSize(hic: HIC): DWORD;
600

601
{-- Get value macros ---------------------------------------------------------}
602

603
function    ICGetDefaultQuality(hic: HIC): DWORD;
604
function    ICGetDefaultKeyFrameRate(hic: HIC): DWORD;
605

606
{-- Draw window macro --------------------------------------------------------}
607

608
function    ICDrawWindow(hic: HIC; prc: PRECT): DWORD;
609

610
(************************************************************************
611

612
    compression functions
613

614
************************************************************************/
615
/*
616
 *  ICCompress()
617
 *
618
 *  compress a single frame
619
 *
620
 *)
621
function ICCompress(
622
    hic             : HIC;
623
    dwFlags         : DWORD;                // flags
624
    lpbiOutput      : PBITMAPINFOHEADER;    // output format
625
    lpData          : PVOID;                // output data
626
    lpbiInput       : PBITMAPINFOHEADER;    // format of frame to compress
627
    lpBits          : PVOID;                // frame data to compress
628
    lpckid          : PDWORD;               // ckid for data in AVI file
629
    lpdwFlags       : PDWORD;               // flags in the AVI index.
630
    lFrameNum       : DWORD;                 // frame number of seq.
631
    dwFrameSize     : DWORD;                // reqested size in bytes. (if non zero)
632
    dwQuality       : DWORD;                // quality within one frame
633
    lpbiPrev        : PBITMAPINFOHEADER;    // format of previous frame
634
    lpPrev          : PVOID                 // previous frame
635
    ): DWORD; cdecl;
636

637
(*
638
 *  ICCompressBegin()
639
 *
640
 *  start compression from a source format (lpbiInput) to a dest
641
 *  format (lpbiOuput) is supported.
642
 *
643
 *)
644

645
function    ICCompressBegin(hic: HIC; lpbiInput: PBITMAPINFOHEADER; lpbiOutput: PBITMAPINFOHEADER): DWORD;
646

647
(*
648
 *  ICCompressQuery()
649
 *
650
 *  determines if compression from a source format (lpbiInput) to a dest
651
 *  format (lpbiOuput) is supported.
652
 *
653
 *)
654

655
function    ICCompressQuery(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
656

657
(*
658
 *  ICCompressGetFormat()
659
 *
660
 *  get the output format, (format of compressed data)
661
 *  if lpbiOutput is NULL return the size in bytes needed for format.
662
 *
663
 *)
664

665
function    ICCompressGetFormat(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
666
function    ICCompressGetFormatSize(hic: HIC; lpbi: PBITMAPINFOHEADER): DWORD;
667

668
(*
669
 *  ICCompressSize()
670
 *
671
 *  return the maximal size of a compressed frame
672
 *
673
 *)
674

675
function    ICCompressGetSize(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
676
function    ICCompressEnd(hic: HIC): DWORD;
677

678
(************************************************************************
679

680
    decompression functions
681

682
************************************************************************)
683

684
(*
685
 *  ICDecompress()
686
 *
687
 *  decompress a single frame
688
 *
689
 *)
690

691
function    ICDecompress(
692
    hic             : HIC;
693
    dwFlags         : DWORD;                // flags (from AVI index...)
694
    lpbiFormat      : PBITMAPINFOHEADER;    // BITMAPINFO of compressed data
695
                                            // biSizeImage has the chunk size
696
    lpData          : PVOID;                // data
697
    lpbi            : PBITMAPINFOHEADER;    // DIB to decompress to
698
    lpBits          : PVOID
699
    ): DWORD; cdecl;
700

701
(*
702
 *  ICDecompressBegin()
703
 *
704
 *  start compression from a source format (lpbiInput) to a dest
705
 *  format (lpbiOutput) is supported.
706
 *
707
 *)
708

709
function    ICDecompressBegin(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
710

711
(*
712
 *  ICDecompressQuery()
713
 *
714
 *  determines if compression from a source format (lpbiInput) to a dest
715
 *  format (lpbiOutput) is supported.
716
 *
717
 *)
718

719
function    ICDecompressQuery(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
720

721
(*
722
 *  ICDecompressGetFormat()
723
 *
724
 *  get the output format, (format of un-compressed data)
725
 *  if lpbiOutput is NULL return the size in bytes needed for format.
726
 *
727
 *)
728

729
function    ICDecompressGetFormat(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
730
function    ICDecompressGetFormatSize(hic: HIC; lpbi: PBITMAPINFOHEADER): DWORD;
731

732
(*
733
 *  ICDecompressGetPalette()
734
 *
735
 *  get the output palette
736
 *
737
 *)
738

739
function    ICDecompressGetPalette(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
740
function    ICDecompressSetPalette(hic: HIC; lpbiPalette: PBITMAPINFOHEADER): DWORD;
741

742
function    ICDecompressEnd(hic: HIC): DWORD;
743

744
(************************************************************************
745

746
    decompression (ex) functions
747

748
************************************************************************)
749

750
//
751
// on Win16 these functions are macros that call ICMessage. ICMessage will
752
// not work on NT. rather than add new entrypoints we have given
753
// them as static inline functions
754
//
755

756
(*
757
 *  ICDecompressEx()
758
 *
759
 *  decompress a single frame
760
 *
761
 *)
762

763
function    ICDecompressEx(
764
    hic         : HIC;
765
    dwFlags     : DWORD;
766
    lpbiSrc     : PBITMAPINFOHEADER;
767
    lpSrc       : PVOID;
768
    xSrc        : int;
769
    ySrc        : int;
770
    dxSrc       : int;
771
    dySrc       : int;
772
    lpbiDst     : PBITMAPINFOHEADER;
773
    lpDst       : PVOID;
774
    xDst        : int;
775
    yDst        : int;
776
    dxDst       : int;
777
    dyDst       : int
778
    ): DWORD; stdcall;
779

780
(*
781
 *  ICDecompressExBegin()
782
 *
783
 *  start compression from a source format (lpbiInput) to a dest
784
 *  format (lpbiOutput) is supported.
785
 *
786
 *)
787

788
function    ICDecompressExBegin(
789
    hic         : HIC;
790
    dwFlags     : DWORD;
791
    lpbiSrc     : PBITMAPINFOHEADER;
792
    lpSrc       : PVOID;
793
    xSrc        : int;
794
    ySrc        : int;
795
    dxSrc       : int;
796
    dySrc       : int;
797
    lpbiDst     : PBITMAPINFOHEADER;
798
    lpDst       : PVOID;
799
    xDst        : int;
800
    yDst        : int;
801
    dxDst       : int;
802
    dyDst       : int
803
    ): DWORD; stdcall;
804

805
(*
806
 *  ICDecompressExQuery()
807
 *
808
 *)
809

810
function    ICDecompressExQuery(
811
    hic         : HIC;
812
    dwFlags     : DWORD;
813
    lpbiSrc     : PBITMAPINFOHEADER;
814
    lpSrc       : PVOID;
815
    xSrc        : int;
816
    ySrc        : int;
817
    dxSrc       : int;
818
    dySrc       : int;
819
    lpbiDst     : PBITMAPINFOHEADER;
820
    lpDst       : PVOID;
821
    xDst        : int;
822
    yDst        : int;
823
    dxDst       : int;
824
    dyDst       : int
825
    ): DWORD; stdcall;
826

827
function ICDecompressExEnd(hic: HIC): DWORD;
828

829
(************************************************************************
830

831
    drawing functions
832

833
************************************************************************)
834

835
(*
836
 *  ICDrawBegin()
837
 *
838
 *  start decompressing data with format (lpbiInput) directly to the screen
839
 *
840
 *  return zero if the decompressor supports drawing.
841
 *
842
 *)
843

844
function    ICDrawBegin(
845
    hic         : HIC;
846
    dwFlags     : DWORD;                // flags
847
    hpal        : HPALETTE;             // palette to draw with
848
    hwnd        : HWND;                 // window to draw to
849
    hdc         : HDC;                  // HDC to draw to
850
    xDst        : int;                  // destination rectangle
851
    yDst        : int;
852
    dxDst       : int;
853
    dyDst       : int;
854
    lpbi        : PBITMAPINFOHEADER;    // format of frame to draw
855
    xSrc        : int;                  // source rectangle
856
    ySrc        : int;
857
    dxSrc       : int;
858
    dySrc       : int;
859
    dwRate      : DWORD;                // frames/second = (dwRate/dwScale)
860
    dwScale     : DWORD
861
    ): DWORD; cdecl;
862

863
(*
864
 *  ICDraw()
865
 *
866
 *  decompress data directly to the screen
867
 *
868
 *)
869

870
function    ICDraw(
871
    hic         : HIC;
872
    dwFlags     : DWORD;                // flags
873
    lpFormat    : PVOID;                // format of frame to decompress
874
    lpData      : PVOID;                // frame data to decompress
875
    cbData      : DWORD;                // size of data
876
    lTime       : DWORD                  // time to draw this frame
877
    ): DWORD; cdecl;
878

879
// ICMessage is not supported on Win32, so provide a static inline function
880
// to do the same job
881
function    ICDrawSuggestFormat(
882
    hic         : HIC;
883
    lpbiIn      : PBITMAPINFOHEADER;
884
    lpbiOut     : PBITMAPINFOHEADER;
885
    dxSrc       : int;
886
    dySrc       : int;
887
    dxDst       : int;
888
    dyDst       : int;
889
    hicDecomp   : HIC
890
    ): DWORD; stdcall;
891

892
(*
893
 *  ICDrawQuery()
894
 *
895
 *  determines if the compressor is willing to render the specified format.
896
 *
897
 *)
898

899
function    ICDrawQuery(hic: HIC; lpbiInput: PBITMAPINFOHEADER): DWORD;
900
function    ICDrawChangePalette(hic: HIC; lpbiInput: PBITMAPINFOHEADER): DWORD;
901
function    ICGetBuffersWanted(hic: HIC; lpdwBuffers: PDWORD): DWORD;
902
function    ICDrawEnd(hic: HIC): DWORD;
903
function    ICDrawStart(hic: HIC): DWORD;
904
function    ICDrawStartPlay(hic: HIC; lFrom, lTo: DWORD): DWORD;
905
function    ICDrawStop(hic: HIC): DWORD;
906
function    ICDrawStopPlay(hic: HIC): DWORD;
907
function    ICDrawGetTime(hic: HIC; lplTime: PDWORD): DWORD;
908
function    ICDrawSetTime(hic: HIC; lTime: DWORD): DWORD;
909
function    ICDrawRealize(hic: HIC; hdc: HDC; fBackground: BOOL): DWORD;
910
function    ICDrawFlush(hic: HIC): DWORD;
911
function    ICDrawRenderBuffer(hic: HIC): DWORD;
912

913
(************************************************************************
914

915
    Status callback functions
916

917
************************************************************************/
918

919
/*
920
 *  ICSetStatusProc()
921
 *
922
 *  Set the status callback function
923
 *
924
 *)
925

926

927
// ICMessage is not supported on NT
928
function    ICSetStatusProc(
929
    hic         : HIC;
930
    dwFlags     : DWORD;
931
    lParam      : DWORD;
932
    fpfnStatus  : TICStatusProc
933
    ): DWORD; stdcall;
934

935
(************************************************************************
936

937
helper routines for DrawDib and MCIAVI...
938

939
************************************************************************)
940

941
function    ICLocate(fccType, fccHandler: DWORD; lpbiIn, lpbiOut: PBITMAPINFOHEADER; wFlags: WORD): HIC; stdcall;
942
function    ICGetDisplayFormat(hic: HIC; lpbiIn, lpbiOut: PBITMAPINFOHEADER; BitDepth: int; dx, dy: int): HIC; stdcall;
943

944
function    ICDecompressOpen(fccType, fccHandler: DWORD; lpbiIn, lpbiOut: PBITMAPINFOHEADER): HIC;
945
function    ICDrawOpen(fccType, fccHandler: DWORD; lpbiIn: PBITMAPINFOHEADER): HIC;
946

947
(************************************************************************
948
Higher level functions
949
************************************************************************)
950

951
function    ICImageCompress(
952
    hic         : HIC;                  // compressor to use
953
    uiFlags     : UINT;                 // flags (none yet)
954
    lpbiIn      : PBITMAPINFO;          // format to compress from
955
    lpBits      : PVOID;                // data to compress
956
    lpbiOut     : PBITMAPINFO;          // compress to this (NULL ==> default)
957
    lQuality    : LONG;                 // quality to use
958
    plSize      : PDWORD                 // compress to this size (0=whatever)
959
    ): THANDLE; stdcall;
960

961
function    ICImageDecompress(
962
    hic         : HIC;                  // compressor to use
963
    uiFlags     : UINT;                 // flags (none yet)
964
    lpbiIn      : PBITMAPINFO;          // format to decompress from
965
    lpBits      : PVOID;                // data to decompress
966
    lpbiOut     : PBITMAPINFO           // decompress to this (NULL ==> default)
967
    ): THANDLE; stdcall;
968

969
{-- TCompVars ----------------------------------------------------------------}
970

971
//
972
// Structure used by ICSeqCompressFrame and ICCompressorChoose routines
973
// Make sure this matches the autodoc in icm.c!
974
//
975

976
type
977
  PCOMPVARS       = ^TCOMPVARS;
978
  TCOMPVARS       = packed record
979
        cbSize      : DWORD;            // set to sizeof(COMPVARS) before
980
                                        // calling ICCompressorChoose
981
        dwFlags     : DWORD;            // see below...
982
        hic         : HIC;              // HIC of chosen compressor
983
        fccType     : DWORD;            // basically ICTYPE_VIDEO
984
        fccHandler  : DWORD;            // handler of chosen compressor or
985
                                        // "" or "DIB "
986
        lpbiIn      : PBITMAPINFO;      // input format
987
        lpbiOut     : PBITMAPINFO;      // output format - will compress to this
988
        lpBitsOut   : PVOID;
989
        lpBitsPrev  : PVOID;
990
        lFrame      : LONG;
991
        lKey        : LONG;             // key frames how often?
992
        lDataRate   : LONG;             // desired data rate KB/Sec
993
        lQ          : LONG;             // desired quality
994
        lKeyCount   : LONG;
995
        lpState     : PVOID;            // state of compressor
996
        cbState     : LONG;             // size of the state
997
    end;
998

999
// FLAGS for dwFlags element of COMPVARS structure:
1000
// set this flag if you initialize COMPVARS before calling ICCompressorChoose
1001

1002
const
1003
    ICMF_COMPVARS_VALID         = $00000001;    // COMPVARS contains valid data
1004

1005
//
1006
//  allows user to choose compressor, quality etc...
1007
//
1008
function    ICCompressorChoose(
1009
    hwnd        : HWND;                     // parent window for dialog
1010
    uiFlags     : UINT;                     // flags
1011
    pvIn        : PVOID;                    // input format (optional)
1012
    lpData      : PVOID;                    // input data (optional)
1013
    pc          : PCOMPVARS;                // data about the compressor/dlg
1014
    lpszTitle   : LPSTR                     // dialog title (optional)
1015
    ): BOOL; stdcall;
1016

1017
// defines for uiFlags
1018

1019
const
1020
    ICMF_CHOOSE_KEYFRAME        = $0001;    // show KeyFrame Every box
1021
    ICMF_CHOOSE_DATARATE        = $0002;    // show DataRate box
1022
    ICMF_CHOOSE_PREVIEW         = $0004;    // allow expanded preview dialog
1023
    ICMF_CHOOSE_ALLCOMPRESSORS  = $0008;    // don't only show those that
1024
                                            // can handle the input format
1025
                                            // or input data
1026

1027
function    ICSeqCompressFrameStart(pc: PCOMPVARS; lpbiIn: PBITMAPINFO): BOOL; stdcall;
1028
procedure   ICSeqCompressFrameEnd(pc: PCOMPVARS); stdcall;
1029

1030
function    ICSeqCompressFrame(
1031
    pc          : PCOMPVARS;                // set by ICCompressorChoose
1032
    uiFlags     : UINT;                     // flags
1033
    lpBits      : PVOID;                    // input DIB bits
1034
    pfKey       : PBOOL;                    // did it end up being a key frame?
1035
    plSize      : PDWORD                     // size to compress to/of returned image
1036
    ): PVOID; stdcall;
1037

1038
procedure   ICCompressorFree(pc: PCOMPVARS); stdcall;
1039

1040

1041
(**************************************************************************
1042
 *
1043
 *  DRAWDIB - Routines for drawing to the display.
1044
 *
1045
 *************************************************************************)
1046

1047
type
1048
    HDRAWDIB                    = THandle;  // hdd
1049

1050
(*********************************************************************
1051

1052
  DrawDib Flags
1053

1054
**********************************************************************)
1055

1056
const
1057
    DDF_UPDATE                  = $0002;    // re-draw the last DIB
1058
    DDF_SAME_HDC                = $0004;    // HDC same as last call (all setup)
1059
    DDF_SAME_DRAW               = $0008;    // draw params are the same
1060
    DDF_DONTDRAW                = $0010;    // dont draw frame, just decompress
1061
    DDF_ANIMATE                 = $0020;    // allow palette animation
1062
    DDF_BUFFER                  = $0040;    // always buffer image
1063
    DDF_JUSTDRAWIT              = $0080;    // just draw it with GDI
1064
    DDF_FULLSCREEN              = $0100;    // use DisplayDib
1065
    DDF_BACKGROUNDPAL           = $0200;    // Realize palette in background
1066
    DDF_NOTKEYFRAME             = $0400;    // this is a partial frame update, hint
1067
    DDF_HURRYUP                 = $0800;    // hurry up please!
1068
    DDF_HALFTONE                = $1000;    // always halftone
1069

1070
    DDF_PREROLL                 = DDF_DONTDRAW; // Builing up a non-keyframe
1071
    DDF_SAME_DIB                = DDF_SAME_DRAW;
1072
    DDF_SAME_SIZE               = DDF_SAME_DRAW;
1073

1074
(*********************************************************************
1075

1076
    DrawDib functions
1077

1078
*********************************************************************)
1079

1080
{-- DrawDibOpen() ------------------------------------------------------------}
1081

1082
function    DrawDibOpen: HDRAWDIB; stdcall;
1083

1084
{-- DrawDibClose() -----------------------------------------------------------}
1085

1086
function    DrawDibClose(hdd: HDRAWDIB): BOOL; stdcall;
1087

1088
{-- DrawDibGetBuffer() -------------------------------------------------------}
1089

1090
function    DrawDibGetBuffer(hdd: HDRAWDIB; lpbi: PBITMAPINFOHEADER; dwSize: DWORD; dwFlags: DWORD): PVOID; stdcall;
1091

1092
{-- DrawDibGetPalette() - get the palette used for drawing DIBs --------------}
1093

1094
function    DrawDibGetPalette(hdd: HDRAWDIB): HPALETTE; stdcall;
1095

1096
{-- DrawDibSetPalette() - set the palette used for drawing DIBs --------------}
1097

1098
function    DrawDibSetPalette(hdd: HDRAWDIB; hpal: HPALETTE): BOOL; stdcall;
1099

1100
{-- DrawDibChangePalette() ---------------------------------------------------}
1101

1102
function    DrawDibChangePalette(hdd: HDRAWDIB; iStart, iLen: int; lppe: PPALETTEENTRY): BOOL; stdcall;
1103

1104
{-- DrawDibRealize() - realize the palette in a HDD --------------------------}
1105

1106
function    DrawDibRealize(hdd: HDRAWDIB; hdc: HDC; fBackground: BOOL): UINT; stdcall;
1107

1108
{-- DrawDibStart() - start of streaming playback -----------------------------}
1109

1110
function    DrawDibStart(hdd: HDRAWDIB; rate: DWORD): BOOL; stdcall;
1111

1112
{-- DrawDibStop() - start of streaming playback ------------------------------}
1113

1114
function    DrawDibStop(hdd: HDRAWDIB): BOOL; stdcall;
1115

1116
{-- DrawDibBegin() - prepare to draw -----------------------------------------}
1117

1118
function    DrawDibBegin(
1119
    hdd         : HDRAWDIB;
1120
    hdc         : HDC;
1121
    dxDst       : int;
1122
    dyDst       : int;
1123
    lpbi        : PBITMAPINFOHEADER;
1124
    dxSrc       : int;
1125
    dySrc       : int;
1126
    wFlags      : UINT
1127
    ): BOOL; stdcall;
1128

1129
{-- DrawDibDraw() - actually draw a DIB to the screen ------------------------}
1130

1131
function    DrawDibDraw(
1132
    hdd         : HDRAWDIB;
1133
    hdc         : HDC;
1134
    xDst        : int;
1135
    yDst        : int;
1136
    dxDst       : int;
1137
    dyDst       : int;
1138
    lpbi        : PBITMAPINFOHEADER;
1139
    lpBits      : PVOID;
1140
    xSrc        : int;
1141
    ySrc        : int;
1142
    dxSrc       : int;
1143
    dySrc       : int;
1144
    wFlags      : UINT
1145
    ): BOOL; stdcall;
1146

1147
{-- DrawDibUpdate() - redraw last image (may only be valid with DDF_BUFFER) --}
1148

1149
function    DrawDibUpdate(hdd: HDRAWDIB; hdc: HDC; x, y: int): BOOL;
1150

1151
{-- DrawDibEnd() -------------------------------------------------------------}
1152

1153
function    DrawDibEnd(hdd: HDRAWDIB): BOOL; stdcall;
1154

1155
{-- DrawDibTime() - for debugging purposes only ------------------------------}
1156

1157
type
1158
    PDRAWDIBTIME        = ^TDRAWDIBTIME;
1159
    TDRAWDIBTIME        = packed record
1160
        timeCount       : LONG;
1161
        timeDraw        : LONG;
1162
        timeDecompress  : LONG;
1163
        timeDither      : LONG;
1164
        timeStretch     : LONG;
1165
        timeBlt         : LONG;
1166
        timeSetDIBits   : LONG;
1167
    end;
1168

1169
function    DrawDibTime(hdd: HDRAWDIB; lpddtime: PDRAWDIBTIME): BOOL; stdcall;
1170

1171
{-- Display profiling --------------------------------------------------------}
1172

1173
const
1174
    PD_CAN_DRAW_DIB             = $0001;    // if you can draw at all
1175
    PD_CAN_STRETCHDIB           = $0002;    // basicly RC_STRETCHDIB
1176
    PD_STRETCHDIB_1_1_OK        = $0004;    // is it fast?
1177
    PD_STRETCHDIB_1_2_OK        = $0008;    // ...
1178
    PD_STRETCHDIB_1_N_OK        = $0010;    // ...
1179

1180
function    DrawDibProfileDisplay(lpbi: PBITMAPINFOHEADER): DWORD; stdcall;
1181

1182
(****************************************************************************
1183
 *
1184
 *  AVIFMT - AVI file format definitions
1185
 *
1186
 ****************************************************************************)
1187

1188
//
1189
// The following is a short description of the AVI file format.  Please
1190
// see the accompanying documentation for a full explanation.
1191
//
1192
// An AVI file is the following RIFF form:
1193
//
1194
//  RIFF('AVI'
1195
//        LIST('hdrl'
1196
//          avih(<MainAVIHeader>)
1197
//                  LIST ('strl'
1198
//                      strh(<Stream header>)
1199
//                      strf(<Stream format>)
1200
//                      ... additional header data
1201
//            LIST('movi'
1202
//            { LIST('rec'
1203
//                    SubChunk...
1204
//                 )
1205
//                | SubChunk } ....
1206
//            )
1207
//            [ <AVIIndex> ]
1208
//      )
1209
//
1210
//  The main file header specifies how many streams are present.  For
1211
//  each one, there must be a stream header chunk and a stream format
1212
//  chunk, enlosed in a 'strl' LIST chunk.  The 'strf' chunk contains
1213
//  type-specific format information; for a video stream, this should
1214
//  be a BITMAPINFO structure, including palette.  For an audio stream,
1215
//  this should be a WAVEFORMAT (or PCMWAVEFORMAT) structure.
1216
//
1217
//  The actual data is contained in subchunks within the 'movi' LIST
1218
//  chunk.  The first two characters of each data chunk are the
1219
//  stream number with which that data is associated.
1220
//
1221
//  Some defined chunk types:
1222
//           Video Streams:
1223
//                  ##db:   RGB DIB bits
1224
//                  ##dc:   RLE8 compressed DIB bits
1225
//                  ##pc:   Palette Change
1226
//
1227
//           Audio Streams:
1228
//                  ##wb:   waveform audio bytes
1229
//
1230
// The grouping into LIST 'rec' chunks implies only that the contents of
1231
//   the chunk should be read into memory at the same time.  This
1232
//   grouping is used for files specifically intended to be played from
1233
//   CD-ROM.
1234
//
1235
// The index chunk at the end of the file should contain one entry for
1236
//   each data chunk in the file.
1237
//
1238
// Limitations for the current software:
1239
//  Only one video stream and one audio stream are allowed.
1240
//  The streams must start at the beginning of the file.
1241
//
1242
//
1243
// To register codec types please obtain a copy of the Multimedia
1244
// Developer Registration Kit from:
1245
//
1246
//  Microsoft Corporation
1247
//  Multimedia Systems Group
1248
//  Product Marketing
1249
//  One Microsoft Way
1250
//  Redmond, WA 98052-6399
1251
//
1252

1253
{-- form types, list types and chunk types -----------------------------------}
1254

1255
const
1256
    formtypeAVI                 = $20495641; // mmioFOURCC('A', 'V', 'I', ' ')
1257
    listtypeAVIHEADER           = $6C726468; // mmioFOURCC('h', 'd', 'r', 'l')
1258
    ckidAVIMAINHDR              = $68697661; // mmioFOURCC('a', 'v', 'i', 'h')
1259
    listtypeSTREAMHEADER        = $6C727473; // mmioFOURCC('s', 't', 'r', 'l')
1260
    ckidSTREAMHEADER            = $68727473; // mmioFOURCC('s', 't', 'r', 'h')
1261
    ckidSTREAMFORMAT            = $66727473; // mmioFOURCC('s', 't', 'r', 'f')
1262
    ckidSTREAMHANDLERDATA       = $64727473; // mmioFOURCC('s', 't', 'r', 'd')
1263
    ckidSTREAMNAME              = $6E727473; // mmioFOURCC('s', 't', 'r', 'n')
1264

1265
    listtypeAVIMOVIE            = $69766F6D; // mmioFOURCC('m', 'o', 'v', 'i')
1266
    listtypeAVIRECORD           = $20636572; // mmioFOURCC('r', 'e', 'c', ' ')
1267

1268
    ckidAVINEWINDEX             = $31786469; // mmioFOURCC('i', 'd', 'x', '1')
1269

1270
{-- Stream types for the <fccType> field of the stream header ----------------}
1271

1272
    streamtypeVIDEO             = $73646976; // mmioFOURCC('v', 'i', 'd', 's')
1273
    streamtypeAUDIO             = $73647561; // mmioFOURCC('a', 'u', 'd', 's')
1274
    streamtypeMIDI              = $7364696D; // mmioFOURCC('m', 'i', 'd', 's')
1275
    streamtypeTEXT              = $73747874; // mmioFOURCC('t', 'x', 't', 's')
1276

1277
{-- Basic chunk types --------------------------------------------------------}
1278

1279
    cktypeDIBbits               = $6264; // aviTWOCC('d', 'b')
1280
    cktypeDIBcompressed         = $6364; // aviTWOCC('d', 'c')
1281
    cktypePALchange             = $6370; // aviTWOCC('p', 'c')
1282
    cktypeWAVEbytes             = $6277; // aviTWOCC('w', 'b')
1283

1284
{-- Chunk id to use for extra chunks for padding -----------------------------}
1285

1286
    ckidAVIPADDING              = $4B4E554A; // mmioFOURCC('J', 'U', 'N', 'K')
1287

1288
(*
1289
** Useful macros
1290
**
1291
** Warning: These are nasty macro, and MS C 6.0 compiles some of them
1292
** incorrectly if optimizations are on.  Ack.
1293
*)
1294

1295
{-- Macro to get stream number out of a FOURCC ckid --------------------------}
1296

1297
function    FromHex(n: BYTE): BYTE;
1298
function    StreamFromFOURCC(fcc: DWORD): BYTE;
1299

1300
{-- Macro to get TWOCC chunk type out of a FOURCC ckid -----------------------}
1301

1302
function    TWOCCFromFOURCC(fcc: DWORD): WORD;
1303

1304
{-- Macro to make a ckid for a chunk out of a TWOCC and a stream num (0-255) -}
1305

1306
function    ToHex(n: BYTE): BYTE;
1307
function    MAKEAVICKID(tcc: WORD; stream: BYTE): DWORD;
1308

1309
{-- Main AVI file header -----------------------------------------------------}
1310

1311
{-- flags for use in <dwFlags> in AVIFileHdr ---------------------------------}
1312

1313
const
1314
    AVIF_HASINDEX               = $00000010;    // Index at end of file?
1315
    AVIF_MUSTUSEINDEX           = $00000020;
1316
    AVIF_ISINTERLEAVED          = $00000100;
1317
    AVIF_TRUSTCKTYPE            = $00000800;    // Use CKType to find key frames?
1318
    AVIF_WASCAPTUREFILE         = $00010000;
1319
    AVIF_COPYRIGHTED            = $00020000;
1320

1321
{-- The AVI File Header LIST chunk should be padded to this size -------------}
1322

1323
const
1324
    AVI_HEADERSIZE              = 2048;         // size of AVI header list
1325

1326
type
1327
    PMainAVIHeader              = ^TMainAVIHeader;
1328
    TMainAVIHeader              = packed record
1329
        dwMicroSecPerFrame      : DWORD;        // frame display rate (or 0L)
1330
        dwMaxBytesPerSec        : DWORD;        // max. transfer rate
1331
        dwPaddingGranularity    : DWORD;        // pad to multiples of this
1332
                                                // size; normally 2K.
1333
        dwFlags                 : DWORD;        // the ever-present flags
1334
        dwTotalFrames           : DWORD;        // # frames in file
1335
        dwInitialFrames         : DWORD;
1336
        dwStreams               : DWORD;
1337
        dwSuggestedBufferSize   : DWORD;
1338

1339
        dwWidth                 : DWORD;
1340
        dwHeight                : DWORD;
1341

1342
        dwReserved              : array[0..3] of DWORD;
1343
    end;
1344

1345
{-- Stream header ------------------------------------------------------------}
1346

1347
const
1348
    AVISF_DISABLED              = $00000001;
1349

1350
    AVISF_VIDEO_PALCHANGES      = $00010000;
1351

1352
type
1353
    PAVIStreamHeader            = ^TAVIStreamHeader;
1354
    TAVIStreamHeader            = packed record
1355
        fccType                 : FOURCC;
1356
        fccHandler              : FOURCC;
1357
        dwFlags                 : DWORD;        // Contains AVITF_* flags
1358
        wPriority               : WORD;
1359
        wLanguage               : WORD;
1360
        dwInitialFrames         : DWORD;
1361
        dwScale                 : DWORD;
1362
        dwRate                  : DWORD;        // dwRate / dwScale == samples/second
1363
        dwStart                 : DWORD;
1364
        dwLength                : DWORD;        // In units above...
1365
        dwSuggestedBufferSize   : DWORD;
1366
        dwQuality               : DWORD;
1367
        dwSampleSize            : DWORD;
1368
        rcFrame                 : TRECT;
1369
    end;
1370

1371
{-- Flags for index ----------------------------------------------------------}
1372

1373
const
1374
    AVIIF_NOTIME                = $00000100;    // this frame doesn't take any time
1375
    AVIIF_COMPUSE               = $0FFF0000;    // these bits are for compressor use
1376

1377
type
1378
    PAVIINDEXENTRY              = ^TAVIINDEXENTRY;
1379
    TAVIINDEXENTRY              = packed record
1380
        ckid                    : DWORD;
1381
        dwFlags                 : DWORD;
1382
        dwChunkOffset           : DWORD;        // Position of chunk
1383
        dwChunkLength           : DWORD;        // Length of chunk
1384
    end;
1385

1386
{-- Palette change chunk (used in video streams) -----------------------------}
1387

1388
    PAVIPALCHANGE               = ^TAVIPALCHANGE;
1389
    TAVIPALCHANGE               = packed record
1390
        bFirstEntry             : BYTE;         // first entry to change
1391
        bNumEntries             : BYTE;         // # entries to change (0 if 256)
1392
        wFlags                  : WORD;         // Mostly to preserve alignment...
1393
        peNew                   : array[0..0] of TPALETTEENTRY; // New color specifications
1394
    end;
1395

1396
(****************************************************************************
1397
 *
1398
 *  AVIFile - routines for reading/writing standard AVI files
1399
 *
1400
 ***************************************************************************)
1401

1402
//
1403
// Ansi - Unicode thunking.
1404
//
1405
// Unicode or Ansi-only apps can call the avifile APIs.
1406
// any Win32 app who wants to use
1407
// any of the AVI COM interfaces must be UNICODE - the AVISTREAMINFO and
1408
// AVIFILEINFO structures used in the Info methods of these interfaces are
1409
// the unicode variants, and no thunking to or from ansi takes place
1410
// except in the AVIFILE api entrypoints.
1411
//
1412
// For Ansi/Unicode thunking: for each entrypoint or structure that
1413
// uses chars or strings, two versions are declared in the Win32 version,
1414
// ApiNameW and ApiNameA. The default name ApiName is #defined to one or
1415
// other of these depending on whether UNICODE is defined (during
1416
// compilation of the app that is including this header). The source will
1417
// contain ApiName and ApiNameA (with ApiName being the Win16 implementation,
1418
// and also #defined to ApiNameW, and ApiNameA being the thunk entrypoint).
1419
//
1420

1421
// For GetFrame::SetFormat - use the best format for the display
1422

1423
const
1424
    AVIGETFRAMEF_BESTDISPLAYFMT = 1;
1425

1426
//
1427
// Structures used by AVIStreamInfo & AVIFileInfo.
1428
//
1429
// These are related to, but not identical to, the header chunks
1430
// in an AVI file.
1431
//
1432

1433
{-- AVISTREAMINFO ------------------------------------------------------------}
1434

1435
// for Unicode/Ansi thunking we need to declare three versions of this!
1436

1437
type
1438
    PAVIStreamInfoW             = ^TAVIStreamInfoW;
1439
    TAVIStreamInfoW             = packed record
1440
        fccType                 : DWORD;
1441
        fccHandler              : DWORD;
1442
        dwFlags                 : DWORD;        // Contains AVITF_* flags
1443
        dwCaps                  : DWORD;
1444
        wPriority               : WORD;
1445
        wLanguage               : WORD;
1446
        dwScale                 : DWORD;
1447
        dwRate                  : DWORD;        // dwRate / dwScale == samples/second
1448
        dwStart                 : DWORD;
1449
        dwLength                : DWORD;        // In units above...
1450
        dwInitialFrames         : DWORD;
1451
        dwSuggestedBufferSize   : DWORD;
1452
        dwQuality               : DWORD;
1453
        dwSampleSize            : DWORD;
1454
        rcFrame                 : TRECT;
1455
        dwEditCount             : DWORD;
1456
        dwFormatChangeCount     : DWORD;
1457
        szName                  : array[0..63] of WideChar;
1458
    end;
1459

1460
    PAVIStreamInfoA             = ^TAVIStreamInfoA;
1461
    TAVIStreamInfoA             = packed record
1462
        fccType                 : DWORD;
1463
        fccHandler              : DWORD;
1464
        dwFlags                 : DWORD;        // Contains AVITF_* flags
1465
        dwCaps                  : DWORD;
1466
        wPriority               : WORD;
1467
        wLanguage               : WORD;
1468
        dwScale                 : DWORD;
1469
        dwRate                  : DWORD;        // dwRate / dwScale == samples/second
1470
        dwStart                 : DWORD;
1471
        dwLength                : DWORD;        // In units above...
1472
        dwInitialFrames         : DWORD;
1473
        dwSuggestedBufferSize   : DWORD;
1474
        dwQuality               : DWORD;
1475
        dwSampleSize            : DWORD;
1476
        rcFrame                 : TRECT;
1477
        dwEditCount             : DWORD;
1478
        dwFormatChangeCount     : DWORD;
1479
        szName                  : array[0..63] of AnsiChar;
1480
    end;
1481

1482
  PAVIStreamInfo = ^TAVIStreamInfo;
1483
{$IFDEF UNICODE}
1484
  TAVIStreamInfo = TAVIStreamInfoW;
1485
{$ELSE}
1486
  TAVIStreamInfo = TAVIStreamInfoA;
1487
{$ENDIF}
1488

1489
const
1490
    AVISTREAMINFO_DISABLED      = $00000001;
1491
    AVISTREAMINFO_FORMATCHANGES = $00010000;
1492

1493
{-- AVIFILEINFO --------------------------------------------------------------}
1494

1495
type
1496
    PAVIFileInfoW               = ^TAVIFileInfoW;
1497
    TAVIFileInfoW               = packed record
1498
        dwMaxBytesPerSec        : DWORD;        // max. transfer rate
1499
        dwFlags                 : DWORD;        // the ever-present flags
1500
        dwCaps                  : DWORD;
1501
        dwStreams               : DWORD;
1502
        dwSuggestedBufferSize   : DWORD;
1503

1504
        dwWidth                 : DWORD;
1505
        dwHeight                : DWORD;
1506

1507
        dwScale                 : DWORD;
1508
        dwRate                  : DWORD;        // dwRate / dwScale == samples/second
1509
        dwLength                : DWORD;
1510

1511
        dwEditCount             : DWORD;
1512

1513
        szFileType              : array[0..63] of WideChar;
1514
                                                // descriptive string for file type?
1515
    end;
1516

1517
    PAVIFileInfoA               = ^TAVIFileInfoA;
1518
    TAVIFileInfoA               = packed record
1519
        dwMaxBytesPerSec        : DWORD;        // max. transfer rate
1520
        dwFlags                 : DWORD;        // the ever-present flags
1521
        dwCaps                  : DWORD;
1522
        dwStreams               : DWORD;
1523
        dwSuggestedBufferSize   : DWORD;
1524

1525
        dwWidth                 : DWORD;
1526
        dwHeight                : DWORD;
1527

1528
        dwScale                 : DWORD;
1529
        dwRate                  : DWORD;        // dwRate / dwScale == samples/second
1530
        dwLength                : DWORD;
1531

1532
        dwEditCount             : DWORD;
1533

1534
        szFileType              : array[0..63] of AnsiChar;
1535
                                                // descriptive string for file type?
1536
    end;
1537

1538
  PAVIFileInfo = ^TAVIFileInfo;
1539
{$IFDEF UNICODE}
1540
  TAVIFileInfo = TAVIFileInfoW;
1541
{$ELSE}
1542
  TAVIFileInfo = TAVIFileInfoA;
1543
{$ENDIF}
1544

1545
{-- Flags for dwFlags --------------------------------------------------------}
1546

1547
const
1548
    AVIFILEINFO_HASINDEX            = $00000010;
1549
    AVIFILEINFO_MUSTUSEINDEX        = $00000020;
1550
    AVIFILEINFO_ISINTERLEAVED       = $00000100;
1551
    AVIFILEINFO_WASCAPTUREFILE      = $00010000;
1552
    AVIFILEINFO_COPYRIGHTED         = $00020000;
1553

1554
{-- Flags for dwCaps ---------------------------------------------------------}
1555

1556
    AVIFILECAPS_CANREAD             = $00000001;
1557
    AVIFILECAPS_CANWRITE            = $00000002;
1558
    AVIFILECAPS_ALLKEYFRAMES        = $00000010;
1559
    AVIFILECAPS_NOCOMPRESSION       = $00000020;
1560

1561
type
1562
    TAVISAVECALLBACK                = function(i: int): BOOL; pascal;
1563

1564
{-- AVICOMPRESSOPTIONS -------------------------------------------------------}
1565

1566
// Make sure it matches the AutoDoc in avisave.c !!!
1567

1568
type
1569
    PAVICOMPRESSOPTIONS             = ^TAVICOMPRESSOPTIONS;
1570
    TAVICOMPRESSOPTIONS             = packed record
1571
        fccType                     : DWORD;    // stream type, for consistency
1572
        fccHandler                  : DWORD;    // compressor
1573
        dwKeyFrameEvery             : DWORD;    // keyframe rate
1574
        dwQuality                   : DWORD;    // compress quality 0-10,000
1575
        dwBytesPerSecond            : DWORD;    // bytes per second
1576
        dwFlags                     : DWORD;    // flags... see below
1577
        lpFormat                    : PVOID;    // save format
1578
        cbFormat                    : DWORD;
1579
        lpParms                     : PVOID;    // compressor options
1580
        cbParms                     : DWORD;
1581
        dwInterleaveEvery           : DWORD;    // for non-video streams only
1582
    end;
1583

1584
//
1585
// Defines for the dwFlags field of the AVICOMPRESSOPTIONS struct
1586
// Each of these flags determines if the appropriate field in the structure
1587
// (dwInterleaveEvery, dwBytesPerSecond, and dwKeyFrameEvery) is payed
1588
// attention to.  See the autodoc in avisave.c for details.
1589
//
1590

1591
const
1592
    AVICOMPRESSF_INTERLEAVE         = $00000001;    // interleave
1593
    AVICOMPRESSF_DATARATE           = $00000002;    // use a data rate
1594
    AVICOMPRESSF_KEYFRAMES          = $00000004;    // use keyframes
1595
    AVICOMPRESSF_VALID              = $00000008;    // has valid data?
1596

1597
(*	-	-	-	-	-	-	-	-	*/
1598

1599

1600
/****** AVI Stream Interface *******************************************)
1601

1602
type
1603
    IAVIStream = interface(IUnknown)
1604
        function Create(lParam1, lParam2: LPARAM): HResult; stdcall;
1605
        function Info(var psi: TAVIStreamInfoW; lSize: LONG): HResult; stdcall;
1606
        function FindSample(lPos: LONG; lFlags: LONG): LONG; stdcall;
1607
        function ReadFormat(lPos: LONG; lpFormat: PVOID; var lpcbFormat: LONG): HResult; stdcall;
1608
        function SetFormat(lPos: LONG; lpFormat: PVOID; cbFormat: LONG): HResult; stdcall;
1609
        function Read(lStart: LONG; lSamples: LONG; lpBuffer: PVOID; cbBuffer: LONG; var plBytes, plSamples: LONG): HResult; stdcall;
1610
        function Write(lStart: LONG; lSamples: LONG; lpBuffer: PVOID; cbBuffer: LONG; dwFlags: DWORD; var plSampWritten, plBytesWritten: LONG): HResult; stdcall;
1611
        function Delete(lStart: LONG; lSamples: LONG): HResult; stdcall;
1612
        function ReadData(fcc: DWORD; lp: PVOID; var lpcb: LONG): HResult; stdcall;
1613
        function WriteData(fcc: DWORD; lp: PVOID; cb: LONG): HResult; stdcall;
1614
        function SetInfo(var lpInfo: TAVIStreamInfoW; cbInfo: LONG): HResult; stdcall;
1615
    end;
1616

1617
    IAVIStreaming = interface(IUnknown)
1618
        function _Begin(lStart, lEnd : LONG; lRate : LONG): HResult; stdcall;
1619
        function _End: HResult; stdcall;
1620
    end;
1621

1622
    IAVIEditStream = interface(IUnknown)
1623
        function Cut(var plStart, plLength: LONG; var ppResult: IAVIStream): HResult; stdcall;
1624
        function Copy(var plStart, plLength: LONG; var ppResult: IAVIStream): HResult; stdcall;
1625
        function Paste(var plPos: LONG; var plLength: LONG; pstream: IAVIStream; lStart, lEnd: LONG): HResult; stdcall;
1626
        function Clone(var ppResult: IAVIStream): HResult; stdcall;
1627
        function SetInfo(var lpInfo: TAVIStreamInfoW; cbInfo: LONG): HResult; stdcall;
1628
    end;
1629

1630
{-- AVIFile ------------------------------------------------------------------}
1631

1632
    IAVIFile = interface(IUnknown)
1633
        function Info(var pfi: TAVIFileInfoW; iSize: LONG): HResult; stdcall;
1634
        function GetStream(var ppStream: IAVISTREAM; fccType: DWORD; lParam: LONG): HResult; stdcall;
1635
        function CreateStream(var ppStream: IAVISTREAM; var psi: TAVIStreamInfoW): HResult; stdcall;
1636
        function WriteData(ckid: DWORD; lpData: PVOID; cbData: LONG): HResult; stdcall;
1637
        function ReadData(ckid: DWORD; lpData: PVOID; lpcbData: PLONG): HResult; stdcall;
1638
        function EndRecord: HResult; stdcall;
1639
        function DeleteStream(fccType: DWORD; lParam: LONG): HResult; stdcall;
1640
    end;
1641

1642
{-- GetFrame -----------------------------------------------------------------}
1643

1644
     // The functions 'BeginExtraction' and 'EndExtraction' have actually
1645
     // the names 'Begin' and 'End', but we cannot use that identifiers for
1646
     // obvious reasons.
1647

1648
     IGetFrame = interface(IUnknown)
1649
       function GetFrame(lPos: LONG): PBitmapInfoHeader; stdcall;
1650
       function BeginExtraction(lStart, lEnd, lRate: LONG): HResult; stdcall;
1651
       function EndExtraction: HResult; stdcall;
1652
       function SetFormat(var lpbi: TBitmapInfoHeader; lpBits: Pointer; x, y, dx, dy: Integer): HResult; stdcall;
1653
     end;
1654

1655
{-- GUIDs --------------------------------------------------------------------}
1656

1657
const
1658
    IID_IAVIFile      : TGUID = (D1: $00020020; D2: $0; D3: $0; D4:($C0,$0,$0,$0,$0,$0,$0,$46));
1659
    IID_IAVIStream    : TGUID = (D1: $00020021; D2: $0; D3: $0; D4:($C0,$0,$0,$0,$0,$0,$0,$46));
1660
    IID_IAVIStreaming : TGUID = (D1: $00020022; D2: $0; D3: $0; D4:($C0,$0,$0,$0,$0,$0,$0,$46));
1661
    IID_IGetFrame     : TGUID = (D1: $00020023; D2: $0; D3: $0; D4:($C0,$0,$0,$0,$0,$0,$0,$46));
1662
    IID_IAVIEditStream: TGUID = (D1: $00020024; D2: $0; D3: $0; D4:($C0,$0,$0,$0,$0,$0,$0,$46));
1663

1664
    CLSID_AVISimpleUnMarshal : TGUID = (D1: $00020009; D2: $0; D3: $0; D4:($C0,$0,$0,$0,$0,$0,$0,$46));
1665
    CLSID_AVIFile            : TGUID = (D1: $00020000; D2: $0; D3: $0; D4:($C0,$0,$0,$0,$0,$0,$0,$46));
1666

1667
    AVIFILEHANDLER_CANREAD          = $0001;
1668
    AVIFILEHANDLER_CANWRITE         = $0002;
1669
    AVIFILEHANDLER_CANACCEPTNONRGB  = $0004;
1670

1671
{-- Functions ----------------------------------------------------------------}
1672

1673
procedure   AVIFileInit; stdcall;   // Call this first!
1674
procedure   AVIFileExit; stdcall;
1675

1676
function    AVIFileAddRef(pfile: IAVIFile): ULONG; stdcall;
1677
function    AVIFileRelease(pfile: IAVIFile): ULONG; stdcall;
1678

1679
function    AVIFileOpenA(var ppfile: IAVIFile; szFile: LPCSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall;
1680
function    AVIFileOpenW(var ppfile: IAVIFile; szFile: LPCWSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall;
1681

1682
{$IFDEF UNICODE}
1683
function    AVIFileOpen(var ppfile: IAVIFile; szFile: LPCWSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall;
1684
{$ELSE}
1685
function    AVIFileOpen(var ppfile: IAVIFile; szFile: LPCSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall;
1686
{$ENDIF}
1687

1688
function    AVIFileInfoW(pfile: IAVIFile; var pfi: TAVIFILEINFOW; lSize: LONG): HResult; stdcall;
1689
function    AVIFileInfoA(pfile: IAVIFile; var pfi: TAVIFILEINFOA; lSize: LONG): HResult; stdcall;
1690

1691
function    AVIFileInfo(pfile: IAVIFile; var pfi: TAVIFILEINFO; lSize: LONG): HResult; stdcall;
1692

1693
function    AVIFileGetStream(pfile: IAVIFile; var ppavi: IAVISTREAM; fccType: DWORD; lParam: LONG): HResult; stdcall;
1694

1695
function    AVIFileCreateStreamW(pfile: IAVIFile; var ppavi: IAVISTREAM; var psi: TAVISTREAMINFOW): HResult; stdcall;
1696
function    AVIFileCreateStreamA(pfile: IAVIFile; var ppavi: IAVISTREAM; var psi: TAVISTREAMINFOA): HResult; stdcall;
1697

1698
function    AVIFileCreateStream(pfile: IAVIFile; var ppavi: IAVISTREAM; var psi: TAVISTREAMINFO): HResult; stdcall;
1699

1700
function    AVIFileWriteData(pfile: IAVIFile; ckid: DWORD; lpData: PVOID; cbData: LONG): HResult; stdcall;
1701
function    AVIFileReadData(pfile: IAVIFile; ckid: DWORD; lpData: PVOID; var lpcbData: LONG): HResult; stdcall;
1702
function    AVIFileEndRecord(pfile: IAVIFile): HResult; stdcall;
1703

1704
function    AVIStreamAddRef(pavi: IAVIStream): ULONG; stdcall;
1705
function    AVIStreamRelease(pavi: IAVIStream): ULONG; stdcall;
1706

1707
function    AVIStreamInfoW (pavi: IAVIStream; var psi: TAVISTREAMINFOW; lSize: LONG): HResult; stdcall;
1708
function    AVIStreamInfoA (pavi: IAVIStream; var psi: TAVISTREAMINFOA; lSize: LONG): HResult; stdcall;
1709

1710
function    AVIStreamInfo(pavi: IAVIStream; var psi: TAVISTREAMINFO; lSize: LONG): HResult; stdcall;
1711

1712
function    AVIStreamFindSample(pavi: IAVIStream; lPos: LONG; lFlags: LONG): LONG; stdcall;
1713
function    AVIStreamReadFormat(pavi: IAVIStream; lPos: LONG; lpFormat: PVOID; lpcbFormat: PLONG): HResult; stdcall;
1714
function    AVIStreamSetFormat(pavi: IAVIStream; lPos: LONG; lpFormat: PVOID; cbFormat: LONG): HResult; stdcall;
1715
function    AVIStreamReadData(pavi: IAVIStream; fcc: DWORD; lp: PVOID; lpcb: PLONG): HResult; stdcall;
1716
function    AVIStreamWriteData(pavi: IAVIStream; fcc: DWORD; lp: PVOID; cb: LONG): HResult; stdcall;
1717

1718
function    AVIStreamRead(
1719
    pavi            : IAVISTREAM;
1720
    lStart          : LONG;
1721
    lSamples        : LONG;
1722
    lpBuffer        : PVOID;
1723
    cbBuffer        : LONG;
1724
    plBytes         : PLONG;
1725
    plSamples       : PLONG
1726
    ): HResult; stdcall;
1727

1728
const
1729
    AVISTREAMREAD_CONVENIENT    = -1;
1730

1731
function    AVIStreamWrite(
1732
    pavi            : IAVISTREAM;
1733
    lStart          : LONG;
1734
    lSamples        : LONG;
1735
    lpBuffer        : PVOID;
1736
    cbBuffer        : LONG;
1737
    dwFlags         : DWORD;
1738
    plSampWritten   : PLONG;
1739
    plBytesWritten  : PLONG
1740
    ): HResult; stdcall;
1741

1742
// Right now, these just use AVIStreamInfo() to get information, then
1743
// return some of it.  Can they be more efficient?
1744

1745
function    AVIStreamStart(pavi: IAVIStream): LONG; stdcall;
1746
function    AVIStreamLength(pavi: IAVIStream): LONG; stdcall;
1747
function    AVIStreamTimeToSample(pavi: IAVIStream; lTime: LONG): LONG; stdcall;
1748
function    AVIStreamSampleToTime(pavi: IAVIStream; lSample: LONG): LONG; stdcall;
1749

1750
function    AVIStreamBeginStreaming(pavi: IAVIStream; lStart, lEnd: LONG; lRate: LONG): HResult; stdcall;
1751
function    AVIStreamEndStreaming(pavi: IAVIStream): HResult; stdcall;
1752

1753
{-- Helper functions for using IGetFrame -------------------------------------}
1754

1755
function    AVIStreamGetFrameOpen(pavi: IAVIStream; lpbiWanted: PBitmapInfoHeader): IGetFrame; stdcall;
1756
function    AVIStreamGetFrame(pg: IGetFrame; lPos: LONG): PBitmapInfoHeader; stdcall;
1757
function    AVIStreamGetFrameClose(pg: IGetFrame): HResult; stdcall;
1758

1759
// !!! We need some way to place an advise on a stream....
1760
// STDAPI AVIStreamHasChanged   (PAVISTREAM pavi);
1761

1762
{-- Shortcut function --------------------------------------------------------}
1763

1764
function    AVIStreamOpenFromFileA(var ppavi: IAVISTREAM; szFile: LPCSTR; fccType: DWORD;
1765
                                   lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall;
1766
function    AVIStreamOpenFromFileW(var ppavi: IAVISTREAM; szFile: LPCWSTR; fccType: DWORD;
1767
                                   lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall;
1768

1769
{$IFDEF UNICODE}
1770
   function AVIStreamOpenFromFile(var ppavi: IAVISTREAM; szFile: LPCWSTR; fccType: DWORD;
1771
     lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall;
1772
{$ELSE}
1773
   function AVIStreamOpenFromFile(var ppavi: IAVISTREAM; szFile: LPCSTR; fccType: DWORD;
1774
     lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall;
1775
{$ENDIF}
1776

1777
{-- Use to create disembodied streams ----------------------------------------}
1778

1779
function    AVIStreamCreate(var ppavi: IAVISTREAM; lParam1, lParam2: LONG; pclsidHandler: PCLSID): HResult; stdcall;
1780

1781
// PHANDLER    AVIAPI AVIGetHandler         (PAVISTREAM pavi, PAVISTREAMHANDLER psh);
1782
// PAVISTREAM  AVIAPI AVIGetStream          (PHANDLER p);
1783

1784
{-- Flags for AVIStreamFindSample --------------------------------------------}
1785

1786
const
1787
    FIND_DIR                        = $0000000F;    // direction
1788
    FIND_NEXT                       = $00000001;    // go forward
1789
    FIND_PREV                       = $00000004;    // go backward
1790
    FIND_FROM_START                 = $00000008;    // start at the logical beginning
1791

1792
    FIND_TYPE                       = $000000F0;    // type mask
1793
    FIND_KEY                        = $00000010;    // find key frame.
1794
    FIND_ANY                        = $00000020;    // find any (non-empty) sample
1795
    FIND_FORMAT                     = $00000040;    // find format change
1796

1797
    FIND_RET                        = $0000F000;    // return mask
1798
    FIND_POS                        = $00000000;    // return logical position
1799
    FIND_LENGTH                     = $00001000;    // return logical size
1800
    FIND_OFFSET                     = $00002000;    // return physical position
1801
    FIND_SIZE                       = $00003000;    // return physical size
1802
    FIND_INDEX                      = $00004000;    // return physical index position
1803

1804
{-- Stuff to support backward compat. ----------------------------------------}
1805

1806
function    AVIStreamFindKeyFrame(var pavi: IAVISTREAM; lPos: LONG; lFlags: LONG): DWORD; stdcall; // AVIStreamFindSample
1807

1808
// Non-portable: this is alias for method name
1809
// FindKeyFrame FindSample
1810

1811
function    AVIStreamClose(pavi: IAVISTREAM): ULONG; stdcall; // AVIStreamRelease
1812
function    AVIFileClose(pfile: IAVIFILE): ULONG; stdcall; // AVIFileRelease
1813
procedure   AVIStreamInit; stdcall; // AVIFileInit
1814
procedure   AVIStreamExit; stdcall; // AVIFileExit
1815

1816
const
1817
    SEARCH_NEAREST                  = FIND_PREV;
1818
    SEARCH_BACKWARD                 = FIND_PREV;
1819
    SEARCH_FORWARD                  = FIND_NEXT;
1820
    SEARCH_KEY                      = FIND_KEY;
1821
    SEARCH_ANY                      = FIND_ANY;
1822

1823
{-- Helper macros ------------------------------------------------------------}
1824

1825
function    AVIStreamSampleToSample(pavi1, pavi2: IAVISTREAM; l: LONG): LONG;
1826
function    AVIStreamNextSample(pavi: IAVISTREAM; l: LONG): LONG;
1827
function    AVIStreamPrevSample(pavi: IAVISTREAM; l: LONG): LONG;
1828
function    AVIStreamNearestSample(pavi: IAVISTREAM; l: LONG): LONG;
1829
function    AVIStreamNextKeyFrame(pavi: IAVISTREAM; l: LONG): LONG;
1830
function    AVIStreamPrevKeyFrame(pavi: IAVISTREAM; l: LONG): LONG;
1831
function    AVIStreamNearestKeyFrame(pavi: IAVISTREAM; l: LONG): LONG;
1832
function    AVIStreamIsKeyFrame(pavi: IAVISTREAM; l: LONG): BOOL;
1833
function    AVIStreamPrevSampleTime(pavi: IAVISTREAM; t: LONG): LONG;
1834
function    AVIStreamNextSampleTime(pavi: IAVISTREAM; t: LONG): LONG;
1835
function    AVIStreamNearestSampleTime(pavi: IAVISTREAM; t: LONG): LONG;
1836
function    AVIStreamNextKeyFrameTime(pavi: IAVISTREAM; t: LONG): LONG;
1837
function    AVIStreamPrevKeyFrameTime(pavi: IAVISTREAM; t: LONG): LONG;
1838
function    AVIStreamNearestKeyFrameTime(pavi: IAVISTREAM; t: LONG): LONG;
1839
function    AVIStreamStartTime(pavi: IAVISTREAM): LONG;
1840
function    AVIStreamLengthTime(pavi: IAVISTREAM): LONG;
1841
function    AVIStreamEnd(pavi: IAVISTREAM): LONG;
1842
function    AVIStreamEndTime(pavi: IAVISTREAM): LONG;
1843
function    AVIStreamSampleSize(pavi: IAVISTREAM; lPos: LONG; plSize: PLONG): LONG;
1844
function    AVIStreamFormatSize(pavi: IAVISTREAM; lPos: LONG; plSize: PLONG): HResult;
1845
function    AVIStreamDataSize(pavi: IAVISTREAM; fcc: DWORD; plSize: PLONG): HResult;
1846

1847
{== AVISave routines and structures ==========================================}
1848

1849
const
1850
    comptypeDIB                     = $20424944; // mmioFOURCC('D', 'I', 'B', ' ')
1851

1852
function    AVIMakeCompressedStream(
1853
    var ppsCompressed   : IAVISTREAM;
1854
    ppsSource           : IAVISTREAM;
1855
    lpOptions           : PAVICOMPRESSOPTIONS;
1856
    pclsidHandler       : PCLSID
1857
    ): HResult; stdcall;
1858

1859
// Non-portable: uses variable number of params
1860
// EXTERN_C HRESULT CDECL AVISaveA (LPCSTR               szFile,
1861
//      CLSID FAR *pclsidHandler,
1862
//      AVISAVECALLBACK     lpfnCallback,
1863
//      int                 nStreams,
1864
//      PAVISTREAM      pfile,
1865
//      LPAVICOMPRESSOPTIONS lpOptions,
1866
//      ...);
1867

1868
function    AVISaveVA(
1869
    szFile          : LPCSTR;
1870
    pclsidHandler   : PCLSID;
1871
    lpfnCallback    : TAVISAVECALLBACK;
1872
    nStreams        : int;
1873
    var ppavi       : IAVISTREAM;
1874
    var plpOptions  : PAVICOMPRESSOPTIONS
1875
    ): HResult; stdcall;
1876

1877
// Non-portable: uses variable number of params
1878
// EXTERN_C HRESULT CDECL AVISaveW (LPCWSTR               szFile,
1879
//      CLSID FAR *pclsidHandler,
1880
//      AVISAVECALLBACK     lpfnCallback,
1881
//      int                 nStreams,
1882
//      PAVISTREAM      pfile,
1883
//      LPAVICOMPRESSOPTIONS lpOptions,
1884
//      ...);
1885

1886
function    AVISaveVW(
1887
    szFile          : LPCWSTR;
1888
    pclsidHandler   : PCLSID;
1889
    lpfnCallback    : TAVISAVECALLBACK;
1890
    nStreams        : int;
1891
    var ppavi       : IAVISTREAM;
1892
    var plpOptions  : PAVICOMPRESSOPTIONS
1893
    ): HResult; stdcall;
1894

1895
// #define AVISave      AVISaveA
1896

1897
function    AVISaveV(
1898
    szFile          : LPCSTR;
1899
    pclsidHandler   : PCLSID;
1900
    lpfnCallback    : TAVISAVECALLBACK;
1901
    nStreams        : int;
1902
    var ppavi       : IAVISTREAM;
1903
    var plpOptions  : PAVICOMPRESSOPTIONS
1904
    ): HResult; stdcall; // AVISaveVA
1905

1906
function    AVISaveOptions(
1907
    hwnd            : HWND;
1908
    uiFlags         : UINT;
1909
    nStreams        : int;
1910
    var ppavi       : IAVISTREAM;
1911
    var plpOptions  : PAVICOMPRESSOPTIONS
1912
    ): BOOL; stdcall;
1913

1914
function    AVISaveOptionsFree(nStreams: int; var plpOptions: PAVICOMPRESSOPTIONS): HResult; stdcall;
1915

1916
{-- FLAGS FOR uiFlags --------------------------------------------------------}
1917

1918
// Same as the flags for ICCompressorChoose (see compman.h)
1919
// These determine what the compression options dialog for video streams
1920
// will look like.
1921

1922
function    AVIBuildFilterW(lpszFilter: LPWSTR; cbFilter: LONG; fSaving: BOOL): HResult; stdcall;
1923
function    AVIBuildFilterA(lpszFilter: LPSTR; cbFilter: LONG; fSaving: BOOL): HResult; stdcall;
1924

1925
function    AVIBuildFilter(lpszFilter: LPSTR; cbFilter: LONG; fSaving: BOOL): HResult; stdcall; // AVIBuildFilterA
1926

1927
function    AVIMakeFileFromStreams(var ppfile: IAVIFILE; nStreams: int; var papStreams: IAVISTREAM): HResult; stdcall;
1928

1929
function    AVIMakeStreamFromClipboard(cfFormat: UINT; hGlobal: THANDLE; var ppstream: IAVISTREAM): HResult; stdcall;
1930

1931
{-- Clipboard routines -------------------------------------------------------}
1932

1933
function    AVIPutFileOnClipboard(pf: IAVIFILE): HResult; stdcall;
1934
function    AVIGetFromClipboard(var lppf: IAVIFILE): HResult; stdcall;
1935
function    AVIClearClipboard: HResult; stdcall;
1936

1937
{-- Editing routines ---------------------------------------------------------}
1938

1939
function    CreateEditableStream(var ppsEditable: IAVISTREAM; psSource: IAVISTREAM): HResult; stdcall;
1940

1941
function    EditStreamCut(pavi: IAVISTREAM; var plStart, plLength: LONG; var ppResult: IAVISTREAM): HResult; stdcall;
1942

1943
function    EditStreamCopy(pavi: IAVISTREAM; var plStart, plLength: LONG; var ppResult: IAVISTREAM): HResult; stdcall;
1944

1945
function    EditStreamPaste(pavi: IAVISTREAM; var plPos, plLength: LONG; pstream: IAVISTREAM; lStart, lEnd: LONG): HResult; stdcall;
1946

1947
function    EditStreamClone(pavi: IAVISTREAM; var ppResult: IAVISTREAM): HResult; stdcall;
1948

1949
function    EditStreamSetNameA(pavi: IAVISTREAM; lpszName: LPCSTR): HResult; stdcall;
1950
function    EditStreamSetNameW(pavi: IAVISTREAM; lpszName: LPCWSTR): HResult; stdcall;
1951
function    EditStreamSetInfoW(pavi: IAVISTREAM; lpInfo: PAVISTREAMINFOW; cbInfo: LONG): HResult; stdcall;
1952
function    EditStreamSetInfoA(pavi: IAVISTREAM; lpInfo: PAVISTREAMINFOA; cbInfo: LONG): HResult; stdcall;
1953

1954
function    EditStreamSetInfo(pavi: IAVISTREAM; lpInfo: PAVISTREAMINFOA; cbInfo: LONG): HResult; stdcall; // EditStreamSetInfoA
1955
function    EditStreamSetName(pavi: IAVISTREAM; lpszName: LPCSTR): HResult; stdcall; // EditStreamSetNameA
1956

1957
{-- Error handling -----------------------------------------------------------}
1958

1959
const
1960
    AVIERR_OK                       = 0;
1961

1962
// !!! Questions to be answered:
1963
// How can you get a string form of these errors?
1964
// Which of these errors should be replaced by errors in SCODE.H?
1965

1966
const
1967
    AVIERR_UNSUPPORTED              = $80044065; // MAKE_AVIERR(101)
1968
    AVIERR_BADFORMAT                = $80044066; // MAKE_AVIERR(102)
1969
    AVIERR_MEMORY                   = $80044067; // MAKE_AVIERR(103)
1970
    AVIERR_INTERNAL                 = $80044068; // MAKE_AVIERR(104)
1971
    AVIERR_BADFLAGS                 = $80044069; // MAKE_AVIERR(105)
1972
    AVIERR_BADPARAM                 = $8004406A; // MAKE_AVIERR(106)
1973
    AVIERR_BADSIZE                  = $8004406B; // MAKE_AVIERR(107)
1974
    AVIERR_BADHANDLE                = $8004406C; // MAKE_AVIERR(108)
1975
    AVIERR_FILEREAD                 = $8004406D; // MAKE_AVIERR(109)
1976
    AVIERR_FILEWRITE                = $8004406E; // MAKE_AVIERR(110)
1977
    AVIERR_FILEOPEN                 = $8004406F; // MAKE_AVIERR(111)
1978
    AVIERR_COMPRESSOR               = $80044070; // MAKE_AVIERR(112)
1979
    AVIERR_NOCOMPRESSOR             = $80044071; // MAKE_AVIERR(113)
1980
    AVIERR_READONLY                 = $80044072; // MAKE_AVIERR(114)
1981
    AVIERR_NODATA                   = $80044073; // MAKE_AVIERR(115)
1982
    AVIERR_BUFFERTOOSMALL           = $80044074; // MAKE_AVIERR(116)
1983
    AVIERR_CANTCOMPRESS             = $80044075; // MAKE_AVIERR(117)
1984
    AVIERR_USERABORT                = $800440C6; // MAKE_AVIERR(198)
1985
    AVIERR_ERROR                    = $800440C7; // MAKE_AVIERR(199)
1986

1987
{== MCIWnd - Window class for MCI objects ====================================}
1988

1989
//
1990
//  MCIWnd
1991
//
1992
//    MCIWnd window class header file.
1993
//
1994
//    the MCIWnd window class is a window class for controling MCI devices
1995
//    MCI devices include, wave files, midi files, AVI Video, cd audio,
1996
//    vcr, video disc, and others..
1997
//
1998
//    to learn more about MCI and mci command sets see the
1999
//    "Microsoft Multimedia Programmers's guide" in the Win31 SDK
2000
//
2001
//    the easiest use of the MCIWnd class is like so:
2002
//
2003
//          hwnd = MCIWndCreate(hwndParent, hInstance, 0, "chimes.wav");
2004
//          ...
2005
//          MCIWndPlay(hwnd);
2006
//          MCIWndStop(hwnd);
2007
//          MCIWndPause(hwnd);
2008
//          ....
2009
//          MCIWndDestroy(hwnd);
2010
//
2011
//    this will create a window with a play/pause, stop and a playbar
2012
//    and start the wave file playing.
2013
//
2014
//    mciwnd.h defines macros for all the most common MCI commands, but
2015
//    any string command can be used if needed.
2016
//
2017
//    Note: unlike the mciSendString() API, no alias or file name needs
2018
//    to be specifed, since the device to use is implied by the window handle.
2019
//
2020
//          MCIWndSendString(hwnd, "setaudio stream to 2");
2021
//
2022
//    (C) Copyright Microsoft Corp. 1991-1995.  All rights reserved.
2023
//
2024
// WIN32:
2025
//
2026
//    MCIWnd supports both ansi and unicode interfaces. For any message that
2027
//    takes or returns a text string, two versions of the message are defined,
2028
//    appended with A or W for Ansi or Wide Char. The message or api itself
2029
//    is defined to be one or other of these depending on whether you have
2030
//    UNICODE defined in your application.
2031
//    Thus for the api MCIWndCreate, there are in fact two apis,
2032
//    MCIWndCreateA and MCIWndCreateW. If you call MCIWndCreate, this will be
2033
//    re-routed to MCIWndCreateA unless UNICODE is defined when building your
2034
//    application. In any one application, you can mix calls to the
2035
//    Ansi and Unicode entrypoints.
2036
//
2037
//    If you use SendMessage instead of the macros below such as MCIWndOpen(),
2038
//    you will see that the messages have changed for WIN32, to support Ansi
2039
//    and Unicode entrypoints. In particular, MCI_OPEN has been replaced by
2040
//    MCWNDM_OPENA, or MCIWNDM_OPENW (MCIWNDM_OPEN is defined to be one or
2041
//    other of these).
2042
//
2043
//    Also, note that the WIN32 implementation of MCIWnd uses UNICODE
2044
//    so all apis and messages supporting ANSI strings do so by mapping them
2045
//    UNICODE strings and then calling the corresponding UNICODE entrypoint.
2046
//
2047

2048
function    MCIWndSM(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): DWORD;
2049

2050
const                               
2051
    MCIWND_WINDOW_CLASS             = 'MCIWndClass' ;
2052

2053
function    MCIWndCreateA(hwndParent: HWND; hInstance: HINST; dwStyle: DWORd; szFile: LPCSTR): HWND; cdecl;
2054
function    MCIWndCreateW(hwndParent: HWND; hInstance: HINST; dwStyle: DWORd; szFile: LPCWSTR): HWND; cdecl;
2055

2056
function    MCIWndCreate(hwndParent: HWND; hInstance: HINST; dwStyle: DWORd; szFile: LPCSTR): HWND; cdecl; // MCIWndCreateA
2057

2058
function    MCIWndRegisterClass: BOOL; cdecl;
2059

2060
{-- Flags for the MCIWndOpen command -----------------------------------------}
2061

2062
const
2063
    MCIWNDOPENF_NEW                 = $0001;    // open a new file
2064

2065
{-- Window styles ------------------------------------------------------------}
2066

2067
    MCIWNDF_NOAUTOSIZEWINDOW        = $0001;    // when movie size changes
2068
    MCIWNDF_NOPLAYBAR               = $0002;    // no toolbar
2069
    MCIWNDF_NOAUTOSIZEMOVIE         = $0004;    // when window size changes
2070
    MCIWNDF_NOMENU                  = $0008;    // no popup menu from RBUTTONDOWN
2071
    MCIWNDF_SHOWNAME                = $0010;    // show name in caption
2072
    MCIWNDF_SHOWPOS                 = $0020;    // show position in caption
2073
    MCIWNDF_SHOWMODE                = $0040;    // show mode in caption
2074
    MCIWNDF_SHOWALL                 = $0070;    // show all
2075

2076
    MCIWNDF_NOTIFYMODE              = $0100;    // tell parent of mode change
2077
    MCIWNDF_NOTIFYPOS               = $0200;    // tell parent of pos change
2078
    MCIWNDF_NOTIFYSIZE              = $0400;    // tell parent of size change
2079
    MCIWNDF_NOTIFYERROR             = $1000;    // tell parent of an error
2080
    MCIWNDF_NOTIFYALL               = $1F00;    // tell all
2081

2082
    MCIWNDF_NOTIFYANSI              = $0080;
2083

2084
// The MEDIA notification includes a text string.
2085
// To receive notifications in ANSI instead of unicode set the
2086
// MCIWNDF_NOTIFYANSI style bit. The macro below includes this bit
2087
// by default unless you define UNICODE in your application.
2088

2089
    MCIWNDF_NOTIFYMEDIAA            = $0880;    // tell parent of media change
2090
    MCIWNDF_NOTIFYMEDIAW            = $0800;    // tell parent of media change
2091

2092
    MCIWNDF_NOTIFYMEDIA             = MCIWNDF_NOTIFYMEDIAA;
2093

2094
    MCIWNDF_RECORD                  = $2000;    // Give a record button
2095
    MCIWNDF_NOERRORDLG              = $4000;    // Show Error Dlgs for MCI cmds?
2096
    MCIWNDF_NOOPEN                  = $8000;    // Don't allow user to open things
2097

2098
{-- Can macros ---------------------------------------------------------------}
2099

2100
function    MCIWndCanPlay(hwnd: HWND): BOOL;
2101
function    MCIWndCanRecord(hwnd: HWND): BOOL;
2102
function    MCIWndCanSave(hwnd: HWND): BOOL;
2103
function    MCIWndCanWindow(hwnd: HWND): BOOL;
2104
function    MCIWndCanEject(hwnd: HWND): BOOL;
2105
function    MCIWndCanConfig(hwnd: HWND): BOOL;
2106
function    MCIWndPaletteKick(hwnd: HWND): BOOL;
2107

2108
function    MCIWndSave(hwnd: HWND; szFile: LPCSTR): DWORD;
2109
function    MCIWndSaveDialog(hwnd: HWND): DWORD;
2110

2111
// If you dont give a device it will use the current device....
2112

2113
function    MCIWndNew(hwnd: HWND; lp: PVOID): DWORD;
2114
function    MCIWndRecord(hwnd: HWND): DWORD;
2115
function    MCIWndOpen(hwnd: HWND; sz: LPCSTR; f: BOOL): DWORD;
2116
function    MCIWndOpenDialog(hwnd: HWND): DWORD;
2117
function    MCIWndClose(hwnd: HWND): DWORD;
2118
function    MCIWndPlay(hwnd: HWND): DWORD;
2119
function    MCIWndStop(hwnd: HWND): DWORD;
2120
function    MCIWndPause(hwnd: HWND): DWORD;
2121
function    MCIWndResume(hwnd: HWND): DWORD;
2122
function    MCIWndSeek(hwnd: HWND; lPos: DWORD): DWORD;
2123
function    MCIWndEject(hwnd: HWND): DWORD;
2124

2125
function    MCIWndHome(hwnd: HWND): DWORD;
2126
function    MCIWndEnd(hwnd: HWND): DWORD;
2127

2128
function    MCIWndGetSource(hwnd: HWND; prc: PRECT): DWORD;
2129
function    MCIWndPutSource(hwnd: HWND; prc: PRECT): DWORD;
2130

2131
function    MCIWndGetDest(hwnd: HWND; prc: PRECT): DWORD;
2132
function    MCIWndPutDest(hwnd: HWND; prc: PRECT): DWORD;
2133

2134
function    MCIWndPlayReverse(hwnd: HWND): DWORD;
2135
function    MCIWndPlayFrom(hwnd: HWND; lPos: DWORD): DWORD;
2136
function    MCIWndPlayTo(hwnd: HWND; lPos: DWORD): DWORD;
2137
function    MCIWndPlayFromTo(hwnd: HWND; lStart, lEnd: DWORD): DWORD;
2138

2139
function    MCIWndGetDeviceID(hwnd: HWND): UINT;
2140
function    MCIWndGetAlias(hwnd: HWND): UINT;
2141
function    MCIWndGetMode(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
2142
function    MCIWndGetPosition(hwnd: HWND): DWORD;
2143
function    MCIWndGetPositionString(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
2144
function    MCIWndGetStart(hwnd: HWND): DWORD;
2145
function    MCIWndGetLength(hwnd: HWND): DWORD;
2146
function    MCIWndGetEnd(hwnd: HWND): DWORD;
2147

2148
function    MCIWndStep(hwnd: HWND; n: DWORD): DWORD;
2149

2150
procedure   MCIWndDestroy(hwnd: HWND);
2151
procedure   MCIWndSetZoom(hwnd: HWND; iZoom: UINT);
2152
function    MCIWndGetZoom(hwnd: HWND): UINT;
2153
function    MCIWndSetVolume(hwnd: HWND; iVol: UINT): DWORD;
2154
function    MCIWndGetVolume(hwnd: HWND): DWORD;
2155
function    MCIWndSetSpeed(hwnd: HWND; iSpeed: UINT): DWORD;
2156
function    MCIWndGetSpeed(hwnd: HWND): DWORD;
2157
function    MCIWndSetTimeFormat(hwnd: HWND; lp: LPCSTR): DWORD;
2158
function    MCIWndGetTimeFormat(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
2159
procedure   MCIWndValidateMedia(hwnd: HWND);
2160

2161
procedure   MCIWndSetRepeat(hwnd: HWND; f: BOOL);
2162
function    MCIWndGetRepeat(hwnd: HWND): BOOL;
2163

2164
function    MCIWndUseFrames(hwnd: HWND): DWORD;
2165
function    MCIWndUseTime(hwnd: HWND): DWORD;
2166

2167
procedure   MCIWndSetActiveTimer(hwnd: HWND; active: UINT);
2168
procedure   MCIWndSetInactiveTimer(hwnd: HWND; inactive: UINT);
2169
procedure   MCIWndSetTimers(hwnd: HWND; active, inactive: UINT);
2170
function    MCIWndGetActiveTimer(hwnd: HWND): UINT;
2171
function    MCIWndGetInactiveTimer(hwnd: HWND): UINT;
2172

2173
function    MCIWndRealize(hwnd: HWND; fBkgnd: BOOL): DWORD;
2174

2175
function    MCIWndSendString(hwnd: HWND; sz: LPCSTR): DWORD;
2176
function    MCIWndReturnString(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
2177
function    MCIWndGetError(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
2178

2179
// #define MCIWndActivate(hwnd, f)     (void)MCIWndSM(hwnd, WM_ACTIVATE, (WPARAM)(BOOL)(f), 0)
2180

2181
function    MCIWndGetPalette(hwnd: HWND): HPALETTE;
2182
function    MCIWndSetPalette(hwnd: HWND; hpal: HPALETTE): DWORD;
2183

2184
function    MCIWndGetFileName(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
2185
function    MCIWndGetDevice(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
2186

2187
function    MCIWndGetStyles(hwnd: HWND): UINT;
2188
function    MCIWndChangeStyles(hwnd: HWND; mask: UINT; value: DWORD): DWORD;
2189

2190
type
2191
    PUnknown    = ^IUnknown;
2192

2193
function    MCIWndOpenInterface(hwnd: HWND; pUnk: PUnknown): DWORD;
2194

2195
function    MCIWndSetOwner(hwnd: HWND; hwndP: HWND): DWORD;
2196

2197
{-- Messages an app will send to MCIWND --------------------------------------}
2198

2199
// all the text-related messages are defined out of order above (they need
2200
// to be defined before the MCIWndOpen() macros
2201

2202
const
2203
    MCIWNDM_GETDEVICEID             = WM_USER + 100;
2204
    MCIWNDM_GETSTART                = WM_USER + 103;
2205
    MCIWNDM_GETLENGTH               = WM_USER + 104;
2206
    MCIWNDM_GETEND                  = WM_USER + 105;
2207
    MCIWNDM_EJECT                   = WM_USER + 107;
2208
    MCIWNDM_SETZOOM                 = WM_USER + 108;
2209
    MCIWNDM_GETZOOM                 = WM_USER + 109;
2210
    MCIWNDM_SETVOLUME               = WM_USER + 110;
2211
    MCIWNDM_GETVOLUME               = WM_USER + 111;
2212
    MCIWNDM_SETSPEED                = WM_USER + 112;
2213
    MCIWNDM_GETSPEED                = WM_USER + 113;
2214
    MCIWNDM_SETREPEAT               = WM_USER + 114;
2215
    MCIWNDM_GETREPEAT               = WM_USER + 115;
2216
    MCIWNDM_REALIZE                 = WM_USER + 118;
2217
    MCIWNDM_VALIDATEMEDIA           = WM_USER + 121;
2218
    MCIWNDM_PLAYFROM                = WM_USER + 122;
2219
    MCIWNDM_PLAYTO                  = WM_USER + 123;
2220
    MCIWNDM_GETPALETTE              = WM_USER + 126;
2221
    MCIWNDM_SETPALETTE              = WM_USER + 127;
2222
    MCIWNDM_SETTIMERS               = WM_USER + 129;
2223
    MCIWNDM_SETACTIVETIMER          = WM_USER + 130;
2224
    MCIWNDM_SETINACTIVETIMER        = WM_USER + 131;
2225
    MCIWNDM_GETACTIVETIMER          = WM_USER + 132;
2226
    MCIWNDM_GETINACTIVETIMER        = WM_USER + 133;
2227
    MCIWNDM_CHANGESTYLES            = WM_USER + 135;
2228
    MCIWNDM_GETSTYLES               = WM_USER + 136;
2229
    MCIWNDM_GETALIAS                = WM_USER + 137;
2230
    MCIWNDM_PLAYREVERSE             = WM_USER + 139;
2231
    MCIWNDM_GET_SOURCE              = WM_USER + 140;
2232
    MCIWNDM_PUT_SOURCE              = WM_USER + 141;
2233
    MCIWNDM_GET_DEST                = WM_USER + 142;
2234
    MCIWNDM_PUT_DEST                = WM_USER + 143;
2235
    MCIWNDM_CAN_PLAY                = WM_USER + 144;
2236
    MCIWNDM_CAN_WINDOW              = WM_USER + 145;
2237
    MCIWNDM_CAN_RECORD              = WM_USER + 146;
2238
    MCIWNDM_CAN_SAVE                = WM_USER + 147;
2239
    MCIWNDM_CAN_EJECT               = WM_USER + 148;
2240
    MCIWNDM_CAN_CONFIG              = WM_USER + 149;
2241
    MCIWNDM_PALETTEKICK             = WM_USER + 150;
2242
    MCIWNDM_OPENINTERFACE           = WM_USER + 151;
2243
    MCIWNDM_SETOWNER                = WM_USER + 152;
2244

2245
{-- Define both A and W messages ---------------------------------------------}
2246

2247
    MCIWNDM_SENDSTRINGA             = WM_USER + 101;
2248
    MCIWNDM_GETPOSITIONA            = WM_USER + 102;
2249
    MCIWNDM_GETMODEA                = WM_USER + 106;
2250
    MCIWNDM_SETTIMEFORMATA          = WM_USER + 119;
2251
    MCIWNDM_GETTIMEFORMATA          = WM_USER + 120;
2252
    MCIWNDM_GETFILENAMEA            = WM_USER + 124;
2253
    MCIWNDM_GETDEVICEA              = WM_USER + 125;
2254
    MCIWNDM_GETERRORA               = WM_USER + 128;
2255
    MCIWNDM_NEWA                    = WM_USER + 134;
2256
    MCIWNDM_RETURNSTRINGA           = WM_USER + 138;
2257
    MCIWNDM_OPENA                   = WM_USER + 153;
2258

2259
    MCIWNDM_SENDSTRINGW             = WM_USER + 201;
2260
    MCIWNDM_GETPOSITIONW            = WM_USER + 202;
2261
    MCIWNDM_GETMODEW                = WM_USER + 206;
2262
    MCIWNDM_SETTIMEFORMATW          = WM_USER + 219;
2263
    MCIWNDM_GETTIMEFORMATW          = WM_USER + 220;
2264
    MCIWNDM_GETFILENAMEW            = WM_USER + 224;
2265
    MCIWNDM_GETDEVICEW              = WM_USER + 225;
2266
    MCIWNDM_GETERRORW               = WM_USER + 228;
2267
    MCIWNDM_NEWW                    = WM_USER + 234;
2268
    MCIWNDM_RETURNSTRINGW           = WM_USER + 238;
2269
    MCIWNDM_OPENW                   = WM_USER + 252;
2270

2271
{-- Map defaults to A --------------------------------------------------------}
2272

2273
    MCIWNDM_SENDSTRING              = MCIWNDM_SENDSTRINGA;
2274
    MCIWNDM_GETPOSITION             = MCIWNDM_GETPOSITIONA;
2275
    MCIWNDM_GETMODE                 = MCIWNDM_GETMODEA;
2276
    MCIWNDM_SETTIMEFORMAT           = MCIWNDM_SETTIMEFORMATA;
2277
    MCIWNDM_GETTIMEFORMAT           = MCIWNDM_GETTIMEFORMATA;
2278
    MCIWNDM_GETFILENAME             = MCIWNDM_GETFILENAMEA;
2279
    MCIWNDM_GETDEVICE               = MCIWNDM_GETDEVICEA;
2280
    MCIWNDM_GETERROR                = MCIWNDM_GETERRORA;
2281
    MCIWNDM_NEW                     = MCIWNDM_NEWA;
2282
    MCIWNDM_RETURNSTRING            = MCIWNDM_RETURNSTRINGA;
2283
    MCIWNDM_OPEN                    = MCIWNDM_OPENA;
2284

2285
// note that the source text for MCIWND will thus contain
2286
// support for eg MCIWNDM_SENDSTRING (both the 16-bit entrypoint and
2287
// in win32 mapped to MCIWNDM_SENDSTRINGW), and MCIWNDM_SENDSTRINGA (the
2288
// win32 ansi thunk).
2289

2290
{-- Messages MCIWND will send to an app --------------------------------------}
2291

2292
const
2293
    MCIWNDM_NOTIFYMODE              = WM_USER + 200;    // wp = hwnd, lp = mode
2294
    MCIWNDM_NOTIFYPOS               = WM_USER + 201;    // wp = hwnd, lp = pos
2295
    MCIWNDM_NOTIFYSIZE              = WM_USER + 202;    // wp = hwnd
2296
    MCIWNDM_NOTIFYMEDIA             = WM_USER + 203;    // wp = hwnd, lp = fn
2297
    MCIWNDM_NOTIFYERROR             = WM_USER + 205;    // wp = hwnd, lp = error
2298

2299
{-- Special seek values for START and END ------------------------------------}
2300

2301
    MCIWND_START                    = dword(-1) ;
2302
    MCIWND_END                      = dword(-2) ;
2303

2304
{== VIDEO - Video capture driver interface ===================================}
2305

2306
type
2307
    HVIDEO                          = THandle;
2308
    PHVIDEO                         = ^HVIDEO;
2309

2310
{-- Error return values ------------------------------------------------------}
2311

2312
const
2313
    DV_ERR_OK                       = 0;                    // No error
2314
    DV_ERR_BASE                     = 1;                    // Error Base 
2315
    DV_ERR_NONSPECIFIC              = DV_ERR_BASE;
2316
    DV_ERR_BADFORMAT                = DV_ERR_BASE + 1;      // unsupported video format 
2317
    DV_ERR_STILLPLAYING             = DV_ERR_BASE + 2;      // still something playing 
2318
    DV_ERR_UNPREPARED               = DV_ERR_BASE + 3;      // header not prepared 
2319
    DV_ERR_SYNC                     = DV_ERR_BASE + 4;      // device is synchronous 
2320
    DV_ERR_TOOMANYCHANNELS          = DV_ERR_BASE + 5;      // number of channels exceeded 
2321
    DV_ERR_NOTDETECTED              = DV_ERR_BASE + 6;      // HW not detected 
2322
    DV_ERR_BADINSTALL               = DV_ERR_BASE + 7;      // Can not get Profile 
2323
    DV_ERR_CREATEPALETTE            = DV_ERR_BASE + 8;
2324
    DV_ERR_SIZEFIELD                = DV_ERR_BASE + 9;
2325
    DV_ERR_PARAM1                   = DV_ERR_BASE + 10;
2326
    DV_ERR_PARAM2                   = DV_ERR_BASE + 11;
2327
    DV_ERR_CONFIG1                  = DV_ERR_BASE + 12;
2328
    DV_ERR_CONFIG2                  = DV_ERR_BASE + 13;
2329
    DV_ERR_FLAGS                    = DV_ERR_BASE + 14;
2330
    DV_ERR_13                       = DV_ERR_BASE + 15;
2331

2332
    DV_ERR_NOTSUPPORTED             = DV_ERR_BASE + 16;     // function not suported 
2333
    DV_ERR_NOMEM                    = DV_ERR_BASE + 17;     // out of memory 
2334
    DV_ERR_ALLOCATED                = DV_ERR_BASE + 18;     // device is allocated 
2335
    DV_ERR_BADDEVICEID              = DV_ERR_BASE + 19;
2336
    DV_ERR_INVALHANDLE              = DV_ERR_BASE + 20;
2337
    DV_ERR_BADERRNUM                = DV_ERR_BASE + 21;
2338
    DV_ERR_NO_BUFFERS               = DV_ERR_BASE + 22;     // out of buffers 
2339

2340
    DV_ERR_MEM_CONFLICT             = DV_ERR_BASE + 23;     // Mem conflict detected 
2341
    DV_ERR_IO_CONFLICT              = DV_ERR_BASE + 24;     // I/O conflict detected 
2342
    DV_ERR_DMA_CONFLICT             = DV_ERR_BASE + 25;     // DMA conflict detected
2343
    DV_ERR_INT_CONFLICT             = DV_ERR_BASE + 26;     // Interrupt conflict detected
2344
    DV_ERR_PROTECT_ONLY             = DV_ERR_BASE + 27;     // Can not run in standard mode
2345
    DV_ERR_LASTERROR                = DV_ERR_BASE + 27;
2346

2347
    DV_ERR_USER_MSG                 = DV_ERR_BASE + 1000;   // Hardware specific errors
2348

2349
{-- Callback messages --------------------------------------------------------}
2350

2351
// Note that the values for all installable driver callback messages are
2352
// identical, (ie. MM_DRVM_DATA has the same value for capture drivers,
2353
// installable video codecs, and the audio compression manager).
2354

2355
const
2356
    DV_VM_OPEN                      = MM_DRVM_OPEN;     // Obsolete messages
2357
    DV_VM_CLOSE                     = MM_DRVM_CLOSE;
2358
    DV_VM_DATA                      = MM_DRVM_DATA;
2359
    DV_VM_ERROR                     = MM_DRVM_ERROR;
2360

2361
{== Structures ===============================================================}
2362

2363
{-- Video data block header --------------------------------------------------}
2364

2365
type
2366
    PVIDEOHDR               = ^TVIDEOHDR;
2367
    TVIDEOHDR               = record
2368
        lpData              : PBYTE;                // pointer to locked data buffer
2369
        dwBufferLength      : DWORD;                // Length of data buffer
2370
        dwBytesUsed         : DWORD;                // Bytes actually used
2371
        dwTimeCaptured      : DWORD;                // Milliseconds from start of stream
2372
        dwUser              : DWORD;                // for client's use
2373
        dwFlags             : DWORD;                // assorted flags (see defines)
2374
        dwReserved          : array[0..3] of DWORD; // reserved for driver
2375
    end;
2376

2377
{-- dwFlags field of VIDEOHDR ------------------------------------------------}
2378

2379
const
2380
    VHDR_DONE                       = $00000001;    // Done bit
2381
    VHDR_PREPARED                   = $00000002;    // Set if this header has been prepared
2382
    VHDR_INQUEUE                    = $00000004;    // Reserved for driver
2383
    VHDR_KEYFRAME                   = $00000008;    // Key Frame
2384

2385
{-- Channel capabilities structure -------------------------------------------}
2386

2387
type
2388
    PCHANNEL_CAPS           = ^TCHANNEL_CAPS;
2389
    TCHANNEL_CAPS           = record
2390
        dwFlags             : DWORD;    // Capability flags
2391
        dwSrcRectXMod       : DWORD;    // Granularity of src rect in x
2392
        dwSrcRectYMod       : DWORD;    // Granularity of src rect in y
2393
        dwSrcRectWidthMod   : DWORD;    // Granularity of src rect width
2394
        dwSrcRectHeightMod  : DWORD;    // Granularity of src rect height
2395
        dwDstRectXMod       : DWORD;    // Granularity of dst rect in x
2396
        dwDstRectYMod       : DWORD;    // Granularity of dst rect in y
2397
        dwDstRectWidthMod   : DWORD;    // Granularity of dst rect width
2398
        dwDstRectHeightMod  : DWORD;    // Granularity of dst rect height
2399
    end;
2400

2401
{-- dwFlags of CHANNEL_CAPS --------------------------------------------------}
2402

2403
const
2404
    VCAPS_OVERLAY                   = $00000001;    // overlay channel 
2405
    VCAPS_SRC_CAN_CLIP              = $00000002;    // src rect can clip
2406
    VCAPS_DST_CAN_CLIP              = $00000004;    // dst rect can clip
2407
    VCAPS_CAN_SCALE                 = $00000008;    // allows src != dst
2408

2409
{== API flags ================================================================}
2410

2411
{-- Types of channels to open with the videoOpen function --------------------}
2412

2413
const
2414
    VIDEO_EXTERNALIN                = $0001;
2415
    VIDEO_EXTERNALOUT               = $0002;
2416
    VIDEO_IN                        = $0004;
2417
    VIDEO_OUT                       = $0008;
2418

2419
{-- Is a driver dialog available for this channel ----------------------------}
2420

2421
    VIDEO_DLG_QUERY                 = $0010;
2422

2423
{-- videoConfigure (both GET and SET) ----------------------------------------}
2424

2425
    VIDEO_CONFIGURE_QUERY           = $8000;
2426

2427
{-- videoConfigure (SET only) ------------------------------------------------}
2428

2429
    VIDEO_CONFIGURE_SET             = $1000;
2430

2431
{-- videoConfigure (GET only) ------------------------------------------------}
2432

2433
    VIDEO_CONFIGURE_GET             = $2000;
2434
    VIDEO_CONFIGURE_QUERYSIZE       = $0001;
2435

2436
    VIDEO_CONFIGURE_CURRENT         = $0010;
2437
    VIDEO_CONFIGURE_NOMINAL         = $0020;
2438
    VIDEO_CONFIGURE_MIN             = $0040;
2439
    VIDEO_CONFIGURE_MAX             = $0080;
2440

2441
{== Configure messages =======================================================}
2442

2443
    DVM_USER                        = $4000;
2444

2445
    DVM_CONFIGURE_START             = $1000;
2446
    DVM_CONFIGURE_END               = $1FFF;
2447

2448
    DVM_PALETTE                     = DVM_CONFIGURE_START + 1;
2449
    DVM_FORMAT                      = DVM_CONFIGURE_START + 2;
2450
    DVM_PALETTERGB555               = DVM_CONFIGURE_START + 3;
2451
    DVM_SRC_RECT                    = DVM_CONFIGURE_START + 4;
2452
    DVM_DST_RECT                    = DVM_CONFIGURE_START + 5;
2453

2454
{== AVICAP - Window class for AVI capture ====================================}
2455

2456
function    AVICapSM(hwnd: HWND; m: UINT; w: WPARAM; l: LPARAM): DWORD;
2457

2458
{-- Window messages WM_CAP... which can be sent to an AVICAP window ----------}
2459

2460
// UNICODE
2461
//
2462
// The Win32 version of AVICAP on NT supports UNICODE applications:
2463
// for each API or message that takes a char or string parameter, there are
2464
// two versions, ApiNameA and ApiNameW. The default name ApiName is #defined
2465
// to one or other depending on whether UNICODE is defined. Apps can call
2466
// the A and W apis directly, and mix them.
2467
//
2468
// The 32-bit AVICAP on NT uses unicode exclusively internally.
2469
// ApiNameA() will be implemented as a call to ApiNameW() together with
2470
// translation of strings.
2471

2472
// Defines start of the message range
2473
const
2474
    WM_CAP_START                    = WM_USER;
2475
    WM_CAP_UNICODE_START            = WM_USER + 100;
2476

2477
    WM_CAP_GET_CAPSTREAMPTR         = WM_CAP_START + 1;
2478

2479
    WM_CAP_SET_CALLBACK_ERRORW      = WM_CAP_UNICODE_START + 2;
2480
    WM_CAP_SET_CALLBACK_STATUSW     = WM_CAP_UNICODE_START + 3;
2481
    WM_CAP_SET_CALLBACK_ERRORA      = WM_CAP_START + 2;
2482
    WM_CAP_SET_CALLBACK_STATUSA     = WM_CAP_START + 3;
2483
    WM_CAP_SET_CALLBACK_ERROR       = WM_CAP_SET_CALLBACK_ERRORA;
2484
    WM_CAP_SET_CALLBACK_STATUS      = WM_CAP_SET_CALLBACK_STATUSA;
2485

2486
    WM_CAP_SET_CALLBACK_YIELD       = WM_CAP_START + 4;
2487
    WM_CAP_SET_CALLBACK_FRAME       = WM_CAP_START + 5;
2488
    WM_CAP_SET_CALLBACK_VIDEOSTREAM = WM_CAP_START + 6;
2489
    WM_CAP_SET_CALLBACK_WAVESTREAM  = WM_CAP_START + 7;
2490
    WM_CAP_GET_USER_DATA            = WM_CAP_START + 8;
2491
    WM_CAP_SET_USER_DATA            = WM_CAP_START + 9;
2492

2493
    WM_CAP_DRIVER_CONNECT           = WM_CAP_START + 10;
2494
    WM_CAP_DRIVER_DISCONNECT        = WM_CAP_START + 11;
2495

2496
    WM_CAP_DRIVER_GET_NAMEA         = WM_CAP_START + 12;
2497
    WM_CAP_DRIVER_GET_VERSIONA      = WM_CAP_START + 13;
2498
    WM_CAP_DRIVER_GET_NAMEW         = WM_CAP_UNICODE_START + 12;
2499
    WM_CAP_DRIVER_GET_VERSIONW      = WM_CAP_UNICODE_START + 13;
2500
    WM_CAP_DRIVER_GET_NAME          = WM_CAP_DRIVER_GET_NAMEA;
2501
    WM_CAP_DRIVER_GET_VERSION       = WM_CAP_DRIVER_GET_VERSIONA;
2502

2503
    WM_CAP_DRIVER_GET_CAPS          = WM_CAP_START + 14;
2504

2505
    WM_CAP_FILE_SET_CAPTURE_FILEA   = WM_CAP_START + 20;
2506
    WM_CAP_FILE_GET_CAPTURE_FILEA   = WM_CAP_START + 21;
2507
    WM_CAP_FILE_SAVEASA             = WM_CAP_START + 23;
2508
    WM_CAP_FILE_SAVEDIBA            = WM_CAP_START + 25;
2509
    WM_CAP_FILE_SET_CAPTURE_FILEW   = WM_CAP_UNICODE_START + 20;
2510
    WM_CAP_FILE_GET_CAPTURE_FILEW   = WM_CAP_UNICODE_START + 21;
2511
    WM_CAP_FILE_SAVEASW             = WM_CAP_UNICODE_START + 23;
2512
    WM_CAP_FILE_SAVEDIBW            = WM_CAP_UNICODE_START + 25;
2513
    WM_CAP_FILE_SET_CAPTURE_FILE    = WM_CAP_FILE_SET_CAPTURE_FILEA;
2514
    WM_CAP_FILE_GET_CAPTURE_FILE    = WM_CAP_FILE_GET_CAPTURE_FILEA;
2515
    WM_CAP_FILE_SAVEAS              = WM_CAP_FILE_SAVEASA;
2516
    WM_CAP_FILE_SAVEDIB             = WM_CAP_FILE_SAVEDIBA;
2517

2518
    // out of order to save on ifdefs
2519

2520
    WM_CAP_FILE_ALLOCATE            = WM_CAP_START + 22;
2521
    WM_CAP_FILE_SET_INFOCHUNK       = WM_CAP_START + 24;
2522

2523
    WM_CAP_EDIT_COPY                = WM_CAP_START + 30;
2524

2525
    WM_CAP_SET_AUDIOFORMAT          = WM_CAP_START + 35;
2526
    WM_CAP_GET_AUDIOFORMAT          = WM_CAP_START + 36;
2527

2528
    WM_CAP_DLG_VIDEOFORMAT          = WM_CAP_START + 41;
2529
    WM_CAP_DLG_VIDEOSOURCE          = WM_CAP_START + 42;
2530
    WM_CAP_DLG_VIDEODISPLAY         = WM_CAP_START + 43;
2531
    WM_CAP_GET_VIDEOFORMAT          = WM_CAP_START + 44;
2532
    WM_CAP_SET_VIDEOFORMAT          = WM_CAP_START + 45;
2533
    WM_CAP_DLG_VIDEOCOMPRESSION     = WM_CAP_START + 46;
2534

2535
    WM_CAP_SET_PREVIEW              = WM_CAP_START + 50;
2536
    WM_CAP_SET_OVERLAY              = WM_CAP_START + 51;
2537
    WM_CAP_SET_PREVIEWRATE          = WM_CAP_START + 52;
2538
    WM_CAP_SET_SCALE                = WM_CAP_START + 53;
2539
    WM_CAP_GET_STATUS               = WM_CAP_START + 54;
2540
    WM_CAP_SET_SCROLL               = WM_CAP_START + 55;
2541

2542
    WM_CAP_GRAB_FRAME               = WM_CAP_START + 60;
2543
    WM_CAP_GRAB_FRAME_NOSTOP        = WM_CAP_START + 61;
2544

2545
    WM_CAP_SEQUENCE                 = WM_CAP_START + 62;
2546
    WM_CAP_SEQUENCE_NOFILE          = WM_CAP_START + 63;
2547
    WM_CAP_SET_SEQUENCE_SETUP       = WM_CAP_START + 64;
2548
    WM_CAP_GET_SEQUENCE_SETUP       = WM_CAP_START + 65;
2549

2550
    WM_CAP_SET_MCI_DEVICEA          = WM_CAP_START + 66;
2551
    WM_CAP_GET_MCI_DEVICEA          = WM_CAP_START + 67;
2552
    WM_CAP_SET_MCI_DEVICEW          = WM_CAP_UNICODE_START + 66;
2553
    WM_CAP_GET_MCI_DEVICEW          = WM_CAP_UNICODE_START + 67;
2554
    WM_CAP_SET_MCI_DEVICE           = WM_CAP_SET_MCI_DEVICEA;
2555
    WM_CAP_GET_MCI_DEVICE           = WM_CAP_GET_MCI_DEVICEA;
2556

2557
    WM_CAP_STOP                     = WM_CAP_START + 68;
2558
    WM_CAP_ABORT                    = WM_CAP_START + 69;
2559

2560
    WM_CAP_SINGLE_FRAME_OPEN        = WM_CAP_START + 70;
2561
    WM_CAP_SINGLE_FRAME_CLOSE       = WM_CAP_START + 71;
2562
    WM_CAP_SINGLE_FRAME             = WM_CAP_START + 72;
2563

2564
    WM_CAP_PAL_OPENA                = WM_CAP_START + 80;
2565
    WM_CAP_PAL_SAVEA                = WM_CAP_START + 81;
2566
    WM_CAP_PAL_OPENW                = WM_CAP_UNICODE_START + 80;
2567
    WM_CAP_PAL_SAVEW                = WM_CAP_UNICODE_START + 81;
2568
    WM_CAP_PAL_OPEN                 = WM_CAP_PAL_OPENA;
2569
    WM_CAP_PAL_SAVE                 = WM_CAP_PAL_SAVEA;
2570

2571
    WM_CAP_PAL_PASTE                = WM_CAP_START + 82;
2572
    WM_CAP_PAL_AUTOCREATE           = WM_CAP_START + 83;
2573
    WM_CAP_PAL_MANUALCREATE         = WM_CAP_START + 84;
2574

2575
    // Following added post VFW 1.1
2576

2577
    WM_CAP_SET_CALLBACK_CAPCONTROL  = WM_CAP_START + 85;
2578

2579
    // Defines end of the message range
2580

2581
    WM_CAP_UNICODE_END              = WM_CAP_PAL_SAVEW;
2582
    WM_CAP_END                      = WM_CAP_UNICODE_END;
2583

2584
{-- Callback definitions -----------------------------------------------------}
2585

2586
type
2587
    TCAPYIELDCALLBACK               = function(hWnd: HWND): DWORD; stdcall;
2588

2589
    TCAPSTATUSCALLBACKW             = function(hWnd: HWND; nID: int; lpsz: LPCWSTR): DWORD; stdcall;
2590
    TCAPERRORCALLBACKW              = function(hWnd: HWND; nID: int; lpsz: LPCWSTR): DWORD; stdcall;
2591
    TCAPSTATUSCALLBACKA             = function(hWnd: HWND; nID: int; lpsz: LPCSTR): DWORD; stdcall;
2592
    TCAPERRORCALLBACKA              = function(hWnd: HWND; nID: int; lpsz: LPCSTR): DWORD; stdcall;
2593

2594
    TCAPSTATUSCALLBACK              = TCAPSTATUSCALLBACKA;
2595
    TCAPERRORCALLBACK               = TCAPERRORCALLBACKA;
2596

2597
    TCAPVIDEOCALLBACK               = function(hWnd: HWND; lpVHdr: PVIDEOHDR): DWORD; stdcall;
2598
    TCAPWAVECALLBACK                = function(hWnd: HWND; lpWHdr: PWAVEHDR): DWORD; stdcall;
2599
    TCAPCONTROLCALLBACK             = function(hWnd: HWND; nState: int): DWORD; stdcall;
2600

2601
{-- Structures ---------------------------------------------------------------}
2602

2603
type
2604
    PCAPDRIVERCAPS                  = ^TCAPDRIVERCAPS;
2605
    TCAPDRIVERCAPS                  = record
2606
        wDeviceIndex                : UINT;     // Driver index in system.ini
2607
        fHasOverlay                 : BOOL;     // Can device overlay?
2608
        fHasDlgVideoSource          : BOOL;     // Has Video source dlg?
2609
        fHasDlgVideoFormat          : BOOL;     // Has Format dlg?
2610
        fHasDlgVideoDisplay         : BOOL;     // Has External out dlg?
2611
        fCaptureInitialized         : BOOL;     // Driver ready to capture?
2612
        fDriverSuppliesPalettes     : BOOL;     // Can driver make palettes?
2613

2614
        // following always NULL on Win32.
2615
        hVideoIn                    : THANDLE;   // Driver In channel
2616
        hVideoOut                   : THANDLE;   // Driver Out channel
2617
        hVideoExtIn                 : THANDLE;   // Driver Ext In channel
2618
        hVideoExtOut                : THANDLE;   // Driver Ext Out channel
2619
    end;
2620

2621
    PCAPSTATUS                      = ^TCAPSTATUS;
2622
    TCAPSTATUS                      = record
2623
        uiImageWidth                : UINT    ; // Width of the image
2624
        uiImageHeight               : UINT    ; // Height of the image
2625
        fLiveWindow                 : BOOL    ; // Now Previewing video?
2626
        fOverlayWindow              : BOOL    ; // Now Overlaying video?
2627
        fScale                      : BOOL    ; // Scale image to client?
2628
        ptScroll                    : TPOINT  ; // Scroll position
2629
        fUsingDefaultPalette        : BOOL    ; // Using default driver palette?
2630
        fAudioHardware              : BOOL    ; // Audio hardware present?
2631
        fCapFileExists              : BOOL    ; // Does capture file exist?
2632
        dwCurrentVideoFrame         : DWORD   ; // # of video frames cap'td
2633
        dwCurrentVideoFramesDropped : DWORD   ; // # of video frames dropped
2634
        dwCurrentWaveSamples        : DWORD   ; // # of wave samples cap'td
2635
        dwCurrentTimeElapsedMS      : DWORD   ; // Elapsed capture duration
2636
        hPalCurrent                 : HPALETTE; // Current palette in use
2637
        fCapturingNow               : BOOL    ; // Capture in progress?
2638
        dwReturn                    : DWORD   ; // Error value after any operation
2639
        wNumVideoAllocated          : UINT    ; // Actual number of video buffers
2640
        wNumAudioAllocated          : UINT    ; // Actual number of audio buffers
2641
    end;
2642

2643
    // Default values in parenthesis
2644

2645
    PCAPTUREPARMS                   = ^TCAPTUREPARMS;
2646
    TCAPTUREPARMS                   = record
2647
        dwRequestMicroSecPerFrame   : DWORD ;   // Requested capture rate
2648
        fMakeUserHitOKToCapture     : BOOL  ;   // Show "Hit OK to cap" dlg?
2649
        wPercentDropForError        : UINT  ;   // Give error msg if > (10%)
2650
        fYield                      : BOOL  ;   // Capture via background task?
2651
        dwIndexSize                 : DWORD ;   // Max index size in frames (32K)
2652
        wChunkGranularity           : UINT  ;   // Junk chunk granularity (2K)
2653
        fUsingDOSMemory             : BOOL  ;   // Use DOS buffers?
2654
        wNumVideoRequested          : UINT  ;   // # video buffers, If 0, autocalc
2655
        fCaptureAudio               : BOOL  ;   // Capture audio?
2656
        wNumAudioRequested          : UINT  ;   // # audio buffers, If 0, autocalc
2657
        vKeyAbort                   : UINT  ;   // Virtual key causing abort
2658
        fAbortLeftMouse             : BOOL  ;   // Abort on left mouse?
2659
        fAbortRightMouse            : BOOL  ;   // Abort on right mouse?
2660
        fLimitEnabled               : BOOL  ;   // Use wTimeLimit?
2661
        wTimeLimit                  : UINT  ;   // Seconds to capture
2662
        fMCIControl                 : BOOL  ;   // Use MCI video source?
2663
        fStepMCIDevice              : BOOL  ;   // Step MCI device?
2664
        dwMCIStartTime              : DWORD ;   // Time to start in MS
2665
        dwMCIStopTime               : DWORD ;   // Time to stop in MS
2666
        fStepCaptureAt2x            : BOOL  ;   // Perform spatial averaging 2x
2667
        wStepCaptureAverageFrames   : UINT  ;   // Temporal average n Frames
2668
        dwAudioBufferSize           : DWORD ;   // Size of audio bufs (0 = default)
2669
        fDisableWriteCache          : BOOL  ;   // Attempt to disable write cache
2670
        AVStreamMaster              : UINT  ;   // Which stream controls length?
2671
    end;
2672

2673
{-- AVStreamMaster -----------------------------------------------------------}
2674

2675
//  Since Audio and Video streams generally use non-synchronized capture
2676
//  clocks, this flag determines whether the audio stream is to be considered
2677
//  the master or controlling clock when writing the AVI file:
2678
//
2679
//  AVSTREAMMASTER_AUDIO  - Audio is master, video frame duration is forced
2680
//                          to match audio duration (VFW 1.0, 1.1 default)
2681
//  AVSTREAMMASTER_NONE   - No master, audio and video streams may be of
2682
//                          different lengths
2683

2684
const
2685
    AVSTREAMMASTER_AUDIO            = 0;        // Audio master (VFW 1.0, 1.1)
2686
    AVSTREAMMASTER_NONE             = 1;        // No master
2687

2688
type
2689
    PCAPINFOCHUNK                   = ^TCAPINFOCHUNK;
2690
    TCAPINFOCHUNK                   = record
2691
        fccInfoID                   : FOURCC;   // Chunk ID, "ICOP" for copyright
2692
        lpData                      : PVOID;    // pointer to data
2693
        cbData                      : DWORD;     // size of lpData
2694
    end;
2695

2696
{-- CapControlCallback states ------------------------------------------------}
2697

2698
const
2699
    CONTROLCALLBACK_PREROLL         = 1;        // Waiting to start capture 
2700
    CONTROLCALLBACK_CAPTURING       = 2;        // Now capturing
2701

2702
{-- Message crackers for above -----------------------------------------------}
2703

2704
// message wrapper macros are defined for the default messages only. Apps
2705
// that wish to mix Ansi and UNICODE message sending will have to
2706
// reference the _A and _W messages directly
2707

2708
function    capSetCallbackOnError(hwnd: HWND; fpProc: TCAPERRORCALLBACK): BOOL;
2709
function    capSetCallbackOnStatus(hwnd: HWND; fpProc: TCAPSTATUSCALLBACK): BOOL;
2710
function    capSetCallbackOnYield(hwnd: HWND; fpProc: TCAPYIELDCALLBACK): BOOL;
2711
function    capSetCallbackOnFrame(hwnd: HWND; fpProc: TCAPVIDEOCALLBACK): BOOL;
2712
function    capSetCallbackOnVideoStream(hwnd: HWND; fpProc: TCAPVIDEOCALLBACK): BOOL;
2713
function    capSetCallbackOnWaveStream(hwnd: HWND; fpProc: TCAPWAVECALLBACK): BOOL;
2714
function    capSetCallbackOnCapControl(hwnd: HWND; fpProc: TCAPCONTROLCALLBACK): BOOL;
2715

2716
function    capSetUserData(hwnd: HWND; lUser: DWORD): BOOL;
2717
function    capGetUserData(hwnd: HWND): DWORD;
2718

2719
function    capDriverConnect(hwnd: HWND; i: INT): BOOL;
2720
function    capDriverDisconnect(hwnd: HWND): BOOL;
2721
function    capDriverGetName(hwnd: HWND; szName: LPSTR; wSize: WORD): BOOL;
2722
function    capDriverGetVersion(hwnd: HWND; szVer: LPSTR; wSize: WORD): BOOL;
2723
function    capDriverGetCaps(hwnd: HWND; s: PCAPDRIVERCAPS; wSize: WORD): BOOL;
2724

2725
function    capFileSetCaptureFile(hwnd: HWND; szName: LPCSTR): BOOL;
2726
function    capFileGetCaptureFile(hwnd: HWND; szName: LPSTR; wSize: WORD): BOOL;
2727
function    capFileAlloc(hwnd: HWND; dwSize: DWORD): BOOL;
2728
function    capFileSaveAs(hwnd: HWND; szName: LPCSTR): BOOL;
2729
function    capFileSetInfoChunk(hwnd: HWND; lpInfoChunk: PCAPINFOCHUNK): BOOL;
2730
function    capFileSaveDIB(hwnd: HWND; szName: LPCSTR): BOOL;
2731

2732
function    capEditCopy(hwnd: HWND): BOOL;
2733

2734
function    capSetAudioFormat(hwnd: HWND; s: PWAVEFORMATEX; wSize: WORD): BOOL;
2735
function    capGetAudioFormat(hwnd: HWND; s: PWAVEFORMATEX; wSize: WORD): DWORD;
2736
function    capGetAudioFormatSize(hwnd: HWND): DWORD;
2737

2738
function    capDlgVideoFormat(hwnd: HWND): BOOL;
2739
function    capDlgVideoSource(hwnd: HWND): BOOL;
2740
function    capDlgVideoDisplay(hwnd: HWND): BOOL;
2741
function    capDlgVideoCompression(hwnd: HWND): BOOL;
2742

2743
function    capGetVideoFormat(hwnd: HWND; s: PVOID; wSize: WORD): DWORD;
2744
function    capGetVideoFormatSize(hwnd: HWND): DWORD;
2745
function    capSetVideoFormat(hwnd: HWND; s: PVOID; wSize: WORD): BOOL;
2746

2747
function    capPreview(hwnd: HWND; f: BOOL): BOOL;
2748
function    capPreviewRate(hwnd: HWND; wMS: WORD): BOOL;
2749
function    capOverlay(hwnd: HWND; f: BOOL): BOOL;
2750
function    capPreviewScale(hwnd: HWND; f: BOOL): BOOL;
2751
function    capGetStatus(hwnd: HWND; s: PCAPSTATUS; wSize: WORD): BOOL;
2752
function    capSetScrollPos(hwnd: HWND; lpP: PPOINT): BOOL;
2753

2754
function    capGrabFrame(hwnd: HWND): BOOL;
2755
function    capGrabFrameNoStop(hwnd: HWND): BOOL;
2756

2757
function    capCaptureSequence(hwnd: HWND): BOOL;
2758
function    capCaptureSequenceNoFile(hwnd: HWND): BOOL;
2759
function    capCaptureStop(hwnd: HWND): BOOL;
2760
function    capCaptureAbort(hwnd: HWND): BOOL;
2761

2762
function    capCaptureSingleFrameOpen(hwnd: HWND): BOOL;
2763
function    capCaptureSingleFrameClose(hwnd: HWND): BOOL;
2764
function    capCaptureSingleFrame(hwnd: HWND): BOOL;
2765

2766
function    capCaptureGetSetup(hwnd: HWND; s: PCAPTUREPARMS; wSize: WORD): BOOL;
2767
function    capCaptureSetSetup(hwnd: HWND; s: PCAPTUREPARMS; wSize: WORD): BOOL;
2768

2769
function    capSetMCIDeviceName(hwnd: HWND; szName: LPCSTR): BOOL;
2770
function    capGetMCIDeviceName(hwnd: HWND; szName: LPSTR; wSize: WORD): BOOL;
2771

2772
function    capPaletteOpen(hwnd: HWND; szName: LPCSTR): BOOL;
2773
function    capPaletteSave(hwnd: HWND; szName: LPCSTR): BOOL;
2774
function    capPalettePaste(hwnd: HWND): BOOL;
2775
function    capPaletteAuto(hwnd: HWND; iFrames, iColors: INT): BOOL;
2776
function    capPaletteManual(hwnd: HWND; fGrab: BOOL; iColors: INT): BOOL;
2777

2778
{-- The only exported functions from AVICAP.DLL ------------------------------}
2779

2780
function    capCreateCaptureWindowA(
2781
    lpszWindowName      : LPCSTR;
2782
    dwStyle             : DWORD;
2783
    x, y                : int;
2784
    nWidth, nHeight     : int;
2785
    hwndParent          : HWND;
2786
    nID                 : int
2787
    ): HWND; stdcall;
2788

2789
function    capGetDriverDescriptionA(
2790
    wDriverIndex        : UINT;
2791
    lpszName            : LPSTR;
2792
    cbName              : int;
2793
    lpszVer             : LPSTR;
2794
    cbVer               : int
2795
    ): BOOL; stdcall;
2796

2797
function    capCreateCaptureWindowW(
2798
    lpszWindowName      : LPCWSTR;
2799
    dwStyle             : DWORD;
2800
    x, y                : int;
2801
    nWidth, nHeight     : int;
2802
    hwndParent          : HWND;
2803
    nID                 : int
2804
    ): HWND; stdcall;
2805

2806
function    capGetDriverDescriptionW(
2807
    wDriverIndex        : UINT;
2808
    lpszName            : LPWSTR;
2809
    cbName              : int;
2810
    lpszVer             : LPWSTR;
2811
    cbVer               : int
2812
    ): BOOL; stdcall;
2813

2814
function    capCreateCaptureWindow(
2815
    lpszWindowName      : LPCSTR;
2816
    dwStyle             : DWORD;
2817
    x, y                : int;
2818
    nWidth, nHeight     : int;
2819
    hwndParent          : HWND;
2820
    nID                 : int
2821
    ): HWND; stdcall; // capCreateCaptureWindowA
2822

2823
function    capGetDriverDescription(
2824
    wDriverIndex        : UINT;
2825
    lpszName            : LPSTR;
2826
    cbName              : int;
2827
    lpszVer             : LPSTR;
2828
    cbVer               : int
2829
    ): BOOL; stdcall; // capGetDriverDescriptionA
2830

2831
{-- New information chunk IDs ------------------------------------------------}
2832

2833
const
2834
    infotypeDIGITIZATION_TIME       = $54494449; // mmioFOURCC ('I','D','I','T')
2835
    infotypeSMPTE_TIME              = $504D5349; // mmioFOURCC ('I','S','M','P')
2836

2837
{-- String IDs from status and error callbacks -------------------------------}
2838

2839
    IDS_CAP_BEGIN                   = 300;  // "Capture Start" 
2840
    IDS_CAP_END                     = 301;  // "Capture End" 
2841

2842
    IDS_CAP_INFO                    = 401;  // "%s" 
2843
    IDS_CAP_OUTOFMEM                = 402;  // "Out of memory" 
2844
    IDS_CAP_FILEEXISTS              = 403;  // "File '%s' exists -- overwrite it?" 
2845
    IDS_CAP_ERRORPALOPEN            = 404;  // "Error opening palette '%s'" 
2846
    IDS_CAP_ERRORPALSAVE            = 405;  // "Error saving palette '%s'" 
2847
    IDS_CAP_ERRORDIBSAVE            = 406;  // "Error saving frame '%s'" 
2848
    IDS_CAP_DEFAVIEXT               = 407;  // "avi" 
2849
    IDS_CAP_DEFPALEXT               = 408;  // "pal" 
2850
    IDS_CAP_CANTOPEN                = 409;  // "Cannot open '%s'"
2851
    IDS_CAP_SEQ_MSGSTART            = 410;  // "Select OK to start capture\nof video sequence\nto %s."
2852
    IDS_CAP_SEQ_MSGSTOP             = 411;  // "Hit ESCAPE or click to end capture" 
2853

2854
    IDS_CAP_VIDEDITERR              = 412;  // "An error occurred while trying to run VidEdit." 
2855
    IDS_CAP_READONLYFILE            = 413;  // "The file '%s' is a read-only file." 
2856
    IDS_CAP_WRITEERROR              = 414;  // "Unable to write to file '%s'.\nDisk may be full." 
2857
    IDS_CAP_NODISKSPACE             = 415;  // "There is no space to create a capture file on the specified device." 
2858
    IDS_CAP_SETFILESIZE             = 416;  // "Set File Size" 
2859
    IDS_CAP_SAVEASPERCENT           = 417;  // "SaveAs: %2ld%%  Hit Escape to abort." 
2860

2861
    IDS_CAP_DRIVER_ERROR            = 418;  // Driver specific error message 
2862

2863
    IDS_CAP_WAVE_OPEN_ERROR         = 419;  // "Error: Cannot open the wave input device.\nCheck sample size, frequency, and channels." 
2864
    IDS_CAP_WAVE_ALLOC_ERROR        = 420;  // "Error: Out of memory for wave buffers." 
2865
    IDS_CAP_WAVE_PREPARE_ERROR      = 421;  // "Error: Cannot prepare wave buffers." 
2866
    IDS_CAP_WAVE_ADD_ERROR          = 422;  // "Error: Cannot add wave buffers." 
2867
    IDS_CAP_WAVE_SIZE_ERROR         = 423;  // "Error: Bad wave size." 
2868

2869
    IDS_CAP_VIDEO_OPEN_ERROR        = 424;  // "Error: Cannot open the video input device." 
2870
    IDS_CAP_VIDEO_ALLOC_ERROR       = 425;  // "Error: Out of memory for video buffers."
2871
    IDS_CAP_VIDEO_PREPARE_ERROR     = 426;  // "Error: Cannot prepare video buffers." 
2872
    IDS_CAP_VIDEO_ADD_ERROR         = 427;  // "Error: Cannot add video buffers." 
2873
    IDS_CAP_VIDEO_SIZE_ERROR        = 428;  // "Error: Bad video size." 
2874

2875
    IDS_CAP_FILE_OPEN_ERROR         = 429;  // "Error: Cannot open capture file." 
2876
    IDS_CAP_FILE_WRITE_ERROR        = 430;  // "Error: Cannot write to capture file.  Disk may be full." 
2877
    IDS_CAP_RECORDING_ERROR         = 431;  // "Error: Cannot write to capture file.  Data rate too high or disk full." 
2878
    IDS_CAP_RECORDING_ERROR2        = 432;  // "Error while recording" 
2879
    IDS_CAP_AVI_INIT_ERROR          = 433;  // "Error: Unable to initialize for capture."
2880
    IDS_CAP_NO_FRAME_CAP_ERROR      = 434;  // "Warning: No frames captured.\nConfirm that vertical sync interrupts\nare configured and enabled." 
2881
    IDS_CAP_NO_PALETTE_WARN         = 435;  // "Warning: Using default palette." 
2882
    IDS_CAP_MCI_CONTROL_ERROR       = 436;  // "Error: Unable to access MCI device." 
2883
    IDS_CAP_MCI_CANT_STEP_ERROR     = 437;  // "Error: Unable to step MCI device." 
2884
    IDS_CAP_NO_AUDIO_CAP_ERROR      = 438;  // "Error: No audio data captured.\nCheck audio card settings." 
2885
    IDS_CAP_AVI_DRAWDIB_ERROR       = 439;  // "Error: Unable to draw this data format."
2886
    IDS_CAP_COMPRESSOR_ERROR        = 440;  // "Error: Unable to initialize compressor."
2887
    IDS_CAP_AUDIO_DROP_ERROR        = 441;  // "Error: Audio data was lost during capture, reduce capture rate."
2888

2889
{-- Status string IDs --------------------------------------------------------}
2890

2891
    IDS_CAP_STAT_LIVE_MODE          = 500;  // "Live window" 
2892
    IDS_CAP_STAT_OVERLAY_MODE       = 501;  // "Overlay window" 
2893
    IDS_CAP_STAT_CAP_INIT           = 502;  // "Setting up for capture - Please wait" 
2894
    IDS_CAP_STAT_CAP_FINI           = 503;  // "Finished capture, now writing frame %ld" 
2895
    IDS_CAP_STAT_PALETTE_BUILD      = 504;  // "Building palette map" 
2896
    IDS_CAP_STAT_OPTPAL_BUILD       = 505;  // "Computing optimal palette" 
2897
    IDS_CAP_STAT_I_FRAMES           = 506;  // "%d frames" 
2898
    IDS_CAP_STAT_L_FRAMES           = 507;  // "%ld frames" 
2899
    IDS_CAP_STAT_CAP_L_FRAMES       = 508;  // "Captured %ld frames" 
2900
    IDS_CAP_STAT_CAP_AUDIO          = 509;  // "Capturing audio" 
2901
    IDS_CAP_STAT_VIDEOCURRENT       = 510;  // "Captured %ld frames (%ld dropped) %d.%03d sec." 
2902
    IDS_CAP_STAT_VIDEOAUDIO         = 511;  // "Captured %d.%03d sec.  %ld frames (%ld dropped) (%d.%03d fps).  %ld audio bytes (%d,%03d sps)" 
2903
    IDS_CAP_STAT_VIDEOONLY          = 512;  // "Captured %d.%03d sec.  %ld frames (%ld dropped) (%d.%03d fps)" 
2904
    IDS_CAP_STAT_FRAMESDROPPED      = 513;  // "Dropped %ld of %ld frames (%d.%02d%%) during capture."
2905

2906
{== FilePreview dialog =======================================================}
2907

2908
function    GetOpenFileNamePreviewA(lpofn: POPENFILENAMEA): BOOL; stdcall;
2909
function    GetSaveFileNamePreviewA(lpofn: POPENFILENAMEA): BOOL; stdcall;
2910

2911
function    GetOpenFileNamePreviewW(lpofn: POPENFILENAMEW): BOOL; stdcall;
2912
function    GetSaveFileNamePreviewW(lpofn: POPENFILENAMEW): BOOL; stdcall;
2913

2914
function    GetOpenFileNamePreview(lpofn: POPENFILENAMEA): BOOL; stdcall; // GetOpenFileNamePreviewA
2915
function    GetSaveFileNamePreview(lpofn: POPENFILENAMEA): BOOL; stdcall; // GetSaveFileNamePreviewA
2916

2917
implementation
2918

2919
function MKFOURCC( ch0, ch1, ch2, ch3: AnsiChar ): FOURCC;
2920
begin
2921
  Result := (DWord(Ord(ch0))) or
2922
            (DWord(Ord(ch1)) shl 8) or
2923
            (DWord(Ord(ch2)) shl 16) or
2924
            (DWord(Ord(ch3)) shl 24);
2925
end;
2926

2927
function mmioFOURCC( ch0, ch1, ch2, ch3: AnsiChar ): FOURCC;
2928
begin
2929
  Result := MKFOURCC(ch0,ch1,ch2,ch3);
2930
end;
2931

2932
function aviTWOCC(ch0, ch1: AnsiChar): TWOCC;
2933
begin
2934
  Result := (Word(Ord(ch0))) or (Word(Ord(ch1)) shl 8);
2935
end;
2936

2937
{-- Query macros -------------------------------------------------------------}
2938

2939
function ICQueryAbout(hic: HIC): BOOL;
2940
begin
2941
  Result := ICSendMessage(hic, ICM_ABOUT, dword(-1), ICMF_ABOUT_QUERY) = ICERR_OK;
2942
end;
2943

2944
function ICAbout(hic: HIC; hwnd: HWND): DWORD;
2945
begin
2946
  Result := ICSendMessage(hic, ICM_ABOUT, hwnd, 0);
2947
end;
2948

2949
function ICQueryConfigure(hic: HIC): BOOL;
2950
begin
2951
  Result := ICSendMessage(hic, ICM_CONFIGURE, dword(-1), ICMF_CONFIGURE_QUERY) = ICERR_OK;
2952
end;
2953

2954
function ICConfigure(hic: HIC; hwnd: HWND): DWORD;
2955
begin
2956
  Result := ICSendMessage(hic, ICM_CONFIGURE, hwnd, 0);
2957
end;
2958

2959
{-- Get/Set state macros -----------------------------------------------------}
2960

2961
function ICGetState(hic: HIC; pv: PVOID; cb: DWORD): DWORD;
2962
begin
2963
  Result := ICSendMessage(hic, ICM_GETSTATE, DWORD(pv), cb);
2964
end;
2965

2966
function ICSetState(hic: HIC; pv: PVOID; cb: DWORD): DWORD;
2967
begin
2968
  Result := ICSendMessage(hic, ICM_SETSTATE, DWORD(pv), cb);
2969
end;
2970

2971
function ICGetStateSize(hic: HIC): DWORD;
2972
begin
2973
  Result := ICGetState(hic, nil, 0);
2974
end;
2975

2976
{-- Get value macros ---------------------------------------------------------}
2977

2978
function ICGetDefaultQuality(hic: HIC): DWORD;
2979
begin
2980
  ICSendMessage(hic, ICM_GETDEFAULTQUALITY, DWORD(@Result), sizeof(Result));
2981
end;
2982

2983
function ICGetDefaultKeyFrameRate(hic: HIC): DWORD;
2984
begin
2985
  ICSendMessage(hic, ICM_GETDEFAULTKEYFRAMERATE, DWORD(@Result), sizeof(Result));
2986
end;
2987

2988
{-- Draw window macro --------------------------------------------------------}
2989

2990
function ICDrawWindow(hic: HIC; prc: PRECT): DWORD;
2991
begin
2992
  Result := ICSendMessage(hic, ICM_DRAW_WINDOW, DWORD(prc), sizeof(prc^));
2993
end;
2994

2995
{-- ICCompressBegin() - start compression from a source fmt to a dest fmt ----}
2996

2997
function ICCompressBegin(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
2998
begin
2999
  Result := ICSendMessage(hic, ICM_COMPRESS_BEGIN, DWORD(lpbiInput), DWORD(lpbiOutput));
3000
end;
3001

3002
{-- ICCompressQuery() - determines if compression from src to dst is supp ----}
3003

3004
function ICCompressQuery(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
3005
begin
3006
  Result := ICSendMessage(hic, ICM_COMPRESS_QUERY, DWORD(lpbiInput), DWORD(lpbiOutput));
3007
end;
3008

3009
{-- ICCompressGetFormat() - get the output format (fmt of compressed) --------}
3010

3011
// if lpbiOutput is nil return the size in bytes needed for format.
3012

3013
function ICCompressGetFormat(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
3014
begin
3015
  Result := ICSendMessage(hic, ICM_COMPRESS_GET_FORMAT, DWORD(lpbiInput), DWORD(lpbiOutput));
3016
end;
3017

3018
function ICCompressGetFormatSize(hic: HIC; lpbi: PBITMAPINFOHEADER): DWORD;
3019
begin
3020
  Result := ICCompressGetFormat(hic, lpbi, nil);
3021
end;
3022

3023
{-- ICCompressSize() - return the maximal size of a compressed frame ---------}
3024

3025
function    ICCompressGetSize(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
3026
begin
3027
    Result := ICSendMessage(hic, ICM_COMPRESS_GET_SIZE, DWORD(lpbiInput), DWORD(lpbiOutput));
3028
end;
3029

3030
function    ICCompressEnd(hic: HIC): DWORD;
3031
begin
3032
    Result := ICSendMessage(hic, ICM_COMPRESS_END, 0, 0);
3033
end;
3034

3035
{-- ICDecompressBegin() - start compression from src fmt to a dest fmt -------}
3036

3037
function    ICDecompressBegin(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
3038
begin
3039
    Result := ICSendMessage(hic, ICM_DECOMPRESS_BEGIN, DWORD(lpbiInput), DWORD(lpbiOutput));
3040
end;
3041

3042
{-- ICDecompressQuery() - determines if compression is supported -------------}
3043

3044
function    ICDecompressQuery(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
3045
begin
3046
    Result := ICSendMessage(hic, ICM_DECOMPRESS_QUERY, DWORD(lpbiInput), DWORD(lpbiOutput));
3047
end;
3048

3049
{-- ICDecompressGetFormat - get the output fmt (fmt of uncompressed data) ----}
3050

3051
// if lpbiOutput is NULL return the size in bytes needed for format.
3052

3053
function    ICDecompressGetFormat(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
3054
begin
3055
    Result := ICSendMessage(hic, ICM_DECOMPRESS_GET_FORMAT, DWORD(lpbiInput), DWORD(lpbiOutput));
3056
end;
3057

3058
function    ICDecompressGetFormatSize(hic: HIC; lpbi: PBITMAPINFOHEADER): DWORD;
3059
begin
3060
    Result := ICDecompressGetFormat(hic, lpbi, nil);
3061
end;
3062

3063
{-- ICDecompressGetPalette() - get the output palette ------------------------}
3064

3065
function    ICDecompressGetPalette(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
3066
begin
3067
    Result := ICSendMessage(hic, ICM_DECOMPRESS_GET_PALETTE, DWORD(lpbiInput), DWORD(lpbiOutput));
3068
end;
3069

3070
function    ICDecompressSetPalette(hic: HIC; lpbiPalette: PBITMAPINFOHEADER): DWORD;
3071
begin
3072
    Result := ICSendMessage(hic, ICM_DECOMPRESS_SET_PALETTE, DWORD(lpbiPalette), 0);
3073
end;
3074

3075
function    ICDecompressEnd(hic: HIC): DWORD;
3076
begin
3077
    Result := ICSendMessage(hic, ICM_DECOMPRESS_END, 0, 0);
3078
end;
3079

3080
{-- ICDecompressEx() - decompress a single frame -----------------------------}
3081

3082
function    ICDecompressEx(
3083
    hic     : HIC;
3084
    dwFlags : DWORD;
3085
    lpbiSrc : PBITMAPINFOHEADER;
3086
    lpSrc   : PVOID;
3087
    xSrc    : int;
3088
    ySrc    : int;
3089
    dxSrc   : int;
3090
    dySrc   : int;
3091
    lpbiDst : PBITMAPINFOHEADER;
3092
    lpDst   : PVOID;
3093
    xDst    : int;
3094
    yDst    : int;
3095
    dxDst   : int;
3096
    dyDst   : int
3097
    ): DWORD; stdcall;
3098
var
3099
    ic : TICDECOMPRESSEX;
3100
begin
3101
    ic.dwFlags  := dwFlags;
3102
    ic.lpbiSrc  := lpbiSrc;
3103
    ic.lpSrc    := lpSrc;
3104
    ic.xSrc     := xSrc;
3105
    ic.ySrc     := ySrc;
3106
    ic.dxSrc    := dxSrc;
3107
    ic.dySrc    := dySrc;
3108
    ic.lpbiDst  := lpbiDst;
3109
    ic.lpDst    := lpDst;
3110
    ic.xDst     := xDst;
3111
    ic.yDst     := yDst;
3112
    ic.dxDst    := dxDst;
3113
    ic.dyDst    := dyDst;
3114

3115
    // note that ICM swaps round the length and pointer
3116
    // length in lparam2, pointer in lparam1
3117
    Result := ICSendMessage(hic, ICM_DECOMPRESSEX, DWORD(@ic), sizeof(ic));
3118
end;
3119

3120
{-- ICDecompressExBegin() - start compression from a src fmt to a dest fmt ---}
3121

3122
function    ICDecompressExBegin(
3123
    hic     : HIC;
3124
    dwFlags : DWORD;
3125
    lpbiSrc : PBITMAPINFOHEADER;
3126
    lpSrc   : PVOID;
3127
    xSrc    : int;
3128
    ySrc    : int;
3129
    dxSrc   : int;
3130
    dySrc   : int;
3131
    lpbiDst : PBITMAPINFOHEADER;
3132
    lpDst   : PVOID;
3133
    xDst    : int;
3134
    yDst    : int;
3135
    dxDst   : int;
3136
    dyDst   : int
3137
    ): DWORD; stdcall;
3138
var
3139
    ic : TICDECOMPRESSEX ;
3140
begin
3141
    ic.dwFlags  := dwFlags;
3142
    ic.lpbiSrc  := lpbiSrc;
3143
    ic.lpSrc    := lpSrc;
3144
    ic.xSrc     := xSrc;
3145
    ic.ySrc     := ySrc;
3146
    ic.dxSrc    := dxSrc;
3147
    ic.dySrc    := dySrc;
3148
    ic.lpbiDst  := lpbiDst;
3149
    ic.lpDst    := lpDst;
3150
    ic.xDst     := xDst;
3151
    ic.yDst     := yDst;
3152
    ic.dxDst    := dxDst;
3153
    ic.dyDst    := dyDst;
3154

3155
    // note that ICM swaps round the length and pointer
3156
    // length in lparam2, pointer in lparam1
3157
    Result      := ICSendMessage(hic, ICM_DECOMPRESSEX_BEGIN, DWORD(@ic), sizeof(ic));
3158
end;
3159

3160
{-- ICDecompressExQuery() ----------------------------------------------------}
3161

3162
function    ICDecompressExQuery(
3163
    hic     : HIC;
3164
    dwFlags : DWORD;
3165
    lpbiSrc : PBITMAPINFOHEADER;
3166
    lpSrc   : PVOID;
3167
    xSrc    : int;
3168
    ySrc    : int;
3169
    dxSrc   : int;
3170
    dySrc   : int;
3171
    lpbiDst : PBITMAPINFOHEADER;
3172
    lpDst   : PVOID;
3173
    xDst    : int;
3174
    yDst    : int;
3175
    dxDst   : int;
3176
    dyDst   : int
3177
    ): DWORD; stdcall;
3178
var
3179
    ic : TICDECOMPRESSEX;
3180
begin
3181
    ic.dwFlags  := dwFlags;
3182
    ic.lpbiSrc  := lpbiSrc;
3183
    ic.lpSrc    := lpSrc;
3184
    ic.xSrc     := xSrc;
3185
    ic.ySrc     := ySrc;
3186
    ic.dxSrc    := dxSrc;
3187
    ic.dySrc    := dySrc;
3188
    ic.lpbiDst  := lpbiDst;
3189
    ic.lpDst    := lpDst;
3190
    ic.xDst     := xDst;
3191
    ic.yDst     := yDst;
3192
    ic.dxDst    := dxDst;
3193
    ic.dyDst    := dyDst;
3194

3195
    // note that ICM swaps round the length and pointer
3196
    // length in lparam2, pointer in lparam1
3197
    Result      := ICSendMessage(hic, ICM_DECOMPRESSEX_QUERY, DWORD(@ic), sizeof(ic));
3198
end;
3199

3200
function    ICDecompressExEnd(hic: HIC): DWORD;
3201
begin
3202
    Result := ICSendMessage(hic, ICM_DECOMPRESSEX_END, 0, 0)
3203
end;
3204

3205
function    ICDrawSuggestFormat(
3206
    hic         : HIC;
3207
    lpbiIn      : PBITMAPINFOHEADER;
3208
    lpbiOut     : PBITMAPINFOHEADER;
3209
    dxSrc       : int;
3210
    dySrc       : int;
3211
    dxDst       : int;
3212
    dyDst       : int;
3213
    hicDecomp   : HIC
3214
    ): DWORD; stdcall;
3215
var
3216
    ic : TICDRAWSUGGEST;
3217
begin
3218
    ic.lpbiIn           := lpbiIn;
3219
    ic.lpbiSuggest      := lpbiOut;
3220
    ic.dxSrc            := dxSrc;
3221
    ic.dySrc            := dySrc;
3222
    ic.dxDst            := dxDst;
3223
    ic.dyDst            := dyDst;
3224
    ic.hicDecompressor  := hicDecomp;
3225

3226
    // note that ICM swaps round the length and pointer
3227
    // length in lparam2, pointer in lparam1
3228
    Result := ICSendMessage(hic, ICM_DRAW_SUGGESTFORMAT, DWORD(@ic), sizeof(ic));
3229
end;
3230

3231
{-- ICDrawQuery() - determines if the compressor is willing to render fmt ----}
3232

3233
function    ICDrawQuery(hic: HIC; lpbiInput: PBITMAPINFOHEADER): DWORD;
3234
begin
3235
    Result := ICSendMessage(hic, ICM_DRAW_QUERY, DWORD(lpbiInput), 0);
3236
end;
3237

3238
function    ICDrawChangePalette(hic: HIC; lpbiInput: PBITMAPINFOHEADER): DWORD;
3239
begin
3240
    Result := ICSendMessage(hic, ICM_DRAW_CHANGEPALETTE, DWORD(lpbiInput), 0);
3241
end;
3242

3243
function    ICGetBuffersWanted(hic: HIC; lpdwBuffers: PDWORD): DWORD;
3244
begin
3245
    Result := ICSendMessage(hic, ICM_GETBUFFERSWANTED, DWORD(lpdwBuffers), 0);
3246
end;
3247

3248
function    ICDrawEnd(hic: HIC): DWORD;
3249
begin
3250
    Result := ICSendMessage(hic, ICM_DRAW_END, 0, 0);
3251
end;
3252

3253
function    ICDrawStart(hic: HIC): DWORD;
3254
begin
3255
    Result := ICSendMessage(hic, ICM_DRAW_START, 0, 0);
3256
end;
3257

3258
function    ICDrawStartPlay(hic: HIC; lFrom, lTo: DWORD): DWORD;
3259
begin
3260
    Result := ICSendMessage(hic, ICM_DRAW_START_PLAY, lFrom, lTo);
3261
end;
3262

3263
function    ICDrawStop(hic: HIC): DWORD;
3264
begin
3265
    Result := ICSendMessage(hic, ICM_DRAW_STOP, 0, 0);
3266
end;
3267

3268
function    ICDrawStopPlay(hic: HIC): DWORD;
3269
begin
3270
    Result := ICSendMessage(hic, ICM_DRAW_STOP_PLAY, 0, 0);
3271
end;
3272

3273
function    ICDrawGetTime(hic: HIC; lplTime: PDWORD): DWORD;
3274
begin
3275
    Result := ICSendMessage(hic, ICM_DRAW_GETTIME, DWORD(lplTime), 0);
3276
end;
3277

3278
function    ICDrawSetTime(hic: HIC; lTime: DWORD): DWORD;
3279
begin
3280
    Result := ICSendMessage(hic, ICM_DRAW_SETTIME, lTime, 0);
3281
end;
3282

3283
function    ICDrawRealize(hic: HIC; hdc: HDC; fBackground: BOOL): DWORD;
3284
begin
3285
    Result := ICSendMessage(hic, ICM_DRAW_REALIZE, DWORD(hdc), DWORD(fBackground));
3286
end;
3287

3288
function    ICDrawFlush(hic: HIC): DWORD;
3289
begin
3290
    Result := ICSendMessage(hic, ICM_DRAW_FLUSH, 0, 0);
3291
end;
3292

3293
function    ICDrawRenderBuffer(hic: HIC): DWORD;
3294
begin
3295
    Result := ICSendMessage(hic, ICM_DRAW_RENDERBUFFER, 0, 0);
3296
end;
3297

3298
{-- ICSetStatusProc() - Set the status callback function ---------------------}
3299

3300
// ICMessage is not supported on NT
3301

3302
function    ICSetStatusProc(
3303
    hic         : HIC;
3304
    dwFlags     : DWORD;
3305
    lParam      : DWORD;
3306
    fpfnStatus  : TICStatusProc
3307
    ): DWORD; stdcall;
3308
var
3309
    ic : TICSETSTATUSPROC;
3310
begin
3311
    ic.dwFlags  := dwFlags;
3312
    ic.lParam   := lParam;
3313
    ic.Status   := fpfnStatus;
3314

3315
    // note that ICM swaps round the length and pointer
3316
    // length in lparam2, pointer in lparam1
3317
    Result      := ICSendMessage(hic, ICM_SET_STATUS_PROC, DWORD(@ic), sizeof(ic));
3318
end;
3319

3320
{== Helper routines for DrawDib and MCIAVI... ================================}
3321

3322
function    ICDecompressOpen(fccType, fccHandler: DWORD; lpbiIn, lpbiOut: PBITMAPINFOHEADER): HIC;
3323
begin
3324
    Result := ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, ICMODE_DECOMPRESS);
3325
end;
3326

3327
function    ICDrawOpen(fccType, fccHandler: DWORD; lpbiIn: PBITMAPINFOHEADER): HIC;
3328
begin
3329
    Result := ICLocate(fccType, fccHandler, lpbiIn, nil, ICMODE_DRAW);
3330
end;
3331

3332
{-- DrawDibUpdate() - redraw last image (may only be valid with DDF_BUFFER) --}
3333

3334
function    DrawDibUpdate(hdd: HDRAWDIB; hdc: HDC; x, y: int): BOOL;
3335
begin
3336
    Result  := DrawDibDraw(hdd, hdc, x, y, 0, 0, nil, nil, 0, 0, 0, 0, DDF_UPDATE);
3337
end;
3338

3339
{== Useful macros ============================================================}
3340

3341
{-- Macro to get stream number out of a FOURCC ckid --------------------------}
3342

3343
function    FromHex(n: BYTE): BYTE;
3344
begin
3345
    if n >= Ord('A') then
3346
        Result := Ord(n) + 10 - Ord('A')
3347
    else
3348
        Result := Ord(n) - Ord('0');
3349
end;
3350

3351
function    StreamFromFOURCC(fcc: DWORD): BYTE;
3352
begin
3353
    Result :=  (FromHex(Lo(LoWord(fcc))) shl 4) + FromHex(Hi(LoWord(fcc)));
3354
end;
3355

3356
{-- Macro to get TWOCC chunk type out of a FOURCC ckid -----------------------}
3357

3358
function    TWOCCFromFOURCC(fcc: DWORD): WORD;
3359
begin
3360
    Result := HiWord(fcc);
3361
end;
3362

3363
{-- Macro to make a ckid for a chunk out of a TWOCC and a stream num (0-255) -}
3364

3365
function    ToHex(n: BYTE): BYTE;
3366
begin
3367
    if n > 9 then
3368
        Result := n - 10 + Ord('A')
3369
    else
3370
        Result := n + Ord('0');
3371
end;
3372

3373
function    MAKEAVICKID(tcc: WORD; stream: BYTE): DWORD;
3374
begin
3375
    Result := MakeLONG((ToHex(stream and $0F) shl 8) or ToHex((stream and $F0) shr 4),tcc);
3376
end;
3377

3378
{-- Helper macros ------------------------------------------------------------}
3379

3380
function    AVIStreamSampleToSample(pavi1, pavi2: IAVISTREAM; l: LONG): LONG;
3381
begin
3382
    Result  := AVIStreamTimeToSample(pavi1,AVIStreamSampleToTime(pavi2, l));
3383
end;
3384

3385
function    AVIStreamNextSample(pavi: IAVISTREAM; l: LONG): LONG;
3386
begin
3387
    Result  := AVIStreamFindSample(pavi,l+1,FIND_NEXT or FIND_ANY);
3388
end;
3389

3390
function    AVIStreamPrevSample(pavi: IAVISTREAM; l: LONG): LONG;
3391
begin
3392
    Result  := AVIStreamFindSample(pavi,l-1,FIND_PREV or FIND_ANY);
3393
end;
3394

3395
function    AVIStreamNearestSample(pavi: IAVISTREAM; l: LONG): LONG;
3396
begin
3397
    Result  := AVIStreamFindSample(pavi,l,FIND_PREV or FIND_ANY);
3398
end;
3399

3400
function    AVIStreamNextKeyFrame(pavi: IAVISTREAM; l: LONG): LONG;
3401
begin
3402
    Result  := AVIStreamFindSample(pavi,l+1,FIND_NEXT or FIND_KEY);
3403
end;
3404

3405
function    AVIStreamPrevKeyFrame(pavi: IAVISTREAM; l: LONG): LONG;
3406
begin
3407
    Result  := AVIStreamFindSample(pavi,l-1,FIND_PREV or FIND_KEY);
3408
end;
3409

3410
function    AVIStreamNearestKeyFrame(pavi: IAVISTREAM; l: LONG): LONG;
3411
begin
3412
    Result  := AVIStreamFindSample(pavi,l,FIND_PREV or FIND_KEY)
3413
end;
3414

3415
function    AVIStreamIsKeyFrame(pavi: IAVISTREAM; l: LONG): BOOL;
3416
begin
3417
    Result  := AVIStreamNearestKeyFrame(pavi,l) = l;
3418
end;
3419

3420
function    AVIStreamPrevSampleTime(pavi: IAVISTREAM; t: LONG): LONG;
3421
begin
3422
    Result  := AVIStreamSampleToTime(pavi, AVIStreamPrevSample(pavi,AVIStreamTimeToSample(pavi,t)));
3423
end;
3424

3425
function    AVIStreamNextSampleTime(pavi: IAVISTREAM; t: LONG): LONG;
3426
begin
3427
    Result  := AVIStreamSampleToTime(pavi, AVIStreamNextSample(pavi,AVIStreamTimeToSample(pavi,t)));
3428
end;
3429

3430
function    AVIStreamNearestSampleTime(pavi: IAVISTREAM; t: LONG): LONG;
3431
begin
3432
    Result  := AVIStreamSampleToTime(pavi, AVIStreamNearestSample(pavi,AVIStreamTimeToSample(pavi,t)));
3433
end;
3434

3435
function    AVIStreamNextKeyFrameTime(pavi: IAVISTREAM; t: LONG): LONG;
3436
begin
3437
    Result  := AVIStreamSampleToTime(pavi, AVIStreamNextKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)));
3438
end;
3439

3440
function    AVIStreamPrevKeyFrameTime(pavi: IAVISTREAM; t: LONG): LONG;
3441
begin
3442
    Result  := AVIStreamSampleToTime(pavi, AVIStreamPrevKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)));
3443
end;
3444

3445
function    AVIStreamNearestKeyFrameTime(pavi: IAVISTREAM; t: LONG): LONG;
3446
begin
3447
    Result  := AVIStreamSampleToTime(pavi, AVIStreamNearestKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)));
3448
end;
3449

3450
function    AVIStreamStartTime(pavi: IAVISTREAM): LONG;
3451
begin
3452
    Result  := AVIStreamSampleToTime(pavi, AVIStreamStart(pavi));
3453
end;
3454

3455
function    AVIStreamLengthTime(pavi: IAVISTREAM): LONG;
3456
begin
3457
    Result  := AVIStreamSampleToTime(pavi, AVIStreamLength(pavi));
3458
end;
3459

3460
function    AVIStreamEnd(pavi: IAVISTREAM): LONG;
3461
begin
3462
    Result  := AVIStreamStart(pavi) + AVIStreamLength(pavi);
3463
end;
3464

3465
function    AVIStreamEndTime(pavi: IAVISTREAM): LONG;
3466
begin
3467
    Result  := AVIStreamSampleToTime(pavi, AVIStreamEnd(pavi));
3468
end;
3469

3470
function    AVIStreamSampleSize(pavi: IAVISTREAM; lPos: LONG; plSize: PLONG): LONG;
3471
begin
3472
    Result  := AVIStreamRead(pavi,lPos,1,nil,0,plSize,nil);
3473
end;
3474

3475
function    AVIStreamFormatSize(pavi: IAVISTREAM; lPos: LONG; plSize: PLONG): HResult;
3476
begin
3477
    Result  := AVIStreamReadFormat(pavi,lPos,nil,plSize);
3478
end;
3479

3480
function    AVIStreamDataSize(pavi: IAVISTREAM; fcc: DWORD; plSize: PLONG): HResult;
3481
begin
3482
    Result  := AVIStreamReadData(pavi,fcc,nil,plSize)
3483
end;
3484

3485
{== MCIWnd ===================================================================}
3486

3487
function    MCIWndSM(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): DWORD;
3488
begin
3489
    Result := SendMessage(hWnd, Msg, wParam, lParam);
3490
end;
3491

3492
{-- Can macros ---------------------------------------------------------------}
3493

3494
function    MCIWndCanPlay(hwnd: HWND): BOOL;
3495
begin
3496
    Result  := MCIWndSM(hwnd,MCIWNDM_CAN_PLAY,0,0) <> 0;
3497
end;
3498

3499
function    MCIWndCanRecord(hwnd: HWND): BOOL;
3500
begin
3501
    Result  := MCIWndSM(hwnd,MCIWNDM_CAN_RECORD,0,0) <> 0;
3502
end;
3503

3504
function    MCIWndCanSave(hwnd: HWND): BOOL;
3505
begin
3506
    Result  := MCIWndSM(hwnd,MCIWNDM_CAN_SAVE,0,0) <> 0;
3507
end;
3508

3509
function    MCIWndCanWindow(hwnd: HWND): BOOL;
3510
begin
3511
    Result  := MCIWndSM(hwnd,MCIWNDM_CAN_WINDOW,0,0) <> 0;
3512
end;
3513

3514
function    MCIWndCanEject(hwnd: HWND): BOOL;
3515
begin
3516
    Result  := MCIWndSM(hwnd,MCIWNDM_CAN_EJECT,0,0) <> 0;
3517
end;
3518

3519
function    MCIWndCanConfig(hwnd: HWND): BOOL;
3520
begin
3521
    Result  := MCIWndSM(hwnd,MCIWNDM_CAN_CONFIG,0,0) <> 0;
3522
end;
3523

3524
function    MCIWndPaletteKick(hwnd: HWND): BOOL;
3525
begin
3526
    Result  := MCIWndSM(hwnd,MCIWNDM_PALETTEKICK,0,0) <> 0;
3527
end;
3528

3529
function    MCIWndSave(hwnd: HWND; szFile: LPCSTR): DWORD;
3530
begin
3531
    Result  := MCIWndSM(hwnd, MCI_SAVE, 0, LPARAM(szFile));
3532
end;
3533

3534
function    MCIWndSaveDialog(hwnd: HWND): DWORD;
3535
begin
3536
    Result  := MCIWndSave(hwnd, LPCSTR(-1));
3537
end;
3538

3539
// If you dont give a device it will use the current device....
3540

3541
function    MCIWndNew(hwnd: HWND; lp: PVOID): DWORD;
3542
begin
3543
    Result  := MCIWndSM(hwnd, MCIWNDM_NEW, 0, LPARAM(lp));
3544
end;
3545

3546
function    MCIWndRecord(hwnd: HWND): DWORD;
3547
begin
3548
    Result  := MCIWndSM(hwnd, MCI_RECORD, 0, 0);
3549
end;
3550

3551
function    MCIWndOpen(hwnd: HWND; sz: LPCSTR; f: BOOL): DWORD;
3552
begin
3553
    Result  := MCIWndSM(hwnd, MCIWNDM_OPEN, WPARAM(f), LPARAM(sz));
3554
end;
3555

3556
function    MCIWndOpenDialog(hwnd: HWND): DWORD;
3557
begin
3558
    Result  := MCIWndOpen(hwnd, LPCSTR(-1), False);
3559
end;
3560

3561
function    MCIWndClose(hwnd: HWND): DWORD;
3562
begin
3563
    Result  := MCIWndSM(hwnd, MCI_CLOSE, 0, 0);
3564
end;
3565

3566
function    MCIWndPlay(hwnd: HWND): DWORD;
3567
begin
3568
    Result  := MCIWndSM(hwnd, MCI_PLAY, 0, 0);
3569
end;
3570

3571
function    MCIWndStop(hwnd: HWND): DWORD;
3572
begin
3573
    Result  := MCIWndSM(hwnd, MCI_STOP, 0, 0);
3574
end;
3575

3576
function    MCIWndPause(hwnd: HWND): DWORD;
3577
begin
3578
    Result  := MCIWndSM(hwnd, MCI_PAUSE, 0, 0);
3579
end;
3580

3581
function    MCIWndResume(hwnd: HWND): DWORD;
3582
begin
3583
    Result  := MCIWndSM(hwnd, MCI_RESUME, 0, 0);
3584
end;
3585

3586
function    MCIWndSeek(hwnd: HWND; lPos: DWORD): DWORD;
3587
begin
3588
    Result  := MCIWndSM(hwnd, MCI_SEEK, 0, lPos);
3589
end;
3590

3591
function    MCIWndEject(hwnd: HWND): DWORD;
3592
begin
3593
    Result  := MCIWndSM(hwnd, MCIWNDM_EJECT, 0, 0);
3594
end;
3595

3596
function    MCIWndHome(hwnd: HWND): DWORD;
3597
begin
3598
    Result  := MCIWndSeek(hwnd, MCIWND_START);
3599
end;
3600

3601
function    MCIWndEnd(hwnd: HWND): DWORD;
3602
begin
3603
    Result  := MCIWndSeek(hwnd, MCIWND_END);
3604
end;
3605

3606
function    MCIWndGetSource(hwnd: HWND; prc: PRECT): DWORD;
3607
begin
3608
    Result  := MCIWndSM(hwnd, MCIWNDM_GET_SOURCE, 0, LPARAM(prc));
3609
end;
3610

3611
function    MCIWndPutSource(hwnd: HWND; prc: PRECT): DWORD;
3612
begin
3613
    Result  := MCIWndSM(hwnd, MCIWNDM_PUT_SOURCE, 0, LPARAM(prc));
3614
end;
3615

3616
function    MCIWndGetDest(hwnd: HWND; prc: PRECT): DWORD;
3617
begin
3618
    Result  := MCIWndSM(hwnd, MCIWNDM_GET_DEST, 0, LPARAM(prc));
3619
end;
3620

3621
function    MCIWndPutDest(hwnd: HWND; prc: PRECT): DWORD;
3622
begin
3623
    Result  := MCIWndSM(hwnd, MCIWNDM_PUT_DEST, 0, LPARAM(prc));
3624
end;
3625

3626
function    MCIWndPlayReverse(hwnd: HWND): DWORD;
3627
begin
3628
    Result  := MCIWndSM(hwnd, MCIWNDM_PLAYREVERSE, 0, 0);
3629
end;
3630

3631
function    MCIWndPlayFrom(hwnd: HWND; lPos: DWORD): DWORD;
3632
begin
3633
    Result  := MCIWndSM(hwnd, MCIWNDM_PLAYFROM, 0, lPos);
3634
end;
3635

3636
function    MCIWndPlayTo(hwnd: HWND; lPos: DWORD): DWORD;
3637
begin
3638
    Result  := MCIWndSM(hwnd, MCIWNDM_PLAYTO, 0, lPos);
3639
end;
3640

3641
function    MCIWndPlayFromTo(hwnd: HWND; lStart, lEnd: DWORD): DWORD;
3642
begin
3643
    MCIWndSeek(hwnd, lStart);
3644
    Result  := MCIWndPlayTo(hwnd, lEnd);
3645
end;
3646

3647
function    MCIWndGetDeviceID(hwnd: HWND): UINT;
3648
begin
3649
    Result  := MCIWndSM(hwnd, MCIWNDM_GETDEVICEID, 0, 0);
3650
end;
3651

3652
function    MCIWndGetAlias(hwnd: HWND): UINT;
3653
begin
3654
    Result  := MCIWndSM(hwnd, MCIWNDM_GETALIAS, 0, 0);
3655
end;
3656

3657
function    MCIWndGetMode(hwnd: HWND; lp: LPCSTR; len: UINT): DWORD;
3658
begin
3659
    Result  := MCIWndSM(hwnd, MCIWNDM_GETMODE, len, LPARAM(lp));
3660
end;
3661

3662
function    MCIWndGetPosition(hwnd: HWND): DWORD;
3663
begin
3664
    Result  := MCIWndSM(hwnd, MCIWNDM_GETPOSITION, 0, 0);
3665
end;
3666

3667
function    MCIWndGetPositionString(hwnd: HWND; lp: LPCSTR; len: UINT): DWORD;
3668
begin
3669
    Result  := MCIWndSM(hwnd, MCIWNDM_GETPOSITION, len, LPARAM(lp));
3670
end;
3671

3672
function    MCIWndGetStart(hwnd: HWND): DWORD;
3673
begin
3674
    Result  := MCIWndSM(hwnd, MCIWNDM_GETSTART, 0, 0);
3675
end;
3676

3677
function    MCIWndGetLength(hwnd: HWND): DWORD;
3678
begin
3679
    Result  := MCIWndSM(hwnd, MCIWNDM_GETLENGTH, 0, 0);
3680
end;
3681

3682
function    MCIWndGetEnd(hwnd: HWND): DWORD;
3683
begin
3684
    Result  := MCIWndSM(hwnd, MCIWNDM_GETEND, 0, 0);
3685
end;
3686

3687
function    MCIWndStep(hwnd: HWND; n: DWORD): DWORD;
3688
begin
3689
    Result  := MCIWndSM(hwnd, MCI_STEP, 0, n);
3690
end;
3691

3692
procedure   MCIWndDestroy(hwnd: HWND);
3693
begin
3694
    MCIWndSM(hwnd, WM_CLOSE, 0, 0);
3695
end;
3696

3697
procedure   MCIWndSetZoom(hwnd: HWND; iZoom: UINT);
3698
begin
3699
    MCIWndSM(hwnd, MCIWNDM_SETZOOM, 0, iZoom);
3700
end;
3701

3702
function    MCIWndGetZoom(hwnd: HWND): UINT;
3703
begin
3704
    Result  := MCIWndSM(hwnd, MCIWNDM_GETZOOM, 0, 0);
3705
end;
3706

3707
function    MCIWndSetVolume(hwnd: HWND; iVol: UINT): DWORD;
3708
begin
3709
    Result  := MCIWndSM(hwnd, MCIWNDM_SETVOLUME, 0, iVol);
3710
end;
3711

3712
function    MCIWndGetVolume(hwnd: HWND): DWORD;
3713
begin
3714
    Result  := MCIWndSM(hwnd, MCIWNDM_GETVOLUME, 0, 0);
3715
end;
3716

3717
function    MCIWndSetSpeed(hwnd: HWND; iSpeed: UINT): DWORD;
3718
begin
3719
    Result  := MCIWndSM(hwnd, MCIWNDM_SETSPEED, 0, iSpeed);
3720
end;
3721

3722
function    MCIWndGetSpeed(hwnd: HWND): DWORD;
3723
begin
3724
    Result  := MCIWndSM(hwnd, MCIWNDM_GETSPEED, 0, 0);
3725
end;
3726

3727
function    MCIWndSetTimeFormat(hwnd: HWND; lp: LPCSTR): DWORD;
3728
begin
3729
    Result  := MCIWndSM(hwnd, MCIWNDM_SETTIMEFORMAT, 0, LPARAM(lp));
3730
end;
3731

3732
function    MCIWndGetTimeFormat(hwnd: HWND; lp: LPCSTR; len: UINT): DWORD;
3733
begin
3734
    Result  := MCIWndSM(hwnd, MCIWNDM_GETTIMEFORMAT, len, LPARAM(lp));
3735
end;
3736

3737
procedure   MCIWndValidateMedia(hwnd: HWND);
3738
begin
3739
    MCIWndSM(hwnd, MCIWNDM_VALIDATEMEDIA, 0, 0);
3740
end;
3741

3742
procedure   MCIWndSetRepeat(hwnd: HWND; f: BOOL);
3743
begin
3744
    MCIWndSM(hwnd, MCIWNDM_SETREPEAT, 0, LPARAM(f));
3745
end;
3746

3747
function    MCIWndGetRepeat(hwnd: HWND): BOOL;
3748
begin
3749
    Result  := MCIWndSM(hwnd, MCIWNDM_GETREPEAT, 0, 0) <> 0;
3750
end;
3751

3752
function    MCIWndUseFrames(hwnd: HWND): DWORD;
3753
begin
3754
    Result  := MCIWndSetTimeFormat(hwnd, 'frames');
3755
end;
3756

3757
function    MCIWndUseTime(hwnd: HWND): DWORD;
3758
begin
3759
    Result  := MCIWndSetTimeFormat(hwnd, 'ms');
3760
end;
3761

3762
procedure   MCIWndSetActiveTimer(hwnd: HWND; active: UINT);
3763
begin
3764
    MCIWndSM(hwnd, MCIWNDM_SETACTIVETIMER, active, 0);
3765
end;
3766

3767
procedure   MCIWndSetInactiveTimer(hwnd: HWND; inactive: UINT);
3768
begin
3769
    MCIWndSM(hwnd, MCIWNDM_SETINACTIVETIMER, inactive, 0);
3770
end;
3771

3772
procedure   MCIWndSetTimers(hwnd: HWND; active, inactive: UINT);
3773
begin
3774
    MCIWndSM(hwnd, MCIWNDM_SETTIMERS, active, inactive);
3775
end;
3776

3777
function    MCIWndGetActiveTimer(hwnd: HWND): UINT;
3778
begin
3779
    Result  := MCIWndSM(hwnd, MCIWNDM_GETACTIVETIMER, 0, 0);
3780
end;
3781

3782
function    MCIWndGetInactiveTimer(hwnd: HWND): UINT;
3783
begin
3784
    Result  := MCIWndSM(hwnd, MCIWNDM_GETINACTIVETIMER, 0, 0);
3785
end;
3786

3787
function    MCIWndRealize(hwnd: HWND; fBkgnd: BOOL): DWORD;
3788
begin
3789
    Result  := MCIWndSM(hwnd, MCIWNDM_REALIZE, WPARAM(fBkgnd), 0);
3790
end;
3791

3792
function    MCIWndSendString(hwnd: HWND; sz: LPCSTR): DWORD;
3793
begin
3794
    Result  := MCIWndSM(hwnd, MCIWNDM_SENDSTRING, 0, LPARAM(sz));
3795
end;
3796

3797
function    MCIWndReturnString(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
3798
begin
3799
    Result  := MCIWndSM(hwnd, MCIWNDM_RETURNSTRING, len, LPARAM(lp));
3800
end;
3801

3802
function    MCIWndGetError(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
3803
begin
3804
    Result  := MCIWndSM(hwnd, MCIWNDM_GETERROR, len, LPARAM(lp));
3805
end;
3806

3807
function    MCIWndGetPalette(hwnd: HWND): HPALETTE;
3808
begin
3809
    Result  := MCIWndSM(hwnd, MCIWNDM_GETPALETTE, 0, 0);
3810
end;
3811

3812
function    MCIWndSetPalette(hwnd: HWND; hpal: HPALETTE): DWORD;
3813
begin
3814
    Result  := MCIWndSM(hwnd, MCIWNDM_SETPALETTE, hpal, 0);
3815
end;
3816

3817
function    MCIWndGetFileName(hwnd: HWND; lp: LPCSTR; len: UINT): DWORD;
3818
begin
3819
    Result  := MCIWndSM(hwnd, MCIWNDM_GETFILENAME, len, LPARAM(lp));
3820
end;
3821

3822
function    MCIWndGetDevice(hwnd: HWND; lp: LPCSTR; len: UINT): DWORD;
3823
begin
3824
    Result  := MCIWndSM(hwnd, MCIWNDM_GETDEVICE, len, LPARAM(lp));
3825
end;
3826

3827
function    MCIWndGetStyles(hwnd: HWND): UINT;
3828
begin
3829
    Result  := MCIWndSM(hwnd, MCIWNDM_GETSTYLES, 0, 0);
3830
end;
3831

3832
function    MCIWndChangeStyles(hwnd: HWND; mask: UINT; value: DWORD): DWORD;
3833
begin
3834
    Result  := MCIWndSM(hwnd, MCIWNDM_CHANGESTYLES, mask, value);
3835
end;
3836

3837
function    MCIWndOpenInterface(hwnd: HWND; pUnk: PUNKNOWN): DWORD;
3838
begin
3839
    Result  := MCIWndSM(hwnd, MCIWNDM_OPENINTERFACE, 0, LPARAM(pUnk));
3840
end;
3841

3842
function    MCIWndSetOwner(hwnd: HWND; hwndP: HWND): DWORD;
3843
begin
3844
    Result  := MCIWndSM(hwnd, MCIWNDM_SETOWNER, hwndP, 0);
3845
end;
3846

3847
{== AVICAP - Window class for AVI capture ====================================}
3848

3849
function    AVICapSM(hwnd: HWND; m: UINT; w: WPARAM; l: LPARAM): DWORD;
3850
begin
3851
    if IsWindow(hwnd) then
3852
        Result := SendMessage(hwnd,m,w,l)
3853
    else
3854
        Result := 0;
3855
end;
3856

3857
{-- Message crackers for above -----------------------------------------------}
3858

3859
function    capSetCallbackOnError(hwnd: HWND; fpProc: TCAPERRORCALLBACK): BOOL;
3860
begin
3861
    Result  := AVICapSM(hwnd, WM_CAP_SET_CALLBACK_ERROR, 0, LPARAM(@fpProc)) <> 0;
3862
end;
3863

3864
function    capSetCallbackOnStatus(hwnd: HWND; fpProc: TCAPSTATUSCALLBACK): BOOL;
3865
begin
3866
    Result  := AVICapSM(hwnd, WM_CAP_SET_CALLBACK_STATUS, 0, LPARAM(@fpProc)) <> 0;
3867
end;
3868

3869
function    capSetCallbackOnYield(hwnd: HWND; fpProc: TCAPYIELDCALLBACK): BOOL;
3870
begin
3871
    Result  := AVICapSM(hwnd, WM_CAP_SET_CALLBACK_YIELD, 0, LPARAM(@fpProc)) <> 0;
3872
end;
3873

3874
function    capSetCallbackOnFrame(hwnd: HWND; fpProc: TCAPVIDEOCALLBACK): BOOL;
3875
begin
3876
    Result  := AVICapSM(hwnd, WM_CAP_SET_CALLBACK_FRAME, 0, LPARAM(@fpProc)) <> 0;
3877
end;
3878

3879
function    capSetCallbackOnVideoStream(hwnd: HWND; fpProc: TCAPVIDEOCALLBACK): BOOL;
3880
begin
3881
    Result  := AVICapSM(hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, LPARAM(@fpProc)) <> 0;
3882
end;
3883

3884
function    capSetCallbackOnWaveStream(hwnd: HWND; fpProc: TCAPWAVECALLBACK): BOOL;
3885
begin
3886
    Result  := AVICapSM(hwnd, WM_CAP_SET_CALLBACK_WAVESTREAM, 0, LPARAM(@fpProc)) <> 0;
3887
end;
3888

3889
function    capSetCallbackOnCapControl(hwnd: HWND; fpProc: TCAPCONTROLCALLBACK): BOOL;
3890
begin
3891
    Result  := AVICapSM(hwnd, WM_CAP_SET_CALLBACK_CAPCONTROL, 0, LPARAM(@fpProc)) <> 0;
3892
end;
3893

3894
function    capSetUserData(hwnd: HWND; lUser: DWORD): BOOL;
3895
begin
3896
    Result  := AVICapSM(hwnd, WM_CAP_SET_USER_DATA, 0, lUser) <> 0;
3897
end;
3898

3899
function    capGetUserData(hwnd: HWND): DWORD;
3900
begin
3901
    Result  := AVICapSM(hwnd, WM_CAP_GET_USER_DATA, 0, 0);
3902
end;
3903

3904
function    capDriverConnect(hwnd: HWND; i: INT): BOOL;
3905
begin
3906
    Result  := AVICapSM(hwnd, WM_CAP_DRIVER_CONNECT, i, 0) <> 0;
3907
end;
3908

3909
function    capDriverDisconnect(hwnd: HWND): BOOL;
3910
begin
3911
    Result  := AVICapSM(hwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0) <> 0;
3912
end;
3913

3914
function    capDriverGetName(hwnd: HWND; szName: LPSTR; wSize: WORD): BOOL;
3915
begin
3916
    Result  := AVICapSM(hwnd, WM_CAP_DRIVER_GET_NAME, wSize, LPARAM(szName)) <> 0;
3917
end;
3918

3919
function    capDriverGetVersion(hwnd: HWND; szVer: LPSTR; wSize: WORD): BOOL;
3920
begin
3921
    Result  := AVICapSM(hwnd, WM_CAP_DRIVER_GET_VERSION, wSize, LPARAM(szVer)) <> 0;
3922
end;
3923

3924
function    capDriverGetCaps(hwnd: HWND; s: PCAPDRIVERCAPS; wSize: WORD): BOOL;
3925
begin
3926
    Result  := AVICapSM(hwnd, WM_CAP_DRIVER_GET_CAPS, wSize, LPARAM(s)) <> 0;
3927
end;
3928

3929
function    capFileSetCaptureFile(hwnd: HWND; szName: LPCSTR): BOOL;
3930
begin
3931
    Result  := AVICapSM(hwnd, WM_CAP_FILE_SET_CAPTURE_FILE, 0, LPARAM(szName)) <> 0;
3932
end;
3933

3934
function    capFileGetCaptureFile(hwnd: HWND; szName: LPSTR; wSize: WORD): BOOL;
3935
begin
3936
    Result  := AVICapSM(hwnd, WM_CAP_FILE_GET_CAPTURE_FILE, wSize, LPARAM(szName)) <> 0;
3937
end;
3938

3939
function    capFileAlloc(hwnd: HWND; dwSize: DWORD): BOOL;
3940
begin
3941
    Result  := AVICapSM(hwnd, WM_CAP_FILE_ALLOCATE, 0, dwSize) <> 0;
3942
end;
3943

3944
function    capFileSaveAs(hwnd: HWND; szName: LPCSTR): BOOL;
3945
begin
3946
    Result  := AVICapSM(hwnd, WM_CAP_FILE_SAVEAS, 0, LPARAM(szName)) <> 0;
3947
end;
3948

3949
function    capFileSetInfoChunk(hwnd: HWND; lpInfoChunk: PCAPINFOCHUNK): BOOL;
3950
begin
3951
    Result  := AVICapSM(hwnd, WM_CAP_FILE_SET_INFOCHUNK, 0, LPARAM(lpInfoChunk)) <> 0;
3952
end;
3953

3954
function    capFileSaveDIB(hwnd: HWND; szName: LPCSTR): BOOL;
3955
begin
3956
    Result  := AVICapSM(hwnd, WM_CAP_FILE_SAVEDIB, 0, LPARAM(szName)) <> 0;
3957
end;
3958

3959
function    capEditCopy(hwnd: HWND): BOOL;
3960
begin
3961
    Result  := AVICapSM(hwnd, WM_CAP_EDIT_COPY, 0, 0) <> 0;
3962
end;
3963

3964
function    capSetAudioFormat(hwnd: HWND; s: PWAVEFORMATEX; wSize: WORD): BOOL;
3965
begin
3966
    Result  := AVICapSM(hwnd, WM_CAP_SET_AUDIOFORMAT, wSize, LPARAM(s)) <> 0;
3967
end;
3968

3969
function    capGetAudioFormat(hwnd: HWND; s: PWAVEFORMATEX; wSize: WORD): DWORD;
3970
begin
3971
    Result  := AVICapSM(hwnd, WM_CAP_GET_AUDIOFORMAT, wSize, LPARAM(s));
3972
end;
3973

3974
function    capGetAudioFormatSize(hwnd: HWND): DWORD;
3975
begin
3976
    Result  := AVICapSM(hwnd, WM_CAP_GET_AUDIOFORMAT, 0, 0);
3977
end;
3978

3979
function    capDlgVideoFormat(hwnd: HWND): BOOL;
3980
begin
3981
    Result  := AVICapSM(hwnd, WM_CAP_DLG_VIDEOFORMAT, 0, 0) <> 0;
3982
end;
3983

3984
function    capDlgVideoSource(hwnd: HWND): BOOL;
3985
begin
3986
    Result  := AVICapSM(hwnd, WM_CAP_DLG_VIDEOSOURCE, 0, 0) <> 0;
3987
end;
3988

3989
function    capDlgVideoDisplay(hwnd: HWND): BOOL;
3990
begin
3991
    Result  := AVICapSM(hwnd, WM_CAP_DLG_VIDEODISPLAY, 0, 0) <> 0;
3992
end;
3993

3994
function    capDlgVideoCompression(hwnd: HWND): BOOL;
3995
begin
3996
    Result  := AVICapSM(hwnd, WM_CAP_DLG_VIDEOCOMPRESSION, 0, 0) <> 0;
3997
end;
3998

3999
function    capGetVideoFormat(hwnd: HWND; s: PVOID; wSize: WORD): DWORD;
4000
begin
4001
    Result  := AVICapSM(hwnd, WM_CAP_GET_VIDEOFORMAT, wSize, LPARAM(s));
4002
end;
4003

4004
function    capGetVideoFormatSize(hwnd: HWND): DWORD;
4005
begin
4006
    Result  := AVICapSM(hwnd, WM_CAP_GET_VIDEOFORMAT, 0, 0);
4007
end;
4008

4009
function    capSetVideoFormat(hwnd: HWND; s: PVOID; wSize: WORD): BOOL;
4010
begin
4011
    Result  := AVICapSM(hwnd, WM_CAP_SET_VIDEOFORMAT, wSize, LPARAM(s)) <> 0;
4012
end;
4013

4014
function    capPreview(hwnd: HWND; f: BOOL): BOOL;
4015
begin
4016
    Result  := AVICapSM(hwnd, WM_CAP_SET_PREVIEW, WPARAM(f), 0) <> 0;
4017
end;
4018

4019
function    capPreviewRate(hwnd: HWND; wMS: WORD): BOOL;
4020
begin
4021
    Result  := AVICapSM(hwnd, WM_CAP_SET_PREVIEWRATE, wMS, 0) <> 0;
4022
end;
4023

4024
function    capOverlay(hwnd: HWND; f: BOOL): BOOL;
4025
begin
4026
    Result  := AVICapSM(hwnd, WM_CAP_SET_OVERLAY, WPARAM(f), 0) <> 0;
4027
end;
4028

4029
function    capPreviewScale(hwnd: HWND; f: BOOL): BOOL;
4030
begin
4031
    Result  := AVICapSM(hwnd, WM_CAP_SET_SCALE, WPARAM(f), 0) <> 0;
4032
end;
4033

4034
function    capGetStatus(hwnd: HWND; s: PCAPSTATUS; wSize: WORD): BOOL;
4035
begin
4036
    Result  := AVICapSM(hwnd, WM_CAP_GET_STATUS, wSize, LPARAM(s)) <> 0;
4037
end;
4038

4039
function    capSetScrollPos(hwnd: HWND; lpP: PPOINT): BOOL;
4040
begin
4041
    Result  := AVICapSM(hwnd, WM_CAP_SET_SCROLL, 0, LPARAM(lpP)) <> 0;
4042
end;
4043

4044
function    capGrabFrame(hwnd: HWND): BOOL;
4045
begin
4046
    Result  := AVICapSM(hwnd, WM_CAP_GRAB_FRAME, 0, 0) <> 0;
4047
end;
4048

4049
function    capGrabFrameNoStop(hwnd: HWND): BOOL;
4050
begin
4051
    Result  := AVICapSM(hwnd, WM_CAP_GRAB_FRAME_NOSTOP, 0, 0) <> 0;
4052
end;
4053

4054
function    capCaptureSequence(hwnd: HWND): BOOL;
4055
begin
4056
    Result  := AVICapSM(hwnd, WM_CAP_SEQUENCE, 0, 0) <> 0;
4057
end;
4058

4059
function    capCaptureSequenceNoFile(hwnd: HWND): BOOL;
4060
begin
4061
    Result  := AVICapSM(hwnd, WM_CAP_SEQUENCE_NOFILE, 0, 0) <> 0;
4062
end;
4063

4064
function    capCaptureStop(hwnd: HWND): BOOL;
4065
begin
4066
    Result  := AVICapSM(hwnd, WM_CAP_STOP, 0, 0) <> 0;
4067
end;
4068

4069
function    capCaptureAbort(hwnd: HWND): BOOL;
4070
begin
4071
    Result  := AVICapSM(hwnd, WM_CAP_ABORT, 0, 0) <> 0;
4072
end;
4073

4074
function    capCaptureSingleFrameOpen(hwnd: HWND): BOOL;
4075
begin
4076
    Result  := AVICapSM(hwnd, WM_CAP_SINGLE_FRAME_OPEN, 0, 0) <> 0;
4077
end;
4078

4079
function    capCaptureSingleFrameClose(hwnd: HWND): BOOL;
4080
begin
4081
    Result  := AVICapSM(hwnd, WM_CAP_SINGLE_FRAME_CLOSE, 0, 0) <> 0;
4082
end;
4083

4084
function    capCaptureSingleFrame(hwnd: HWND): BOOL;
4085
begin
4086
    Result  := AVICapSM(hwnd, WM_CAP_SINGLE_FRAME, 0, 0) <> 0;
4087
end;
4088

4089
function    capCaptureGetSetup(hwnd: HWND; s: PCAPTUREPARMS; wSize: WORD): BOOL;
4090
begin
4091
    Result  := AVICapSM(hwnd, WM_CAP_GET_SEQUENCE_SETUP, wSize, LPARAM(s)) <> 0;
4092
end;
4093

4094
function    capCaptureSetSetup(hwnd: HWND; s: PCAPTUREPARMS; wSize: WORD): BOOL;
4095
begin
4096
    Result  := AVICapSM(hwnd, WM_CAP_SET_SEQUENCE_SETUP, wSize, LPARAM(s)) <> 0;
4097
end;
4098

4099
function    capSetMCIDeviceName(hwnd: HWND; szName: LPCSTR): BOOL;
4100
begin
4101
    Result  := AVICapSM(hwnd, WM_CAP_SET_MCI_DEVICE, 0, LPARAM(szName)) <> 0;
4102
end;
4103

4104
function    capGetMCIDeviceName(hwnd: HWND; szName: LPSTR; wSize: WORD): BOOL;
4105
begin
4106
    Result  := AVICapSM(hwnd, WM_CAP_GET_MCI_DEVICE, wSize, LPARAM(szName)) <> 0;
4107
end;
4108

4109
function    capPaletteOpen(hwnd: HWND; szName: LPCSTR): BOOL;
4110
begin
4111
    Result  := AVICapSM(hwnd, WM_CAP_PAL_OPEN, 0, LPARAM(szName)) <> 0;
4112
end;
4113

4114
function    capPaletteSave(hwnd: HWND; szName: LPCSTR): BOOL;
4115
begin
4116
    Result  := AVICapSM(hwnd, WM_CAP_PAL_SAVE, 0, LPARAM(szName)) <> 0;
4117
end;
4118

4119
function    capPalettePaste(hwnd: HWND): BOOL;
4120
begin
4121
    Result  := AVICapSM(hwnd, WM_CAP_PAL_PASTE, 0, 0) <> 0;
4122
end;
4123

4124
function    capPaletteAuto(hwnd: HWND; iFrames, iColors: INT): BOOL;
4125
begin
4126
    Result  := AVICapSM(hwnd, WM_CAP_PAL_AUTOCREATE, iFrames, iColors) <> 0;
4127
end;
4128

4129
function    capPaletteManual(hwnd: HWND; fGrab: BOOL; iColors: INT): BOOL;
4130
begin
4131
    Result  := AVICapSM(hwnd, WM_CAP_PAL_MANUALCREATE, WPARAM(fGrab), iColors) <> 0;
4132
end;
4133

4134
{== Externals ================================================================}
4135

4136
const
4137
    VFWDLL      = 'MSVFW32.DLL';
4138
    AVIFILDLL   = 'AVIFIL32.DLL';
4139
    AVICAPDLL   = 'AVICAP32.DLL';
4140

4141
{-- Returns version of VFW ---------------------------------------------------}
4142

4143
function    VideoForWindowsVersion: DWord; pascal; external VFWDLL;
4144

4145
{-- Call these to start stop using VfW from your app -------------------------}
4146

4147
{ TODO: Where are these functions? }
4148
                            {
4149
 function    InitVFW: LONG; stdcall;
4150
 function    TermVFW: LONG; stdcall; }
4151

4152
{-- ICM function declarations ------------------------------------------------}
4153

4154
function    ICInfo(fccType, fccHandler: DWORD; lpicinfo: PICINFO) : BOOL ; stdcall ; external VFWDLL;
4155
function    ICInstall(fccType, fccHandler: DWORD; lParam: LPARAM; szDesc: LPSTR; wFlags: UINT) : BOOL ; stdcall ; external VFWDLL;
4156
function    ICRemove(fccType, fccHandler: DWORD; wFlags: UINT) : BOOL ; stdcall ; external VFWDLL;
4157
function    ICGetInfo(hic: HIC; picinfo: PICINFO; cb: DWORD) : DWORD ; stdcall ; external VFWDLL;
4158

4159
function    ICOpen(fccType, fccHandler: DWORD; wMode: UINT) : HIC ; stdcall ; external VFWDLL;
4160
function    ICOpenFunction(fccType, fccHandler: DWORD; wMode: UINT; lpfnHandler: TFarProc) : HIC ; stdcall ; external VFWDLL;
4161
function    ICClose(hic: HIC) : DWORD ; stdcall ; external VFWDLL;
4162

4163
function    ICSendMessage(hic: HIC; msg: UINT; dw1, dw2: DWORD) : DWORD ; stdcall ; external VFWDLL;
4164

4165
{== Compression functions ====================================================}
4166

4167
{-- ICCompress() - compress a single frame -----------------------------------}
4168

4169
function    ICCompress(
4170
    hic             : HIC;
4171
    dwFlags         : DWORD;                // flags
4172
    lpbiOutput      : PBITMAPINFOHEADER;    // output format
4173
    lpData          : PVOID;                // output data
4174
    lpbiInput       : PBITMAPINFOHEADER;    // format of frame to compress
4175
    lpBits          : PVOID;                // frame data to compress
4176
    lpckid          : PDWORD;               // ckid for data in AVI file
4177
    lpdwFlags       : PDWORD;               // flags in the AVI index.
4178
    lFrameNum       : DWORD;                 // frame number of seq.
4179
    dwFrameSize     : DWORD;                // reqested size in bytes. (if non zero)
4180
    dwQuality       : DWORD;                // quality within one frame
4181
    lpbiPrev        : PBITMAPINFOHEADER;    // format of previous frame
4182
    lpPrev          : PVOID                 // previous frame
4183
    ) : DWORD; cdecl; external VFWDLL;
4184

4185
{== Decompression functions ==================================================}
4186

4187
{-- ICDecompress() - decompress a single frame -------------------------------}
4188

4189
function    ICDecompress(
4190
    hic             : HIC;
4191
    dwFlags         : DWORD;                // flags (from AVI index...)
4192
    lpbiFormat      : PBITMAPINFOHEADER;    // BITMAPINFO of compressed data
4193
                                            // biSizeImage has the chunk size
4194
    lpData          : PVOID;                // data
4195
    lpbi            : PBITMAPINFOHEADER;    // DIB to decompress to
4196
    lpBits          : PVOID
4197
    ): DWORD; cdecl; external VFWDLL;
4198

4199
{== Drawing functions ========================================================}
4200

4201
{-- ICDrawBegin() - start decompressing data with fmt directly to screen -----}
4202

4203
// return zero if the decompressor supports drawing.
4204

4205
function    ICDrawBegin(
4206
    hic         : HIC;
4207
    dwFlags     : DWORD;                // flags
4208
    hpal        : HPALETTE;             // palette to draw with
4209
    hwnd        : HWND;                 // window to draw to
4210
    hdc         : HDC;                  // HDC to draw to
4211
    xDst        : int;                  // destination rectangle
4212
    yDst        : int;
4213
    dxDst       : int;
4214
    dyDst       : int;
4215
    lpbi        : PBITMAPINFOHEADER;    // format of frame to draw
4216
    xSrc        : int;                  // source rectangle
4217
    ySrc        : int;
4218
    dxSrc       : int;
4219
    dySrc       : int;
4220
    dwRate      : DWORD;                // frames/second = (dwRate/dwScale)
4221
    dwScale     : DWORD
4222
    ): DWORD; cdecl; external VFWDLL;
4223

4224
{-- ICDraw() - decompress data directly to the screen ------------------------}
4225

4226
function    ICDraw(
4227
    hic         : HIC;
4228
    dwFlags     : DWORD;                // flags
4229
    lpFormat    : PVOID;                // format of frame to decompress
4230
    lpData      : PVOID;                // frame data to decompress
4231
    cbData      : DWORD;                // size of data
4232
    lTime       : DWORD                  // time to draw this frame
4233
    ): DWORD; cdecl; external VFWDLL;
4234

4235
{== Helper routines for DrawDib and MCIAVI... ================================}
4236

4237
function    ICLocate(fccType, fccHandler: DWORD; lpbiIn, lpbiOut: PBITMAPINFOHEADER; wFlags: WORD): HIC; stdcall; external VFWDLL;
4238
function    ICGetDisplayFormat(hic: HIC; lpbiIn, lpbiOut: PBITMAPINFOHEADER; BitDepth: int; dx, dy: int): HIC; stdcall; external VFWDLL;
4239

4240
{== Higher level functions ===================================================}
4241

4242
function    ICImageCompress(
4243
    hic         : HIC;                  // compressor to use
4244
    uiFlags     : UINT;                 // flags (none yet)
4245
    lpbiIn      : PBITMAPINFO;          // format to compress from
4246
    lpBits      : PVOID;                // data to compress
4247
    lpbiOut     : PBITMAPINFO;          // compress to this (NULL ==> default)
4248
    lQuality    : LONG;                 // quality to use
4249
    plSize      : PDWORD                 // compress to this size (0=whatever)
4250
    ): THANDLE; stdcall; external VFWDLL;
4251

4252
function    ICImageDecompress(
4253
    hic         : HIC;                  // compressor to use
4254
    uiFlags     : UINT;                 // flags (none yet)
4255
    lpbiIn      : PBITMAPINFO;          // format to decompress from
4256
    lpBits      : PVOID;                // data to decompress
4257
    lpbiOut     : PBITMAPINFO           // decompress to this (NULL ==> default)
4258
    ): THANDLE; stdcall; external VFWDLL;
4259

4260
{-- ICCompressorChoose() - allows user to choose compressor, quality etc... --}
4261

4262
function    ICCompressorChoose(
4263
    hwnd        : HWND;                     // parent window for dialog
4264
    uiFlags     : UINT;                     // flags
4265
    pvIn        : PVOID;                    // input format (optional)
4266
    lpData      : PVOID;                    // input data (optional)
4267
    pc          : PCOMPVARS;                // data about the compressor/dlg
4268
    lpszTitle   : LPSTR                     // dialog title (optional)
4269
    ): BOOL; stdcall; external VFWDLL;
4270

4271
function    ICSeqCompressFrameStart(pc: PCOMPVARS; lpbiIn: PBITMAPINFO): BOOL; stdcall; external VFWDLL;
4272
procedure   ICSeqCompressFrameEnd(pc: PCOMPVARS); stdcall; external VFWDLL;
4273

4274
function    ICSeqCompressFrame(
4275
    pc          : PCOMPVARS;                // set by ICCompressorChoose
4276
    uiFlags     : UINT;                     // flags
4277
    lpBits      : PVOID;                    // input DIB bits
4278
    pfKey       : PBOOL;                    // did it end up being a key frame?
4279
    plSize      : PDWORD                     // size to compress to/of returned image
4280
    ): PVOID; stdcall; external VFWDLL;
4281

4282
procedure   ICCompressorFree(pc: PCOMPVARS); stdcall; external VFWDLL;
4283

4284
{== DrawDib functions ========================================================}
4285

4286
{-- DrawDibOpen() ------------------------------------------------------------}
4287

4288
function    DrawDibOpen: HDRAWDIB; stdcall; external VFWDLL;
4289

4290
{-- DrawDibClose() -----------------------------------------------------------}
4291

4292
function    DrawDibClose(hdd: HDRAWDIB): BOOL; stdcall; external VFWDLL;
4293

4294
{-- DrawDibGetBuffer() -------------------------------------------------------}
4295

4296
function    DrawDibGetBuffer(hdd: HDRAWDIB; lpbi: PBITMAPINFOHEADER; dwSize: DWORD; dwFlags: DWORD): PVOID; stdcall; external VFWDLL;
4297

4298
{-- DrawDibGetPalette() - get the palette used for drawing DIBs --------------}
4299

4300
function    DrawDibGetPalette(hdd: HDRAWDIB): HPALETTE; stdcall; external VFWDLL;
4301

4302
{-- DrawDibSetPalette() - set the palette used for drawing DIBs --------------}
4303

4304
function    DrawDibSetPalette(hdd: HDRAWDIB; hpal: HPALETTE): BOOL; stdcall; external VFWDLL;
4305

4306
{-- DrawDibChangePalette() ---------------------------------------------------}
4307

4308
function    DrawDibChangePalette(hdd: HDRAWDIB; iStart, iLen: int; lppe: PPALETTEENTRY): BOOL; stdcall; external VFWDLL;
4309

4310
{-- DrawDibRealize() - realize the palette in a HDD --------------------------}
4311

4312
function    DrawDibRealize(hdd: HDRAWDIB; hdc: HDC; fBackground: BOOL): UINT; stdcall; external VFWDLL;
4313

4314
{-- DrawDibStart() - start of streaming playback -----------------------------}
4315

4316
function    DrawDibStart(hdd: HDRAWDIB; rate: DWORD): BOOL; stdcall; external VFWDLL;
4317

4318
{-- DrawDibStop() - start of streaming playback ------------------------------}
4319

4320
function    DrawDibStop(hdd: HDRAWDIB): BOOL; stdcall; external VFWDLL;
4321

4322
{-- DrawDibBegin() - prepare to draw -----------------------------------------}
4323

4324
function    DrawDibBegin(
4325
    hdd         : HDRAWDIB;
4326
    hdc         : HDC;
4327
    dxDst       : int;
4328
    dyDst       : int;
4329
    lpbi        : PBITMAPINFOHEADER;
4330
    dxSrc       : int;
4331
    dySrc       : int;
4332
    wFlags      : UINT
4333
    ): BOOL; stdcall; external VFWDLL;
4334

4335
{-- DrawDibDraw() - actually draw a DIB to the screen ------------------------}
4336

4337
function    DrawDibDraw(
4338
    hdd         : HDRAWDIB;
4339
    hdc         : HDC;
4340
    xDst        : int;
4341
    yDst        : int;
4342
    dxDst       : int;
4343
    dyDst       : int;
4344
    lpbi        : PBITMAPINFOHEADER;
4345
    lpBits      : PVOID;
4346
    xSrc        : int;
4347
    ySrc        : int;
4348
    dxSrc       : int;
4349
    dySrc       : int;
4350
    wFlags      : UINT
4351
    ): BOOL; stdcall; external VFWDLL;
4352

4353
{-- DrawDibEnd() -------------------------------------------------------------}
4354

4355
function    DrawDibEnd(hdd: HDRAWDIB): BOOL; stdcall; external VFWDLL;
4356

4357
{-- DrawDibTime() - for debugging purposes only ------------------------------}
4358

4359
function    DrawDibTime(hdd: HDRAWDIB; lpddtime: PDRAWDIBTIME): BOOL; stdcall; external VFWDLL;
4360

4361
{-- Display profiling --------------------------------------------------------}
4362

4363
function    DrawDibProfileDisplay(lpbi: PBITMAPINFOHEADER): DWORD; stdcall; external VFWDLL;
4364

4365
{-- Functions ----------------------------------------------------------------}
4366

4367
procedure   AVIFileInit; stdcall; external AVIFILDLL; // Call this first!
4368
procedure   AVIFileExit; stdcall; external AVIFILDLL;
4369

4370
function    AVIFileAddRef(pfile: IAVIFILE): ULONG; stdcall; external AVIFILDLL;
4371
function    AVIFileRelease(pfile: IAVIFILE): ULONG; stdcall; external AVIFILDLL;
4372

4373
function    AVIFileOpenA(var ppfile: IAVIFILE; szFile: LPCSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall; external AVIFILDLL;
4374
function    AVIFileOpenW(var ppfile: IAVIFILE; szFile: LPCWSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall; external AVIFILDLL;
4375

4376
{$IFDEF UNICODE}
4377
function    AVIFileOpen(var ppfile: IAVIFILE; szFile: LPCWSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall;  external AVIFILDLL name 'AVIFileOpenW';
4378
{$ELSE}
4379
function    AVIFileOpen(var ppfile: IAVIFILE; szFile: LPCSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall;  external AVIFILDLL name 'AVIFileOpenA';
4380
{$ENDIF}
4381

4382
function    AVIFileInfoW(pfile: IAVIFILE; var pfi: TAVIFILEINFOW; lSize: LONG): HResult; stdcall; external AVIFILDLL;
4383
function    AVIFileInfoA(pfile: IAVIFILE; var pfi: TAVIFILEINFOA; lSize: LONG): HResult; stdcall; external AVIFILDLL;
4384

4385
{$IFDEF UNICODE}
4386
function    AVIFileInfo(pfile: IAVIFILE; var pfi: TAVIFILEINFO; lSize: LONG): HResult; stdcall;  external AVIFILDLL name 'AVIFileInfoW';
4387
{$ELSE}
4388
function    AVIFileInfo(pfile: IAVIFILE; var pfi: TAVIFILEINFO; lSize: LONG): HResult; stdcall;  external AVIFILDLL name 'AVIFileInfoA';
4389
{$ENDIF}
4390

4391
function    AVIFileGetStream(pfile: IAVIFILE; var ppavi: IAVISTREAM; fccType: DWORD; lParam: LONG): HResult; stdcall; external AVIFILDLL;
4392

4393
function    AVIFileCreateStreamW(pfile: IAVIFILE; var ppavi: IAVISTREAM; var psi: TAVISTREAMINFOW): HResult; stdcall; external AVIFILDLL;
4394
function    AVIFileCreateStreamA(pfile: IAVIFILE; var ppavi: IAVISTREAM; var psi: TAVISTREAMINFOA): HResult; stdcall; external AVIFILDLL;
4395

4396
{$IFDEF UNICODE}
4397
function    AVIFileCreateStream(pfile: IAVIFILE; var ppavi: IAVISTREAM; var psi: TAVISTREAMINFO): HResult; stdcall; external AVIFILDLL name 'AVIFileCreateStreamW';
4398
{$ELSE}
4399
function    AVIFileCreateStream(pfile: IAVIFILE; var ppavi: IAVISTREAM; var psi: TAVISTREAMINFO): HResult; stdcall; external AVIFILDLL name 'AVIFileCreateStreamA';
4400
{$ENDIF}
4401

4402
function    AVIFileWriteData(pfile: IAVIFILE; ckid: DWORD; lpData: PVOID; cbData: LONG): HResult; stdcall; external AVIFILDLL;
4403
function    AVIFileReadData(pfile: IAVIFILE; ckid: DWORD; lpData: PVOID; var lpcbData: LONG): HResult; stdcall; external AVIFILDLL;
4404
function    AVIFileEndRecord(pfile: IAVIFILE): HResult; stdcall; external AVIFILDLL;
4405

4406
function    AVIStreamAddRef(pavi: IAVISTREAM): ULONG; stdcall; external AVIFILDLL;
4407
function    AVIStreamRelease(pavi: IAVISTREAM): ULONG; stdcall; external AVIFILDLL;
4408

4409
function    AVIStreamInfoW (pavi: IAVISTREAM; var psi: TAVISTREAMINFOW; lSize: LONG): HResult; stdcall; external AVIFILDLL;
4410
function    AVIStreamInfoA (pavi: IAVISTREAM; var psi: TAVISTREAMINFOA; lSize: LONG): HResult; stdcall; external AVIFILDLL;
4411

4412
{$IFDEF UNICODE}
4413
function    AVIStreamInfo(pavi: IAVISTREAM; var psi: TAVISTREAMINFO; lSize: LONG): HResult; stdcall; external AVIFILDLL name 'AVIStreamInfoW';
4414
{$ELSE}
4415
function    AVIStreamInfo(pavi: IAVISTREAM; var psi: TAVISTREAMINFO; lSize: LONG): HResult; stdcall; external AVIFILDLL name 'AVIStreamInfoA';
4416
{$ENDIF}
4417

4418

4419
function    AVIStreamFindSample(pavi: IAVISTREAM; lPos: LONG; lFlags: LONG): LONG; stdcall; external AVIFILDLL;
4420
function    AVIStreamReadFormat(pavi: IAVISTREAM; lPos: LONG; lpFormat: PVOID; lpcbFormat: PLONG): HResult; stdcall; external AVIFILDLL;
4421
function    AVIStreamSetFormat(pavi: IAVISTREAM; lPos: LONG; lpFormat: PVOID; cbFormat: LONG): HResult; stdcall; external AVIFILDLL;
4422
function    AVIStreamReadData(pavi: IAVISTREAM; fcc: DWORD; lp: PVOID; lpcb: PLONG): HResult; stdcall; external AVIFILDLL;
4423
function    AVIStreamWriteData(pavi: IAVISTREAM; fcc: DWORD; lp: PVOID; cb: LONG): HResult; stdcall; external AVIFILDLL;
4424

4425
function    AVIStreamRead(
4426
    pavi            : IAVISTREAM;
4427
    lStart          : LONG;
4428
    lSamples        : LONG;
4429
    lpBuffer        : PVOID;
4430
    cbBuffer        : LONG;
4431
    plBytes         : PLONG;
4432
    plSamples       : PLONG
4433
    ): HResult; stdcall; external AVIFILDLL;
4434

4435
function    AVIStreamWrite(
4436
    pavi            : IAVISTREAM;
4437
    lStart          : LONG;
4438
    lSamples        : LONG;
4439
    lpBuffer        : PVOID;
4440
    cbBuffer        : LONG;
4441
    dwFlags         : DWORD;
4442
    plSampWritten   : PLONG;
4443
    plBytesWritten  : PLONG
4444
    ): HResult; stdcall; external AVIFILDLL;
4445

4446
// Right now, these just use AVIStreamInfo() to get information, then
4447
// return some of it.  Can they be more efficient?
4448

4449
function    AVIStreamStart(pavi: IAVISTREAM): LONG; stdcall; external AVIFILDLL;
4450
function    AVIStreamLength(pavi: IAVISTREAM): LONG; stdcall; external AVIFILDLL;
4451
function    AVIStreamTimeToSample(pavi: IAVISTREAM; lTime: LONG): LONG; stdcall; external AVIFILDLL;
4452
function    AVIStreamSampleToTime(pavi: IAVISTREAM; lSample: LONG): LONG; stdcall; external AVIFILDLL;
4453

4454
function    AVIStreamBeginStreaming(pavi: IAVISTREAM; lStart, lEnd: LONG; lRate: LONG): HResult; stdcall; external AVIFILDLL;
4455
function    AVIStreamEndStreaming(pavi: IAVISTREAM): HResult; stdcall; external AVIFILDLL;
4456

4457
{-- Helper functions for using IGetFrame -------------------------------------}
4458

4459
function    AVIStreamGetFrameOpen_(pavi: IAVISTREAM; lpbiWanted: PBitmapInfoHeader): pointer; stdcall; external AVIFILDLL name 'AVIStreamGetFrameOpen';
4460
function    AVIStreamGetFrame(pg: IGETFRAME; lPos: LONG): PBitmapInfoHeader; stdcall; external AVIFILDLL;
4461
function    AVIStreamGetFrameClose(pg: IGETFRAME): HResult; stdcall; external AVIFILDLL;
4462

4463
function    AVIStreamGetFrameOpen(pavi: IAVIStream; lpbiWanted: PBitmapInfoHeader): IGetFrame; stdcall;
4464
begin
4465
  pointer(Result) := AVIStreamGetFrameOpen_(pavi, lpbiWanted);
4466
end;
4467

4468
// !!! We need some way to place an advise on a stream....
4469
// STDAPI AVIStreamHasChanged   (PAVISTREAM pavi);
4470

4471
{-- Shortcut function --------------------------------------------------------}
4472

4473
function    AVIStreamOpenFromFileA(var ppavi: IAVISTREAM; szFile: LPCSTR; fccType: DWORD;
4474
                                   lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall; external AVIFILDLL;
4475
function    AVIStreamOpenFromFileW(var ppavi: IAVISTREAM; szFile: LPCWSTR; fccType: DWORD;
4476
                                   lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall; external AVIFILDLL;
4477

4478
{$IFDEF UNICODE}
4479
function AVIStreamOpenFromFile(var ppavi: IAVISTREAM; szFile: LPCWSTR; fccType: DWORD;
4480
  lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall; external AVIFILDLL name 'AVIStreamOpenFromFileW';
4481
{$ELSE}
4482
function AVIStreamOpenFromFile(var ppavi: IAVISTREAM; szFile: LPCSTR; fccType: DWORD;
4483
  lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall; external AVIFILDLL name 'AVIStreamOpenFromFileA';
4484
{$ENDIF}
4485

4486
{-- Use to create disembodied streams ----------------------------------------}
4487

4488
function    AVIStreamCreate(var ppavi: IAVISTREAM; lParam1, lParam2: LONG;
4489
                            pclsidHandler: PCLSID): HResult; stdcall; external AVIFILDLL;
4490

4491
// PHANDLER    AVIAPI AVIGetHandler         (PAVISTREAM pavi, PAVISTREAMHANDLER psh);
4492
// PAVISTREAM  AVIAPI AVIGetStream          (PHANDLER p);
4493

4494
{-- Stuff to support backward compat. ----------------------------------------}
4495

4496
function    AVIStreamFindKeyFrame(var pavi: IAVISTREAM; lPos: LONG; lFlags: LONG): DWORD; stdcall; external AVIFILDLL name 'AVIStreamFindSample';
4497

4498
// Non-portable: this is alias for method name
4499
// FindKeyFrame FindSample
4500

4501
function    AVIStreamClose(pavi: IAVISTREAM): ULONG; stdcall; external AVIFILDLL name 'AVIStreamRelease';
4502
function    AVIFileClose(pfile: IAVIFILE): ULONG; stdcall; external AVIFILDLL name 'AVIFileRelease';
4503
procedure   AVIStreamInit; stdcall; external AVIFILDLL name 'AVIFileInit';
4504
procedure   AVIStreamExit; stdcall; external AVIFILDLL name 'AVIFileExit';
4505

4506
{== AVISave routines and structures ==========================================}
4507

4508
function    AVIMakeCompressedStream(
4509
    var ppsCompressed   : IAVISTREAM;
4510
    ppsSource           : IAVISTREAM;
4511
    lpOptions           : PAVICOMPRESSOPTIONS;
4512
    pclsidHandler       : PCLSID
4513
    ): HResult; stdcall; external AVIFILDLL;
4514

4515
// Non-portable: uses variable number of params
4516
// EXTERN_C HRESULT CDECL AVISaveA (LPCSTR               szFile,
4517
//      CLSID FAR *pclsidHandler,
4518
//      AVISAVECALLBACK     lpfnCallback,
4519
//      int                 nStreams,
4520
//      PAVISTREAM      pfile,
4521
//      LPAVICOMPRESSOPTIONS lpOptions,
4522
//      ...);
4523

4524
function    AVISaveVA(
4525
    szFile          : LPCSTR;
4526
    pclsidHandler   : PCLSID;
4527
    lpfnCallback    : TAVISAVECALLBACK;
4528
    nStreams        : int;
4529
    var ppavi       : IAVISTREAM;
4530
    var plpOptions  : PAVICOMPRESSOPTIONS
4531
    ): HResult; stdcall; external AVIFILDLL;
4532

4533
// Non-portable: uses variable number of params
4534
// EXTERN_C HRESULT CDECL AVISaveW (LPCWSTR               szFile,
4535
//      CLSID FAR *pclsidHandler,
4536
//      AVISAVECALLBACK     lpfnCallback,
4537
//      int                 nStreams,
4538
//      PAVISTREAM      pfile,
4539
//      LPAVICOMPRESSOPTIONS lpOptions,
4540
//      ...);
4541

4542
function    AVISaveVW(
4543
    szFile          : LPCWSTR;
4544
    pclsidHandler   : PCLSID;
4545
    lpfnCallback    : TAVISAVECALLBACK;
4546
    nStreams        : int;
4547
    var ppavi       : IAVISTREAM;
4548
    var plpOptions  : PAVICOMPRESSOPTIONS
4549
    ): HResult; stdcall; external AVIFILDLL;
4550

4551
// #define AVISave      AVISaveA
4552

4553
function    AVISaveV(
4554
    szFile          : LPCSTR;
4555
    pclsidHandler   : PCLSID;
4556
    lpfnCallback    : TAVISAVECALLBACK;
4557
    nStreams        : int;
4558
    var ppavi       : IAVISTREAM;
4559
    var plpOptions  : PAVICOMPRESSOPTIONS
4560
    ): HResult; stdcall; external AVIFILDLL name 'AVISaveVA';
4561

4562
function    AVISaveOptions(
4563
    hwnd            : HWND;
4564
    uiFlags         : UINT;
4565
    nStreams        : int;
4566
    var ppavi       : IAVISTREAM;
4567
    var plpOptions  : PAVICOMPRESSOPTIONS
4568
    ): BOOL; stdcall; external AVIFILDLL;
4569

4570
function    AVISaveOptionsFree(nStreams: int; var plpOptions: PAVICOMPRESSOPTIONS): HResult; stdcall; external AVIFILDLL;
4571

4572
{-----------------------------------------------------------------------------}
4573

4574
function    AVIBuildFilterW(lpszFilter: LPWSTR; cbFilter: LONG; fSaving: BOOL): HResult; stdcall; external AVIFILDLL;
4575
function    AVIBuildFilterA(lpszFilter: LPSTR; cbFilter: LONG; fSaving: BOOL): HResult; stdcall; external AVIFILDLL;
4576

4577
function    AVIBuildFilter(lpszFilter: LPSTR; cbFilter: LONG; fSaving: BOOL): HResult; stdcall; external AVIFILDLL name 'AVIBuildFilterA';
4578

4579
function    AVIMakeFileFromStreams(var ppfile: IAVIFILE; nStreams: int; var papStreams: IAVISTREAM): HResult; stdcall; external AVIFILDLL;
4580

4581
function    AVIMakeStreamFromClipboard(cfFormat: UINT; hGlobal: THANDLE; var ppstream: IAVISTREAM): HResult; stdcall; external AVIFILDLL;
4582

4583
{-- Clipboard routines -------------------------------------------------------}
4584

4585
function    AVIPutFileOnClipboard(pf: IAVIFILE): HResult; stdcall; external AVIFILDLL;
4586
function    AVIGetFromClipboard(var lppf: IAVIFILE): HResult; stdcall; external AVIFILDLL;
4587
function    AVIClearClipboard: HResult; stdcall; external AVIFILDLL;
4588

4589
{-- Editing routines ---------------------------------------------------------}
4590

4591
function    CreateEditableStream(var ppsEditable: IAVISTREAM; psSource: IAVISTREAM): HResult; stdcall; external AVIFILDLL;
4592

4593
function    EditStreamCut(pavi: IAVISTREAM; var plStart, plLength: LONG; var ppResult: IAVISTREAM): HResult; stdcall; external AVIFILDLL;
4594
function    EditStreamCopy(pavi: IAVISTREAM; var plStart, plLength: LONG; var ppResult: IAVISTREAM): HResult; stdcall; external AVIFILDLL;
4595
function    EditStreamPaste(pavi: IAVISTREAM; var plPos, plLength: LONG; pstream: IAVISTREAM; lStart, lEnd: LONG): HResult; stdcall; external AVIFILDLL;
4596
function    EditStreamClone(pavi: IAVISTREAM; var ppResult: IAVISTREAM): HResult; stdcall; external AVIFILDLL;
4597

4598
function    EditStreamSetNameA(pavi: IAVISTREAM; lpszName: LPCSTR): HResult; stdcall; external AVIFILDLL;
4599
function    EditStreamSetNameW(pavi: IAVISTREAM; lpszName: LPCWSTR): HResult; stdcall; external AVIFILDLL;
4600
function    EditStreamSetInfoW(pavi: IAVISTREAM; lpInfo: PAVISTREAMINFOW; cbInfo: LONG): HResult; stdcall; external AVIFILDLL;
4601
function    EditStreamSetInfoA(pavi: IAVISTREAM; lpInfo: PAVISTREAMINFOA; cbInfo: LONG): HResult; stdcall; external AVIFILDLL;
4602

4603
function    EditStreamSetInfo(pavi: IAVISTREAM; lpInfo: PAVISTREAMINFOA; cbInfo: LONG): HResult; stdcall; external AVIFILDLL name 'EditStreamSetInfoA';
4604
function    EditStreamSetName(pavi: IAVISTREAM; lpszName: LPCSTR): HResult; stdcall; external AVIFILDLL name 'EditStreamSetNameA';
4605

4606
{-- MCIWnd -------------------------------------------------------------------}
4607

4608
function    MCIWndCreateA(hwndParent: HWND; hInstance: HINST; dwStyle: DWORd; szFile: LPCSTR): HWND; cdecl; external VFWDLL;
4609
function    MCIWndCreateW(hwndParent: HWND; hInstance: HINST; dwStyle: DWORd; szFile: LPCWSTR): HWND; cdecl; external VFWDLL;
4610

4611
function    MCIWndCreate(hwndParent: HWND; hInstance: HINST; dwStyle: DWORd; szFile: LPCSTR): HWND; cdecl;  external VFWDLL name 'MCIWndCreateA';
4612

4613
function    MCIWndRegisterClass: BOOL; cdecl; external VFWDLL;
4614

4615
{== AVICAP - Window class for AVI capture ====================================}
4616

4617
{-- The only exported functions from AVICAP.DLL ------------------------------}
4618

4619
function    capCreateCaptureWindowA(
4620
    lpszWindowName      : LPCSTR;
4621
    dwStyle             : DWORD;
4622
    x, y                : int;
4623
    nWidth, nHeight     : int;
4624
    hwndParent          : HWND;
4625
    nID                 : int
4626
    ): HWND; stdcall; external AVICAPDLL;
4627

4628
function    capGetDriverDescriptionA(
4629
    wDriverIndex        : UINT;
4630
    lpszName            : LPSTR;
4631
    cbName              : int;
4632
    lpszVer             : LPSTR;
4633
    cbVer               : int
4634
    ): BOOL; stdcall; external AVICAPDLL;
4635

4636
function    capCreateCaptureWindowW(
4637
    lpszWindowName      : LPCWSTR;
4638
    dwStyle             : DWORD;
4639
    x, y                : int;
4640
    nWidth, nHeight     : int;
4641
    hwndParent          : HWND;
4642
    nID                 : int
4643
    ): HWND; stdcall; external AVICAPDLL;
4644

4645
function    capGetDriverDescriptionW(
4646
    wDriverIndex        : UINT;
4647
    lpszName            : LPWSTR;
4648
    cbName              : int;
4649
    lpszVer             : LPWSTR;
4650
    cbVer               : int
4651
    ): BOOL; stdcall; external AVICAPDLL;
4652

4653
function    capCreateCaptureWindow(
4654
    lpszWindowName      : LPCSTR;
4655
    dwStyle             : DWORD;
4656
    x, y                : int;
4657
    nWidth, nHeight     : int;
4658
    hwndParent          : HWND;
4659
    nID                 : int
4660
    ): HWND; stdcall; external AVICAPDLL name 'capCreateCaptureWindowA';
4661

4662
function    capGetDriverDescription(
4663
    wDriverIndex        : UINT;
4664
    lpszName            : LPSTR;
4665
    cbName              : int;
4666
    lpszVer             : LPSTR;
4667
    cbVer               : int
4668
    ): BOOL; stdcall; external AVICAPDLL name 'capGetDriverDescriptionA';
4669

4670
{== FilePreview dialog =======================================================}
4671

4672
function GetOpenFileNamePreviewA(lpofn: POPENFILENAMEA): BOOL; stdcall; external VFWDLL;
4673
function GetSaveFileNamePreviewA(lpofn: POPENFILENAMEA): BOOL; stdcall; external VFWDLL;
4674

4675
function GetOpenFileNamePreviewW(lpofn: POPENFILENAMEW): BOOL; stdcall; external VFWDLL;
4676
function GetSaveFileNamePreviewW(lpofn: POPENFILENAMEW): BOOL; stdcall; external VFWDLL;
4677

4678
function GetOpenFileNamePreview(lpofn: POPENFILENAMEA): BOOL; stdcall; external VFWDLL name 'GetOpenFileNamePreviewA';
4679
function GetSaveFileNamePreview(lpofn: POPENFILENAMEA): BOOL; stdcall; external VFWDLL name 'GetSaveFileNamePreviewA';
4680

4681
end.
4682

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.