-
Notifications
You must be signed in to change notification settings - Fork 12
/
VfW.pas
4677 lines (3730 loc) · 186 KB
/
VfW.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
unit VFW;
interface
{$UNDEF UNICODE}
(****************************************************************************
*
* VfW.H - Video for windows include file for WIN32
*
* Copyright (c) 1991-1999, Microsoft Corp. All rights reserved.
*
* This include files defines interfaces to the following
* video components
*
* COMPMAN - Installable Compression Manager.
* DRAWDIB - Routines for drawing to the display.
* VIDEO - Video Capture Driver Interface
*
* AVIFMT - AVI File Format structure definitions.
* MMREG - FOURCC and other things
*
* AVIFile - Interface for reading AVI Files and AVI Streams
* MCIWND - MCI/AVI window class
* AVICAP - AVI Capture Window class
*
* MSACM - Audio compression manager.
*
* The following symbols control inclusion of various parts of this file:
*
* NOCOMPMAN - dont include COMPMAN
* NODRAWDIB - dont include DRAWDIB
* NOVIDEO - dont include video capture interface
*
* NOAVIFMT - dont include AVI file format structs
* NOMMREG - dont include MMREG
*
* NOAVIFILE - dont include AVIFile interface
* NOMCIWND - dont include AVIWnd class.
* NOAVICAP - dont include AVICap class.
*
* NOMSACM - dont include ACM stuff.
*
****************************************************************************)
(******************************************************************************)
(* *)
(* VFW.PAS Conversion by Ronald Dittrich *)
(* *)
(* E-Mail: info@swiftsoft.de *)
(* http://www.swiftsoft.de *)
(* *)
(******************************************************************************)
(******************************************************************************)
(* *)
(* Modyfied: 25.April.2000 *)
(* *)
(* E-Mail: *)
(* Ivo Steinmann: isteinmann@bluewin.ch *)
(* *)
(* Please send all messages regarding specific errors and lacks of this unit *)
(* to Ivo Steinmann *)
(* *)
(******************************************************************************)
(******************************************************************************)
(* *)
(* Modyfied: 2000-12-07 *)
(* *)
(* E-Mail: *)
(* Peter Haas: PeterJHaas@t-online.de *)
(* *)
(* Only modified line 1380 ( TAVIPALCHANGE.peNew ) *)
(* *)
(******************************************************************************)
uses
Windows,
MMSystem,
Messages,
CommDlg,
ActiveX,
Dialogs;
(****************************************************************************
*
* types
*
***************************************************************************)
type
PVOID = pointer;
LONG = longint;
PLONG = ^LONG;
int = integer;
(****************************************************************************
*
* VideoForWindowsVersion() - returns version of VfW
*
***************************************************************************)
function VideoForWindowsVersion: DWORD; pascal;
(****************************************************************************
*
* call these to start stop using VfW from your app.
*
***************************************************************************)
{
function InitVFW: LONG; stdcall;
function TermVFW: LONG; stdcall; }
(****************************************************************************/
/* */
/* Macros */
/* */
/* should we define this?? */
/* */
/****************************************************************************)
function MKFOURCC(ch0, ch1, ch2, ch3: Char): FOURCC;
(****************************************************************************
*
* COMPMAN - Installable Compression Manager.
*
****************************************************************************)
const
ICVERSION = $0104 ;
type
HIC = THandle; // Handle to an Installable Compressor
//
// this code in biCompression means the DIB must be accesed via
// 48 bit pointers! using *ONLY* the selector given.
//
const
BI_1632 = $32333631; // '1632'
function mmioFOURCC(ch0, ch1, ch2, ch3: Char): FOURCC;
type
TWOCC = word;
function aviTWOCC(ch0, ch1: Char): TWOCC;
const
ICTYPE_VIDEO = $63646976; {vidc}
ICTYPE_AUDIO = $63647561; {audc}
const
ICERR_OK = 0 ;
ICERR_DONTDRAW = 1 ;
ICERR_NEWPALETTE = 2 ;
ICERR_GOTOKEYFRAME = 3 ;
ICERR_STOPDRAWING = 4 ;
ICERR_UNSUPPORTED = -1 ;
ICERR_BADFORMAT = -2 ;
ICERR_MEMORY = -3 ;
ICERR_INTERNAL = -4 ;
ICERR_BADFLAGS = -5 ;
ICERR_BADPARAM = -6 ;
ICERR_BADSIZE = -7 ;
ICERR_BADHANDLE = -8 ;
ICERR_CANTUPDATE = -9 ;
ICERR_ABORT = -10 ;
ICERR_ERROR = -100 ;
ICERR_BADBITDEPTH = -200 ;
ICERR_BADIMAGESIZE = -201 ;
ICERR_CUSTOM = -400 ; // errors less than ICERR_CUSTOM...
{-- Values for dwFlags of ICOpen() -------------------------------------------}
ICMODE_COMPRESS = 1 ;
ICMODE_DECOMPRESS = 2 ;
ICMODE_FASTDECOMPRESS = 3 ;
ICMODE_QUERY = 4 ;
ICMODE_FASTCOMPRESS = 5 ;
ICMODE_DRAW = 8 ;
{-- Flags for AVI file index -------------------------------------------------}
AVIIF_LIST = $00000001 ;
AVIIF_TWOCC = $00000002 ;
AVIIF_KEYFRAME = $00000010 ;
{-- quality flags ------------------------------------------------------------}
ICQUALITY_LOW = 0 ;
ICQUALITY_HIGH = 10000 ;
ICQUALITY_DEFAULT = -1 ;
(************************************************************************
************************************************************************)
ICM_USER = (DRV_USER+$0000) ;
ICM_RESERVED_LOW = (DRV_USER+$1000) ;
ICM_RESERVED_HIGH = (DRV_USER+$2000) ;
ICM_RESERVED = ICM_RESERVED_LOW ;
(************************************************************************
messages.
************************************************************************)
ICM_GETSTATE = (ICM_RESERVED+0) ; // Get compressor state
ICM_SETSTATE = (ICM_RESERVED+1) ; // Set compressor state
ICM_GETINFO = (ICM_RESERVED+2) ; // Query info about the compressor
ICM_CONFIGURE = (ICM_RESERVED+10); // show the configure dialog
ICM_ABOUT = (ICM_RESERVED+11); // show the about box
ICM_GETDEFAULTQUALITY = (ICM_RESERVED+30); // get the default value for quality
ICM_GETQUALITY = (ICM_RESERVED+31); // get the current value for quality
ICM_SETQUALITY = (ICM_RESERVED+32); // set the default value for quality
ICM_SET = (ICM_RESERVED+40); // Tell the driver something
ICM_GET = (ICM_RESERVED+41); // Ask the driver something
{-- Constants for ICM_SET: ---------------------------------------------------}
ICM_FRAMERATE = $526D7246; {FrmR}
ICM_KEYFRAMERATE = $5279654B; {KeyR}
(************************************************************************
ICM specific messages.
************************************************************************)
ICM_COMPRESS_GET_FORMAT = (ICM_USER+4) ; // get compress format or size
ICM_COMPRESS_GET_SIZE = (ICM_USER+5) ; // get output size
ICM_COMPRESS_QUERY = (ICM_USER+6) ; // query support for compress
ICM_COMPRESS_BEGIN = (ICM_USER+7) ; // begin a series of compress calls.
ICM_COMPRESS = (ICM_USER+8) ; // compress a frame
ICM_COMPRESS_END = (ICM_USER+9) ; // end of a series of compress calls.
ICM_DECOMPRESS_GET_FORMAT = (ICM_USER+10) ; // get decompress format or size
ICM_DECOMPRESS_QUERY = (ICM_USER+11) ; // query support for dempress
ICM_DECOMPRESS_BEGIN = (ICM_USER+12) ; // start a series of decompress calls
ICM_DECOMPRESS = (ICM_USER+13) ; // decompress a frame
ICM_DECOMPRESS_END = (ICM_USER+14) ; // end a series of decompress calls
ICM_DECOMPRESS_SET_PALETTE = (ICM_USER+29) ; // fill in the DIB color table
ICM_DECOMPRESS_GET_PALETTE = (ICM_USER+30) ; // fill in the DIB color table
ICM_DRAW_QUERY = (ICM_USER+31) ; // query support for dempress
ICM_DRAW_BEGIN = (ICM_USER+15) ; // start a series of draw calls
ICM_DRAW_GET_PALETTE = (ICM_USER+16) ; // get the palette needed for drawing
ICM_DRAW_START = (ICM_USER+18) ; // start decompress clock
ICM_DRAW_STOP = (ICM_USER+19) ; // stop decompress clock
ICM_DRAW_END = (ICM_USER+21) ; // end a series of draw calls
ICM_DRAW_GETTIME = (ICM_USER+32) ; // get value of decompress clock
ICM_DRAW = (ICM_USER+33) ; // generalized "render" message
ICM_DRAW_WINDOW = (ICM_USER+34) ; // drawing window has moved or hidden
ICM_DRAW_SETTIME = (ICM_USER+35) ; // set correct value for decompress clock
ICM_DRAW_REALIZE = (ICM_USER+36) ; // realize palette for drawing
ICM_DRAW_FLUSH = (ICM_USER+37) ; // clear out buffered frames
ICM_DRAW_RENDERBUFFER = (ICM_USER+38) ; // draw undrawn things in queue
ICM_DRAW_START_PLAY = (ICM_USER+39) ; // start of a play
ICM_DRAW_STOP_PLAY = (ICM_USER+40) ; // end of a play
ICM_DRAW_SUGGESTFORMAT = (ICM_USER+50) ; // Like ICGetDisplayFormat
ICM_DRAW_CHANGEPALETTE = (ICM_USER+51) ; // for animating palette
ICM_GETBUFFERSWANTED = (ICM_USER+41) ; // ask about prebuffering
ICM_GETDEFAULTKEYFRAMERATE = (ICM_USER+42) ; // get the default value for key frames
ICM_DECOMPRESSEX_BEGIN = (ICM_USER+60) ; // start a series of decompress calls
ICM_DECOMPRESSEX_QUERY = (ICM_USER+61) ; // start a series of decompress calls
ICM_DECOMPRESSEX = (ICM_USER+62) ; // decompress a frame
ICM_DECOMPRESSEX_END = (ICM_USER+63) ; // end a series of decompress calls
ICM_COMPRESS_FRAMES_INFO = (ICM_USER+70) ; // tell about compress to come
ICM_SET_STATUS_PROC = (ICM_USER+72) ; // set status callback
(************************************************************************
************************************************************************)
type
PICOPEN = ^TICOPEN;
TICOPEN = packed record
dwSize : DWORD ; // sizeof(ICOPEN)
fccType : DWORD ; // 'vidc'
fccHandler : DWORD ; //
dwVersion : DWORD ; // version of compman opening you
dwFlags : DWORD ; // LOWORD is type specific
dwError : DWORD ; // error return.
pV1Reserved : PVOID ; // Reserved
pV2Reserved : PVOID ; // Reserved
dnDevNode : DWORD ; // Devnode for PnP devices
end;
(************************************************************************
************************************************************************)
PICINFO = ^TICINFO;
TICINFO = packed record
dwSize : DWORD; // sizeof(ICINFO)
fccType : DWORD; // compressor type 'vidc' 'audc'
fccHandler : DWORD; // compressor sub-type 'rle ' 'jpeg' 'pcm '
dwFlags : DWORD; // flags LOWORD is type specific
dwVersion : DWORD; // version of the driver
dwVersionICM : DWORD; // version of the ICM used
//
// under Win32, the driver always returns UNICODE strings.
//
szName : array[0..15] of WChar ; // short name
szDescription : array[0..127] of WChar ; // DWORD name
szDriver : array[0..127] of WChar ; // driver that contains compressor
end;
{-- Flags for the <dwFlags> field of the <ICINFO> structure. ------------}
const
VIDCF_QUALITY = $0001 ; // supports quality
VIDCF_CRUNCH = $0002 ; // supports crunching to a frame size
VIDCF_TEMPORAL = $0004 ; // supports inter-frame compress
VIDCF_COMPRESSFRAMES = $0008 ; // wants the compress all frames message
VIDCF_DRAW = $0010 ; // supports drawing
VIDCF_FASTTEMPORALC = $0020 ; // does not need prev frame on compress
VIDCF_FASTTEMPORALD = $0080 ; // does not need prev frame on decompress
//VIDCF_QUALITYTIME = $0040 ; // supports temporal quality
//VIDCF_FASTTEMPORAL = (VIDCF_FASTTEMPORALC or VIDCF_FASTTEMPORALD)
(************************************************************************
************************************************************************)
ICCOMPRESS_KEYFRAME = $00000001;
type
PICCOMPRESS = ^TICCOMPRESS;
TICCOMPRESS = packed record
dwFlags : DWORD; // flags
lpbiOutput : PBITMAPINFOHEADER ; // output format
lpOutput : PVOID ; // output data
lpbiInput : PBITMAPINFOHEADER ; // format of frame to compress
lpInput : PVOID ; // frame data to compress
lpckid : PDWORD ; // ckid for data in AVI file
lpdwFlags : PDWORD; // flags in the AVI index.
lFrameNum : LONG ; // frame number of seq.
dwFrameSize : DWORD ; // reqested size in bytes. (if non zero)
dwQuality : DWORD ; // quality
// these are new fields
lpbiPrev : PBITMAPINFOHEADER ; // format of previous frame
lpPrev : PVOID ; // previous frame
end;
(************************************************************************
************************************************************************)
const
ICCOMPRESSFRAMES_PADDING = $00000001 ;
type
TICCompressProc = function(lInputOutput: LPARAM; lFrame: DWORD; lpBits: PVOID; len: LONG): LONG; stdcall;
PICCOMPRESSFRAMES = ^TICCOMPRESSFRAMES;
TICCOMPRESSFRAMES = packed record
dwFlags : DWORD ; // flags
lpbiOutput : PBITMAPINFOHEADER ; // output format
lOutput : LPARAM ; // output identifier
lpbiInput : PBITMAPINFOHEADER ; // format of frame to compress
lInput : LPARAM ; // input identifier
lStartFrame : LONG ; // start frame
lFrameCount : LONG ; // # of frames
lQuality : LONG ; // quality
lDataRate : LONG ; // data rate
lKeyRate : LONG ; // key frame rate
dwRate : DWORD ; // frame rate, as always
dwScale : DWORD ;
dwOverheadPerFrame : DWORD ;
dwReserved2 : DWORD ;
GetData : TICCompressProc;
PutData : TICCompressProc;
end;
{-- Messages for Status callback ---------------------------------------------}
const
ICSTATUS_START = 0 ;
ICSTATUS_STATUS = 1 ; // l = % done
ICSTATUS_END = 2 ;
ICSTATUS_ERROR = 3 ; // l = error string (LPSTR)
ICSTATUS_YIELD = 4 ;
type
// return nonzero means abort operation in progress
TICStatusProc = function(lParam: LPARAM; message: UINT; l: LONG): LONG; stdcall;
PICSETSTATUSPROC = ^TICSETSTATUSPROC;
TICSETSTATUSPROC = packed record
dwFlags : DWORD ;
lParam : LPARAM ;
Status : TICStatusProc;
end;
(************************************************************************
************************************************************************)
const
ICDECOMPRESS_HURRYUP = $80000000 ; // don't draw just buffer (hurry up!)
ICDECOMPRESS_UPDATE = $40000000 ; // don't draw just update screen
ICDECOMPRESS_PREROLL = $20000000 ; // this frame is before real start
ICDECOMPRESS_NULLFRAME = $10000000 ; // repeat last frame
ICDECOMPRESS_NOTKEYFRAME = $08000000 ; // this frame is not a key frame
type
PICDECOMPRESS = ^TICDECOMPRESS;
TICDECOMPRESS = packed record
dwFlags : DWORD ; // flags (from AVI index...)
lpbiInput : PBITMAPINFOHEADER ; // BITMAPINFO of compressed data
// biSizeImage has the chunk size
lpInput : PVOID ; // compressed data
lpbiOutput : PBITMAPINFOHEADER ; // DIB to decompress to
lpOutput : PVOID ;
ckid : DWORD ; // ckid from AVI file
end;
PICDECOMPRESSEX = ^TICDECOMPRESSEX;
TICDECOMPRESSEX = packed record
//
// same as ICM_DECOMPRESS
//
dwFlags : DWORD;
lpbiSrc : PBITMAPINFOHEADER; // BITMAPINFO of compressed data
lpSrc : PVOID; // compressed data
lpbiDst : PBITMAPINFOHEADER; // DIB to decompress to
lpDst : PVOID; // output data
//
// new for ICM_DECOMPRESSEX
//
xDst : int; // destination rectangle
yDst : int;
dxDst : int;
dyDst : int;
xSrc : int; // source rectangle
ySrc : int;
dxSrc : int;
dySrc : int;
end;
(************************************************************************
************************************************************************)
const
ICDRAW_QUERY = $00000001 ; // test for support
ICDRAW_FULLSCREEN = $00000002 ; // draw to full screen
ICDRAW_HDC = $00000004 ; // draw to a HDC/HWND
ICDRAW_ANIMATE = $00000008 ; // expect palette animation
ICDRAW_CONTINUE = $00000010 ; // draw is a continuation of previous draw
ICDRAW_MEMORYDC = $00000020 ; // DC is offscreen, by the way
ICDRAW_UPDATING = $00000040 ; // We're updating, as opposed to playing
ICDRAW_RENDER = $00000080 ; // used to render data not draw it
ICDRAW_BUFFER = $00000100 ; // please buffer this data offscreen, we will need to update it
type
PICDRAWBEGIN = ^TICDRAWBEGIN;
TICDRAWBEGIN = packed record
dwFlags : DWORD ; // flags
hpal : HPALETTE ; // palette to draw with
hwnd : HWND ; // window to draw to
hdc : HDC ; // HDC to draw to
xDst : int ; // destination rectangle
yDst : int ;
dxDst : int ;
dyDst : int ;
lpbi : PBITMAPINFOHEADER ;
// format of frame to draw
xSrc : int ; // source rectangle
ySrc : int ;
dxSrc : int ;
dySrc : int ;
dwRate : DWORD ; // frames/second = (dwRate/dwScale)
dwScale : DWORD ;
end;
(************************************************************************
************************************************************************)
const
ICDRAW_HURRYUP = $80000000 ; // don't draw just buffer (hurry up!)
ICDRAW_UPDATE = $40000000 ; // don't draw just update screen
ICDRAW_PREROLL = $20000000 ; // this frame is before real start
ICDRAW_NULLFRAME = $10000000 ; // repeat last frame
ICDRAW_NOTKEYFRAME = $08000000 ; // this frame is not a key frame
type
PICDRAW = ^TICDRAW;
TICDRAW = packed record
dwFlags : DWORD ; // flags
lpFormat : PVOID ; // format of frame to decompress
lpData : PVOID ; // frame data to decompress
cbData : DWORD ;
lTime : LONG ; // time in drawbegin units (see dwRate and dwScale)
end;
PICDRAWSUGGEST = ^TICDRAWSUGGEST;
TICDRAWSUGGEST = packed record
lpbiIn : PBITMAPINFOHEADER ; // format to be drawn
lpbiSuggest : PBITMAPINFOHEADER ; // location for suggested format (or NULL to get size)
dxSrc : int ; // source extent or 0
dySrc : int ;
dxDst : int ; // dest extent or 0
dyDst : int ;
hicDecompressor : HIC ; // decompressor you can talk to
end;
(************************************************************************
************************************************************************)
PICPALETTE = ^TICPALETTE;
TICPALETTE = packed record
dwFlags : DWORD ; // flags (from AVI index...)
iStart : int ; // first palette to change
iLen : int ; // count of entries to change.
lppe : PPALETTEENTRY ; // palette
end;
(************************************************************************
ICM function declarations
************************************************************************)
function ICInfo(fccType, fccHandler: DWORD; lpicinfo: PICINFO) : BOOL ; stdcall ;
function ICInstall(fccType, fccHandler: DWORD; lParam: LPARAM; szDesc: LPSTR; wFlags: UINT) : BOOL ; stdcall ;
function ICRemove(fccType, fccHandler: DWORD; wFlags: UINT) : BOOL ; stdcall ;
function ICGetInfo(hic: HIC; picinfo: PICINFO; cb: DWORD) : DWORD ; stdcall ;
function ICOpen(fccType, fccHandler: DWORD; wMode: UINT) : HIC ; stdcall ;
function ICOpenFunction(fccType, fccHandler: DWORD; wMode: UINT; lpfnHandler: TFarProc) : HIC ; stdcall ;
function ICClose(hic: HIC) : DWORD; stdcall ;
function ICSendMessage(hic: HIC; msg: UINT; dw1, dw2: DWORD) : DWORD ; stdcall ;
{-- Values for wFlags of ICInstall -------------------------------------------}
const
ICINSTALL_UNICODE = $8000 ;
ICINSTALL_FUNCTION = $0001 ; // lParam is a DriverProc (function ptr)
ICINSTALL_DRIVER = $0002 ; // lParam is a driver name (string)
ICINSTALL_HDRV = $0004 ; // lParam is a HDRVR (driver handle)
ICINSTALL_DRIVERW = $8002 ; // lParam is a unicode driver name
{-- Query macros -------------------------------------------------------------}
ICMF_CONFIGURE_QUERY = $00000001 ;
ICMF_ABOUT_QUERY = $00000001 ;
function ICQueryAbout(hic: HIC): BOOL;
function ICAbout(hic: HIC; hwnd: HWND): DWORD;
function ICQueryConfigure(hic: HIC): BOOL;
function ICConfigure(hic: HIC; hwnd: HWND): DWORD;
{-- Get/Set state macros -----------------------------------------------------}
function ICGetState(hic: HIC; pv: PVOID; cb: DWORD): DWORD;
function ICSetState(hic: HIC; pv: PVOID; cb: DWORD): DWORD;
function ICGetStateSize(hic: HIC): DWORD;
{-- Get value macros ---------------------------------------------------------}
function ICGetDefaultQuality(hic: HIC): DWORD;
function ICGetDefaultKeyFrameRate(hic: HIC): DWORD;
{-- Draw window macro --------------------------------------------------------}
function ICDrawWindow(hic: HIC; prc: PRECT): DWORD;
(************************************************************************
compression functions
************************************************************************/
/*
* ICCompress()
*
* compress a single frame
*
*)
function ICCompress(
hic : HIC;
dwFlags : DWORD; // flags
lpbiOutput : PBITMAPINFOHEADER; // output format
lpData : PVOID; // output data
lpbiInput : PBITMAPINFOHEADER; // format of frame to compress
lpBits : PVOID; // frame data to compress
lpckid : PDWORD; // ckid for data in AVI file
lpdwFlags : PDWORD; // flags in the AVI index.
lFrameNum : DWORD; // frame number of seq.
dwFrameSize : DWORD; // reqested size in bytes. (if non zero)
dwQuality : DWORD; // quality within one frame
lpbiPrev : PBITMAPINFOHEADER; // format of previous frame
lpPrev : PVOID // previous frame
): DWORD; cdecl;
(*
* ICCompressBegin()
*
* start compression from a source format (lpbiInput) to a dest
* format (lpbiOuput) is supported.
*
*)
function ICCompressBegin(hic: HIC; lpbiInput: PBITMAPINFOHEADER; lpbiOutput: PBITMAPINFOHEADER): DWORD;
(*
* ICCompressQuery()
*
* determines if compression from a source format (lpbiInput) to a dest
* format (lpbiOuput) is supported.
*
*)
function ICCompressQuery(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
(*
* ICCompressGetFormat()
*
* get the output format, (format of compressed data)
* if lpbiOutput is NULL return the size in bytes needed for format.
*
*)
function ICCompressGetFormat(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
function ICCompressGetFormatSize(hic: HIC; lpbi: PBITMAPINFOHEADER): DWORD;
(*
* ICCompressSize()
*
* return the maximal size of a compressed frame
*
*)
function ICCompressGetSize(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
function ICCompressEnd(hic: HIC): DWORD;
(************************************************************************
decompression functions
************************************************************************)
(*
* ICDecompress()
*
* decompress a single frame
*
*)
function ICDecompress(
hic : HIC;
dwFlags : DWORD; // flags (from AVI index...)
lpbiFormat : PBITMAPINFOHEADER; // BITMAPINFO of compressed data
// biSizeImage has the chunk size
lpData : PVOID; // data
lpbi : PBITMAPINFOHEADER; // DIB to decompress to
lpBits : PVOID
): DWORD; cdecl;
(*
* ICDecompressBegin()
*
* start compression from a source format (lpbiInput) to a dest
* format (lpbiOutput) is supported.
*
*)
function ICDecompressBegin(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
(*
* ICDecompressQuery()
*
* determines if compression from a source format (lpbiInput) to a dest
* format (lpbiOutput) is supported.
*
*)
function ICDecompressQuery(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
(*
* ICDecompressGetFormat()
*
* get the output format, (format of un-compressed data)
* if lpbiOutput is NULL return the size in bytes needed for format.
*
*)
function ICDecompressGetFormat(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
function ICDecompressGetFormatSize(hic: HIC; lpbi: PBITMAPINFOHEADER): DWORD;
(*
* ICDecompressGetPalette()
*
* get the output palette
*
*)
function ICDecompressGetPalette(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
function ICDecompressSetPalette(hic: HIC; lpbiPalette: PBITMAPINFOHEADER): DWORD;
function ICDecompressEnd(hic: HIC): DWORD;
(************************************************************************
decompression (ex) functions
************************************************************************)
//
// on Win16 these functions are macros that call ICMessage. ICMessage will
// not work on NT. rather than add new entrypoints we have given
// them as static inline functions
//
(*
* ICDecompressEx()
*
* decompress a single frame
*
*)
function ICDecompressEx(
hic : HIC;
dwFlags : DWORD;
lpbiSrc : PBITMAPINFOHEADER;
lpSrc : PVOID;
xSrc : int;
ySrc : int;
dxSrc : int;
dySrc : int;
lpbiDst : PBITMAPINFOHEADER;
lpDst : PVOID;
xDst : int;
yDst : int;
dxDst : int;
dyDst : int
): DWORD; stdcall;
(*
* ICDecompressExBegin()
*
* start compression from a source format (lpbiInput) to a dest
* format (lpbiOutput) is supported.
*
*)
function ICDecompressExBegin(
hic : HIC;
dwFlags : DWORD;
lpbiSrc : PBITMAPINFOHEADER;
lpSrc : PVOID;
xSrc : int;
ySrc : int;
dxSrc : int;
dySrc : int;
lpbiDst : PBITMAPINFOHEADER;
lpDst : PVOID;
xDst : int;
yDst : int;
dxDst : int;
dyDst : int
): DWORD; stdcall;
(*
* ICDecompressExQuery()
*
*)
function ICDecompressExQuery(
hic : HIC;
dwFlags : DWORD;
lpbiSrc : PBITMAPINFOHEADER;
lpSrc : PVOID;
xSrc : int;
ySrc : int;
dxSrc : int;
dySrc : int;
lpbiDst : PBITMAPINFOHEADER;
lpDst : PVOID;
xDst : int;
yDst : int;
dxDst : int;
dyDst : int
): DWORD; stdcall;
function ICDecompressExEnd(hic: HIC): DWORD;
(************************************************************************
drawing functions
************************************************************************)
(*
* ICDrawBegin()
*
* start decompressing data with format (lpbiInput) directly to the screen
*
* return zero if the decompressor supports drawing.
*
*)
function ICDrawBegin(
hic : HIC;
dwFlags : DWORD; // flags
hpal : HPALETTE; // palette to draw with
hwnd : HWND; // window to draw to
hdc : HDC; // HDC to draw to
xDst : int; // destination rectangle
yDst : int;
dxDst : int;
dyDst : int;
lpbi : PBITMAPINFOHEADER; // format of frame to draw
xSrc : int; // source rectangle
ySrc : int;
dxSrc : int;
dySrc : int;
dwRate : DWORD; // frames/second = (dwRate/dwScale)
dwScale : DWORD
): DWORD; cdecl;
(*
* ICDraw()
*
* decompress data directly to the screen
*
*)
function ICDraw(
hic : HIC;
dwFlags : DWORD; // flags
lpFormat : PVOID; // format of frame to decompress
lpData : PVOID; // frame data to decompress
cbData : DWORD; // size of data
lTime : DWORD // time to draw this frame
): DWORD; cdecl;
// ICMessage is not supported on Win32, so provide a static inline function
// to do the same job
function ICDrawSuggestFormat(
hic : HIC;
lpbiIn : PBITMAPINFOHEADER;
lpbiOut : PBITMAPINFOHEADER;
dxSrc : int;
dySrc : int;
dxDst : int;
dyDst : int;
hicDecomp : HIC
): DWORD; stdcall;
(*
* ICDrawQuery()
*
* determines if the compressor is willing to render the specified format.
*
*)
function ICDrawQuery(hic: HIC; lpbiInput: PBITMAPINFOHEADER): DWORD;
function ICDrawChangePalette(hic: HIC; lpbiInput: PBITMAPINFOHEADER): DWORD;
function ICGetBuffersWanted(hic: HIC; lpdwBuffers: PDWORD): DWORD;
function ICDrawEnd(hic: HIC): DWORD;
function ICDrawStart(hic: HIC): DWORD;
function ICDrawStartPlay(hic: HIC; lFrom, lTo: DWORD): DWORD;
function ICDrawStop(hic: HIC): DWORD;
function ICDrawStopPlay(hic: HIC): DWORD;
function ICDrawGetTime(hic: HIC; lplTime: PDWORD): DWORD;
function ICDrawSetTime(hic: HIC; lTime: DWORD): DWORD;
function ICDrawRealize(hic: HIC; hdc: HDC; fBackground: BOOL): DWORD;
function ICDrawFlush(hic: HIC): DWORD;
function ICDrawRenderBuffer(hic: HIC): DWORD;
(************************************************************************
Status callback functions
************************************************************************/
/*
* ICSetStatusProc()
*
* Set the status callback function
*
*)
// ICMessage is not supported on NT
function ICSetStatusProc(
hic : HIC;
dwFlags : DWORD;
lParam : DWORD;
fpfnStatus : TICStatusProc
): DWORD; stdcall;
(************************************************************************
helper routines for DrawDib and MCIAVI...
************************************************************************)
function ICLocate(fccType, fccHandler: DWORD; lpbiIn, lpbiOut: PBITMAPINFOHEADER; wFlags: WORD): HIC; stdcall;
function ICGetDisplayFormat(hic: HIC; lpbiIn, lpbiOut: PBITMAPINFOHEADER; BitDepth: int; dx, dy: int): HIC; stdcall;
function ICDecompressOpen(fccType, fccHandler: DWORD; lpbiIn, lpbiOut: PBITMAPINFOHEADER): HIC;
function ICDrawOpen(fccType, fccHandler: DWORD; lpbiIn: PBITMAPINFOHEADER): HIC;
(************************************************************************
Higher level functions
************************************************************************)
function ICImageCompress(
hic : HIC; // compressor to use
uiFlags : UINT; // flags (none yet)
lpbiIn : PBITMAPINFO; // format to compress from
lpBits : PVOID; // data to compress
lpbiOut : PBITMAPINFO; // compress to this (NULL ==> default)
lQuality : LONG; // quality to use
plSize : PDWORD // compress to this size (0=whatever)
): THANDLE; stdcall;
function ICImageDecompress(
hic : HIC; // compressor to use
uiFlags : UINT; // flags (none yet)
lpbiIn : PBITMAPINFO; // format to decompress from
lpBits : PVOID; // data to decompress
lpbiOut : PBITMAPINFO // decompress to this (NULL ==> default)
): THANDLE; stdcall;
{-- TCompVars ----------------------------------------------------------------}
//
// Structure used by ICSeqCompressFrame and ICCompressorChoose routines
// Make sure this matches the autodoc in icm.c!
//
type
PCOMPVARS = ^TCOMPVARS;
TCOMPVARS = packed record
cbSize : DWORD; // set to sizeof(COMPVARS) before
// calling ICCompressorChoose
dwFlags : DWORD; // see below...
hic : HIC; // HIC of chosen compressor
fccType : DWORD; // basically ICTYPE_VIDEO
fccHandler : DWORD; // handler of chosen compressor or
// "" or "DIB "
lpbiIn : PBITMAPINFO; // input format
lpbiOut : PBITMAPINFO; // output format - will compress to this
lpBitsOut : PVOID;
lpBitsPrev : PVOID;
lFrame : LONG;
lKey : LONG; // key frames how often?
lDataRate : LONG; // desired data rate KB/Sec
lQ : LONG; // desired quality
lKeyCount : LONG;
lpState : PVOID; // state of compressor
cbState : LONG; // size of the state
end;
// FLAGS for dwFlags element of COMPVARS structure:
// set this flag if you initialize COMPVARS before calling ICCompressorChoose
const
ICMF_COMPVARS_VALID = $00000001; // COMPVARS contains valid data