FileVFW.pas 186 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683
  1. //
  2. // This unit is part of the GLScene Engine, http://glscene.org
  3. //
  4. unit FileVFW;
  5. (* Video for windows *)
  6. interface
  7. {.$UNDEF UNICODE}
  8. {$I GLScene.inc}
  9. (****************************************************************************
  10. *
  11. * VfW.H - Video for windows include file for WIN32
  12. *
  13. * Copyright (c) 1991-1999, Microsoft Corp. All rights reserved.
  14. *
  15. * This include files defines interfaces to the following
  16. * video components
  17. *
  18. * COMPMAN - Installable Compression Manager.
  19. * DRAWDIB - Routines for drawing to the display.
  20. * VIDEO - Video Capture Driver Interface
  21. *
  22. * AVIFMT - AVI File Format structure definitions.
  23. * MMREG - FOURCC and other things
  24. *
  25. * AVIFile - Interface for reading AVI Files and AVI Streams
  26. * MCIWND - MCI/AVI window class
  27. * AVICAP - AVI Capture Window class
  28. *
  29. * MSACM - Audio compression manager.
  30. *
  31. * The following symbols control inclusion of various parts of this file:
  32. *
  33. * NOCOMPMAN - dont include COMPMAN
  34. * NODRAWDIB - dont include DRAWDIB
  35. * NOVIDEO - dont include video capture interface
  36. *
  37. * NOAVIFMT - dont include AVI file format structs
  38. * NOMMREG - dont include MMREG
  39. *
  40. * NOAVIFILE - dont include AVIFile interface
  41. * NOMCIWND - dont include AVIWnd class.
  42. * NOAVICAP - dont include AVICap class.
  43. *
  44. * NOMSACM - dont include ACM stuff.
  45. *
  46. ****************************************************************************)
  47. (******************************************************************************)
  48. (* *)
  49. (* VFW.PAS Conversion by Ronald Dittrich *)
  50. (* *)
  51. (* E-Mail: [email protected] *)
  52. (* http://www.swiftsoft.de *)
  53. (* *)
  54. (******************************************************************************)
  55. (******************************************************************************)
  56. (* *)
  57. (* Modyfied: 25.April.2000 *)
  58. (* *)
  59. (* E-Mail: *)
  60. (* Ivo Steinmann: [email protected] *)
  61. (* *)
  62. (* Please send all messages regarding specific errors and lacks of this unit *)
  63. (* to Ivo Steinmann *)
  64. (* *)
  65. (******************************************************************************)
  66. (******************************************************************************)
  67. (* *)
  68. (* Modyfied: 2000-12-07 *)
  69. (* *)
  70. (* E-Mail: *)
  71. (* Peter Haas: [email protected] *)
  72. (* *)
  73. (* Only modified line 1380 ( TAVIPALCHANGE.peNew ) *)
  74. (* *)
  75. (******************************************************************************)
  76. uses
  77. Winapi.Windows,
  78. Winapi.MMSystem,
  79. Winapi.Messages,
  80. Winapi.CommDlg,
  81. Winapi.ActiveX;
  82. (****************************************************************************
  83. *
  84. * types
  85. *
  86. ***************************************************************************)
  87. type
  88. PVOID = pointer;
  89. LONG = longint;
  90. PLONG = ^LONG;
  91. int = integer;
  92. (****************************************************************************
  93. *
  94. * VideoForWindowsVersion() - returns version of VfW
  95. *
  96. ***************************************************************************)
  97. function VideoForWindowsVersion: DWORD; pascal;
  98. (****************************************************************************
  99. *
  100. * call these to start stop using VfW from your app.
  101. *
  102. ***************************************************************************)
  103. {
  104. function InitVFW: LONG; stdcall;
  105. function TermVFW: LONG; stdcall; }
  106. (****************************************************************************/
  107. /* */
  108. /* Macros */
  109. /* */
  110. /* should we define this?? */
  111. /* */
  112. /****************************************************************************)
  113. function MKFOURCC(ch0, ch1, ch2, ch3: AnsiChar): FOURCC;
  114. (****************************************************************************
  115. *
  116. * COMPMAN - Installable Compression Manager.
  117. *
  118. ****************************************************************************)
  119. const
  120. ICVERSION = $0104 ;
  121. type
  122. HIC = THandle; // Handle to an Installable Compressor
  123. //
  124. // this code in biCompression means the DIB must be accesed via
  125. // 48 bit pointers! using *ONLY* the selector given.
  126. //
  127. const
  128. BI_1632 = $32333631; // '1632'
  129. function mmioFOURCC(ch0, ch1, ch2, ch3: AnsiChar): FOURCC;
  130. type
  131. TWOCC = word;
  132. function aviTWOCC(ch0, ch1: AnsiChar): TWOCC;
  133. const
  134. ICTYPE_VIDEO = $63646976; {vidc}
  135. ICTYPE_AUDIO = $63647561; {audc}
  136. const
  137. ICERR_OK = 0 ;
  138. ICERR_DONTDRAW = 1 ;
  139. ICERR_NEWPALETTE = 2 ;
  140. ICERR_GOTOKEYFRAME = 3 ;
  141. ICERR_STOPDRAWING = 4 ;
  142. ICERR_UNSUPPORTED = -1 ;
  143. ICERR_BADFORMAT = -2 ;
  144. ICERR_MEMORY = -3 ;
  145. ICERR_INTERNAL = -4 ;
  146. ICERR_BADFLAGS = -5 ;
  147. ICERR_BADPARAM = -6 ;
  148. ICERR_BADSIZE = -7 ;
  149. ICERR_BADHANDLE = -8 ;
  150. ICERR_CANTUPDATE = -9 ;
  151. ICERR_ABORT = -10 ;
  152. ICERR_ERROR = -100 ;
  153. ICERR_BADBITDEPTH = -200 ;
  154. ICERR_BADIMAGESIZE = -201 ;
  155. ICERR_CUSTOM = -400 ; // errors less than ICERR_CUSTOM...
  156. {-- Values for dwFlags of ICOpen() -------------------------------------------}
  157. ICMODE_COMPRESS = 1 ;
  158. ICMODE_DECOMPRESS = 2 ;
  159. ICMODE_FASTDECOMPRESS = 3 ;
  160. ICMODE_QUERY = 4 ;
  161. ICMODE_FASTCOMPRESS = 5 ;
  162. ICMODE_DRAW = 8 ;
  163. {-- Flags for AVI file index -------------------------------------------------}
  164. AVIIF_LIST = $00000001 ;
  165. AVIIF_TWOCC = $00000002 ;
  166. AVIIF_KEYFRAME = $00000010 ;
  167. {-- quality flags ------------------------------------------------------------}
  168. ICQUALITY_LOW = 0 ;
  169. ICQUALITY_HIGH = 10000 ;
  170. ICQUALITY_DEFAULT = -1 ;
  171. (************************************************************************
  172. ************************************************************************)
  173. ICM_USER = (DRV_USER+$0000) ;
  174. ICM_RESERVED_LOW = (DRV_USER+$1000) ;
  175. ICM_RESERVED_HIGH = (DRV_USER+$2000) ;
  176. ICM_RESERVED = ICM_RESERVED_LOW ;
  177. (************************************************************************
  178. messages.
  179. ************************************************************************)
  180. ICM_GETSTATE = (ICM_RESERVED+0) ; // Get compressor state
  181. ICM_SETSTATE = (ICM_RESERVED+1) ; // Set compressor state
  182. ICM_GETINFO = (ICM_RESERVED+2) ; // Query info about the compressor
  183. ICM_CONFIGURE = (ICM_RESERVED+10); // show the configure dialog
  184. ICM_ABOUT = (ICM_RESERVED+11); // show the about box
  185. ICM_GETDEFAULTQUALITY = (ICM_RESERVED+30); // get the default value for quality
  186. ICM_GETQUALITY = (ICM_RESERVED+31); // get the current value for quality
  187. ICM_SETQUALITY = (ICM_RESERVED+32); // set the default value for quality
  188. ICM_SET = (ICM_RESERVED+40); // Tell the driver something
  189. ICM_GET = (ICM_RESERVED+41); // Ask the driver something
  190. {-- Constants for ICM_SET: ---------------------------------------------------}
  191. ICM_FRAMERATE = $526D7246; {FrmR}
  192. ICM_KEYFRAMERATE = $5279654B; {KeyR}
  193. (************************************************************************
  194. ICM specific messages.
  195. ************************************************************************)
  196. ICM_COMPRESS_GET_FORMAT = (ICM_USER+4) ; // get compress format or size
  197. ICM_COMPRESS_GET_SIZE = (ICM_USER+5) ; // get output size
  198. ICM_COMPRESS_QUERY = (ICM_USER+6) ; // query support for compress
  199. ICM_COMPRESS_BEGIN = (ICM_USER+7) ; // begin a series of compress calls.
  200. ICM_COMPRESS = (ICM_USER+8) ; // compress a frame
  201. ICM_COMPRESS_END = (ICM_USER+9) ; // end of a series of compress calls.
  202. ICM_DECOMPRESS_GET_FORMAT = (ICM_USER+10) ; // get decompress format or size
  203. ICM_DECOMPRESS_QUERY = (ICM_USER+11) ; // query support for dempress
  204. ICM_DECOMPRESS_BEGIN = (ICM_USER+12) ; // start a series of decompress calls
  205. ICM_DECOMPRESS = (ICM_USER+13) ; // decompress a frame
  206. ICM_DECOMPRESS_END = (ICM_USER+14) ; // end a series of decompress calls
  207. ICM_DECOMPRESS_SET_PALETTE = (ICM_USER+29) ; // fill in the DIB color table
  208. ICM_DECOMPRESS_GET_PALETTE = (ICM_USER+30) ; // fill in the DIB color table
  209. ICM_DRAW_QUERY = (ICM_USER+31) ; // query support for dempress
  210. ICM_DRAW_BEGIN = (ICM_USER+15) ; // start a series of draw calls
  211. ICM_DRAW_GET_PALETTE = (ICM_USER+16) ; // get the palette needed for drawing
  212. ICM_DRAW_START = (ICM_USER+18) ; // start decompress clock
  213. ICM_DRAW_STOP = (ICM_USER+19) ; // stop decompress clock
  214. ICM_DRAW_END = (ICM_USER+21) ; // end a series of draw calls
  215. ICM_DRAW_GETTIME = (ICM_USER+32) ; // get value of decompress clock
  216. ICM_DRAW = (ICM_USER+33) ; // generalized "render" message
  217. ICM_DRAW_WINDOW = (ICM_USER+34) ; // drawing window has moved or hidden
  218. ICM_DRAW_SETTIME = (ICM_USER+35) ; // set correct value for decompress clock
  219. ICM_DRAW_REALIZE = (ICM_USER+36) ; // realize palette for drawing
  220. ICM_DRAW_FLUSH = (ICM_USER+37) ; // clear out buffered frames
  221. ICM_DRAW_RENDERBUFFER = (ICM_USER+38) ; // draw undrawn things in queue
  222. ICM_DRAW_START_PLAY = (ICM_USER+39) ; // start of a play
  223. ICM_DRAW_STOP_PLAY = (ICM_USER+40) ; // end of a play
  224. ICM_DRAW_SUGGESTFORMAT = (ICM_USER+50) ; // Like ICGetDisplayFormat
  225. ICM_DRAW_CHANGEPALETTE = (ICM_USER+51) ; // for animating palette
  226. ICM_GETBUFFERSWANTED = (ICM_USER+41) ; // ask about prebuffering
  227. ICM_GETDEFAULTKEYFRAMERATE = (ICM_USER+42) ; // get the default value for key frames
  228. ICM_DECOMPRESSEX_BEGIN = (ICM_USER+60) ; // start a series of decompress calls
  229. ICM_DECOMPRESSEX_QUERY = (ICM_USER+61) ; // start a series of decompress calls
  230. ICM_DECOMPRESSEX = (ICM_USER+62) ; // decompress a frame
  231. ICM_DECOMPRESSEX_END = (ICM_USER+63) ; // end a series of decompress calls
  232. ICM_COMPRESS_FRAMES_INFO = (ICM_USER+70) ; // tell about compress to come
  233. ICM_SET_STATUS_PROC = (ICM_USER+72) ; // set status callback
  234. (************************************************************************
  235. ************************************************************************)
  236. type
  237. PICOPEN = ^TICOPEN;
  238. TICOPEN = packed record
  239. dwSize : DWORD ; // sizeof(ICOPEN)
  240. fccType : DWORD ; // 'vidc'
  241. fccHandler : DWORD ; //
  242. dwVersion : DWORD ; // version of compman opening you
  243. dwFlags : DWORD ; // LOWORD is type specific
  244. dwError : DWORD ; // error return.
  245. pV1Reserved : PVOID ; // Reserved
  246. pV2Reserved : PVOID ; // Reserved
  247. dnDevNode : DWORD ; // Devnode for PnP devices
  248. end;
  249. (************************************************************************
  250. ************************************************************************)
  251. PICINFO = ^TICINFO;
  252. TICINFO = packed record
  253. dwSize : DWORD; // sizeof(ICINFO)
  254. fccType : DWORD; // compressor type 'vidc' 'audc'
  255. fccHandler : DWORD; // compressor sub-type 'rle ' 'jpeg' 'pcm '
  256. dwFlags : DWORD; // flags LOWORD is type specific
  257. dwVersion : DWORD; // version of the driver
  258. dwVersionICM : DWORD; // version of the ICM used
  259. //
  260. // under Win32, the driver always returns UNICODE strings.
  261. //
  262. szName : array[0..15] of WChar ; // short name
  263. szDescription : array[0..127] of WChar ; // DWORD name
  264. szDriver : array[0..127] of WChar ; // driver that contains compressor
  265. end;
  266. {-- Flags for the <dwFlags> field of the <ICINFO> structure. ------------}
  267. const
  268. VIDCF_QUALITY = $0001 ; // supports quality
  269. VIDCF_CRUNCH = $0002 ; // supports crunching to a frame size
  270. VIDCF_TEMPORAL = $0004 ; // supports inter-frame compress
  271. VIDCF_COMPRESSFRAMES = $0008 ; // wants the compress all frames message
  272. VIDCF_DRAW = $0010 ; // supports drawing
  273. VIDCF_FASTTEMPORALC = $0020 ; // does not need prev frame on compress
  274. VIDCF_FASTTEMPORALD = $0080 ; // does not need prev frame on decompress
  275. //VIDCF_QUALITYTIME = $0040 ; // supports temporal quality
  276. //VIDCF_FASTTEMPORAL = (VIDCF_FASTTEMPORALC or VIDCF_FASTTEMPORALD)
  277. (************************************************************************
  278. ************************************************************************)
  279. ICCOMPRESS_KEYFRAME = $00000001;
  280. type
  281. PICCOMPRESS = ^TICCOMPRESS;
  282. TICCOMPRESS = packed record
  283. dwFlags : DWORD; // flags
  284. lpbiOutput : PBITMAPINFOHEADER ; // output format
  285. lpOutput : PVOID ; // output data
  286. lpbiInput : PBITMAPINFOHEADER ; // format of frame to compress
  287. lpInput : PVOID ; // frame data to compress
  288. lpckid : PDWORD ; // ckid for data in AVI file
  289. lpdwFlags : PDWORD; // flags in the AVI index.
  290. lFrameNum : LONG ; // frame number of seq.
  291. dwFrameSize : DWORD ; // reqested size in bytes. (if non zero)
  292. dwQuality : DWORD ; // quality
  293. // these are new fields
  294. lpbiPrev : PBITMAPINFOHEADER ; // format of previous frame
  295. lpPrev : PVOID ; // previous frame
  296. end;
  297. (************************************************************************
  298. ************************************************************************)
  299. const
  300. ICCOMPRESSFRAMES_PADDING = $00000001 ;
  301. type
  302. TICCompressProc = function(lInputOutput: LPARAM; lFrame: DWORD; lpBits: PVOID; len: LONG): LONG; stdcall;
  303. PICCOMPRESSFRAMES = ^TICCOMPRESSFRAMES;
  304. TICCOMPRESSFRAMES = packed record
  305. dwFlags : DWORD ; // flags
  306. lpbiOutput : PBITMAPINFOHEADER ; // output format
  307. lOutput : LPARAM ; // output identifier
  308. lpbiInput : PBITMAPINFOHEADER ; // format of frame to compress
  309. lInput : LPARAM ; // input identifier
  310. lStartFrame : LONG ; // start frame
  311. lFrameCount : LONG ; // # of frames
  312. lQuality : LONG ; // quality
  313. lDataRate : LONG ; // data rate
  314. lKeyRate : LONG ; // key frame rate
  315. dwRate : DWORD ; // frame rate, as always
  316. dwScale : DWORD ;
  317. dwOverheadPerFrame : DWORD ;
  318. dwReserved2 : DWORD ;
  319. GetData : TICCompressProc;
  320. PutData : TICCompressProc;
  321. end;
  322. {-- Messages for Status callback ---------------------------------------------}
  323. const
  324. ICSTATUS_START = 0 ;
  325. ICSTATUS_STATUS = 1 ; // l = % done
  326. ICSTATUS_END = 2 ;
  327. ICSTATUS_ERROR = 3 ; // l = error string (LPSTR)
  328. ICSTATUS_YIELD = 4 ;
  329. type
  330. // return nonzero means abort operation in progress
  331. TICStatusProc = function(lParam: LPARAM; message: UINT; l: LONG): LONG; stdcall;
  332. PICSETSTATUSPROC = ^TICSETSTATUSPROC;
  333. TICSETSTATUSPROC = packed record
  334. dwFlags : DWORD ;
  335. lParam : LPARAM ;
  336. Status : TICStatusProc;
  337. end;
  338. (************************************************************************
  339. ************************************************************************)
  340. const
  341. ICDECOMPRESS_HURRYUP = $80000000 ; // don't draw just buffer (hurry up!)
  342. ICDECOMPRESS_UPDATE = $40000000 ; // don't draw just update screen
  343. ICDECOMPRESS_PREROLL = $20000000 ; // this frame is before real start
  344. ICDECOMPRESS_NULLFRAME = $10000000 ; // repeat last frame
  345. ICDECOMPRESS_NOTKEYFRAME = $08000000 ; // this frame is not a key frame
  346. type
  347. PICDECOMPRESS = ^TICDECOMPRESS;
  348. TICDECOMPRESS = packed record
  349. dwFlags : DWORD ; // flags (from AVI index...)
  350. lpbiInput : PBITMAPINFOHEADER ; // BITMAPINFO of compressed data
  351. // biSizeImage has the chunk size
  352. lpInput : PVOID ; // compressed data
  353. lpbiOutput : PBITMAPINFOHEADER ; // DIB to decompress to
  354. lpOutput : PVOID ;
  355. ckid : DWORD ; // ckid from AVI file
  356. end;
  357. PICDECOMPRESSEX = ^TICDECOMPRESSEX;
  358. TICDECOMPRESSEX = packed record
  359. //
  360. // same as ICM_DECOMPRESS
  361. //
  362. dwFlags : DWORD;
  363. lpbiSrc : PBITMAPINFOHEADER; // BITMAPINFO of compressed data
  364. lpSrc : PVOID; // compressed data
  365. lpbiDst : PBITMAPINFOHEADER; // DIB to decompress to
  366. lpDst : PVOID; // output data
  367. //
  368. // new for ICM_DECOMPRESSEX
  369. //
  370. xDst : int; // destination rectangle
  371. yDst : int;
  372. dxDst : int;
  373. dyDst : int;
  374. xSrc : int; // source rectangle
  375. ySrc : int;
  376. dxSrc : int;
  377. dySrc : int;
  378. end;
  379. (************************************************************************
  380. ************************************************************************)
  381. const
  382. ICDRAW_QUERY = $00000001 ; // test for support
  383. ICDRAW_FULLSCREEN = $00000002 ; // draw to full screen
  384. ICDRAW_HDC = $00000004 ; // draw to a HDC/HWND
  385. ICDRAW_ANIMATE = $00000008 ; // expect palette animation
  386. ICDRAW_CONTINUE = $00000010 ; // draw is a continuation of previous draw
  387. ICDRAW_MEMORYDC = $00000020 ; // DC is offscreen, by the way
  388. ICDRAW_UPDATING = $00000040 ; // We're updating, as opposed to playing
  389. ICDRAW_RENDER = $00000080 ; // used to render data not draw it
  390. ICDRAW_BUFFER = $00000100 ; // please buffer this data offscreen, we will need to update it
  391. type
  392. PICDRAWBEGIN = ^TICDRAWBEGIN;
  393. TICDRAWBEGIN = packed record
  394. dwFlags : DWORD ; // flags
  395. hpal : HPALETTE ; // palette to draw with
  396. hwnd : HWND ; // window to draw to
  397. hdc : HDC ; // HDC to draw to
  398. xDst : int ; // destination rectangle
  399. yDst : int ;
  400. dxDst : int ;
  401. dyDst : int ;
  402. lpbi : PBITMAPINFOHEADER ;
  403. // format of frame to draw
  404. xSrc : int ; // source rectangle
  405. ySrc : int ;
  406. dxSrc : int ;
  407. dySrc : int ;
  408. dwRate : DWORD ; // frames/second = (dwRate/dwScale)
  409. dwScale : DWORD ;
  410. end;
  411. (************************************************************************
  412. ************************************************************************)
  413. const
  414. ICDRAW_HURRYUP = $80000000 ; // don't draw just buffer (hurry up!)
  415. ICDRAW_UPDATE = $40000000 ; // don't draw just update screen
  416. ICDRAW_PREROLL = $20000000 ; // this frame is before real start
  417. ICDRAW_NULLFRAME = $10000000 ; // repeat last frame
  418. ICDRAW_NOTKEYFRAME = $08000000 ; // this frame is not a key frame
  419. type
  420. PICDRAW = ^TICDRAW;
  421. TICDRAW = packed record
  422. dwFlags : DWORD ; // flags
  423. lpFormat : PVOID ; // format of frame to decompress
  424. lpData : PVOID ; // frame data to decompress
  425. cbData : DWORD ;
  426. lTime : LONG ; // time in drawbegin units (see dwRate and dwScale)
  427. end;
  428. PICDRAWSUGGEST = ^TICDRAWSUGGEST;
  429. TICDRAWSUGGEST = packed record
  430. lpbiIn : PBITMAPINFOHEADER ; // format to be drawn
  431. lpbiSuggest : PBITMAPINFOHEADER ; // location for suggested format (or NULL to get size)
  432. dxSrc : int ; // source extent or 0
  433. dySrc : int ;
  434. dxDst : int ; // dest extent or 0
  435. dyDst : int ;
  436. hicDecompressor : HIC ; // decompressor you can talk to
  437. end;
  438. (************************************************************************
  439. ************************************************************************)
  440. PICPALETTE = ^TICPALETTE;
  441. TICPALETTE = packed record
  442. dwFlags : DWORD ; // flags (from AVI index...)
  443. iStart : int ; // first palette to change
  444. iLen : int ; // count of entries to change.
  445. lppe : PPALETTEENTRY ; // palette
  446. end;
  447. (************************************************************************
  448. ICM function declarations
  449. ************************************************************************)
  450. function ICInfo(fccType, fccHandler: DWORD; lpicinfo: PICINFO) : BOOL ; stdcall ;
  451. function ICInstall(fccType, fccHandler: DWORD; lParam: LPARAM; szDesc: LPSTR; wFlags: UINT) : BOOL ; stdcall ;
  452. function ICRemove(fccType, fccHandler: DWORD; wFlags: UINT) : BOOL ; stdcall ;
  453. function ICGetInfo(hic: HIC; picinfo: PICINFO; cb: DWORD) : DWORD ; stdcall ;
  454. function ICOpen(fccType, fccHandler: DWORD; wMode: UINT) : HIC ; stdcall ;
  455. function ICOpenFunction(fccType, fccHandler: DWORD; wMode: UINT; lpfnHandler: TFarProc) : HIC ; stdcall ;
  456. function ICClose(hic: HIC) : DWORD; stdcall ;
  457. function ICSendMessage(hic: HIC; msg: UINT; dw1, dw2: DWORD) : DWORD ; stdcall ;
  458. {-- Values for wFlags of ICInstall -------------------------------------------}
  459. const
  460. ICINSTALL_UNICODE = $8000 ;
  461. ICINSTALL_FUNCTION = $0001 ; // lParam is a DriverProc (function ptr)
  462. ICINSTALL_DRIVER = $0002 ; // lParam is a driver name (string)
  463. ICINSTALL_HDRV = $0004 ; // lParam is a HDRVR (driver handle)
  464. ICINSTALL_DRIVERW = $8002 ; // lParam is a unicode driver name
  465. {-- Query macros -------------------------------------------------------------}
  466. ICMF_CONFIGURE_QUERY = $00000001 ;
  467. ICMF_ABOUT_QUERY = $00000001 ;
  468. function ICQueryAbout(hic: HIC): BOOL;
  469. function ICAbout(hic: HIC; hwnd: HWND): DWORD;
  470. function ICQueryConfigure(hic: HIC): BOOL;
  471. function ICConfigure(hic: HIC; hwnd: HWND): DWORD;
  472. {-- Get/Set state macros -----------------------------------------------------}
  473. function ICGetState(hic: HIC; pv: PVOID; cb: DWORD): DWORD;
  474. function ICSetState(hic: HIC; pv: PVOID; cb: DWORD): DWORD;
  475. function ICGetStateSize(hic: HIC): DWORD;
  476. {-- Get value macros ---------------------------------------------------------}
  477. function ICGetDefaultQuality(hic: HIC): DWORD;
  478. function ICGetDefaultKeyFrameRate(hic: HIC): DWORD;
  479. {-- Draw window macro --------------------------------------------------------}
  480. function ICDrawWindow(hic: HIC; prc: PRECT): DWORD;
  481. (************************************************************************
  482. compression functions
  483. ************************************************************************/
  484. /*
  485. * ICCompress()
  486. *
  487. * compress a single frame
  488. *
  489. *)
  490. function ICCompress(
  491. hic : HIC;
  492. dwFlags : DWORD; // flags
  493. lpbiOutput : PBITMAPINFOHEADER; // output format
  494. lpData : PVOID; // output data
  495. lpbiInput : PBITMAPINFOHEADER; // format of frame to compress
  496. lpBits : PVOID; // frame data to compress
  497. lpckid : PDWORD; // ckid for data in AVI file
  498. lpdwFlags : PDWORD; // flags in the AVI index.
  499. lFrameNum : DWORD; // frame number of seq.
  500. dwFrameSize : DWORD; // reqested size in bytes. (if non zero)
  501. dwQuality : DWORD; // quality within one frame
  502. lpbiPrev : PBITMAPINFOHEADER; // format of previous frame
  503. lpPrev : PVOID // previous frame
  504. ): DWORD; cdecl;
  505. (*
  506. * ICCompressBegin()
  507. *
  508. * start compression from a source format (lpbiInput) to a dest
  509. * format (lpbiOuput) is supported.
  510. *
  511. *)
  512. function ICCompressBegin(hic: HIC; lpbiInput: PBITMAPINFOHEADER; lpbiOutput: PBITMAPINFOHEADER): DWORD;
  513. (*
  514. * ICCompressQuery()
  515. *
  516. * determines if compression from a source format (lpbiInput) to a dest
  517. * format (lpbiOuput) is supported.
  518. *
  519. *)
  520. function ICCompressQuery(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
  521. (*
  522. * ICCompressGetFormat()
  523. *
  524. * get the output format, (format of compressed data)
  525. * if lpbiOutput is NULL return the size in bytes needed for format.
  526. *
  527. *)
  528. function ICCompressGetFormat(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
  529. function ICCompressGetFormatSize(hic: HIC; lpbi: PBITMAPINFOHEADER): DWORD;
  530. (*
  531. * ICCompressSize()
  532. *
  533. * return the maximal size of a compressed frame
  534. *
  535. *)
  536. function ICCompressGetSize(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
  537. function ICCompressEnd(hic: HIC): DWORD;
  538. (************************************************************************
  539. decompression functions
  540. ************************************************************************)
  541. (*
  542. * ICDecompress()
  543. *
  544. * decompress a single frame
  545. *
  546. *)
  547. function ICDecompress(
  548. hic : HIC;
  549. dwFlags : DWORD; // flags (from AVI index...)
  550. lpbiFormat : PBITMAPINFOHEADER; // BITMAPINFO of compressed data
  551. // biSizeImage has the chunk size
  552. lpData : PVOID; // data
  553. lpbi : PBITMAPINFOHEADER; // DIB to decompress to
  554. lpBits : PVOID
  555. ): DWORD; cdecl;
  556. (*
  557. * ICDecompressBegin()
  558. *
  559. * start compression from a source format (lpbiInput) to a dest
  560. * format (lpbiOutput) is supported.
  561. *
  562. *)
  563. function ICDecompressBegin(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
  564. (*
  565. * ICDecompressQuery()
  566. *
  567. * determines if compression from a source format (lpbiInput) to a dest
  568. * format (lpbiOutput) is supported.
  569. *
  570. *)
  571. function ICDecompressQuery(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
  572. (*
  573. * ICDecompressGetFormat()
  574. *
  575. * get the output format, (format of un-compressed data)
  576. * if lpbiOutput is NULL return the size in bytes needed for format.
  577. *
  578. *)
  579. function ICDecompressGetFormat(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
  580. function ICDecompressGetFormatSize(hic: HIC; lpbi: PBITMAPINFOHEADER): DWORD;
  581. (*
  582. * ICDecompressGetPalette()
  583. *
  584. * get the output palette
  585. *
  586. *)
  587. function ICDecompressGetPalette(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
  588. function ICDecompressSetPalette(hic: HIC; lpbiPalette: PBITMAPINFOHEADER): DWORD;
  589. function ICDecompressEnd(hic: HIC): DWORD;
  590. (************************************************************************
  591. decompression (ex) functions
  592. ************************************************************************)
  593. //
  594. // on Win16 these functions are macros that call ICMessage. ICMessage will
  595. // not work on NT. rather than add new entrypoints we have given
  596. // them as static inline functions
  597. //
  598. (*
  599. * ICDecompressEx()
  600. *
  601. * decompress a single frame
  602. *
  603. *)
  604. function ICDecompressEx(
  605. hic : HIC;
  606. dwFlags : DWORD;
  607. lpbiSrc : PBITMAPINFOHEADER;
  608. lpSrc : PVOID;
  609. xSrc : int;
  610. ySrc : int;
  611. dxSrc : int;
  612. dySrc : int;
  613. lpbiDst : PBITMAPINFOHEADER;
  614. lpDst : PVOID;
  615. xDst : int;
  616. yDst : int;
  617. dxDst : int;
  618. dyDst : int
  619. ): DWORD; stdcall;
  620. (*
  621. * ICDecompressExBegin()
  622. *
  623. * start compression from a source format (lpbiInput) to a dest
  624. * format (lpbiOutput) is supported.
  625. *
  626. *)
  627. function ICDecompressExBegin(
  628. hic : HIC;
  629. dwFlags : DWORD;
  630. lpbiSrc : PBITMAPINFOHEADER;
  631. lpSrc : PVOID;
  632. xSrc : int;
  633. ySrc : int;
  634. dxSrc : int;
  635. dySrc : int;
  636. lpbiDst : PBITMAPINFOHEADER;
  637. lpDst : PVOID;
  638. xDst : int;
  639. yDst : int;
  640. dxDst : int;
  641. dyDst : int
  642. ): DWORD; stdcall;
  643. (*
  644. * ICDecompressExQuery()
  645. *
  646. *)
  647. function ICDecompressExQuery(
  648. hic : HIC;
  649. dwFlags : DWORD;
  650. lpbiSrc : PBITMAPINFOHEADER;
  651. lpSrc : PVOID;
  652. xSrc : int;
  653. ySrc : int;
  654. dxSrc : int;
  655. dySrc : int;
  656. lpbiDst : PBITMAPINFOHEADER;
  657. lpDst : PVOID;
  658. xDst : int;
  659. yDst : int;
  660. dxDst : int;
  661. dyDst : int
  662. ): DWORD; stdcall;
  663. function ICDecompressExEnd(hic: HIC): DWORD;
  664. (************************************************************************
  665. drawing functions
  666. ************************************************************************)
  667. (*
  668. * ICDrawBegin()
  669. *
  670. * start decompressing data with format (lpbiInput) directly to the screen
  671. *
  672. * return zero if the decompressor supports drawing.
  673. *
  674. *)
  675. function ICDrawBegin(
  676. hic : HIC;
  677. dwFlags : DWORD; // flags
  678. hpal : HPALETTE; // palette to draw with
  679. hwnd : HWND; // window to draw to
  680. hdc : HDC; // HDC to draw to
  681. xDst : int; // destination rectangle
  682. yDst : int;
  683. dxDst : int;
  684. dyDst : int;
  685. lpbi : PBITMAPINFOHEADER; // format of frame to draw
  686. xSrc : int; // source rectangle
  687. ySrc : int;
  688. dxSrc : int;
  689. dySrc : int;
  690. dwRate : DWORD; // frames/second = (dwRate/dwScale)
  691. dwScale : DWORD
  692. ): DWORD; cdecl;
  693. (*
  694. * ICDraw()
  695. *
  696. * decompress data directly to the screen
  697. *
  698. *)
  699. function ICDraw(
  700. hic : HIC;
  701. dwFlags : DWORD; // flags
  702. lpFormat : PVOID; // format of frame to decompress
  703. lpData : PVOID; // frame data to decompress
  704. cbData : DWORD; // size of data
  705. lTime : DWORD // time to draw this frame
  706. ): DWORD; cdecl;
  707. // ICMessage is not supported on Win32, so provide a static inline function
  708. // to do the same job
  709. function ICDrawSuggestFormat(
  710. hic : HIC;
  711. lpbiIn : PBITMAPINFOHEADER;
  712. lpbiOut : PBITMAPINFOHEADER;
  713. dxSrc : int;
  714. dySrc : int;
  715. dxDst : int;
  716. dyDst : int;
  717. hicDecomp : HIC
  718. ): DWORD; stdcall;
  719. (*
  720. * ICDrawQuery()
  721. *
  722. * determines if the compressor is willing to render the specified format.
  723. *
  724. *)
  725. function ICDrawQuery(hic: HIC; lpbiInput: PBITMAPINFOHEADER): DWORD;
  726. function ICDrawChangePalette(hic: HIC; lpbiInput: PBITMAPINFOHEADER): DWORD;
  727. function ICGetBuffersWanted(hic: HIC; lpdwBuffers: PDWORD): DWORD;
  728. function ICDrawEnd(hic: HIC): DWORD;
  729. function ICDrawStart(hic: HIC): DWORD;
  730. function ICDrawStartPlay(hic: HIC; lFrom, lTo: DWORD): DWORD;
  731. function ICDrawStop(hic: HIC): DWORD;
  732. function ICDrawStopPlay(hic: HIC): DWORD;
  733. function ICDrawGetTime(hic: HIC; lplTime: PDWORD): DWORD;
  734. function ICDrawSetTime(hic: HIC; lTime: DWORD): DWORD;
  735. function ICDrawRealize(hic: HIC; hdc: HDC; fBackground: BOOL): DWORD;
  736. function ICDrawFlush(hic: HIC): DWORD;
  737. function ICDrawRenderBuffer(hic: HIC): DWORD;
  738. (************************************************************************
  739. Status callback functions
  740. ************************************************************************/
  741. /*
  742. * ICSetStatusProc()
  743. *
  744. * Set the status callback function
  745. *
  746. *)
  747. // ICMessage is not supported on NT
  748. function ICSetStatusProc(
  749. hic : HIC;
  750. dwFlags : DWORD;
  751. lParam : DWORD;
  752. fpfnStatus : TICStatusProc
  753. ): DWORD; stdcall;
  754. (************************************************************************
  755. helper routines for DrawDib and MCIAVI...
  756. ************************************************************************)
  757. function ICLocate(fccType, fccHandler: DWORD; lpbiIn, lpbiOut: PBITMAPINFOHEADER; wFlags: WORD): HIC; stdcall;
  758. function ICGetDisplayFormat(hic: HIC; lpbiIn, lpbiOut: PBITMAPINFOHEADER; BitDepth: int; dx, dy: int): HIC; stdcall;
  759. function ICDecompressOpen(fccType, fccHandler: DWORD; lpbiIn, lpbiOut: PBITMAPINFOHEADER): HIC;
  760. function ICDrawOpen(fccType, fccHandler: DWORD; lpbiIn: PBITMAPINFOHEADER): HIC;
  761. (************************************************************************
  762. Higher level functions
  763. ************************************************************************)
  764. function ICImageCompress(
  765. hic : HIC; // compressor to use
  766. uiFlags : UINT; // flags (none yet)
  767. lpbiIn : PBITMAPINFO; // format to compress from
  768. lpBits : PVOID; // data to compress
  769. lpbiOut : PBITMAPINFO; // compress to this (NULL ==> default)
  770. lQuality : LONG; // quality to use
  771. plSize : PDWORD // compress to this size (0=whatever)
  772. ): THANDLE; stdcall;
  773. function ICImageDecompress(
  774. hic : HIC; // compressor to use
  775. uiFlags : UINT; // flags (none yet)
  776. lpbiIn : PBITMAPINFO; // format to decompress from
  777. lpBits : PVOID; // data to decompress
  778. lpbiOut : PBITMAPINFO // decompress to this (NULL ==> default)
  779. ): THANDLE; stdcall;
  780. {-- TCompVars ----------------------------------------------------------------}
  781. //
  782. // Structure used by ICSeqCompressFrame and ICCompressorChoose routines
  783. // Make sure this matches the autodoc in icm.c!
  784. //
  785. type
  786. PCOMPVARS = ^TCOMPVARS;
  787. TCOMPVARS = packed record
  788. cbSize : DWORD; // set to sizeof(COMPVARS) before
  789. // calling ICCompressorChoose
  790. dwFlags : DWORD; // see below...
  791. hic : HIC; // HIC of chosen compressor
  792. fccType : DWORD; // basically ICTYPE_VIDEO
  793. fccHandler : DWORD; // handler of chosen compressor or
  794. // "" or "DIB "
  795. lpbiIn : PBITMAPINFO; // input format
  796. lpbiOut : PBITMAPINFO; // output format - will compress to this
  797. lpBitsOut : PVOID;
  798. lpBitsPrev : PVOID;
  799. lFrame : LONG;
  800. lKey : LONG; // key frames how often?
  801. lDataRate : LONG; // desired data rate KB/Sec
  802. lQ : LONG; // desired quality
  803. lKeyCount : LONG;
  804. lpState : PVOID; // state of compressor
  805. cbState : LONG; // size of the state
  806. end;
  807. // FLAGS for dwFlags element of COMPVARS structure:
  808. // set this flag if you initialize COMPVARS before calling ICCompressorChoose
  809. const
  810. ICMF_COMPVARS_VALID = $00000001; // COMPVARS contains valid data
  811. //
  812. // allows user to choose compressor, quality etc...
  813. //
  814. function ICCompressorChoose(
  815. hwnd : HWND; // parent window for dialog
  816. uiFlags : UINT; // flags
  817. pvIn : PVOID; // input format (optional)
  818. lpData : PVOID; // input data (optional)
  819. pc : PCOMPVARS; // data about the compressor/dlg
  820. lpszTitle : LPSTR // dialog title (optional)
  821. ): BOOL; stdcall;
  822. // defines for uiFlags
  823. const
  824. ICMF_CHOOSE_KEYFRAME = $0001; // show KeyFrame Every box
  825. ICMF_CHOOSE_DATARATE = $0002; // show DataRate box
  826. ICMF_CHOOSE_PREVIEW = $0004; // allow expanded preview dialog
  827. ICMF_CHOOSE_ALLCOMPRESSORS = $0008; // don't only show those that
  828. // can handle the input format
  829. // or input data
  830. function ICSeqCompressFrameStart(pc: PCOMPVARS; lpbiIn: PBITMAPINFO): BOOL; stdcall;
  831. procedure ICSeqCompressFrameEnd(pc: PCOMPVARS); stdcall;
  832. function ICSeqCompressFrame(
  833. pc : PCOMPVARS; // set by ICCompressorChoose
  834. uiFlags : UINT; // flags
  835. lpBits : PVOID; // input DIB bits
  836. pfKey : PBOOL; // did it end up being a key frame?
  837. plSize : PDWORD // size to compress to/of returned image
  838. ): PVOID; stdcall;
  839. procedure ICCompressorFree(pc: PCOMPVARS); stdcall;
  840. (**************************************************************************
  841. *
  842. * DRAWDIB - Routines for drawing to the display.
  843. *
  844. *************************************************************************)
  845. type
  846. HDRAWDIB = THandle; // hdd
  847. (*********************************************************************
  848. DrawDib Flags
  849. **********************************************************************)
  850. const
  851. DDF_UPDATE = $0002; // re-draw the last DIB
  852. DDF_SAME_HDC = $0004; // HDC same as last call (all setup)
  853. DDF_SAME_DRAW = $0008; // draw params are the same
  854. DDF_DONTDRAW = $0010; // dont draw frame, just decompress
  855. DDF_ANIMATE = $0020; // allow palette animation
  856. DDF_BUFFER = $0040; // always buffer image
  857. DDF_JUSTDRAWIT = $0080; // just draw it with GDI
  858. DDF_FULLSCREEN = $0100; // use DisplayDib
  859. DDF_BACKGROUNDPAL = $0200; // Realize palette in background
  860. DDF_NOTKEYFRAME = $0400; // this is a partial frame update, hint
  861. DDF_HURRYUP = $0800; // hurry up please!
  862. DDF_HALFTONE = $1000; // always halftone
  863. DDF_PREROLL = DDF_DONTDRAW; // Builing up a non-keyframe
  864. DDF_SAME_DIB = DDF_SAME_DRAW;
  865. DDF_SAME_SIZE = DDF_SAME_DRAW;
  866. (*********************************************************************
  867. DrawDib functions
  868. *********************************************************************)
  869. {-- DrawDibOpen() ------------------------------------------------------------}
  870. function DrawDibOpen: HDRAWDIB; stdcall;
  871. {-- DrawDibClose() -----------------------------------------------------------}
  872. function DrawDibClose(hdd: HDRAWDIB): BOOL; stdcall;
  873. {-- DrawDibGetBuffer() -------------------------------------------------------}
  874. function DrawDibGetBuffer(hdd: HDRAWDIB; lpbi: PBITMAPINFOHEADER; dwSize: DWORD; dwFlags: DWORD): PVOID; stdcall;
  875. {-- DrawDibGetPalette() - get the palette used for drawing DIBs --------------}
  876. function DrawDibGetPalette(hdd: HDRAWDIB): HPALETTE; stdcall;
  877. {-- DrawDibSetPalette() - set the palette used for drawing DIBs --------------}
  878. function DrawDibSetPalette(hdd: HDRAWDIB; hpal: HPALETTE): BOOL; stdcall;
  879. {-- DrawDibChangePalette() ---------------------------------------------------}
  880. function DrawDibChangePalette(hdd: HDRAWDIB; iStart, iLen: int; lppe: PPALETTEENTRY): BOOL; stdcall;
  881. {-- DrawDibRealize() - realize the palette in a HDD --------------------------}
  882. function DrawDibRealize(hdd: HDRAWDIB; hdc: HDC; fBackground: BOOL): UINT; stdcall;
  883. {-- DrawDibStart() - start of streaming playback -----------------------------}
  884. function DrawDibStart(hdd: HDRAWDIB; rate: DWORD): BOOL; stdcall;
  885. {-- DrawDibStop() - start of streaming playback ------------------------------}
  886. function DrawDibStop(hdd: HDRAWDIB): BOOL; stdcall;
  887. {-- DrawDibBegin() - prepare to draw -----------------------------------------}
  888. function DrawDibBegin(
  889. hdd : HDRAWDIB;
  890. hdc : HDC;
  891. dxDst : int;
  892. dyDst : int;
  893. lpbi : PBITMAPINFOHEADER;
  894. dxSrc : int;
  895. dySrc : int;
  896. wFlags : UINT
  897. ): BOOL; stdcall;
  898. {-- DrawDibDraw() - actually draw a DIB to the screen ------------------------}
  899. function DrawDibDraw(
  900. hdd : HDRAWDIB;
  901. hdc : HDC;
  902. xDst : int;
  903. yDst : int;
  904. dxDst : int;
  905. dyDst : int;
  906. lpbi : PBITMAPINFOHEADER;
  907. lpBits : PVOID;
  908. xSrc : int;
  909. ySrc : int;
  910. dxSrc : int;
  911. dySrc : int;
  912. wFlags : UINT
  913. ): BOOL; stdcall;
  914. {-- DrawDibUpdate() - redraw last image (may only be valid with DDF_BUFFER) --}
  915. function DrawDibUpdate(hdd: HDRAWDIB; hdc: HDC; x, y: int): BOOL;
  916. {-- DrawDibEnd() -------------------------------------------------------------}
  917. function DrawDibEnd(hdd: HDRAWDIB): BOOL; stdcall;
  918. {-- DrawDibTime() - for debugging purposes only ------------------------------}
  919. type
  920. PDRAWDIBTIME = ^TDRAWDIBTIME;
  921. TDRAWDIBTIME = packed record
  922. timeCount : LONG;
  923. timeDraw : LONG;
  924. timeDecompress : LONG;
  925. timeDither : LONG;
  926. timeStretch : LONG;
  927. timeBlt : LONG;
  928. timeSetDIBits : LONG;
  929. end;
  930. function DrawDibTime(hdd: HDRAWDIB; lpddtime: PDRAWDIBTIME): BOOL; stdcall;
  931. {-- Display profiling --------------------------------------------------------}
  932. const
  933. PD_CAN_DRAW_DIB = $0001; // if you can draw at all
  934. PD_CAN_STRETCHDIB = $0002; // basicly RC_STRETCHDIB
  935. PD_STRETCHDIB_1_1_OK = $0004; // is it fast?
  936. PD_STRETCHDIB_1_2_OK = $0008; // ...
  937. PD_STRETCHDIB_1_N_OK = $0010; // ...
  938. function DrawDibProfileDisplay(lpbi: PBITMAPINFOHEADER): DWORD; stdcall;
  939. (****************************************************************************
  940. *
  941. * AVIFMT - AVI file format definitions
  942. *
  943. ****************************************************************************)
  944. //
  945. // The following is a short description of the AVI file format. Please
  946. // see the accompanying documentation for a full explanation.
  947. //
  948. // An AVI file is the following RIFF form:
  949. //
  950. // RIFF('AVI'
  951. // LIST('hdrl'
  952. // avih(<MainAVIHeader>)
  953. // LIST ('strl'
  954. // strh(<Stream header>)
  955. // strf(<Stream format>)
  956. // ... additional header data
  957. // LIST('movi'
  958. // { LIST('rec'
  959. // SubChunk...
  960. // )
  961. // | SubChunk } ....
  962. // )
  963. // [ <AVIIndex> ]
  964. // )
  965. //
  966. // The main file header specifies how many streams are present. For
  967. // each one, there must be a stream header chunk and a stream format
  968. // chunk, enlosed in a 'strl' LIST chunk. The 'strf' chunk contains
  969. // type-specific format information; for a video stream, this should
  970. // be a BITMAPINFO structure, including palette. For an audio stream,
  971. // this should be a WAVEFORMAT (or PCMWAVEFORMAT) structure.
  972. //
  973. // The actual data is contained in subchunks within the 'movi' LIST
  974. // chunk. The first two characters of each data chunk are the
  975. // stream number with which that data is associated.
  976. //
  977. // Some defined chunk types:
  978. // Video Streams:
  979. // ##db: RGB DIB bits
  980. // ##dc: RLE8 compressed DIB bits
  981. // ##pc: Palette Change
  982. //
  983. // Audio Streams:
  984. // ##wb: waveform audio bytes
  985. //
  986. // The grouping into LIST 'rec' chunks implies only that the contents of
  987. // the chunk should be read into memory at the same time. This
  988. // grouping is used for files specifically intended to be played from
  989. // CD-ROM.
  990. //
  991. // The index chunk at the end of the file should contain one entry for
  992. // each data chunk in the file.
  993. //
  994. // Limitations for the current software:
  995. // Only one video stream and one audio stream are allowed.
  996. // The streams must start at the beginning of the file.
  997. //
  998. //
  999. // To register codec types please obtain a copy of the Multimedia
  1000. // Developer Registration Kit from:
  1001. //
  1002. // Microsoft Corporation
  1003. // Multimedia Systems Group
  1004. // Product Marketing
  1005. // One Microsoft Way
  1006. // Redmond, WA 98052-6399
  1007. //
  1008. {-- form types, list types and chunk types -----------------------------------}
  1009. const
  1010. formtypeAVI = $20495641; // mmioFOURCC('A', 'V', 'I', ' ')
  1011. listtypeAVIHEADER = $6C726468; // mmioFOURCC('h', 'd', 'r', 'l')
  1012. ckidAVIMAINHDR = $68697661; // mmioFOURCC('a', 'v', 'i', 'h')
  1013. listtypeSTREAMHEADER = $6C727473; // mmioFOURCC('s', 't', 'r', 'l')
  1014. ckidSTREAMHEADER = $68727473; // mmioFOURCC('s', 't', 'r', 'h')
  1015. ckidSTREAMFORMAT = $66727473; // mmioFOURCC('s', 't', 'r', 'f')
  1016. ckidSTREAMHANDLERDATA = $64727473; // mmioFOURCC('s', 't', 'r', 'd')
  1017. ckidSTREAMNAME = $6E727473; // mmioFOURCC('s', 't', 'r', 'n')
  1018. listtypeAVIMOVIE = $69766F6D; // mmioFOURCC('m', 'o', 'v', 'i')
  1019. listtypeAVIRECORD = $20636572; // mmioFOURCC('r', 'e', 'c', ' ')
  1020. ckidAVINEWINDEX = $31786469; // mmioFOURCC('i', 'd', 'x', '1')
  1021. {-- Stream types for the <fccType> field of the stream header ----------------}
  1022. streamtypeVIDEO = $73646976; // mmioFOURCC('v', 'i', 'd', 's')
  1023. streamtypeAUDIO = $73647561; // mmioFOURCC('a', 'u', 'd', 's')
  1024. streamtypeMIDI = $7364696D; // mmioFOURCC('m', 'i', 'd', 's')
  1025. streamtypeTEXT = $73747874; // mmioFOURCC('t', 'x', 't', 's')
  1026. {-- Basic chunk types --------------------------------------------------------}
  1027. cktypeDIBbits = $6264; // aviTWOCC('d', 'b')
  1028. cktypeDIBcompressed = $6364; // aviTWOCC('d', 'c')
  1029. cktypePALchange = $6370; // aviTWOCC('p', 'c')
  1030. cktypeWAVEbytes = $6277; // aviTWOCC('w', 'b')
  1031. {-- Chunk id to use for extra chunks for padding -----------------------------}
  1032. ckidAVIPADDING = $4B4E554A; // mmioFOURCC('J', 'U', 'N', 'K')
  1033. (*
  1034. ** Useful macros
  1035. **
  1036. ** Warning: These are nasty macro, and MS C 6.0 compiles some of them
  1037. ** incorrectly if optimizations are on. Ack.
  1038. *)
  1039. {-- Macro to get stream number out of a FOURCC ckid --------------------------}
  1040. function FromHex(n: BYTE): BYTE;
  1041. function StreamFromFOURCC(fcc: DWORD): BYTE;
  1042. {-- Macro to get TWOCC chunk type out of a FOURCC ckid -----------------------}
  1043. function TWOCCFromFOURCC(fcc: DWORD): WORD;
  1044. {-- Macro to make a ckid for a chunk out of a TWOCC and a stream num (0-255) -}
  1045. function ToHex(n: BYTE): BYTE;
  1046. function MAKEAVICKID(tcc: WORD; stream: BYTE): DWORD;
  1047. {-- Main AVI file header -----------------------------------------------------}
  1048. {-- flags for use in <dwFlags> in AVIFileHdr ---------------------------------}
  1049. const
  1050. AVIF_HASINDEX = $00000010; // Index at end of file?
  1051. AVIF_MUSTUSEINDEX = $00000020;
  1052. AVIF_ISINTERLEAVED = $00000100;
  1053. AVIF_TRUSTCKTYPE = $00000800; // Use CKType to find key frames?
  1054. AVIF_WASCAPTUREFILE = $00010000;
  1055. AVIF_COPYRIGHTED = $00020000;
  1056. {-- The AVI File Header LIST chunk should be padded to this size -------------}
  1057. const
  1058. AVI_HEADERSIZE = 2048; // size of AVI header list
  1059. type
  1060. PMainAVIHeader = ^TMainAVIHeader;
  1061. TMainAVIHeader = packed record
  1062. dwMicroSecPerFrame : DWORD; // frame display rate (or 0L)
  1063. dwMaxBytesPerSec : DWORD; // max. transfer rate
  1064. dwPaddingGranularity : DWORD; // pad to multiples of this
  1065. // size; normally 2K.
  1066. dwFlags : DWORD; // the ever-present flags
  1067. dwTotalFrames : DWORD; // # frames in file
  1068. dwInitialFrames : DWORD;
  1069. dwStreams : DWORD;
  1070. dwSuggestedBufferSize : DWORD;
  1071. dwWidth : DWORD;
  1072. dwHeight : DWORD;
  1073. dwReserved : array[0..3] of DWORD;
  1074. end;
  1075. {-- Stream header ------------------------------------------------------------}
  1076. const
  1077. AVISF_DISABLED = $00000001;
  1078. AVISF_VIDEO_PALCHANGES = $00010000;
  1079. type
  1080. PAVIStreamHeader = ^TAVIStreamHeader;
  1081. TAVIStreamHeader = packed record
  1082. fccType : FOURCC;
  1083. fccHandler : FOURCC;
  1084. dwFlags : DWORD; // Contains AVITF_* flags
  1085. wPriority : WORD;
  1086. wLanguage : WORD;
  1087. dwInitialFrames : DWORD;
  1088. dwScale : DWORD;
  1089. dwRate : DWORD; // dwRate / dwScale == samples/second
  1090. dwStart : DWORD;
  1091. dwLength : DWORD; // In units above...
  1092. dwSuggestedBufferSize : DWORD;
  1093. dwQuality : DWORD;
  1094. dwSampleSize : DWORD;
  1095. rcFrame : TRECT;
  1096. end;
  1097. {-- Flags for index ----------------------------------------------------------}
  1098. const
  1099. AVIIF_NOTIME = $00000100; // this frame doesn't take any time
  1100. AVIIF_COMPUSE = $0FFF0000; // these bits are for compressor use
  1101. type
  1102. PAVIINDEXENTRY = ^TAVIINDEXENTRY;
  1103. TAVIINDEXENTRY = packed record
  1104. ckid : DWORD;
  1105. dwFlags : DWORD;
  1106. dwChunkOffset : DWORD; // Position of chunk
  1107. dwChunkLength : DWORD; // Length of chunk
  1108. end;
  1109. {-- Palette change chunk (used in video streams) -----------------------------}
  1110. PAVIPALCHANGE = ^TAVIPALCHANGE;
  1111. TAVIPALCHANGE = packed record
  1112. bFirstEntry : BYTE; // first entry to change
  1113. bNumEntries : BYTE; // # entries to change (0 if 256)
  1114. wFlags : WORD; // Mostly to preserve alignment...
  1115. peNew : array[0..0] of TPALETTEENTRY; // New color specifications
  1116. end;
  1117. (****************************************************************************
  1118. *
  1119. * AVIFile - routines for reading/writing standard AVI files
  1120. *
  1121. ***************************************************************************)
  1122. //
  1123. // Ansi - Unicode thunking.
  1124. //
  1125. // Unicode or Ansi-only apps can call the avifile APIs.
  1126. // any Win32 app who wants to use
  1127. // any of the AVI COM interfaces must be UNICODE - the AVISTREAMINFO and
  1128. // AVIFILEINFO structures used in the Info methods of these interfaces are
  1129. // the unicode variants, and no thunking to or from ansi takes place
  1130. // except in the AVIFILE api entrypoints.
  1131. //
  1132. // For Ansi/Unicode thunking: for each entrypoint or structure that
  1133. // uses chars or strings, two versions are declared in the Win32 version,
  1134. // ApiNameW and ApiNameA. The default name ApiName is #defined to one or
  1135. // other of these depending on whether UNICODE is defined (during
  1136. // compilation of the app that is including this header). The source will
  1137. // contain ApiName and ApiNameA (with ApiName being the Win16 implementation,
  1138. // and also #defined to ApiNameW, and ApiNameA being the thunk entrypoint).
  1139. //
  1140. // For GetFrame::SetFormat - use the best format for the display
  1141. const
  1142. AVIGETFRAMEF_BESTDISPLAYFMT = 1;
  1143. //
  1144. // Structures used by AVIStreamInfo & AVIFileInfo.
  1145. //
  1146. // These are related to, but not identical to, the header chunks
  1147. // in an AVI file.
  1148. //
  1149. {-- AVISTREAMINFO ------------------------------------------------------------}
  1150. // for Unicode/Ansi thunking we need to declare three versions of this!
  1151. type
  1152. PAVIStreamInfoW = ^TAVIStreamInfoW;
  1153. TAVIStreamInfoW = packed record
  1154. fccType : DWORD;
  1155. fccHandler : DWORD;
  1156. dwFlags : DWORD; // Contains AVITF_* flags
  1157. dwCaps : DWORD;
  1158. wPriority : WORD;
  1159. wLanguage : WORD;
  1160. dwScale : DWORD;
  1161. dwRate : DWORD; // dwRate / dwScale == samples/second
  1162. dwStart : DWORD;
  1163. dwLength : DWORD; // In units above...
  1164. dwInitialFrames : DWORD;
  1165. dwSuggestedBufferSize : DWORD;
  1166. dwQuality : DWORD;
  1167. dwSampleSize : DWORD;
  1168. rcFrame : TRECT;
  1169. dwEditCount : DWORD;
  1170. dwFormatChangeCount : DWORD;
  1171. szName : array[0..63] of WideChar;
  1172. end;
  1173. PAVIStreamInfoA = ^TAVIStreamInfoA;
  1174. TAVIStreamInfoA = packed record
  1175. fccType : DWORD;
  1176. fccHandler : DWORD;
  1177. dwFlags : DWORD; // Contains AVITF_* flags
  1178. dwCaps : DWORD;
  1179. wPriority : WORD;
  1180. wLanguage : WORD;
  1181. dwScale : DWORD;
  1182. dwRate : DWORD; // dwRate / dwScale == samples/second
  1183. dwStart : DWORD;
  1184. dwLength : DWORD; // In units above...
  1185. dwInitialFrames : DWORD;
  1186. dwSuggestedBufferSize : DWORD;
  1187. dwQuality : DWORD;
  1188. dwSampleSize : DWORD;
  1189. rcFrame : TRECT;
  1190. dwEditCount : DWORD;
  1191. dwFormatChangeCount : DWORD;
  1192. szName : array[0..63] of AnsiChar;
  1193. end;
  1194. PAVIStreamInfo = ^TAVIStreamInfo;
  1195. {$IFDEF UNICODE}
  1196. TAVIStreamInfo = TAVIStreamInfoW;
  1197. {$ELSE}
  1198. TAVIStreamInfo = TAVIStreamInfoA;
  1199. {$ENDIF}
  1200. const
  1201. AVISTREAMINFO_DISABLED = $00000001;
  1202. AVISTREAMINFO_FORMATCHANGES = $00010000;
  1203. {-- AVIFILEINFO --------------------------------------------------------------}
  1204. type
  1205. PAVIFileInfoW = ^TAVIFileInfoW;
  1206. TAVIFileInfoW = packed record
  1207. dwMaxBytesPerSec : DWORD; // max. transfer rate
  1208. dwFlags : DWORD; // the ever-present flags
  1209. dwCaps : DWORD;
  1210. dwStreams : DWORD;
  1211. dwSuggestedBufferSize : DWORD;
  1212. dwWidth : DWORD;
  1213. dwHeight : DWORD;
  1214. dwScale : DWORD;
  1215. dwRate : DWORD; // dwRate / dwScale == samples/second
  1216. dwLength : DWORD;
  1217. dwEditCount : DWORD;
  1218. szFileType : array[0..63] of WideChar;
  1219. // descriptive string for file type?
  1220. end;
  1221. PAVIFileInfoA = ^TAVIFileInfoA;
  1222. TAVIFileInfoA = packed record
  1223. dwMaxBytesPerSec : DWORD; // max. transfer rate
  1224. dwFlags : DWORD; // the ever-present flags
  1225. dwCaps : DWORD;
  1226. dwStreams : DWORD;
  1227. dwSuggestedBufferSize : DWORD;
  1228. dwWidth : DWORD;
  1229. dwHeight : DWORD;
  1230. dwScale : DWORD;
  1231. dwRate : DWORD; // dwRate / dwScale == samples/second
  1232. dwLength : DWORD;
  1233. dwEditCount : DWORD;
  1234. szFileType : array[0..63] of AnsiChar;
  1235. // descriptive string for file type?
  1236. end;
  1237. PAVIFileInfo = ^TAVIFileInfo;
  1238. {$IFDEF UNICODE}
  1239. TAVIFileInfo = TAVIFileInfoW;
  1240. {$ELSE}
  1241. TAVIFileInfo = TAVIFileInfoA;
  1242. {$ENDIF}
  1243. {-- Flags for dwFlags --------------------------------------------------------}
  1244. const
  1245. AVIFILEINFO_HASINDEX = $00000010;
  1246. AVIFILEINFO_MUSTUSEINDEX = $00000020;
  1247. AVIFILEINFO_ISINTERLEAVED = $00000100;
  1248. AVIFILEINFO_WASCAPTUREFILE = $00010000;
  1249. AVIFILEINFO_COPYRIGHTED = $00020000;
  1250. {-- Flags for dwCaps ---------------------------------------------------------}
  1251. AVIFILECAPS_CANREAD = $00000001;
  1252. AVIFILECAPS_CANWRITE = $00000002;
  1253. AVIFILECAPS_ALLKEYFRAMES = $00000010;
  1254. AVIFILECAPS_NOCOMPRESSION = $00000020;
  1255. type
  1256. TAVISAVECALLBACK = function(i: int): BOOL; pascal;
  1257. {-- AVICOMPRESSOPTIONS -------------------------------------------------------}
  1258. // Make sure it matches the AutoDoc in avisave.c !!!
  1259. type
  1260. PAVICOMPRESSOPTIONS = ^TAVICOMPRESSOPTIONS;
  1261. TAVICOMPRESSOPTIONS = packed record
  1262. fccType : DWORD; // stream type, for consistency
  1263. fccHandler : DWORD; // compressor
  1264. dwKeyFrameEvery : DWORD; // keyframe rate
  1265. dwQuality : DWORD; // compress quality 0-10,000
  1266. dwBytesPerSecond : DWORD; // bytes per second
  1267. dwFlags : DWORD; // flags... see below
  1268. lpFormat : PVOID; // save format
  1269. cbFormat : DWORD;
  1270. lpParms : PVOID; // compressor options
  1271. cbParms : DWORD;
  1272. dwInterleaveEvery : DWORD; // for non-video streams only
  1273. end;
  1274. //
  1275. // Defines for the dwFlags field of the AVICOMPRESSOPTIONS struct
  1276. // Each of these flags determines if the appropriate field in the structure
  1277. // (dwInterleaveEvery, dwBytesPerSecond, and dwKeyFrameEvery) is payed
  1278. // attention to. See the autodoc in avisave.c for details.
  1279. //
  1280. const
  1281. AVICOMPRESSF_INTERLEAVE = $00000001; // interleave
  1282. AVICOMPRESSF_DATARATE = $00000002; // use a data rate
  1283. AVICOMPRESSF_KEYFRAMES = $00000004; // use keyframes
  1284. AVICOMPRESSF_VALID = $00000008; // has valid data?
  1285. (* - - - - - - - - */
  1286. /****** AVI Stream Interface *******************************************)
  1287. type
  1288. IAVIStream = interface(IUnknown)
  1289. function Create(lParam1, lParam2: LPARAM): HResult; stdcall;
  1290. function Info(var psi: TAVIStreamInfoW; lSize: LONG): HResult; stdcall;
  1291. function FindSample(lPos: LONG; lFlags: LONG): LONG; stdcall;
  1292. function ReadFormat(lPos: LONG; lpFormat: PVOID; var lpcbFormat: LONG): HResult; stdcall;
  1293. function SetFormat(lPos: LONG; lpFormat: PVOID; cbFormat: LONG): HResult; stdcall;
  1294. function Read(lStart: LONG; lSamples: LONG; lpBuffer: PVOID; cbBuffer: LONG; var plBytes, plSamples: LONG): HResult; stdcall;
  1295. function Write(lStart: LONG; lSamples: LONG; lpBuffer: PVOID; cbBuffer: LONG; dwFlags: DWORD; var plSampWritten, plBytesWritten: LONG): HResult; stdcall;
  1296. function Delete(lStart: LONG; lSamples: LONG): HResult; stdcall;
  1297. function ReadData(fcc: DWORD; lp: PVOID; var lpcb: LONG): HResult; stdcall;
  1298. function WriteData(fcc: DWORD; lp: PVOID; cb: LONG): HResult; stdcall;
  1299. function SetInfo(var lpInfo: TAVIStreamInfoW; cbInfo: LONG): HResult; stdcall;
  1300. end;
  1301. IAVIStreaming = interface(IUnknown)
  1302. function _Begin(lStart, lEnd : LONG; lRate : LONG): HResult; stdcall;
  1303. function _End: HResult; stdcall;
  1304. end;
  1305. IAVIEditStream = interface(IUnknown)
  1306. function Cut(var plStart, plLength: LONG; var ppResult: IAVIStream): HResult; stdcall;
  1307. function Copy(var plStart, plLength: LONG; var ppResult: IAVIStream): HResult; stdcall;
  1308. function Paste(var plPos: LONG; var plLength: LONG; pstream: IAVIStream; lStart, lEnd: LONG): HResult; stdcall;
  1309. function Clone(var ppResult: IAVIStream): HResult; stdcall;
  1310. function SetInfo(var lpInfo: TAVIStreamInfoW; cbInfo: LONG): HResult; stdcall;
  1311. end;
  1312. {-- AVIFile ------------------------------------------------------------------}
  1313. IAVIFile = interface(IUnknown)
  1314. function Info(var pfi: TAVIFileInfoW; iSize: LONG): HResult; stdcall;
  1315. function GetStream(var ppStream: IAVISTREAM; fccType: DWORD; lParam: LONG): HResult; stdcall;
  1316. function CreateStream(var ppStream: IAVISTREAM; var psi: TAVIStreamInfoW): HResult; stdcall;
  1317. function WriteData(ckid: DWORD; lpData: PVOID; cbData: LONG): HResult; stdcall;
  1318. function ReadData(ckid: DWORD; lpData: PVOID; lpcbData: PLONG): HResult; stdcall;
  1319. function EndRecord: HResult; stdcall;
  1320. function DeleteStream(fccType: DWORD; lParam: LONG): HResult; stdcall;
  1321. end;
  1322. {-- GetFrame -----------------------------------------------------------------}
  1323. // The functions 'BeginExtraction' and 'EndExtraction' have actually
  1324. // the names 'Begin' and 'End', but we cannot use that identifiers for
  1325. // obvious reasons.
  1326. IGetFrame = interface(IUnknown)
  1327. function GetFrame(lPos: LONG): PBitmapInfoHeader; stdcall;
  1328. function BeginExtraction(lStart, lEnd, lRate: LONG): HResult; stdcall;
  1329. function EndExtraction: HResult; stdcall;
  1330. function SetFormat(var lpbi: TBitmapInfoHeader; lpBits: Pointer; x, y, dx, dy: Integer): HResult; stdcall;
  1331. end;
  1332. {-- GUIDs --------------------------------------------------------------------}
  1333. const
  1334. IID_IAVIFile : TGUID = (D1: $00020020; D2: $0; D3: $0; D4:($C0,$0,$0,$0,$0,$0,$0,$46));
  1335. IID_IAVIStream : TGUID = (D1: $00020021; D2: $0; D3: $0; D4:($C0,$0,$0,$0,$0,$0,$0,$46));
  1336. IID_IAVIStreaming : TGUID = (D1: $00020022; D2: $0; D3: $0; D4:($C0,$0,$0,$0,$0,$0,$0,$46));
  1337. IID_IGetFrame : TGUID = (D1: $00020023; D2: $0; D3: $0; D4:($C0,$0,$0,$0,$0,$0,$0,$46));
  1338. IID_IAVIEditStream: TGUID = (D1: $00020024; D2: $0; D3: $0; D4:($C0,$0,$0,$0,$0,$0,$0,$46));
  1339. CLSID_AVISimpleUnMarshal : TGUID = (D1: $00020009; D2: $0; D3: $0; D4:($C0,$0,$0,$0,$0,$0,$0,$46));
  1340. CLSID_AVIFile : TGUID = (D1: $00020000; D2: $0; D3: $0; D4:($C0,$0,$0,$0,$0,$0,$0,$46));
  1341. AVIFILEHANDLER_CANREAD = $0001;
  1342. AVIFILEHANDLER_CANWRITE = $0002;
  1343. AVIFILEHANDLER_CANACCEPTNONRGB = $0004;
  1344. {-- Functions ----------------------------------------------------------------}
  1345. procedure AVIFileInit; stdcall; // Call this first!
  1346. procedure AVIFileExit; stdcall;
  1347. function AVIFileAddRef(pfile: IAVIFile): ULONG; stdcall;
  1348. function AVIFileRelease(pfile: IAVIFile): ULONG; stdcall;
  1349. function AVIFileOpenA(var ppfile: IAVIFile; szFile: LPCSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall;
  1350. function AVIFileOpenW(var ppfile: IAVIFile; szFile: LPCWSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall;
  1351. {$IFDEF UNICODE}
  1352. function AVIFileOpen(var ppfile: IAVIFile; szFile: LPCWSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall;
  1353. {$ELSE}
  1354. function AVIFileOpen(var ppfile: IAVIFile; szFile: LPCSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall;
  1355. {$ENDIF}
  1356. function AVIFileInfoW(pfile: IAVIFile; var pfi: TAVIFILEINFOW; lSize: LONG): HResult; stdcall;
  1357. function AVIFileInfoA(pfile: IAVIFile; var pfi: TAVIFILEINFOA; lSize: LONG): HResult; stdcall;
  1358. function AVIFileInfo(pfile: IAVIFile; var pfi: TAVIFILEINFO; lSize: LONG): HResult; stdcall;
  1359. function AVIFileGetStream(pfile: IAVIFile; var ppavi: IAVISTREAM; fccType: DWORD; lParam: LONG): HResult; stdcall;
  1360. function AVIFileCreateStreamW(pfile: IAVIFile; var ppavi: IAVISTREAM; var psi: TAVISTREAMINFOW): HResult; stdcall;
  1361. function AVIFileCreateStreamA(pfile: IAVIFile; var ppavi: IAVISTREAM; var psi: TAVISTREAMINFOA): HResult; stdcall;
  1362. function AVIFileCreateStream(pfile: IAVIFile; var ppavi: IAVISTREAM; var psi: TAVISTREAMINFO): HResult; stdcall;
  1363. function AVIFileWriteData(pfile: IAVIFile; ckid: DWORD; lpData: PVOID; cbData: LONG): HResult; stdcall;
  1364. function AVIFileReadData(pfile: IAVIFile; ckid: DWORD; lpData: PVOID; var lpcbData: LONG): HResult; stdcall;
  1365. function AVIFileEndRecord(pfile: IAVIFile): HResult; stdcall;
  1366. function AVIStreamAddRef(pavi: IAVIStream): ULONG; stdcall;
  1367. function AVIStreamRelease(pavi: IAVIStream): ULONG; stdcall;
  1368. function AVIStreamInfoW (pavi: IAVIStream; var psi: TAVISTREAMINFOW; lSize: LONG): HResult; stdcall;
  1369. function AVIStreamInfoA (pavi: IAVIStream; var psi: TAVISTREAMINFOA; lSize: LONG): HResult; stdcall;
  1370. function AVIStreamInfo(pavi: IAVIStream; var psi: TAVISTREAMINFO; lSize: LONG): HResult; stdcall;
  1371. function AVIStreamFindSample(pavi: IAVIStream; lPos: LONG; lFlags: LONG): LONG; stdcall;
  1372. function AVIStreamReadFormat(pavi: IAVIStream; lPos: LONG; lpFormat: PVOID; lpcbFormat: PLONG): HResult; stdcall;
  1373. function AVIStreamSetFormat(pavi: IAVIStream; lPos: LONG; lpFormat: PVOID; cbFormat: LONG): HResult; stdcall;
  1374. function AVIStreamReadData(pavi: IAVIStream; fcc: DWORD; lp: PVOID; lpcb: PLONG): HResult; stdcall;
  1375. function AVIStreamWriteData(pavi: IAVIStream; fcc: DWORD; lp: PVOID; cb: LONG): HResult; stdcall;
  1376. function AVIStreamRead(
  1377. pavi : IAVISTREAM;
  1378. lStart : LONG;
  1379. lSamples : LONG;
  1380. lpBuffer : PVOID;
  1381. cbBuffer : LONG;
  1382. plBytes : PLONG;
  1383. plSamples : PLONG
  1384. ): HResult; stdcall;
  1385. const
  1386. AVISTREAMREAD_CONVENIENT = -1;
  1387. function AVIStreamWrite(
  1388. pavi : IAVISTREAM;
  1389. lStart : LONG;
  1390. lSamples : LONG;
  1391. lpBuffer : PVOID;
  1392. cbBuffer : LONG;
  1393. dwFlags : DWORD;
  1394. plSampWritten : PLONG;
  1395. plBytesWritten : PLONG
  1396. ): HResult; stdcall;
  1397. // Right now, these just use AVIStreamInfo() to get information, then
  1398. // return some of it. Can they be more efficient?
  1399. function AVIStreamStart(pavi: IAVIStream): LONG; stdcall;
  1400. function AVIStreamLength(pavi: IAVIStream): LONG; stdcall;
  1401. function AVIStreamTimeToSample(pavi: IAVIStream; lTime: LONG): LONG; stdcall;
  1402. function AVIStreamSampleToTime(pavi: IAVIStream; lSample: LONG): LONG; stdcall;
  1403. function AVIStreamBeginStreaming(pavi: IAVIStream; lStart, lEnd: LONG; lRate: LONG): HResult; stdcall;
  1404. function AVIStreamEndStreaming(pavi: IAVIStream): HResult; stdcall;
  1405. {-- Helper functions for using IGetFrame -------------------------------------}
  1406. function AVIStreamGetFrameOpen(pavi: IAVIStream; lpbiWanted: PBitmapInfoHeader): IGetFrame; stdcall;
  1407. function AVIStreamGetFrame(pg: IGetFrame; lPos: LONG): PBitmapInfoHeader; stdcall;
  1408. function AVIStreamGetFrameClose(pg: IGetFrame): HResult; stdcall;
  1409. // !!! We need some way to place an advise on a stream....
  1410. // STDAPI AVIStreamHasChanged (PAVISTREAM pavi);
  1411. {-- Shortcut function --------------------------------------------------------}
  1412. function AVIStreamOpenFromFileA(var ppavi: IAVISTREAM; szFile: LPCSTR; fccType: DWORD;
  1413. lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall;
  1414. function AVIStreamOpenFromFileW(var ppavi: IAVISTREAM; szFile: LPCWSTR; fccType: DWORD;
  1415. lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall;
  1416. {$IFDEF UNICODE}
  1417. function AVIStreamOpenFromFile(var ppavi: IAVISTREAM; szFile: LPCWSTR; fccType: DWORD;
  1418. lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall;
  1419. {$ELSE}
  1420. function AVIStreamOpenFromFile(var ppavi: IAVISTREAM; szFile: LPCSTR; fccType: DWORD;
  1421. lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall;
  1422. {$ENDIF}
  1423. {-- Use to create disembodied streams ----------------------------------------}
  1424. function AVIStreamCreate(var ppavi: IAVISTREAM; lParam1, lParam2: LONG; pclsidHandler: PCLSID): HResult; stdcall;
  1425. // PHANDLER AVIAPI AVIGetHandler (PAVISTREAM pavi, PAVISTREAMHANDLER psh);
  1426. // PAVISTREAM AVIAPI AVIGetStream (PHANDLER p);
  1427. {-- Flags for AVIStreamFindSample --------------------------------------------}
  1428. const
  1429. FIND_DIR = $0000000F; // direction
  1430. FIND_NEXT = $00000001; // go forward
  1431. FIND_PREV = $00000004; // go backward
  1432. FIND_FROM_START = $00000008; // start at the logical beginning
  1433. FIND_TYPE = $000000F0; // type mask
  1434. FIND_KEY = $00000010; // find key frame.
  1435. FIND_ANY = $00000020; // find any (non-empty) sample
  1436. FIND_FORMAT = $00000040; // find format change
  1437. FIND_RET = $0000F000; // return mask
  1438. FIND_POS = $00000000; // return logical position
  1439. FIND_LENGTH = $00001000; // return logical size
  1440. FIND_OFFSET = $00002000; // return physical position
  1441. FIND_SIZE = $00003000; // return physical size
  1442. FIND_INDEX = $00004000; // return physical index position
  1443. {-- Stuff to support backward compat. ----------------------------------------}
  1444. function AVIStreamFindKeyFrame(var pavi: IAVISTREAM; lPos: LONG; lFlags: LONG): DWORD; stdcall; // AVIStreamFindSample
  1445. // Non-portable: this is alias for method name
  1446. // FindKeyFrame FindSample
  1447. function AVIStreamClose(pavi: IAVISTREAM): ULONG; stdcall; // AVIStreamRelease
  1448. function AVIFileClose(pfile: IAVIFILE): ULONG; stdcall; // AVIFileRelease
  1449. procedure AVIStreamInit; stdcall; // AVIFileInit
  1450. procedure AVIStreamExit; stdcall; // AVIFileExit
  1451. const
  1452. SEARCH_NEAREST = FIND_PREV;
  1453. SEARCH_BACKWARD = FIND_PREV;
  1454. SEARCH_FORWARD = FIND_NEXT;
  1455. SEARCH_KEY = FIND_KEY;
  1456. SEARCH_ANY = FIND_ANY;
  1457. {-- Helper macros ------------------------------------------------------------}
  1458. function AVIStreamSampleToSample(pavi1, pavi2: IAVISTREAM; l: LONG): LONG;
  1459. function AVIStreamNextSample(pavi: IAVISTREAM; l: LONG): LONG;
  1460. function AVIStreamPrevSample(pavi: IAVISTREAM; l: LONG): LONG;
  1461. function AVIStreamNearestSample(pavi: IAVISTREAM; l: LONG): LONG;
  1462. function AVIStreamNextKeyFrame(pavi: IAVISTREAM; l: LONG): LONG;
  1463. function AVIStreamPrevKeyFrame(pavi: IAVISTREAM; l: LONG): LONG;
  1464. function AVIStreamNearestKeyFrame(pavi: IAVISTREAM; l: LONG): LONG;
  1465. function AVIStreamIsKeyFrame(pavi: IAVISTREAM; l: LONG): BOOL;
  1466. function AVIStreamPrevSampleTime(pavi: IAVISTREAM; t: LONG): LONG;
  1467. function AVIStreamNextSampleTime(pavi: IAVISTREAM; t: LONG): LONG;
  1468. function AVIStreamNearestSampleTime(pavi: IAVISTREAM; t: LONG): LONG;
  1469. function AVIStreamNextKeyFrameTime(pavi: IAVISTREAM; t: LONG): LONG;
  1470. function AVIStreamPrevKeyFrameTime(pavi: IAVISTREAM; t: LONG): LONG;
  1471. function AVIStreamNearestKeyFrameTime(pavi: IAVISTREAM; t: LONG): LONG;
  1472. function AVIStreamStartTime(pavi: IAVISTREAM): LONG;
  1473. function AVIStreamLengthTime(pavi: IAVISTREAM): LONG;
  1474. function AVIStreamEnd(pavi: IAVISTREAM): LONG;
  1475. function AVIStreamEndTime(pavi: IAVISTREAM): LONG;
  1476. function AVIStreamSampleSize(pavi: IAVISTREAM; lPos: LONG; plSize: PLONG): LONG;
  1477. function AVIStreamFormatSize(pavi: IAVISTREAM; lPos: LONG; plSize: PLONG): HResult;
  1478. function AVIStreamDataSize(pavi: IAVISTREAM; fcc: DWORD; plSize: PLONG): HResult;
  1479. {== AVISave routines and structures ==========================================}
  1480. const
  1481. comptypeDIB = $20424944; // mmioFOURCC('D', 'I', 'B', ' ')
  1482. function AVIMakeCompressedStream(
  1483. var ppsCompressed : IAVISTREAM;
  1484. ppsSource : IAVISTREAM;
  1485. lpOptions : PAVICOMPRESSOPTIONS;
  1486. pclsidHandler : PCLSID
  1487. ): HResult; stdcall;
  1488. // Non-portable: uses variable number of params
  1489. // EXTERN_C HRESULT CDECL AVISaveA (LPCSTR szFile,
  1490. // CLSID FAR *pclsidHandler,
  1491. // AVISAVECALLBACK lpfnCallback,
  1492. // int nStreams,
  1493. // PAVISTREAM pfile,
  1494. // LPAVICOMPRESSOPTIONS lpOptions,
  1495. // ...);
  1496. function AVISaveVA(
  1497. szFile : LPCSTR;
  1498. pclsidHandler : PCLSID;
  1499. lpfnCallback : TAVISAVECALLBACK;
  1500. nStreams : int;
  1501. var ppavi : IAVISTREAM;
  1502. var plpOptions : PAVICOMPRESSOPTIONS
  1503. ): HResult; stdcall;
  1504. // Non-portable: uses variable number of params
  1505. // EXTERN_C HRESULT CDECL AVISaveW (LPCWSTR szFile,
  1506. // CLSID FAR *pclsidHandler,
  1507. // AVISAVECALLBACK lpfnCallback,
  1508. // int nStreams,
  1509. // PAVISTREAM pfile,
  1510. // LPAVICOMPRESSOPTIONS lpOptions,
  1511. // ...);
  1512. function AVISaveVW(
  1513. szFile : LPCWSTR;
  1514. pclsidHandler : PCLSID;
  1515. lpfnCallback : TAVISAVECALLBACK;
  1516. nStreams : int;
  1517. var ppavi : IAVISTREAM;
  1518. var plpOptions : PAVICOMPRESSOPTIONS
  1519. ): HResult; stdcall;
  1520. // #define AVISave AVISaveA
  1521. function AVISaveV(
  1522. szFile : LPCSTR;
  1523. pclsidHandler : PCLSID;
  1524. lpfnCallback : TAVISAVECALLBACK;
  1525. nStreams : int;
  1526. var ppavi : IAVISTREAM;
  1527. var plpOptions : PAVICOMPRESSOPTIONS
  1528. ): HResult; stdcall; // AVISaveVA
  1529. function AVISaveOptions(
  1530. hwnd : HWND;
  1531. uiFlags : UINT;
  1532. nStreams : int;
  1533. var ppavi : IAVISTREAM;
  1534. var plpOptions : PAVICOMPRESSOPTIONS
  1535. ): BOOL; stdcall;
  1536. function AVISaveOptionsFree(nStreams: int; var plpOptions: PAVICOMPRESSOPTIONS): HResult; stdcall;
  1537. {-- FLAGS FOR uiFlags --------------------------------------------------------}
  1538. // Same as the flags for ICCompressorChoose (see compman.h)
  1539. // These determine what the compression options dialog for video streams
  1540. // will look like.
  1541. function AVIBuildFilterW(lpszFilter: LPWSTR; cbFilter: LONG; fSaving: BOOL): HResult; stdcall;
  1542. function AVIBuildFilterA(lpszFilter: LPSTR; cbFilter: LONG; fSaving: BOOL): HResult; stdcall;
  1543. function AVIBuildFilter(lpszFilter: LPSTR; cbFilter: LONG; fSaving: BOOL): HResult; stdcall; // AVIBuildFilterA
  1544. function AVIMakeFileFromStreams(var ppfile: IAVIFILE; nStreams: int; var papStreams: IAVISTREAM): HResult; stdcall;
  1545. function AVIMakeStreamFromClipboard(cfFormat: UINT; hGlobal: THANDLE; var ppstream: IAVISTREAM): HResult; stdcall;
  1546. {-- Clipboard routines -------------------------------------------------------}
  1547. function AVIPutFileOnClipboard(pf: IAVIFILE): HResult; stdcall;
  1548. function AVIGetFromClipboard(var lppf: IAVIFILE): HResult; stdcall;
  1549. function AVIClearClipboard: HResult; stdcall;
  1550. {-- Editing routines ---------------------------------------------------------}
  1551. function CreateEditableStream(var ppsEditable: IAVISTREAM; psSource: IAVISTREAM): HResult; stdcall;
  1552. function EditStreamCut(pavi: IAVISTREAM; var plStart, plLength: LONG; var ppResult: IAVISTREAM): HResult; stdcall;
  1553. function EditStreamCopy(pavi: IAVISTREAM; var plStart, plLength: LONG; var ppResult: IAVISTREAM): HResult; stdcall;
  1554. function EditStreamPaste(pavi: IAVISTREAM; var plPos, plLength: LONG; pstream: IAVISTREAM; lStart, lEnd: LONG): HResult; stdcall;
  1555. function EditStreamClone(pavi: IAVISTREAM; var ppResult: IAVISTREAM): HResult; stdcall;
  1556. function EditStreamSetNameA(pavi: IAVISTREAM; lpszName: LPCSTR): HResult; stdcall;
  1557. function EditStreamSetNameW(pavi: IAVISTREAM; lpszName: LPCWSTR): HResult; stdcall;
  1558. function EditStreamSetInfoW(pavi: IAVISTREAM; lpInfo: PAVISTREAMINFOW; cbInfo: LONG): HResult; stdcall;
  1559. function EditStreamSetInfoA(pavi: IAVISTREAM; lpInfo: PAVISTREAMINFOA; cbInfo: LONG): HResult; stdcall;
  1560. function EditStreamSetInfo(pavi: IAVISTREAM; lpInfo: PAVISTREAMINFOA; cbInfo: LONG): HResult; stdcall; // EditStreamSetInfoA
  1561. function EditStreamSetName(pavi: IAVISTREAM; lpszName: LPCSTR): HResult; stdcall; // EditStreamSetNameA
  1562. {-- Error handling -----------------------------------------------------------}
  1563. const
  1564. AVIERR_OK = 0;
  1565. // !!! Questions to be answered:
  1566. // How can you get a string form of these errors?
  1567. // Which of these errors should be replaced by errors in SCODE.H?
  1568. const
  1569. AVIERR_UNSUPPORTED = $80044065; // MAKE_AVIERR(101)
  1570. AVIERR_BADFORMAT = $80044066; // MAKE_AVIERR(102)
  1571. AVIERR_MEMORY = $80044067; // MAKE_AVIERR(103)
  1572. AVIERR_INTERNAL = $80044068; // MAKE_AVIERR(104)
  1573. AVIERR_BADFLAGS = $80044069; // MAKE_AVIERR(105)
  1574. AVIERR_BADPARAM = $8004406A; // MAKE_AVIERR(106)
  1575. AVIERR_BADSIZE = $8004406B; // MAKE_AVIERR(107)
  1576. AVIERR_BADHANDLE = $8004406C; // MAKE_AVIERR(108)
  1577. AVIERR_FILEREAD = $8004406D; // MAKE_AVIERR(109)
  1578. AVIERR_FILEWRITE = $8004406E; // MAKE_AVIERR(110)
  1579. AVIERR_FILEOPEN = $8004406F; // MAKE_AVIERR(111)
  1580. AVIERR_COMPRESSOR = $80044070; // MAKE_AVIERR(112)
  1581. AVIERR_NOCOMPRESSOR = $80044071; // MAKE_AVIERR(113)
  1582. AVIERR_READONLY = $80044072; // MAKE_AVIERR(114)
  1583. AVIERR_NODATA = $80044073; // MAKE_AVIERR(115)
  1584. AVIERR_BUFFERTOOSMALL = $80044074; // MAKE_AVIERR(116)
  1585. AVIERR_CANTCOMPRESS = $80044075; // MAKE_AVIERR(117)
  1586. AVIERR_USERABORT = $800440C6; // MAKE_AVIERR(198)
  1587. AVIERR_ERROR = $800440C7; // MAKE_AVIERR(199)
  1588. {== MCIWnd - Window class for MCI objects ====================================}
  1589. //
  1590. // MCIWnd
  1591. //
  1592. // MCIWnd window class header file.
  1593. //
  1594. // the MCIWnd window class is a window class for controling MCI devices
  1595. // MCI devices include, wave files, midi files, AVI Video, cd audio,
  1596. // vcr, video disc, and others..
  1597. //
  1598. // to learn more about MCI and mci command sets see the
  1599. // "Microsoft Multimedia Programmers's guide" in the Win31 SDK
  1600. //
  1601. // the easiest use of the MCIWnd class is like so:
  1602. //
  1603. // hwnd = MCIWndCreate(hwndParent, hInstance, 0, "chimes.wav");
  1604. // ...
  1605. // MCIWndPlay(hwnd);
  1606. // MCIWndStop(hwnd);
  1607. // MCIWndPause(hwnd);
  1608. // ....
  1609. // MCIWndDestroy(hwnd);
  1610. //
  1611. // this will create a window with a play/pause, stop and a playbar
  1612. // and start the wave file playing.
  1613. //
  1614. // mciwnd.h defines macros for all the most common MCI commands, but
  1615. // any string command can be used if needed.
  1616. //
  1617. // Note: unlike the mciSendString() API, no alias or file name needs
  1618. // to be specifed, since the device to use is implied by the window handle.
  1619. //
  1620. // MCIWndSendString(hwnd, "setaudio stream to 2");
  1621. //
  1622. // (C) Copyright Microsoft Corp. 1991-1995. All rights reserved.
  1623. //
  1624. // WIN32:
  1625. //
  1626. // MCIWnd supports both ansi and unicode interfaces. For any message that
  1627. // takes or returns a text string, two versions of the message are defined,
  1628. // appended with A or W for Ansi or Wide Char. The message or api itself
  1629. // is defined to be one or other of these depending on whether you have
  1630. // UNICODE defined in your application.
  1631. // Thus for the api MCIWndCreate, there are in fact two apis,
  1632. // MCIWndCreateA and MCIWndCreateW. If you call MCIWndCreate, this will be
  1633. // re-routed to MCIWndCreateA unless UNICODE is defined when building your
  1634. // application. In any one application, you can mix calls to the
  1635. // Ansi and Unicode entrypoints.
  1636. //
  1637. // If you use SendMessage instead of the macros below such as MCIWndOpen(),
  1638. // you will see that the messages have changed for WIN32, to support Ansi
  1639. // and Unicode entrypoints. In particular, MCI_OPEN has been replaced by
  1640. // MCWNDM_OPENA, or MCIWNDM_OPENW (MCIWNDM_OPEN is defined to be one or
  1641. // other of these).
  1642. //
  1643. // Also, note that the WIN32 implementation of MCIWnd uses UNICODE
  1644. // so all apis and messages supporting ANSI strings do so by mapping them
  1645. // UNICODE strings and then calling the corresponding UNICODE entrypoint.
  1646. //
  1647. function MCIWndSM(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): DWORD;
  1648. const
  1649. MCIWND_WINDOW_CLASS = 'MCIWndClass' ;
  1650. function MCIWndCreateA(hwndParent: HWND; hInstance: HINST; dwStyle: DWORd; szFile: LPCSTR): HWND; cdecl;
  1651. function MCIWndCreateW(hwndParent: HWND; hInstance: HINST; dwStyle: DWORd; szFile: LPCWSTR): HWND; cdecl;
  1652. function MCIWndCreate(hwndParent: HWND; hInstance: HINST; dwStyle: DWORd; szFile: LPCSTR): HWND; cdecl; // MCIWndCreateA
  1653. function MCIWndRegisterClass: BOOL; cdecl;
  1654. {-- Flags for the MCIWndOpen command -----------------------------------------}
  1655. const
  1656. MCIWNDOPENF_NEW = $0001; // open a new file
  1657. {-- Window styles ------------------------------------------------------------}
  1658. MCIWNDF_NOAUTOSIZEWINDOW = $0001; // when movie size changes
  1659. MCIWNDF_NOPLAYBAR = $0002; // no toolbar
  1660. MCIWNDF_NOAUTOSIZEMOVIE = $0004; // when window size changes
  1661. MCIWNDF_NOMENU = $0008; // no popup menu from RBUTTONDOWN
  1662. MCIWNDF_SHOWNAME = $0010; // show name in caption
  1663. MCIWNDF_SHOWPOS = $0020; // show position in caption
  1664. MCIWNDF_SHOWMODE = $0040; // show mode in caption
  1665. MCIWNDF_SHOWALL = $0070; // show all
  1666. MCIWNDF_NOTIFYMODE = $0100; // tell parent of mode change
  1667. MCIWNDF_NOTIFYPOS = $0200; // tell parent of pos change
  1668. MCIWNDF_NOTIFYSIZE = $0400; // tell parent of size change
  1669. MCIWNDF_NOTIFYERROR = $1000; // tell parent of an error
  1670. MCIWNDF_NOTIFYALL = $1F00; // tell all
  1671. MCIWNDF_NOTIFYANSI = $0080;
  1672. // The MEDIA notification includes a text string.
  1673. // To receive notifications in ANSI instead of unicode set the
  1674. // MCIWNDF_NOTIFYANSI style bit. The macro below includes this bit
  1675. // by default unless you define UNICODE in your application.
  1676. MCIWNDF_NOTIFYMEDIAA = $0880; // tell parent of media change
  1677. MCIWNDF_NOTIFYMEDIAW = $0800; // tell parent of media change
  1678. MCIWNDF_NOTIFYMEDIA = MCIWNDF_NOTIFYMEDIAA;
  1679. MCIWNDF_RECORD = $2000; // Give a record button
  1680. MCIWNDF_NOERRORDLG = $4000; // Show Error Dlgs for MCI cmds?
  1681. MCIWNDF_NOOPEN = $8000; // Don't allow user to open things
  1682. {-- Can macros ---------------------------------------------------------------}
  1683. function MCIWndCanPlay(hwnd: HWND): BOOL;
  1684. function MCIWndCanRecord(hwnd: HWND): BOOL;
  1685. function MCIWndCanSave(hwnd: HWND): BOOL;
  1686. function MCIWndCanWindow(hwnd: HWND): BOOL;
  1687. function MCIWndCanEject(hwnd: HWND): BOOL;
  1688. function MCIWndCanConfig(hwnd: HWND): BOOL;
  1689. function MCIWndPaletteKick(hwnd: HWND): BOOL;
  1690. function MCIWndSave(hwnd: HWND; szFile: LPCSTR): DWORD;
  1691. function MCIWndSaveDialog(hwnd: HWND): DWORD;
  1692. // If you dont give a device it will use the current device....
  1693. function MCIWndNew(hwnd: HWND; lp: PVOID): DWORD;
  1694. function MCIWndRecord(hwnd: HWND): DWORD;
  1695. function MCIWndOpen(hwnd: HWND; sz: LPCSTR; f: BOOL): DWORD;
  1696. function MCIWndOpenDialog(hwnd: HWND): DWORD;
  1697. function MCIWndClose(hwnd: HWND): DWORD;
  1698. function MCIWndPlay(hwnd: HWND): DWORD;
  1699. function MCIWndStop(hwnd: HWND): DWORD;
  1700. function MCIWndPause(hwnd: HWND): DWORD;
  1701. function MCIWndResume(hwnd: HWND): DWORD;
  1702. function MCIWndSeek(hwnd: HWND; lPos: DWORD): DWORD;
  1703. function MCIWndEject(hwnd: HWND): DWORD;
  1704. function MCIWndHome(hwnd: HWND): DWORD;
  1705. function MCIWndEnd(hwnd: HWND): DWORD;
  1706. function MCIWndGetSource(hwnd: HWND; prc: PRECT): DWORD;
  1707. function MCIWndPutSource(hwnd: HWND; prc: PRECT): DWORD;
  1708. function MCIWndGetDest(hwnd: HWND; prc: PRECT): DWORD;
  1709. function MCIWndPutDest(hwnd: HWND; prc: PRECT): DWORD;
  1710. function MCIWndPlayReverse(hwnd: HWND): DWORD;
  1711. function MCIWndPlayFrom(hwnd: HWND; lPos: DWORD): DWORD;
  1712. function MCIWndPlayTo(hwnd: HWND; lPos: DWORD): DWORD;
  1713. function MCIWndPlayFromTo(hwnd: HWND; lStart, lEnd: DWORD): DWORD;
  1714. function MCIWndGetDeviceID(hwnd: HWND): UINT;
  1715. function MCIWndGetAlias(hwnd: HWND): UINT;
  1716. function MCIWndGetMode(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
  1717. function MCIWndGetPosition(hwnd: HWND): DWORD;
  1718. function MCIWndGetPositionString(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
  1719. function MCIWndGetStart(hwnd: HWND): DWORD;
  1720. function MCIWndGetLength(hwnd: HWND): DWORD;
  1721. function MCIWndGetEnd(hwnd: HWND): DWORD;
  1722. function MCIWndStep(hwnd: HWND; n: DWORD): DWORD;
  1723. procedure MCIWndDestroy(hwnd: HWND);
  1724. procedure MCIWndSetZoom(hwnd: HWND; iZoom: UINT);
  1725. function MCIWndGetZoom(hwnd: HWND): UINT;
  1726. function MCIWndSetVolume(hwnd: HWND; iVol: UINT): DWORD;
  1727. function MCIWndGetVolume(hwnd: HWND): DWORD;
  1728. function MCIWndSetSpeed(hwnd: HWND; iSpeed: UINT): DWORD;
  1729. function MCIWndGetSpeed(hwnd: HWND): DWORD;
  1730. function MCIWndSetTimeFormat(hwnd: HWND; lp: LPCSTR): DWORD;
  1731. function MCIWndGetTimeFormat(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
  1732. procedure MCIWndValidateMedia(hwnd: HWND);
  1733. procedure MCIWndSetRepeat(hwnd: HWND; f: BOOL);
  1734. function MCIWndGetRepeat(hwnd: HWND): BOOL;
  1735. function MCIWndUseFrames(hwnd: HWND): DWORD;
  1736. function MCIWndUseTime(hwnd: HWND): DWORD;
  1737. procedure MCIWndSetActiveTimer(hwnd: HWND; active: UINT);
  1738. procedure MCIWndSetInactiveTimer(hwnd: HWND; inactive: UINT);
  1739. procedure MCIWndSetTimers(hwnd: HWND; active, inactive: UINT);
  1740. function MCIWndGetActiveTimer(hwnd: HWND): UINT;
  1741. function MCIWndGetInactiveTimer(hwnd: HWND): UINT;
  1742. function MCIWndRealize(hwnd: HWND; fBkgnd: BOOL): DWORD;
  1743. function MCIWndSendString(hwnd: HWND; sz: LPCSTR): DWORD;
  1744. function MCIWndReturnString(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
  1745. function MCIWndGetError(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
  1746. // #define MCIWndActivate(hwnd, f) (void)MCIWndSM(hwnd, WM_ACTIVATE, (WPARAM)(BOOL)(f), 0)
  1747. function MCIWndGetPalette(hwnd: HWND): HPALETTE;
  1748. function MCIWndSetPalette(hwnd: HWND; hpal: HPALETTE): DWORD;
  1749. function MCIWndGetFileName(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
  1750. function MCIWndGetDevice(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
  1751. function MCIWndGetStyles(hwnd: HWND): UINT;
  1752. function MCIWndChangeStyles(hwnd: HWND; mask: UINT; value: DWORD): DWORD;
  1753. type
  1754. PUnknown = ^IUnknown;
  1755. function MCIWndOpenInterface(hwnd: HWND; pUnk: PUnknown): DWORD;
  1756. function MCIWndSetOwner(hwnd: HWND; hwndP: HWND): DWORD;
  1757. {-- Messages an app will send to MCIWND --------------------------------------}
  1758. // all the text-related messages are defined out of order above (they need
  1759. // to be defined before the MCIWndOpen() macros
  1760. const
  1761. MCIWNDM_GETDEVICEID = WM_USER + 100;
  1762. MCIWNDM_GETSTART = WM_USER + 103;
  1763. MCIWNDM_GETLENGTH = WM_USER + 104;
  1764. MCIWNDM_GETEND = WM_USER + 105;
  1765. MCIWNDM_EJECT = WM_USER + 107;
  1766. MCIWNDM_SETZOOM = WM_USER + 108;
  1767. MCIWNDM_GETZOOM = WM_USER + 109;
  1768. MCIWNDM_SETVOLUME = WM_USER + 110;
  1769. MCIWNDM_GETVOLUME = WM_USER + 111;
  1770. MCIWNDM_SETSPEED = WM_USER + 112;
  1771. MCIWNDM_GETSPEED = WM_USER + 113;
  1772. MCIWNDM_SETREPEAT = WM_USER + 114;
  1773. MCIWNDM_GETREPEAT = WM_USER + 115;
  1774. MCIWNDM_REALIZE = WM_USER + 118;
  1775. MCIWNDM_VALIDATEMEDIA = WM_USER + 121;
  1776. MCIWNDM_PLAYFROM = WM_USER + 122;
  1777. MCIWNDM_PLAYTO = WM_USER + 123;
  1778. MCIWNDM_GETPALETTE = WM_USER + 126;
  1779. MCIWNDM_SETPALETTE = WM_USER + 127;
  1780. MCIWNDM_SETTIMERS = WM_USER + 129;
  1781. MCIWNDM_SETACTIVETIMER = WM_USER + 130;
  1782. MCIWNDM_SETINACTIVETIMER = WM_USER + 131;
  1783. MCIWNDM_GETACTIVETIMER = WM_USER + 132;
  1784. MCIWNDM_GETINACTIVETIMER = WM_USER + 133;
  1785. MCIWNDM_CHANGESTYLES = WM_USER + 135;
  1786. MCIWNDM_GETSTYLES = WM_USER + 136;
  1787. MCIWNDM_GETALIAS = WM_USER + 137;
  1788. MCIWNDM_PLAYREVERSE = WM_USER + 139;
  1789. MCIWNDM_GET_SOURCE = WM_USER + 140;
  1790. MCIWNDM_PUT_SOURCE = WM_USER + 141;
  1791. MCIWNDM_GET_DEST = WM_USER + 142;
  1792. MCIWNDM_PUT_DEST = WM_USER + 143;
  1793. MCIWNDM_CAN_PLAY = WM_USER + 144;
  1794. MCIWNDM_CAN_WINDOW = WM_USER + 145;
  1795. MCIWNDM_CAN_RECORD = WM_USER + 146;
  1796. MCIWNDM_CAN_SAVE = WM_USER + 147;
  1797. MCIWNDM_CAN_EJECT = WM_USER + 148;
  1798. MCIWNDM_CAN_CONFIG = WM_USER + 149;
  1799. MCIWNDM_PALETTEKICK = WM_USER + 150;
  1800. MCIWNDM_OPENINTERFACE = WM_USER + 151;
  1801. MCIWNDM_SETOWNER = WM_USER + 152;
  1802. {-- Define both A and W messages ---------------------------------------------}
  1803. MCIWNDM_SENDSTRINGA = WM_USER + 101;
  1804. MCIWNDM_GETPOSITIONA = WM_USER + 102;
  1805. MCIWNDM_GETMODEA = WM_USER + 106;
  1806. MCIWNDM_SETTIMEFORMATA = WM_USER + 119;
  1807. MCIWNDM_GETTIMEFORMATA = WM_USER + 120;
  1808. MCIWNDM_GETFILENAMEA = WM_USER + 124;
  1809. MCIWNDM_GETDEVICEA = WM_USER + 125;
  1810. MCIWNDM_GETERRORA = WM_USER + 128;
  1811. MCIWNDM_NEWA = WM_USER + 134;
  1812. MCIWNDM_RETURNSTRINGA = WM_USER + 138;
  1813. MCIWNDM_OPENA = WM_USER + 153;
  1814. MCIWNDM_SENDSTRINGW = WM_USER + 201;
  1815. MCIWNDM_GETPOSITIONW = WM_USER + 202;
  1816. MCIWNDM_GETMODEW = WM_USER + 206;
  1817. MCIWNDM_SETTIMEFORMATW = WM_USER + 219;
  1818. MCIWNDM_GETTIMEFORMATW = WM_USER + 220;
  1819. MCIWNDM_GETFILENAMEW = WM_USER + 224;
  1820. MCIWNDM_GETDEVICEW = WM_USER + 225;
  1821. MCIWNDM_GETERRORW = WM_USER + 228;
  1822. MCIWNDM_NEWW = WM_USER + 234;
  1823. MCIWNDM_RETURNSTRINGW = WM_USER + 238;
  1824. MCIWNDM_OPENW = WM_USER + 252;
  1825. {-- Map defaults to A --------------------------------------------------------}
  1826. MCIWNDM_SENDSTRING = MCIWNDM_SENDSTRINGA;
  1827. MCIWNDM_GETPOSITION = MCIWNDM_GETPOSITIONA;
  1828. MCIWNDM_GETMODE = MCIWNDM_GETMODEA;
  1829. MCIWNDM_SETTIMEFORMAT = MCIWNDM_SETTIMEFORMATA;
  1830. MCIWNDM_GETTIMEFORMAT = MCIWNDM_GETTIMEFORMATA;
  1831. MCIWNDM_GETFILENAME = MCIWNDM_GETFILENAMEA;
  1832. MCIWNDM_GETDEVICE = MCIWNDM_GETDEVICEA;
  1833. MCIWNDM_GETERROR = MCIWNDM_GETERRORA;
  1834. MCIWNDM_NEW = MCIWNDM_NEWA;
  1835. MCIWNDM_RETURNSTRING = MCIWNDM_RETURNSTRINGA;
  1836. MCIWNDM_OPEN = MCIWNDM_OPENA;
  1837. // note that the source text for MCIWND will thus contain
  1838. // support for eg MCIWNDM_SENDSTRING (both the 16-bit entrypoint and
  1839. // in win32 mapped to MCIWNDM_SENDSTRINGW), and MCIWNDM_SENDSTRINGA (the
  1840. // win32 ansi thunk).
  1841. {-- Messages MCIWND will send to an app --------------------------------------}
  1842. const
  1843. MCIWNDM_NOTIFYMODE = WM_USER + 200; // wp = hwnd, lp = mode
  1844. MCIWNDM_NOTIFYPOS = WM_USER + 201; // wp = hwnd, lp = pos
  1845. MCIWNDM_NOTIFYSIZE = WM_USER + 202; // wp = hwnd
  1846. MCIWNDM_NOTIFYMEDIA = WM_USER + 203; // wp = hwnd, lp = fn
  1847. MCIWNDM_NOTIFYERROR = WM_USER + 205; // wp = hwnd, lp = error
  1848. {-- Special seek values for START and END ------------------------------------}
  1849. MCIWND_START = dword(-1) ;
  1850. MCIWND_END = dword(-2) ;
  1851. {== VIDEO - Video capture driver interface ===================================}
  1852. type
  1853. HVIDEO = THandle;
  1854. PHVIDEO = ^HVIDEO;
  1855. {-- Error return values ------------------------------------------------------}
  1856. const
  1857. DV_ERR_OK = 0; // No error
  1858. DV_ERR_BASE = 1; // Error Base
  1859. DV_ERR_NONSPECIFIC = DV_ERR_BASE;
  1860. DV_ERR_BADFORMAT = DV_ERR_BASE + 1; // unsupported video format
  1861. DV_ERR_STILLPLAYING = DV_ERR_BASE + 2; // still something playing
  1862. DV_ERR_UNPREPARED = DV_ERR_BASE + 3; // header not prepared
  1863. DV_ERR_SYNC = DV_ERR_BASE + 4; // device is synchronous
  1864. DV_ERR_TOOMANYCHANNELS = DV_ERR_BASE + 5; // number of channels exceeded
  1865. DV_ERR_NOTDETECTED = DV_ERR_BASE + 6; // HW not detected
  1866. DV_ERR_BADINSTALL = DV_ERR_BASE + 7; // Can not get Profile
  1867. DV_ERR_CREATEPALETTE = DV_ERR_BASE + 8;
  1868. DV_ERR_SIZEFIELD = DV_ERR_BASE + 9;
  1869. DV_ERR_PARAM1 = DV_ERR_BASE + 10;
  1870. DV_ERR_PARAM2 = DV_ERR_BASE + 11;
  1871. DV_ERR_CONFIG1 = DV_ERR_BASE + 12;
  1872. DV_ERR_CONFIG2 = DV_ERR_BASE + 13;
  1873. DV_ERR_FLAGS = DV_ERR_BASE + 14;
  1874. DV_ERR_13 = DV_ERR_BASE + 15;
  1875. DV_ERR_NOTSUPPORTED = DV_ERR_BASE + 16; // function not suported
  1876. DV_ERR_NOMEM = DV_ERR_BASE + 17; // out of memory
  1877. DV_ERR_ALLOCATED = DV_ERR_BASE + 18; // device is allocated
  1878. DV_ERR_BADDEVICEID = DV_ERR_BASE + 19;
  1879. DV_ERR_INVALHANDLE = DV_ERR_BASE + 20;
  1880. DV_ERR_BADERRNUM = DV_ERR_BASE + 21;
  1881. DV_ERR_NO_BUFFERS = DV_ERR_BASE + 22; // out of buffers
  1882. DV_ERR_MEM_CONFLICT = DV_ERR_BASE + 23; // Mem conflict detected
  1883. DV_ERR_IO_CONFLICT = DV_ERR_BASE + 24; // I/O conflict detected
  1884. DV_ERR_DMA_CONFLICT = DV_ERR_BASE + 25; // DMA conflict detected
  1885. DV_ERR_INT_CONFLICT = DV_ERR_BASE + 26; // Interrupt conflict detected
  1886. DV_ERR_PROTECT_ONLY = DV_ERR_BASE + 27; // Can not run in standard mode
  1887. DV_ERR_LASTERROR = DV_ERR_BASE + 27;
  1888. DV_ERR_USER_MSG = DV_ERR_BASE + 1000; // Hardware specific errors
  1889. {-- Callback messages --------------------------------------------------------}
  1890. // Note that the values for all installable driver callback messages are
  1891. // identical, (ie. MM_DRVM_DATA has the same value for capture drivers,
  1892. // installable video codecs, and the audio compression manager).
  1893. const
  1894. DV_VM_OPEN = MM_DRVM_OPEN; // Obsolete messages
  1895. DV_VM_CLOSE = MM_DRVM_CLOSE;
  1896. DV_VM_DATA = MM_DRVM_DATA;
  1897. DV_VM_ERROR = MM_DRVM_ERROR;
  1898. {== Structures ===============================================================}
  1899. {-- Video data block header --------------------------------------------------}
  1900. type
  1901. PVIDEOHDR = ^TVIDEOHDR;
  1902. TVIDEOHDR = record
  1903. lpData : PBYTE; // pointer to locked data buffer
  1904. dwBufferLength : DWORD; // Length of data buffer
  1905. dwBytesUsed : DWORD; // Bytes actually used
  1906. dwTimeCaptured : DWORD; // Milliseconds from start of stream
  1907. dwUser : DWORD; // for client's use
  1908. dwFlags : DWORD; // assorted flags (see defines)
  1909. dwReserved : array[0..3] of DWORD; // reserved for driver
  1910. end;
  1911. {-- dwFlags field of VIDEOHDR ------------------------------------------------}
  1912. const
  1913. VHDR_DONE = $00000001; // Done bit
  1914. VHDR_PREPARED = $00000002; // Set if this header has been prepared
  1915. VHDR_INQUEUE = $00000004; // Reserved for driver
  1916. VHDR_KEYFRAME = $00000008; // Key Frame
  1917. {-- Channel capabilities structure -------------------------------------------}
  1918. type
  1919. PCHANNEL_CAPS = ^TCHANNEL_CAPS;
  1920. TCHANNEL_CAPS = record
  1921. dwFlags : DWORD; // Capability flags
  1922. dwSrcRectXMod : DWORD; // Granularity of src rect in x
  1923. dwSrcRectYMod : DWORD; // Granularity of src rect in y
  1924. dwSrcRectWidthMod : DWORD; // Granularity of src rect width
  1925. dwSrcRectHeightMod : DWORD; // Granularity of src rect height
  1926. dwDstRectXMod : DWORD; // Granularity of dst rect in x
  1927. dwDstRectYMod : DWORD; // Granularity of dst rect in y
  1928. dwDstRectWidthMod : DWORD; // Granularity of dst rect width
  1929. dwDstRectHeightMod : DWORD; // Granularity of dst rect height
  1930. end;
  1931. {-- dwFlags of CHANNEL_CAPS --------------------------------------------------}
  1932. const
  1933. VCAPS_OVERLAY = $00000001; // overlay channel
  1934. VCAPS_SRC_CAN_CLIP = $00000002; // src rect can clip
  1935. VCAPS_DST_CAN_CLIP = $00000004; // dst rect can clip
  1936. VCAPS_CAN_SCALE = $00000008; // allows src != dst
  1937. {== API flags ================================================================}
  1938. {-- Types of channels to open with the videoOpen function --------------------}
  1939. const
  1940. VIDEO_EXTERNALIN = $0001;
  1941. VIDEO_EXTERNALOUT = $0002;
  1942. VIDEO_IN = $0004;
  1943. VIDEO_OUT = $0008;
  1944. {-- Is a driver dialog available for this channel ----------------------------}
  1945. VIDEO_DLG_QUERY = $0010;
  1946. {-- videoConfigure (both GET and SET) ----------------------------------------}
  1947. VIDEO_CONFIGURE_QUERY = $8000;
  1948. {-- videoConfigure (SET only) ------------------------------------------------}
  1949. VIDEO_CONFIGURE_SET = $1000;
  1950. {-- videoConfigure (GET only) ------------------------------------------------}
  1951. VIDEO_CONFIGURE_GET = $2000;
  1952. VIDEO_CONFIGURE_QUERYSIZE = $0001;
  1953. VIDEO_CONFIGURE_CURRENT = $0010;
  1954. VIDEO_CONFIGURE_NOMINAL = $0020;
  1955. VIDEO_CONFIGURE_MIN = $0040;
  1956. VIDEO_CONFIGURE_MAX = $0080;
  1957. {== Configure messages =======================================================}
  1958. DVM_USER = $4000;
  1959. DVM_CONFIGURE_START = $1000;
  1960. DVM_CONFIGURE_END = $1FFF;
  1961. DVM_PALETTE = DVM_CONFIGURE_START + 1;
  1962. DVM_FORMAT = DVM_CONFIGURE_START + 2;
  1963. DVM_PALETTERGB555 = DVM_CONFIGURE_START + 3;
  1964. DVM_SRC_RECT = DVM_CONFIGURE_START + 4;
  1965. DVM_DST_RECT = DVM_CONFIGURE_START + 5;
  1966. {== AVICAP - Window class for AVI capture ====================================}
  1967. function AVICapSM(hwnd: HWND; m: UINT; w: WPARAM; l: LPARAM): DWORD;
  1968. {-- Window messages WM_CAP... which can be sent to an AVICAP window ----------}
  1969. // UNICODE
  1970. //
  1971. // The Win32 version of AVICAP on NT supports UNICODE applications:
  1972. // for each API or message that takes a char or string parameter, there are
  1973. // two versions, ApiNameA and ApiNameW. The default name ApiName is #defined
  1974. // to one or other depending on whether UNICODE is defined. Apps can call
  1975. // the A and W apis directly, and mix them.
  1976. //
  1977. // The 32-bit AVICAP on NT uses unicode exclusively internally.
  1978. // ApiNameA() will be implemented as a call to ApiNameW() together with
  1979. // translation of strings.
  1980. // Defines start of the message range
  1981. const
  1982. WM_CAP_START = WM_USER;
  1983. WM_CAP_UNICODE_START = WM_USER + 100;
  1984. WM_CAP_GET_CAPSTREAMPTR = WM_CAP_START + 1;
  1985. WM_CAP_SET_CALLBACK_ERRORW = WM_CAP_UNICODE_START + 2;
  1986. WM_CAP_SET_CALLBACK_STATUSW = WM_CAP_UNICODE_START + 3;
  1987. WM_CAP_SET_CALLBACK_ERRORA = WM_CAP_START + 2;
  1988. WM_CAP_SET_CALLBACK_STATUSA = WM_CAP_START + 3;
  1989. WM_CAP_SET_CALLBACK_ERROR = WM_CAP_SET_CALLBACK_ERRORA;
  1990. WM_CAP_SET_CALLBACK_STATUS = WM_CAP_SET_CALLBACK_STATUSA;
  1991. WM_CAP_SET_CALLBACK_YIELD = WM_CAP_START + 4;
  1992. WM_CAP_SET_CALLBACK_FRAME = WM_CAP_START + 5;
  1993. WM_CAP_SET_CALLBACK_VIDEOSTREAM = WM_CAP_START + 6;
  1994. WM_CAP_SET_CALLBACK_WAVESTREAM = WM_CAP_START + 7;
  1995. WM_CAP_GET_USER_DATA = WM_CAP_START + 8;
  1996. WM_CAP_SET_USER_DATA = WM_CAP_START + 9;
  1997. WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10;
  1998. WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11;
  1999. WM_CAP_DRIVER_GET_NAMEA = WM_CAP_START + 12;
  2000. WM_CAP_DRIVER_GET_VERSIONA = WM_CAP_START + 13;
  2001. WM_CAP_DRIVER_GET_NAMEW = WM_CAP_UNICODE_START + 12;
  2002. WM_CAP_DRIVER_GET_VERSIONW = WM_CAP_UNICODE_START + 13;
  2003. WM_CAP_DRIVER_GET_NAME = WM_CAP_DRIVER_GET_NAMEA;
  2004. WM_CAP_DRIVER_GET_VERSION = WM_CAP_DRIVER_GET_VERSIONA;
  2005. WM_CAP_DRIVER_GET_CAPS = WM_CAP_START + 14;
  2006. WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20;
  2007. WM_CAP_FILE_GET_CAPTURE_FILEA = WM_CAP_START + 21;
  2008. WM_CAP_FILE_SAVEASA = WM_CAP_START + 23;
  2009. WM_CAP_FILE_SAVEDIBA = WM_CAP_START + 25;
  2010. WM_CAP_FILE_SET_CAPTURE_FILEW = WM_CAP_UNICODE_START + 20;
  2011. WM_CAP_FILE_GET_CAPTURE_FILEW = WM_CAP_UNICODE_START + 21;
  2012. WM_CAP_FILE_SAVEASW = WM_CAP_UNICODE_START + 23;
  2013. WM_CAP_FILE_SAVEDIBW = WM_CAP_UNICODE_START + 25;
  2014. WM_CAP_FILE_SET_CAPTURE_FILE = WM_CAP_FILE_SET_CAPTURE_FILEA;
  2015. WM_CAP_FILE_GET_CAPTURE_FILE = WM_CAP_FILE_GET_CAPTURE_FILEA;
  2016. WM_CAP_FILE_SAVEAS = WM_CAP_FILE_SAVEASA;
  2017. WM_CAP_FILE_SAVEDIB = WM_CAP_FILE_SAVEDIBA;
  2018. // out of order to save on ifdefs
  2019. WM_CAP_FILE_ALLOCATE = WM_CAP_START + 22;
  2020. WM_CAP_FILE_SET_INFOCHUNK = WM_CAP_START + 24;
  2021. WM_CAP_EDIT_COPY = WM_CAP_START + 30;
  2022. WM_CAP_SET_AUDIOFORMAT = WM_CAP_START + 35;
  2023. WM_CAP_GET_AUDIOFORMAT = WM_CAP_START + 36;
  2024. WM_CAP_DLG_VIDEOFORMAT = WM_CAP_START + 41;
  2025. WM_CAP_DLG_VIDEOSOURCE = WM_CAP_START + 42;
  2026. WM_CAP_DLG_VIDEODISPLAY = WM_CAP_START + 43;
  2027. WM_CAP_GET_VIDEOFORMAT = WM_CAP_START + 44;
  2028. WM_CAP_SET_VIDEOFORMAT = WM_CAP_START + 45;
  2029. WM_CAP_DLG_VIDEOCOMPRESSION = WM_CAP_START + 46;
  2030. WM_CAP_SET_PREVIEW = WM_CAP_START + 50;
  2031. WM_CAP_SET_OVERLAY = WM_CAP_START + 51;
  2032. WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52;
  2033. WM_CAP_SET_SCALE = WM_CAP_START + 53;
  2034. WM_CAP_GET_STATUS = WM_CAP_START + 54;
  2035. WM_CAP_SET_SCROLL = WM_CAP_START + 55;
  2036. WM_CAP_GRAB_FRAME = WM_CAP_START + 60;
  2037. WM_CAP_GRAB_FRAME_NOSTOP = WM_CAP_START + 61;
  2038. WM_CAP_SEQUENCE = WM_CAP_START + 62;
  2039. WM_CAP_SEQUENCE_NOFILE = WM_CAP_START + 63;
  2040. WM_CAP_SET_SEQUENCE_SETUP = WM_CAP_START + 64;
  2041. WM_CAP_GET_SEQUENCE_SETUP = WM_CAP_START + 65;
  2042. WM_CAP_SET_MCI_DEVICEA = WM_CAP_START + 66;
  2043. WM_CAP_GET_MCI_DEVICEA = WM_CAP_START + 67;
  2044. WM_CAP_SET_MCI_DEVICEW = WM_CAP_UNICODE_START + 66;
  2045. WM_CAP_GET_MCI_DEVICEW = WM_CAP_UNICODE_START + 67;
  2046. WM_CAP_SET_MCI_DEVICE = WM_CAP_SET_MCI_DEVICEA;
  2047. WM_CAP_GET_MCI_DEVICE = WM_CAP_GET_MCI_DEVICEA;
  2048. WM_CAP_STOP = WM_CAP_START + 68;
  2049. WM_CAP_ABORT = WM_CAP_START + 69;
  2050. WM_CAP_SINGLE_FRAME_OPEN = WM_CAP_START + 70;
  2051. WM_CAP_SINGLE_FRAME_CLOSE = WM_CAP_START + 71;
  2052. WM_CAP_SINGLE_FRAME = WM_CAP_START + 72;
  2053. WM_CAP_PAL_OPENA = WM_CAP_START + 80;
  2054. WM_CAP_PAL_SAVEA = WM_CAP_START + 81;
  2055. WM_CAP_PAL_OPENW = WM_CAP_UNICODE_START + 80;
  2056. WM_CAP_PAL_SAVEW = WM_CAP_UNICODE_START + 81;
  2057. WM_CAP_PAL_OPEN = WM_CAP_PAL_OPENA;
  2058. WM_CAP_PAL_SAVE = WM_CAP_PAL_SAVEA;
  2059. WM_CAP_PAL_PASTE = WM_CAP_START + 82;
  2060. WM_CAP_PAL_AUTOCREATE = WM_CAP_START + 83;
  2061. WM_CAP_PAL_MANUALCREATE = WM_CAP_START + 84;
  2062. // Following added post VFW 1.1
  2063. WM_CAP_SET_CALLBACK_CAPCONTROL = WM_CAP_START + 85;
  2064. // Defines end of the message range
  2065. WM_CAP_UNICODE_END = WM_CAP_PAL_SAVEW;
  2066. WM_CAP_END = WM_CAP_UNICODE_END;
  2067. {-- Callback definitions -----------------------------------------------------}
  2068. type
  2069. TCAPYIELDCALLBACK = function(hWnd: HWND): DWORD; stdcall;
  2070. TCAPSTATUSCALLBACKW = function(hWnd: HWND; nID: int; lpsz: LPCWSTR): DWORD; stdcall;
  2071. TCAPERRORCALLBACKW = function(hWnd: HWND; nID: int; lpsz: LPCWSTR): DWORD; stdcall;
  2072. TCAPSTATUSCALLBACKA = function(hWnd: HWND; nID: int; lpsz: LPCSTR): DWORD; stdcall;
  2073. TCAPERRORCALLBACKA = function(hWnd: HWND; nID: int; lpsz: LPCSTR): DWORD; stdcall;
  2074. TCAPSTATUSCALLBACK = TCAPSTATUSCALLBACKA;
  2075. TCAPERRORCALLBACK = TCAPERRORCALLBACKA;
  2076. TCAPVIDEOCALLBACK = function(hWnd: HWND; lpVHdr: PVIDEOHDR): DWORD; stdcall;
  2077. TCAPWAVECALLBACK = function(hWnd: HWND; lpWHdr: PWAVEHDR): DWORD; stdcall;
  2078. TCAPCONTROLCALLBACK = function(hWnd: HWND; nState: int): DWORD; stdcall;
  2079. {-- Structures ---------------------------------------------------------------}
  2080. type
  2081. PCAPDRIVERCAPS = ^TCAPDRIVERCAPS;
  2082. TCAPDRIVERCAPS = record
  2083. wDeviceIndex : UINT; // Driver index in system.ini
  2084. fHasOverlay : BOOL; // Can device overlay?
  2085. fHasDlgVideoSource : BOOL; // Has Video source dlg?
  2086. fHasDlgVideoFormat : BOOL; // Has Format dlg?
  2087. fHasDlgVideoDisplay : BOOL; // Has External out dlg?
  2088. fCaptureInitialized : BOOL; // Driver ready to capture?
  2089. fDriverSuppliesPalettes : BOOL; // Can driver make palettes?
  2090. // following always NULL on Win32.
  2091. hVideoIn : THANDLE; // Driver In channel
  2092. hVideoOut : THANDLE; // Driver Out channel
  2093. hVideoExtIn : THANDLE; // Driver Ext In channel
  2094. hVideoExtOut : THANDLE; // Driver Ext Out channel
  2095. end;
  2096. PCAPSTATUS = ^TCAPSTATUS;
  2097. TCAPSTATUS = record
  2098. uiImageWidth : UINT ; // Width of the image
  2099. uiImageHeight : UINT ; // Height of the image
  2100. fLiveWindow : BOOL ; // Now Previewing video?
  2101. fOverlayWindow : BOOL ; // Now Overlaying video?
  2102. fScale : BOOL ; // Scale image to client?
  2103. ptScroll : TPOINT ; // Scroll position
  2104. fUsingDefaultPalette : BOOL ; // Using default driver palette?
  2105. fAudioHardware : BOOL ; // Audio hardware present?
  2106. fCapFileExists : BOOL ; // Does capture file exist?
  2107. dwCurrentVideoFrame : DWORD ; // # of video frames cap'td
  2108. dwCurrentVideoFramesDropped : DWORD ; // # of video frames dropped
  2109. dwCurrentWaveSamples : DWORD ; // # of wave samples cap'td
  2110. dwCurrentTimeElapsedMS : DWORD ; // Elapsed capture duration
  2111. hPalCurrent : HPALETTE; // Current palette in use
  2112. fCapturingNow : BOOL ; // Capture in progress?
  2113. dwReturn : DWORD ; // Error value after any operation
  2114. wNumVideoAllocated : UINT ; // Actual number of video buffers
  2115. wNumAudioAllocated : UINT ; // Actual number of audio buffers
  2116. end;
  2117. // Default values in parenthesis
  2118. PCAPTUREPARMS = ^TCAPTUREPARMS;
  2119. TCAPTUREPARMS = record
  2120. dwRequestMicroSecPerFrame : DWORD ; // Requested capture rate
  2121. fMakeUserHitOKToCapture : BOOL ; // Show "Hit OK to cap" dlg?
  2122. wPercentDropForError : UINT ; // Give error msg if > (10%)
  2123. fYield : BOOL ; // Capture via background task?
  2124. dwIndexSize : DWORD ; // Max index size in frames (32K)
  2125. wChunkGranularity : UINT ; // Junk chunk granularity (2K)
  2126. fUsingDOSMemory : BOOL ; // Use DOS buffers?
  2127. wNumVideoRequested : UINT ; // # video buffers, If 0, autocalc
  2128. fCaptureAudio : BOOL ; // Capture audio?
  2129. wNumAudioRequested : UINT ; // # audio buffers, If 0, autocalc
  2130. vKeyAbort : UINT ; // Virtual key causing abort
  2131. fAbortLeftMouse : BOOL ; // Abort on left mouse?
  2132. fAbortRightMouse : BOOL ; // Abort on right mouse?
  2133. fLimitEnabled : BOOL ; // Use wTimeLimit?
  2134. wTimeLimit : UINT ; // Seconds to capture
  2135. fMCIControl : BOOL ; // Use MCI video source?
  2136. fStepMCIDevice : BOOL ; // Step MCI device?
  2137. dwMCIStartTime : DWORD ; // Time to start in MS
  2138. dwMCIStopTime : DWORD ; // Time to stop in MS
  2139. fStepCaptureAt2x : BOOL ; // Perform spatial averaging 2x
  2140. wStepCaptureAverageFrames : UINT ; // Temporal average n Frames
  2141. dwAudioBufferSize : DWORD ; // Size of audio bufs (0 = default)
  2142. fDisableWriteCache : BOOL ; // Attempt to disable write cache
  2143. AVStreamMaster : UINT ; // Which stream controls length?
  2144. end;
  2145. {-- AVStreamMaster -----------------------------------------------------------}
  2146. // Since Audio and Video streams generally use non-synchronized capture
  2147. // clocks, this flag determines whether the audio stream is to be considered
  2148. // the master or controlling clock when writing the AVI file:
  2149. //
  2150. // AVSTREAMMASTER_AUDIO - Audio is master, video frame duration is forced
  2151. // to match audio duration (VFW 1.0, 1.1 default)
  2152. // AVSTREAMMASTER_NONE - No master, audio and video streams may be of
  2153. // different lengths
  2154. const
  2155. AVSTREAMMASTER_AUDIO = 0; // Audio master (VFW 1.0, 1.1)
  2156. AVSTREAMMASTER_NONE = 1; // No master
  2157. type
  2158. PCAPINFOCHUNK = ^TCAPINFOCHUNK;
  2159. TCAPINFOCHUNK = record
  2160. fccInfoID : FOURCC; // Chunk ID, "ICOP" for copyright
  2161. lpData : PVOID; // pointer to data
  2162. cbData : DWORD; // size of lpData
  2163. end;
  2164. {-- CapControlCallback states ------------------------------------------------}
  2165. const
  2166. CONTROLCALLBACK_PREROLL = 1; // Waiting to start capture
  2167. CONTROLCALLBACK_CAPTURING = 2; // Now capturing
  2168. {-- Message crackers for above -----------------------------------------------}
  2169. // message wrapper macros are defined for the default messages only. Apps
  2170. // that wish to mix Ansi and UNICODE message sending will have to
  2171. // reference the _A and _W messages directly
  2172. function capSetCallbackOnError(hwnd: HWND; fpProc: TCAPERRORCALLBACK): BOOL;
  2173. function capSetCallbackOnStatus(hwnd: HWND; fpProc: TCAPSTATUSCALLBACK): BOOL;
  2174. function capSetCallbackOnYield(hwnd: HWND; fpProc: TCAPYIELDCALLBACK): BOOL;
  2175. function capSetCallbackOnFrame(hwnd: HWND; fpProc: TCAPVIDEOCALLBACK): BOOL;
  2176. function capSetCallbackOnVideoStream(hwnd: HWND; fpProc: TCAPVIDEOCALLBACK): BOOL;
  2177. function capSetCallbackOnWaveStream(hwnd: HWND; fpProc: TCAPWAVECALLBACK): BOOL;
  2178. function capSetCallbackOnCapControl(hwnd: HWND; fpProc: TCAPCONTROLCALLBACK): BOOL;
  2179. function capSetUserData(hwnd: HWND; lUser: DWORD): BOOL;
  2180. function capGetUserData(hwnd: HWND): DWORD;
  2181. function capDriverConnect(hwnd: HWND; i: INT): BOOL;
  2182. function capDriverDisconnect(hwnd: HWND): BOOL;
  2183. function capDriverGetName(hwnd: HWND; szName: LPSTR; wSize: WORD): BOOL;
  2184. function capDriverGetVersion(hwnd: HWND; szVer: LPSTR; wSize: WORD): BOOL;
  2185. function capDriverGetCaps(hwnd: HWND; s: PCAPDRIVERCAPS; wSize: WORD): BOOL;
  2186. function capFileSetCaptureFile(hwnd: HWND; szName: LPCSTR): BOOL;
  2187. function capFileGetCaptureFile(hwnd: HWND; szName: LPSTR; wSize: WORD): BOOL;
  2188. function capFileAlloc(hwnd: HWND; dwSize: DWORD): BOOL;
  2189. function capFileSaveAs(hwnd: HWND; szName: LPCSTR): BOOL;
  2190. function capFileSetInfoChunk(hwnd: HWND; lpInfoChunk: PCAPINFOCHUNK): BOOL;
  2191. function capFileSaveDIB(hwnd: HWND; szName: LPCSTR): BOOL;
  2192. function capEditCopy(hwnd: HWND): BOOL;
  2193. function capSetAudioFormat(hwnd: HWND; s: PWAVEFORMATEX; wSize: WORD): BOOL;
  2194. function capGetAudioFormat(hwnd: HWND; s: PWAVEFORMATEX; wSize: WORD): DWORD;
  2195. function capGetAudioFormatSize(hwnd: HWND): DWORD;
  2196. function capDlgVideoFormat(hwnd: HWND): BOOL;
  2197. function capDlgVideoSource(hwnd: HWND): BOOL;
  2198. function capDlgVideoDisplay(hwnd: HWND): BOOL;
  2199. function capDlgVideoCompression(hwnd: HWND): BOOL;
  2200. function capGetVideoFormat(hwnd: HWND; s: PVOID; wSize: WORD): DWORD;
  2201. function capGetVideoFormatSize(hwnd: HWND): DWORD;
  2202. function capSetVideoFormat(hwnd: HWND; s: PVOID; wSize: WORD): BOOL;
  2203. function capPreview(hwnd: HWND; f: BOOL): BOOL;
  2204. function capPreviewRate(hwnd: HWND; wMS: WORD): BOOL;
  2205. function capOverlay(hwnd: HWND; f: BOOL): BOOL;
  2206. function capPreviewScale(hwnd: HWND; f: BOOL): BOOL;
  2207. function capGetStatus(hwnd: HWND; s: PCAPSTATUS; wSize: WORD): BOOL;
  2208. function capSetScrollPos(hwnd: HWND; lpP: PPOINT): BOOL;
  2209. function capGrabFrame(hwnd: HWND): BOOL;
  2210. function capGrabFrameNoStop(hwnd: HWND): BOOL;
  2211. function capCaptureSequence(hwnd: HWND): BOOL;
  2212. function capCaptureSequenceNoFile(hwnd: HWND): BOOL;
  2213. function capCaptureStop(hwnd: HWND): BOOL;
  2214. function capCaptureAbort(hwnd: HWND): BOOL;
  2215. function capCaptureSingleFrameOpen(hwnd: HWND): BOOL;
  2216. function capCaptureSingleFrameClose(hwnd: HWND): BOOL;
  2217. function capCaptureSingleFrame(hwnd: HWND): BOOL;
  2218. function capCaptureGetSetup(hwnd: HWND; s: PCAPTUREPARMS; wSize: WORD): BOOL;
  2219. function capCaptureSetSetup(hwnd: HWND; s: PCAPTUREPARMS; wSize: WORD): BOOL;
  2220. function capSetMCIDeviceName(hwnd: HWND; szName: LPCSTR): BOOL;
  2221. function capGetMCIDeviceName(hwnd: HWND; szName: LPSTR; wSize: WORD): BOOL;
  2222. function capPaletteOpen(hwnd: HWND; szName: LPCSTR): BOOL;
  2223. function capPaletteSave(hwnd: HWND; szName: LPCSTR): BOOL;
  2224. function capPalettePaste(hwnd: HWND): BOOL;
  2225. function capPaletteAuto(hwnd: HWND; iFrames, iColors: INT): BOOL;
  2226. function capPaletteManual(hwnd: HWND; fGrab: BOOL; iColors: INT): BOOL;
  2227. {-- The only exported functions from AVICAP.DLL ------------------------------}
  2228. function capCreateCaptureWindowA(
  2229. lpszWindowName : LPCSTR;
  2230. dwStyle : DWORD;
  2231. x, y : int;
  2232. nWidth, nHeight : int;
  2233. hwndParent : HWND;
  2234. nID : int
  2235. ): HWND; stdcall;
  2236. function capGetDriverDescriptionA(
  2237. wDriverIndex : UINT;
  2238. lpszName : LPSTR;
  2239. cbName : int;
  2240. lpszVer : LPSTR;
  2241. cbVer : int
  2242. ): BOOL; stdcall;
  2243. function capCreateCaptureWindowW(
  2244. lpszWindowName : LPCWSTR;
  2245. dwStyle : DWORD;
  2246. x, y : int;
  2247. nWidth, nHeight : int;
  2248. hwndParent : HWND;
  2249. nID : int
  2250. ): HWND; stdcall;
  2251. function capGetDriverDescriptionW(
  2252. wDriverIndex : UINT;
  2253. lpszName : LPWSTR;
  2254. cbName : int;
  2255. lpszVer : LPWSTR;
  2256. cbVer : int
  2257. ): BOOL; stdcall;
  2258. function capCreateCaptureWindow(
  2259. lpszWindowName : LPCSTR;
  2260. dwStyle : DWORD;
  2261. x, y : int;
  2262. nWidth, nHeight : int;
  2263. hwndParent : HWND;
  2264. nID : int
  2265. ): HWND; stdcall; // capCreateCaptureWindowA
  2266. function capGetDriverDescription(
  2267. wDriverIndex : UINT;
  2268. lpszName : LPSTR;
  2269. cbName : int;
  2270. lpszVer : LPSTR;
  2271. cbVer : int
  2272. ): BOOL; stdcall; // capGetDriverDescriptionA
  2273. {-- New information chunk IDs ------------------------------------------------}
  2274. const
  2275. infotypeDIGITIZATION_TIME = $54494449; // mmioFOURCC ('I','D','I','T')
  2276. infotypeSMPTE_TIME = $504D5349; // mmioFOURCC ('I','S','M','P')
  2277. {-- String IDs from status and error callbacks -------------------------------}
  2278. IDS_CAP_BEGIN = 300; // "Capture Start"
  2279. IDS_CAP_END = 301; // "Capture End"
  2280. IDS_CAP_INFO = 401; // "%s"
  2281. IDS_CAP_OUTOFMEM = 402; // "Out of memory"
  2282. IDS_CAP_FILEEXISTS = 403; // "File '%s' exists -- overwrite it?"
  2283. IDS_CAP_ERRORPALOPEN = 404; // "Error opening palette '%s'"
  2284. IDS_CAP_ERRORPALSAVE = 405; // "Error saving palette '%s'"
  2285. IDS_CAP_ERRORDIBSAVE = 406; // "Error saving frame '%s'"
  2286. IDS_CAP_DEFAVIEXT = 407; // "avi"
  2287. IDS_CAP_DEFPALEXT = 408; // "pal"
  2288. IDS_CAP_CANTOPEN = 409; // "Cannot open '%s'"
  2289. IDS_CAP_SEQ_MSGSTART = 410; // "Select OK to start capture\nof video sequence\nto %s."
  2290. IDS_CAP_SEQ_MSGSTOP = 411; // "Hit ESCAPE or click to end capture"
  2291. IDS_CAP_VIDEDITERR = 412; // "An error occurred while trying to run VidEdit."
  2292. IDS_CAP_READONLYFILE = 413; // "The file '%s' is a read-only file."
  2293. IDS_CAP_WRITEERROR = 414; // "Unable to write to file '%s'.\nDisk may be full."
  2294. IDS_CAP_NODISKSPACE = 415; // "There is no space to create a capture file on the specified device."
  2295. IDS_CAP_SETFILESIZE = 416; // "Set File Size"
  2296. IDS_CAP_SAVEASPERCENT = 417; // "SaveAs: %2ld%% Hit Escape to abort."
  2297. IDS_CAP_DRIVER_ERROR = 418; // Driver specific error message
  2298. IDS_CAP_WAVE_OPEN_ERROR = 419; // "Error: Cannot open the wave input device.\nCheck sample size, frequency, and channels."
  2299. IDS_CAP_WAVE_ALLOC_ERROR = 420; // "Error: Out of memory for wave buffers."
  2300. IDS_CAP_WAVE_PREPARE_ERROR = 421; // "Error: Cannot prepare wave buffers."
  2301. IDS_CAP_WAVE_ADD_ERROR = 422; // "Error: Cannot add wave buffers."
  2302. IDS_CAP_WAVE_SIZE_ERROR = 423; // "Error: Bad wave size."
  2303. IDS_CAP_VIDEO_OPEN_ERROR = 424; // "Error: Cannot open the video input device."
  2304. IDS_CAP_VIDEO_ALLOC_ERROR = 425; // "Error: Out of memory for video buffers."
  2305. IDS_CAP_VIDEO_PREPARE_ERROR = 426; // "Error: Cannot prepare video buffers."
  2306. IDS_CAP_VIDEO_ADD_ERROR = 427; // "Error: Cannot add video buffers."
  2307. IDS_CAP_VIDEO_SIZE_ERROR = 428; // "Error: Bad video size."
  2308. IDS_CAP_FILE_OPEN_ERROR = 429; // "Error: Cannot open capture file."
  2309. IDS_CAP_FILE_WRITE_ERROR = 430; // "Error: Cannot write to capture file. Disk may be full."
  2310. IDS_CAP_RECORDING_ERROR = 431; // "Error: Cannot write to capture file. Data rate too high or disk full."
  2311. IDS_CAP_RECORDING_ERROR2 = 432; // "Error while recording"
  2312. IDS_CAP_AVI_INIT_ERROR = 433; // "Error: Unable to initialize for capture."
  2313. IDS_CAP_NO_FRAME_CAP_ERROR = 434; // "Warning: No frames captured.\nConfirm that vertical sync interrupts\nare configured and enabled."
  2314. IDS_CAP_NO_PALETTE_WARN = 435; // "Warning: Using default palette."
  2315. IDS_CAP_MCI_CONTROL_ERROR = 436; // "Error: Unable to access MCI device."
  2316. IDS_CAP_MCI_CANT_STEP_ERROR = 437; // "Error: Unable to step MCI device."
  2317. IDS_CAP_NO_AUDIO_CAP_ERROR = 438; // "Error: No audio data captured.\nCheck audio card settings."
  2318. IDS_CAP_AVI_DRAWDIB_ERROR = 439; // "Error: Unable to draw this data format."
  2319. IDS_CAP_COMPRESSOR_ERROR = 440; // "Error: Unable to initialize compressor."
  2320. IDS_CAP_AUDIO_DROP_ERROR = 441; // "Error: Audio data was lost during capture, reduce capture rate."
  2321. {-- Status string IDs --------------------------------------------------------}
  2322. IDS_CAP_STAT_LIVE_MODE = 500; // "Live window"
  2323. IDS_CAP_STAT_OVERLAY_MODE = 501; // "Overlay window"
  2324. IDS_CAP_STAT_CAP_INIT = 502; // "Setting up for capture - Please wait"
  2325. IDS_CAP_STAT_CAP_FINI = 503; // "Finished capture, now writing frame %ld"
  2326. IDS_CAP_STAT_PALETTE_BUILD = 504; // "Building palette map"
  2327. IDS_CAP_STAT_OPTPAL_BUILD = 505; // "Computing optimal palette"
  2328. IDS_CAP_STAT_I_FRAMES = 506; // "%d frames"
  2329. IDS_CAP_STAT_L_FRAMES = 507; // "%ld frames"
  2330. IDS_CAP_STAT_CAP_L_FRAMES = 508; // "Captured %ld frames"
  2331. IDS_CAP_STAT_CAP_AUDIO = 509; // "Capturing audio"
  2332. IDS_CAP_STAT_VIDEOCURRENT = 510; // "Captured %ld frames (%ld dropped) %d.%03d sec."
  2333. IDS_CAP_STAT_VIDEOAUDIO = 511; // "Captured %d.%03d sec. %ld frames (%ld dropped) (%d.%03d fps). %ld audio bytes (%d,%03d sps)"
  2334. IDS_CAP_STAT_VIDEOONLY = 512; // "Captured %d.%03d sec. %ld frames (%ld dropped) (%d.%03d fps)"
  2335. IDS_CAP_STAT_FRAMESDROPPED = 513; // "Dropped %ld of %ld frames (%d.%02d%%) during capture."
  2336. {== FilePreview dialog =======================================================}
  2337. function GetOpenFileNamePreviewA(lpofn: POPENFILENAMEA): BOOL; stdcall;
  2338. function GetSaveFileNamePreviewA(lpofn: POPENFILENAMEA): BOOL; stdcall;
  2339. function GetOpenFileNamePreviewW(lpofn: POPENFILENAMEW): BOOL; stdcall;
  2340. function GetSaveFileNamePreviewW(lpofn: POPENFILENAMEW): BOOL; stdcall;
  2341. function GetOpenFileNamePreview(lpofn: POPENFILENAMEA): BOOL; stdcall; // GetOpenFileNamePreviewA
  2342. function GetSaveFileNamePreview(lpofn: POPENFILENAMEA): BOOL; stdcall; // GetSaveFileNamePreviewA
  2343. implementation
  2344. function MKFOURCC( ch0, ch1, ch2, ch3: AnsiChar ): FOURCC;
  2345. begin
  2346. Result := (DWord(Ord(ch0))) or
  2347. (DWord(Ord(ch1)) shl 8) or
  2348. (DWord(Ord(ch2)) shl 16) or
  2349. (DWord(Ord(ch3)) shl 24);
  2350. end;
  2351. function mmioFOURCC( ch0, ch1, ch2, ch3: AnsiChar ): FOURCC;
  2352. begin
  2353. Result := MKFOURCC(ch0,ch1,ch2,ch3);
  2354. end;
  2355. function aviTWOCC(ch0, ch1: AnsiChar): TWOCC;
  2356. begin
  2357. Result := (Word(Ord(ch0))) or (Word(Ord(ch1)) shl 8);
  2358. end;
  2359. {-- Query macros -------------------------------------------------------------}
  2360. function ICQueryAbout(hic: HIC): BOOL;
  2361. begin
  2362. Result := ICSendMessage(hic, ICM_ABOUT, dword(-1), ICMF_ABOUT_QUERY) = ICERR_OK;
  2363. end;
  2364. function ICAbout(hic: HIC; hwnd: HWND): DWORD;
  2365. begin
  2366. Result := ICSendMessage(hic, ICM_ABOUT, hwnd, 0);
  2367. end;
  2368. function ICQueryConfigure(hic: HIC): BOOL;
  2369. begin
  2370. Result := ICSendMessage(hic, ICM_CONFIGURE, dword(-1), ICMF_CONFIGURE_QUERY) = ICERR_OK;
  2371. end;
  2372. function ICConfigure(hic: HIC; hwnd: HWND): DWORD;
  2373. begin
  2374. Result := ICSendMessage(hic, ICM_CONFIGURE, hwnd, 0);
  2375. end;
  2376. {-- Get/Set state macros -----------------------------------------------------}
  2377. function ICGetState(hic: HIC; pv: PVOID; cb: DWORD): DWORD;
  2378. begin
  2379. Result := ICSendMessage(hic, ICM_GETSTATE, DWORD(pv), cb);
  2380. end;
  2381. function ICSetState(hic: HIC; pv: PVOID; cb: DWORD): DWORD;
  2382. begin
  2383. Result := ICSendMessage(hic, ICM_SETSTATE, DWORD(pv), cb);
  2384. end;
  2385. function ICGetStateSize(hic: HIC): DWORD;
  2386. begin
  2387. Result := ICGetState(hic, nil, 0);
  2388. end;
  2389. {-- Get value macros ---------------------------------------------------------}
  2390. function ICGetDefaultQuality(hic: HIC): DWORD;
  2391. begin
  2392. ICSendMessage(hic, ICM_GETDEFAULTQUALITY, DWORD(@Result), sizeof(Result));
  2393. end;
  2394. function ICGetDefaultKeyFrameRate(hic: HIC): DWORD;
  2395. begin
  2396. ICSendMessage(hic, ICM_GETDEFAULTKEYFRAMERATE, DWORD(@Result), sizeof(Result));
  2397. end;
  2398. {-- Draw window macro --------------------------------------------------------}
  2399. function ICDrawWindow(hic: HIC; prc: PRECT): DWORD;
  2400. begin
  2401. Result := ICSendMessage(hic, ICM_DRAW_WINDOW, DWORD(prc), sizeof(prc^));
  2402. end;
  2403. {-- ICCompressBegin() - start compression from a source fmt to a dest fmt ----}
  2404. function ICCompressBegin(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
  2405. begin
  2406. Result := ICSendMessage(hic, ICM_COMPRESS_BEGIN, DWORD(lpbiInput), DWORD(lpbiOutput));
  2407. end;
  2408. {-- ICCompressQuery() - determines if compression from src to dst is supp ----}
  2409. function ICCompressQuery(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
  2410. begin
  2411. Result := ICSendMessage(hic, ICM_COMPRESS_QUERY, DWORD(lpbiInput), DWORD(lpbiOutput));
  2412. end;
  2413. {-- ICCompressGetFormat() - get the output format (fmt of compressed) --------}
  2414. // if lpbiOutput is nil return the size in bytes needed for format.
  2415. function ICCompressGetFormat(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
  2416. begin
  2417. Result := ICSendMessage(hic, ICM_COMPRESS_GET_FORMAT, DWORD(lpbiInput), DWORD(lpbiOutput));
  2418. end;
  2419. function ICCompressGetFormatSize(hic: HIC; lpbi: PBITMAPINFOHEADER): DWORD;
  2420. begin
  2421. Result := ICCompressGetFormat(hic, lpbi, nil);
  2422. end;
  2423. {-- ICCompressSize() - return the maximal size of a compressed frame ---------}
  2424. function ICCompressGetSize(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
  2425. begin
  2426. Result := ICSendMessage(hic, ICM_COMPRESS_GET_SIZE, DWORD(lpbiInput), DWORD(lpbiOutput));
  2427. end;
  2428. function ICCompressEnd(hic: HIC): DWORD;
  2429. begin
  2430. Result := ICSendMessage(hic, ICM_COMPRESS_END, 0, 0);
  2431. end;
  2432. {-- ICDecompressBegin() - start compression from src fmt to a dest fmt -------}
  2433. function ICDecompressBegin(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
  2434. begin
  2435. Result := ICSendMessage(hic, ICM_DECOMPRESS_BEGIN, DWORD(lpbiInput), DWORD(lpbiOutput));
  2436. end;
  2437. {-- ICDecompressQuery() - determines if compression is supported -------------}
  2438. function ICDecompressQuery(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
  2439. begin
  2440. Result := ICSendMessage(hic, ICM_DECOMPRESS_QUERY, DWORD(lpbiInput), DWORD(lpbiOutput));
  2441. end;
  2442. {-- ICDecompressGetFormat - get the output fmt (fmt of uncompressed data) ----}
  2443. // if lpbiOutput is NULL return the size in bytes needed for format.
  2444. function ICDecompressGetFormat(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
  2445. begin
  2446. Result := ICSendMessage(hic, ICM_DECOMPRESS_GET_FORMAT, DWORD(lpbiInput), DWORD(lpbiOutput));
  2447. end;
  2448. function ICDecompressGetFormatSize(hic: HIC; lpbi: PBITMAPINFOHEADER): DWORD;
  2449. begin
  2450. Result := ICDecompressGetFormat(hic, lpbi, nil);
  2451. end;
  2452. {-- ICDecompressGetPalette() - get the output palette ------------------------}
  2453. function ICDecompressGetPalette(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;
  2454. begin
  2455. Result := ICSendMessage(hic, ICM_DECOMPRESS_GET_PALETTE, DWORD(lpbiInput), DWORD(lpbiOutput));
  2456. end;
  2457. function ICDecompressSetPalette(hic: HIC; lpbiPalette: PBITMAPINFOHEADER): DWORD;
  2458. begin
  2459. Result := ICSendMessage(hic, ICM_DECOMPRESS_SET_PALETTE, DWORD(lpbiPalette), 0);
  2460. end;
  2461. function ICDecompressEnd(hic: HIC): DWORD;
  2462. begin
  2463. Result := ICSendMessage(hic, ICM_DECOMPRESS_END, 0, 0);
  2464. end;
  2465. {-- ICDecompressEx() - decompress a single frame -----------------------------}
  2466. function ICDecompressEx(
  2467. hic : HIC;
  2468. dwFlags : DWORD;
  2469. lpbiSrc : PBITMAPINFOHEADER;
  2470. lpSrc : PVOID;
  2471. xSrc : int;
  2472. ySrc : int;
  2473. dxSrc : int;
  2474. dySrc : int;
  2475. lpbiDst : PBITMAPINFOHEADER;
  2476. lpDst : PVOID;
  2477. xDst : int;
  2478. yDst : int;
  2479. dxDst : int;
  2480. dyDst : int
  2481. ): DWORD; stdcall;
  2482. var
  2483. ic : TICDECOMPRESSEX;
  2484. begin
  2485. ic.dwFlags := dwFlags;
  2486. ic.lpbiSrc := lpbiSrc;
  2487. ic.lpSrc := lpSrc;
  2488. ic.xSrc := xSrc;
  2489. ic.ySrc := ySrc;
  2490. ic.dxSrc := dxSrc;
  2491. ic.dySrc := dySrc;
  2492. ic.lpbiDst := lpbiDst;
  2493. ic.lpDst := lpDst;
  2494. ic.xDst := xDst;
  2495. ic.yDst := yDst;
  2496. ic.dxDst := dxDst;
  2497. ic.dyDst := dyDst;
  2498. // note that ICM swaps round the length and pointer
  2499. // length in lparam2, pointer in lparam1
  2500. Result := ICSendMessage(hic, ICM_DECOMPRESSEX, DWORD(@ic), sizeof(ic));
  2501. end;
  2502. {-- ICDecompressExBegin() - start compression from a src fmt to a dest fmt ---}
  2503. function ICDecompressExBegin(
  2504. hic : HIC;
  2505. dwFlags : DWORD;
  2506. lpbiSrc : PBITMAPINFOHEADER;
  2507. lpSrc : PVOID;
  2508. xSrc : int;
  2509. ySrc : int;
  2510. dxSrc : int;
  2511. dySrc : int;
  2512. lpbiDst : PBITMAPINFOHEADER;
  2513. lpDst : PVOID;
  2514. xDst : int;
  2515. yDst : int;
  2516. dxDst : int;
  2517. dyDst : int
  2518. ): DWORD; stdcall;
  2519. var
  2520. ic : TICDECOMPRESSEX ;
  2521. begin
  2522. ic.dwFlags := dwFlags;
  2523. ic.lpbiSrc := lpbiSrc;
  2524. ic.lpSrc := lpSrc;
  2525. ic.xSrc := xSrc;
  2526. ic.ySrc := ySrc;
  2527. ic.dxSrc := dxSrc;
  2528. ic.dySrc := dySrc;
  2529. ic.lpbiDst := lpbiDst;
  2530. ic.lpDst := lpDst;
  2531. ic.xDst := xDst;
  2532. ic.yDst := yDst;
  2533. ic.dxDst := dxDst;
  2534. ic.dyDst := dyDst;
  2535. // note that ICM swaps round the length and pointer
  2536. // length in lparam2, pointer in lparam1
  2537. Result := ICSendMessage(hic, ICM_DECOMPRESSEX_BEGIN, DWORD(@ic), sizeof(ic));
  2538. end;
  2539. {-- ICDecompressExQuery() ----------------------------------------------------}
  2540. function ICDecompressExQuery(
  2541. hic : HIC;
  2542. dwFlags : DWORD;
  2543. lpbiSrc : PBITMAPINFOHEADER;
  2544. lpSrc : PVOID;
  2545. xSrc : int;
  2546. ySrc : int;
  2547. dxSrc : int;
  2548. dySrc : int;
  2549. lpbiDst : PBITMAPINFOHEADER;
  2550. lpDst : PVOID;
  2551. xDst : int;
  2552. yDst : int;
  2553. dxDst : int;
  2554. dyDst : int
  2555. ): DWORD; stdcall;
  2556. var
  2557. ic : TICDECOMPRESSEX;
  2558. begin
  2559. ic.dwFlags := dwFlags;
  2560. ic.lpbiSrc := lpbiSrc;
  2561. ic.lpSrc := lpSrc;
  2562. ic.xSrc := xSrc;
  2563. ic.ySrc := ySrc;
  2564. ic.dxSrc := dxSrc;
  2565. ic.dySrc := dySrc;
  2566. ic.lpbiDst := lpbiDst;
  2567. ic.lpDst := lpDst;
  2568. ic.xDst := xDst;
  2569. ic.yDst := yDst;
  2570. ic.dxDst := dxDst;
  2571. ic.dyDst := dyDst;
  2572. // note that ICM swaps round the length and pointer
  2573. // length in lparam2, pointer in lparam1
  2574. Result := ICSendMessage(hic, ICM_DECOMPRESSEX_QUERY, DWORD(@ic), sizeof(ic));
  2575. end;
  2576. function ICDecompressExEnd(hic: HIC): DWORD;
  2577. begin
  2578. Result := ICSendMessage(hic, ICM_DECOMPRESSEX_END, 0, 0)
  2579. end;
  2580. function ICDrawSuggestFormat(
  2581. hic : HIC;
  2582. lpbiIn : PBITMAPINFOHEADER;
  2583. lpbiOut : PBITMAPINFOHEADER;
  2584. dxSrc : int;
  2585. dySrc : int;
  2586. dxDst : int;
  2587. dyDst : int;
  2588. hicDecomp : HIC
  2589. ): DWORD; stdcall;
  2590. var
  2591. ic : TICDRAWSUGGEST;
  2592. begin
  2593. ic.lpbiIn := lpbiIn;
  2594. ic.lpbiSuggest := lpbiOut;
  2595. ic.dxSrc := dxSrc;
  2596. ic.dySrc := dySrc;
  2597. ic.dxDst := dxDst;
  2598. ic.dyDst := dyDst;
  2599. ic.hicDecompressor := hicDecomp;
  2600. // note that ICM swaps round the length and pointer
  2601. // length in lparam2, pointer in lparam1
  2602. Result := ICSendMessage(hic, ICM_DRAW_SUGGESTFORMAT, DWORD(@ic), sizeof(ic));
  2603. end;
  2604. {-- ICDrawQuery() - determines if the compressor is willing to render fmt ----}
  2605. function ICDrawQuery(hic: HIC; lpbiInput: PBITMAPINFOHEADER): DWORD;
  2606. begin
  2607. Result := ICSendMessage(hic, ICM_DRAW_QUERY, DWORD(lpbiInput), 0);
  2608. end;
  2609. function ICDrawChangePalette(hic: HIC; lpbiInput: PBITMAPINFOHEADER): DWORD;
  2610. begin
  2611. Result := ICSendMessage(hic, ICM_DRAW_CHANGEPALETTE, DWORD(lpbiInput), 0);
  2612. end;
  2613. function ICGetBuffersWanted(hic: HIC; lpdwBuffers: PDWORD): DWORD;
  2614. begin
  2615. Result := ICSendMessage(hic, ICM_GETBUFFERSWANTED, DWORD(lpdwBuffers), 0);
  2616. end;
  2617. function ICDrawEnd(hic: HIC): DWORD;
  2618. begin
  2619. Result := ICSendMessage(hic, ICM_DRAW_END, 0, 0);
  2620. end;
  2621. function ICDrawStart(hic: HIC): DWORD;
  2622. begin
  2623. Result := ICSendMessage(hic, ICM_DRAW_START, 0, 0);
  2624. end;
  2625. function ICDrawStartPlay(hic: HIC; lFrom, lTo: DWORD): DWORD;
  2626. begin
  2627. Result := ICSendMessage(hic, ICM_DRAW_START_PLAY, lFrom, lTo);
  2628. end;
  2629. function ICDrawStop(hic: HIC): DWORD;
  2630. begin
  2631. Result := ICSendMessage(hic, ICM_DRAW_STOP, 0, 0);
  2632. end;
  2633. function ICDrawStopPlay(hic: HIC): DWORD;
  2634. begin
  2635. Result := ICSendMessage(hic, ICM_DRAW_STOP_PLAY, 0, 0);
  2636. end;
  2637. function ICDrawGetTime(hic: HIC; lplTime: PDWORD): DWORD;
  2638. begin
  2639. Result := ICSendMessage(hic, ICM_DRAW_GETTIME, DWORD(lplTime), 0);
  2640. end;
  2641. function ICDrawSetTime(hic: HIC; lTime: DWORD): DWORD;
  2642. begin
  2643. Result := ICSendMessage(hic, ICM_DRAW_SETTIME, lTime, 0);
  2644. end;
  2645. function ICDrawRealize(hic: HIC; hdc: HDC; fBackground: BOOL): DWORD;
  2646. begin
  2647. Result := ICSendMessage(hic, ICM_DRAW_REALIZE, DWORD(hdc), DWORD(fBackground));
  2648. end;
  2649. function ICDrawFlush(hic: HIC): DWORD;
  2650. begin
  2651. Result := ICSendMessage(hic, ICM_DRAW_FLUSH, 0, 0);
  2652. end;
  2653. function ICDrawRenderBuffer(hic: HIC): DWORD;
  2654. begin
  2655. Result := ICSendMessage(hic, ICM_DRAW_RENDERBUFFER, 0, 0);
  2656. end;
  2657. {-- ICSetStatusProc() - Set the status callback function ---------------------}
  2658. // ICMessage is not supported on NT
  2659. function ICSetStatusProc(
  2660. hic : HIC;
  2661. dwFlags : DWORD;
  2662. lParam : DWORD;
  2663. fpfnStatus : TICStatusProc
  2664. ): DWORD; stdcall;
  2665. var
  2666. ic : TICSETSTATUSPROC;
  2667. begin
  2668. ic.dwFlags := dwFlags;
  2669. ic.lParam := lParam;
  2670. ic.Status := fpfnStatus;
  2671. // note that ICM swaps round the length and pointer
  2672. // length in lparam2, pointer in lparam1
  2673. Result := ICSendMessage(hic, ICM_SET_STATUS_PROC, DWORD(@ic), sizeof(ic));
  2674. end;
  2675. {== Helper routines for DrawDib and MCIAVI... ================================}
  2676. function ICDecompressOpen(fccType, fccHandler: DWORD; lpbiIn, lpbiOut: PBITMAPINFOHEADER): HIC;
  2677. begin
  2678. Result := ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, ICMODE_DECOMPRESS);
  2679. end;
  2680. function ICDrawOpen(fccType, fccHandler: DWORD; lpbiIn: PBITMAPINFOHEADER): HIC;
  2681. begin
  2682. Result := ICLocate(fccType, fccHandler, lpbiIn, nil, ICMODE_DRAW);
  2683. end;
  2684. {-- DrawDibUpdate() - redraw last image (may only be valid with DDF_BUFFER) --}
  2685. function DrawDibUpdate(hdd: HDRAWDIB; hdc: HDC; x, y: int): BOOL;
  2686. begin
  2687. Result := DrawDibDraw(hdd, hdc, x, y, 0, 0, nil, nil, 0, 0, 0, 0, DDF_UPDATE);
  2688. end;
  2689. {== Useful macros ============================================================}
  2690. {-- Macro to get stream number out of a FOURCC ckid --------------------------}
  2691. function FromHex(n: BYTE): BYTE;
  2692. begin
  2693. if n >= Ord('A') then
  2694. Result := Ord(n) + 10 - Ord('A')
  2695. else
  2696. Result := Ord(n) - Ord('0');
  2697. end;
  2698. function StreamFromFOURCC(fcc: DWORD): BYTE;
  2699. begin
  2700. Result := (FromHex(Lo(LoWord(fcc))) shl 4) + FromHex(Hi(LoWord(fcc)));
  2701. end;
  2702. {-- Macro to get TWOCC chunk type out of a FOURCC ckid -----------------------}
  2703. function TWOCCFromFOURCC(fcc: DWORD): WORD;
  2704. begin
  2705. Result := HiWord(fcc);
  2706. end;
  2707. {-- Macro to make a ckid for a chunk out of a TWOCC and a stream num (0-255) -}
  2708. function ToHex(n: BYTE): BYTE;
  2709. begin
  2710. if n > 9 then
  2711. Result := n - 10 + Ord('A')
  2712. else
  2713. Result := n + Ord('0');
  2714. end;
  2715. function MAKEAVICKID(tcc: WORD; stream: BYTE): DWORD;
  2716. begin
  2717. Result := MakeLONG((ToHex(stream and $0F) shl 8) or ToHex((stream and $F0) shr 4),tcc);
  2718. end;
  2719. {-- Helper macros ------------------------------------------------------------}
  2720. function AVIStreamSampleToSample(pavi1, pavi2: IAVISTREAM; l: LONG): LONG;
  2721. begin
  2722. Result := AVIStreamTimeToSample(pavi1,AVIStreamSampleToTime(pavi2, l));
  2723. end;
  2724. function AVIStreamNextSample(pavi: IAVISTREAM; l: LONG): LONG;
  2725. begin
  2726. Result := AVIStreamFindSample(pavi,l+1,FIND_NEXT or FIND_ANY);
  2727. end;
  2728. function AVIStreamPrevSample(pavi: IAVISTREAM; l: LONG): LONG;
  2729. begin
  2730. Result := AVIStreamFindSample(pavi,l-1,FIND_PREV or FIND_ANY);
  2731. end;
  2732. function AVIStreamNearestSample(pavi: IAVISTREAM; l: LONG): LONG;
  2733. begin
  2734. Result := AVIStreamFindSample(pavi,l,FIND_PREV or FIND_ANY);
  2735. end;
  2736. function AVIStreamNextKeyFrame(pavi: IAVISTREAM; l: LONG): LONG;
  2737. begin
  2738. Result := AVIStreamFindSample(pavi,l+1,FIND_NEXT or FIND_KEY);
  2739. end;
  2740. function AVIStreamPrevKeyFrame(pavi: IAVISTREAM; l: LONG): LONG;
  2741. begin
  2742. Result := AVIStreamFindSample(pavi,l-1,FIND_PREV or FIND_KEY);
  2743. end;
  2744. function AVIStreamNearestKeyFrame(pavi: IAVISTREAM; l: LONG): LONG;
  2745. begin
  2746. Result := AVIStreamFindSample(pavi,l,FIND_PREV or FIND_KEY)
  2747. end;
  2748. function AVIStreamIsKeyFrame(pavi: IAVISTREAM; l: LONG): BOOL;
  2749. begin
  2750. Result := AVIStreamNearestKeyFrame(pavi,l) = l;
  2751. end;
  2752. function AVIStreamPrevSampleTime(pavi: IAVISTREAM; t: LONG): LONG;
  2753. begin
  2754. Result := AVIStreamSampleToTime(pavi, AVIStreamPrevSample(pavi,AVIStreamTimeToSample(pavi,t)));
  2755. end;
  2756. function AVIStreamNextSampleTime(pavi: IAVISTREAM; t: LONG): LONG;
  2757. begin
  2758. Result := AVIStreamSampleToTime(pavi, AVIStreamNextSample(pavi,AVIStreamTimeToSample(pavi,t)));
  2759. end;
  2760. function AVIStreamNearestSampleTime(pavi: IAVISTREAM; t: LONG): LONG;
  2761. begin
  2762. Result := AVIStreamSampleToTime(pavi, AVIStreamNearestSample(pavi,AVIStreamTimeToSample(pavi,t)));
  2763. end;
  2764. function AVIStreamNextKeyFrameTime(pavi: IAVISTREAM; t: LONG): LONG;
  2765. begin
  2766. Result := AVIStreamSampleToTime(pavi, AVIStreamNextKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)));
  2767. end;
  2768. function AVIStreamPrevKeyFrameTime(pavi: IAVISTREAM; t: LONG): LONG;
  2769. begin
  2770. Result := AVIStreamSampleToTime(pavi, AVIStreamPrevKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)));
  2771. end;
  2772. function AVIStreamNearestKeyFrameTime(pavi: IAVISTREAM; t: LONG): LONG;
  2773. begin
  2774. Result := AVIStreamSampleToTime(pavi, AVIStreamNearestKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)));
  2775. end;
  2776. function AVIStreamStartTime(pavi: IAVISTREAM): LONG;
  2777. begin
  2778. Result := AVIStreamSampleToTime(pavi, AVIStreamStart(pavi));
  2779. end;
  2780. function AVIStreamLengthTime(pavi: IAVISTREAM): LONG;
  2781. begin
  2782. Result := AVIStreamSampleToTime(pavi, AVIStreamLength(pavi));
  2783. end;
  2784. function AVIStreamEnd(pavi: IAVISTREAM): LONG;
  2785. begin
  2786. Result := AVIStreamStart(pavi) + AVIStreamLength(pavi);
  2787. end;
  2788. function AVIStreamEndTime(pavi: IAVISTREAM): LONG;
  2789. begin
  2790. Result := AVIStreamSampleToTime(pavi, AVIStreamEnd(pavi));
  2791. end;
  2792. function AVIStreamSampleSize(pavi: IAVISTREAM; lPos: LONG; plSize: PLONG): LONG;
  2793. begin
  2794. Result := AVIStreamRead(pavi,lPos,1,nil,0,plSize,nil);
  2795. end;
  2796. function AVIStreamFormatSize(pavi: IAVISTREAM; lPos: LONG; plSize: PLONG): HResult;
  2797. begin
  2798. Result := AVIStreamReadFormat(pavi,lPos,nil,plSize);
  2799. end;
  2800. function AVIStreamDataSize(pavi: IAVISTREAM; fcc: DWORD; plSize: PLONG): HResult;
  2801. begin
  2802. Result := AVIStreamReadData(pavi,fcc,nil,plSize)
  2803. end;
  2804. {== MCIWnd ===================================================================}
  2805. function MCIWndSM(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): DWORD;
  2806. begin
  2807. Result := SendMessage(hWnd, Msg, wParam, lParam);
  2808. end;
  2809. {-- Can macros ---------------------------------------------------------------}
  2810. function MCIWndCanPlay(hwnd: HWND): BOOL;
  2811. begin
  2812. Result := MCIWndSM(hwnd,MCIWNDM_CAN_PLAY,0,0) <> 0;
  2813. end;
  2814. function MCIWndCanRecord(hwnd: HWND): BOOL;
  2815. begin
  2816. Result := MCIWndSM(hwnd,MCIWNDM_CAN_RECORD,0,0) <> 0;
  2817. end;
  2818. function MCIWndCanSave(hwnd: HWND): BOOL;
  2819. begin
  2820. Result := MCIWndSM(hwnd,MCIWNDM_CAN_SAVE,0,0) <> 0;
  2821. end;
  2822. function MCIWndCanWindow(hwnd: HWND): BOOL;
  2823. begin
  2824. Result := MCIWndSM(hwnd,MCIWNDM_CAN_WINDOW,0,0) <> 0;
  2825. end;
  2826. function MCIWndCanEject(hwnd: HWND): BOOL;
  2827. begin
  2828. Result := MCIWndSM(hwnd,MCIWNDM_CAN_EJECT,0,0) <> 0;
  2829. end;
  2830. function MCIWndCanConfig(hwnd: HWND): BOOL;
  2831. begin
  2832. Result := MCIWndSM(hwnd,MCIWNDM_CAN_CONFIG,0,0) <> 0;
  2833. end;
  2834. function MCIWndPaletteKick(hwnd: HWND): BOOL;
  2835. begin
  2836. Result := MCIWndSM(hwnd,MCIWNDM_PALETTEKICK,0,0) <> 0;
  2837. end;
  2838. function MCIWndSave(hwnd: HWND; szFile: LPCSTR): DWORD;
  2839. begin
  2840. Result := MCIWndSM(hwnd, MCI_SAVE, 0, LPARAM(szFile));
  2841. end;
  2842. function MCIWndSaveDialog(hwnd: HWND): DWORD;
  2843. begin
  2844. Result := MCIWndSave(hwnd, LPCSTR(-1));
  2845. end;
  2846. // If you dont give a device it will use the current device....
  2847. function MCIWndNew(hwnd: HWND; lp: PVOID): DWORD;
  2848. begin
  2849. Result := MCIWndSM(hwnd, MCIWNDM_NEW, 0, LPARAM(lp));
  2850. end;
  2851. function MCIWndRecord(hwnd: HWND): DWORD;
  2852. begin
  2853. Result := MCIWndSM(hwnd, MCI_RECORD, 0, 0);
  2854. end;
  2855. function MCIWndOpen(hwnd: HWND; sz: LPCSTR; f: BOOL): DWORD;
  2856. begin
  2857. Result := MCIWndSM(hwnd, MCIWNDM_OPEN, WPARAM(f), LPARAM(sz));
  2858. end;
  2859. function MCIWndOpenDialog(hwnd: HWND): DWORD;
  2860. begin
  2861. Result := MCIWndOpen(hwnd, LPCSTR(-1), False);
  2862. end;
  2863. function MCIWndClose(hwnd: HWND): DWORD;
  2864. begin
  2865. Result := MCIWndSM(hwnd, MCI_CLOSE, 0, 0);
  2866. end;
  2867. function MCIWndPlay(hwnd: HWND): DWORD;
  2868. begin
  2869. Result := MCIWndSM(hwnd, MCI_PLAY, 0, 0);
  2870. end;
  2871. function MCIWndStop(hwnd: HWND): DWORD;
  2872. begin
  2873. Result := MCIWndSM(hwnd, MCI_STOP, 0, 0);
  2874. end;
  2875. function MCIWndPause(hwnd: HWND): DWORD;
  2876. begin
  2877. Result := MCIWndSM(hwnd, MCI_PAUSE, 0, 0);
  2878. end;
  2879. function MCIWndResume(hwnd: HWND): DWORD;
  2880. begin
  2881. Result := MCIWndSM(hwnd, MCI_RESUME, 0, 0);
  2882. end;
  2883. function MCIWndSeek(hwnd: HWND; lPos: DWORD): DWORD;
  2884. begin
  2885. Result := MCIWndSM(hwnd, MCI_SEEK, 0, lPos);
  2886. end;
  2887. function MCIWndEject(hwnd: HWND): DWORD;
  2888. begin
  2889. Result := MCIWndSM(hwnd, MCIWNDM_EJECT, 0, 0);
  2890. end;
  2891. function MCIWndHome(hwnd: HWND): DWORD;
  2892. begin
  2893. Result := MCIWndSeek(hwnd, MCIWND_START);
  2894. end;
  2895. function MCIWndEnd(hwnd: HWND): DWORD;
  2896. begin
  2897. Result := MCIWndSeek(hwnd, MCIWND_END);
  2898. end;
  2899. function MCIWndGetSource(hwnd: HWND; prc: PRECT): DWORD;
  2900. begin
  2901. Result := MCIWndSM(hwnd, MCIWNDM_GET_SOURCE, 0, LPARAM(prc));
  2902. end;
  2903. function MCIWndPutSource(hwnd: HWND; prc: PRECT): DWORD;
  2904. begin
  2905. Result := MCIWndSM(hwnd, MCIWNDM_PUT_SOURCE, 0, LPARAM(prc));
  2906. end;
  2907. function MCIWndGetDest(hwnd: HWND; prc: PRECT): DWORD;
  2908. begin
  2909. Result := MCIWndSM(hwnd, MCIWNDM_GET_DEST, 0, LPARAM(prc));
  2910. end;
  2911. function MCIWndPutDest(hwnd: HWND; prc: PRECT): DWORD;
  2912. begin
  2913. Result := MCIWndSM(hwnd, MCIWNDM_PUT_DEST, 0, LPARAM(prc));
  2914. end;
  2915. function MCIWndPlayReverse(hwnd: HWND): DWORD;
  2916. begin
  2917. Result := MCIWndSM(hwnd, MCIWNDM_PLAYREVERSE, 0, 0);
  2918. end;
  2919. function MCIWndPlayFrom(hwnd: HWND; lPos: DWORD): DWORD;
  2920. begin
  2921. Result := MCIWndSM(hwnd, MCIWNDM_PLAYFROM, 0, lPos);
  2922. end;
  2923. function MCIWndPlayTo(hwnd: HWND; lPos: DWORD): DWORD;
  2924. begin
  2925. Result := MCIWndSM(hwnd, MCIWNDM_PLAYTO, 0, lPos);
  2926. end;
  2927. function MCIWndPlayFromTo(hwnd: HWND; lStart, lEnd: DWORD): DWORD;
  2928. begin
  2929. MCIWndSeek(hwnd, lStart);
  2930. Result := MCIWndPlayTo(hwnd, lEnd);
  2931. end;
  2932. function MCIWndGetDeviceID(hwnd: HWND): UINT;
  2933. begin
  2934. Result := MCIWndSM(hwnd, MCIWNDM_GETDEVICEID, 0, 0);
  2935. end;
  2936. function MCIWndGetAlias(hwnd: HWND): UINT;
  2937. begin
  2938. Result := MCIWndSM(hwnd, MCIWNDM_GETALIAS, 0, 0);
  2939. end;
  2940. function MCIWndGetMode(hwnd: HWND; lp: LPCSTR; len: UINT): DWORD;
  2941. begin
  2942. Result := MCIWndSM(hwnd, MCIWNDM_GETMODE, len, LPARAM(lp));
  2943. end;
  2944. function MCIWndGetPosition(hwnd: HWND): DWORD;
  2945. begin
  2946. Result := MCIWndSM(hwnd, MCIWNDM_GETPOSITION, 0, 0);
  2947. end;
  2948. function MCIWndGetPositionString(hwnd: HWND; lp: LPCSTR; len: UINT): DWORD;
  2949. begin
  2950. Result := MCIWndSM(hwnd, MCIWNDM_GETPOSITION, len, LPARAM(lp));
  2951. end;
  2952. function MCIWndGetStart(hwnd: HWND): DWORD;
  2953. begin
  2954. Result := MCIWndSM(hwnd, MCIWNDM_GETSTART, 0, 0);
  2955. end;
  2956. function MCIWndGetLength(hwnd: HWND): DWORD;
  2957. begin
  2958. Result := MCIWndSM(hwnd, MCIWNDM_GETLENGTH, 0, 0);
  2959. end;
  2960. function MCIWndGetEnd(hwnd: HWND): DWORD;
  2961. begin
  2962. Result := MCIWndSM(hwnd, MCIWNDM_GETEND, 0, 0);
  2963. end;
  2964. function MCIWndStep(hwnd: HWND; n: DWORD): DWORD;
  2965. begin
  2966. Result := MCIWndSM(hwnd, MCI_STEP, 0, n);
  2967. end;
  2968. procedure MCIWndDestroy(hwnd: HWND);
  2969. begin
  2970. MCIWndSM(hwnd, WM_CLOSE, 0, 0);
  2971. end;
  2972. procedure MCIWndSetZoom(hwnd: HWND; iZoom: UINT);
  2973. begin
  2974. MCIWndSM(hwnd, MCIWNDM_SETZOOM, 0, iZoom);
  2975. end;
  2976. function MCIWndGetZoom(hwnd: HWND): UINT;
  2977. begin
  2978. Result := MCIWndSM(hwnd, MCIWNDM_GETZOOM, 0, 0);
  2979. end;
  2980. function MCIWndSetVolume(hwnd: HWND; iVol: UINT): DWORD;
  2981. begin
  2982. Result := MCIWndSM(hwnd, MCIWNDM_SETVOLUME, 0, iVol);
  2983. end;
  2984. function MCIWndGetVolume(hwnd: HWND): DWORD;
  2985. begin
  2986. Result := MCIWndSM(hwnd, MCIWNDM_GETVOLUME, 0, 0);
  2987. end;
  2988. function MCIWndSetSpeed(hwnd: HWND; iSpeed: UINT): DWORD;
  2989. begin
  2990. Result := MCIWndSM(hwnd, MCIWNDM_SETSPEED, 0, iSpeed);
  2991. end;
  2992. function MCIWndGetSpeed(hwnd: HWND): DWORD;
  2993. begin
  2994. Result := MCIWndSM(hwnd, MCIWNDM_GETSPEED, 0, 0);
  2995. end;
  2996. function MCIWndSetTimeFormat(hwnd: HWND; lp: LPCSTR): DWORD;
  2997. begin
  2998. Result := MCIWndSM(hwnd, MCIWNDM_SETTIMEFORMAT, 0, LPARAM(lp));
  2999. end;
  3000. function MCIWndGetTimeFormat(hwnd: HWND; lp: LPCSTR; len: UINT): DWORD;
  3001. begin
  3002. Result := MCIWndSM(hwnd, MCIWNDM_GETTIMEFORMAT, len, LPARAM(lp));
  3003. end;
  3004. procedure MCIWndValidateMedia(hwnd: HWND);
  3005. begin
  3006. MCIWndSM(hwnd, MCIWNDM_VALIDATEMEDIA, 0, 0);
  3007. end;
  3008. procedure MCIWndSetRepeat(hwnd: HWND; f: BOOL);
  3009. begin
  3010. MCIWndSM(hwnd, MCIWNDM_SETREPEAT, 0, LPARAM(f));
  3011. end;
  3012. function MCIWndGetRepeat(hwnd: HWND): BOOL;
  3013. begin
  3014. Result := MCIWndSM(hwnd, MCIWNDM_GETREPEAT, 0, 0) <> 0;
  3015. end;
  3016. function MCIWndUseFrames(hwnd: HWND): DWORD;
  3017. begin
  3018. Result := MCIWndSetTimeFormat(hwnd, 'frames');
  3019. end;
  3020. function MCIWndUseTime(hwnd: HWND): DWORD;
  3021. begin
  3022. Result := MCIWndSetTimeFormat(hwnd, 'ms');
  3023. end;
  3024. procedure MCIWndSetActiveTimer(hwnd: HWND; active: UINT);
  3025. begin
  3026. MCIWndSM(hwnd, MCIWNDM_SETACTIVETIMER, active, 0);
  3027. end;
  3028. procedure MCIWndSetInactiveTimer(hwnd: HWND; inactive: UINT);
  3029. begin
  3030. MCIWndSM(hwnd, MCIWNDM_SETINACTIVETIMER, inactive, 0);
  3031. end;
  3032. procedure MCIWndSetTimers(hwnd: HWND; active, inactive: UINT);
  3033. begin
  3034. MCIWndSM(hwnd, MCIWNDM_SETTIMERS, active, inactive);
  3035. end;
  3036. function MCIWndGetActiveTimer(hwnd: HWND): UINT;
  3037. begin
  3038. Result := MCIWndSM(hwnd, MCIWNDM_GETACTIVETIMER, 0, 0);
  3039. end;
  3040. function MCIWndGetInactiveTimer(hwnd: HWND): UINT;
  3041. begin
  3042. Result := MCIWndSM(hwnd, MCIWNDM_GETINACTIVETIMER, 0, 0);
  3043. end;
  3044. function MCIWndRealize(hwnd: HWND; fBkgnd: BOOL): DWORD;
  3045. begin
  3046. Result := MCIWndSM(hwnd, MCIWNDM_REALIZE, WPARAM(fBkgnd), 0);
  3047. end;
  3048. function MCIWndSendString(hwnd: HWND; sz: LPCSTR): DWORD;
  3049. begin
  3050. Result := MCIWndSM(hwnd, MCIWNDM_SENDSTRING, 0, LPARAM(sz));
  3051. end;
  3052. function MCIWndReturnString(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
  3053. begin
  3054. Result := MCIWndSM(hwnd, MCIWNDM_RETURNSTRING, len, LPARAM(lp));
  3055. end;
  3056. function MCIWndGetError(hwnd: HWND; lp: LPSTR; len: UINT): DWORD;
  3057. begin
  3058. Result := MCIWndSM(hwnd, MCIWNDM_GETERROR, len, LPARAM(lp));
  3059. end;
  3060. function MCIWndGetPalette(hwnd: HWND): HPALETTE;
  3061. begin
  3062. Result := MCIWndSM(hwnd, MCIWNDM_GETPALETTE, 0, 0);
  3063. end;
  3064. function MCIWndSetPalette(hwnd: HWND; hpal: HPALETTE): DWORD;
  3065. begin
  3066. Result := MCIWndSM(hwnd, MCIWNDM_SETPALETTE, hpal, 0);
  3067. end;
  3068. function MCIWndGetFileName(hwnd: HWND; lp: LPCSTR; len: UINT): DWORD;
  3069. begin
  3070. Result := MCIWndSM(hwnd, MCIWNDM_GETFILENAME, len, LPARAM(lp));
  3071. end;
  3072. function MCIWndGetDevice(hwnd: HWND; lp: LPCSTR; len: UINT): DWORD;
  3073. begin
  3074. Result := MCIWndSM(hwnd, MCIWNDM_GETDEVICE, len, LPARAM(lp));
  3075. end;
  3076. function MCIWndGetStyles(hwnd: HWND): UINT;
  3077. begin
  3078. Result := MCIWndSM(hwnd, MCIWNDM_GETSTYLES, 0, 0);
  3079. end;
  3080. function MCIWndChangeStyles(hwnd: HWND; mask: UINT; value: DWORD): DWORD;
  3081. begin
  3082. Result := MCIWndSM(hwnd, MCIWNDM_CHANGESTYLES, mask, value);
  3083. end;
  3084. function MCIWndOpenInterface(hwnd: HWND; pUnk: PUNKNOWN): DWORD;
  3085. begin
  3086. Result := MCIWndSM(hwnd, MCIWNDM_OPENINTERFACE, 0, LPARAM(pUnk));
  3087. end;
  3088. function MCIWndSetOwner(hwnd: HWND; hwndP: HWND): DWORD;
  3089. begin
  3090. Result := MCIWndSM(hwnd, MCIWNDM_SETOWNER, hwndP, 0);
  3091. end;
  3092. {== AVICAP - Window class for AVI capture ====================================}
  3093. function AVICapSM(hwnd: HWND; m: UINT; w: WPARAM; l: LPARAM): DWORD;
  3094. begin
  3095. if IsWindow(hwnd) then
  3096. Result := SendMessage(hwnd,m,w,l)
  3097. else
  3098. Result := 0;
  3099. end;
  3100. {-- Message crackers for above -----------------------------------------------}
  3101. function capSetCallbackOnError(hwnd: HWND; fpProc: TCAPERRORCALLBACK): BOOL;
  3102. begin
  3103. Result := AVICapSM(hwnd, WM_CAP_SET_CALLBACK_ERROR, 0, LPARAM(@fpProc)) <> 0;
  3104. end;
  3105. function capSetCallbackOnStatus(hwnd: HWND; fpProc: TCAPSTATUSCALLBACK): BOOL;
  3106. begin
  3107. Result := AVICapSM(hwnd, WM_CAP_SET_CALLBACK_STATUS, 0, LPARAM(@fpProc)) <> 0;
  3108. end;
  3109. function capSetCallbackOnYield(hwnd: HWND; fpProc: TCAPYIELDCALLBACK): BOOL;
  3110. begin
  3111. Result := AVICapSM(hwnd, WM_CAP_SET_CALLBACK_YIELD, 0, LPARAM(@fpProc)) <> 0;
  3112. end;
  3113. function capSetCallbackOnFrame(hwnd: HWND; fpProc: TCAPVIDEOCALLBACK): BOOL;
  3114. begin
  3115. Result := AVICapSM(hwnd, WM_CAP_SET_CALLBACK_FRAME, 0, LPARAM(@fpProc)) <> 0;
  3116. end;
  3117. function capSetCallbackOnVideoStream(hwnd: HWND; fpProc: TCAPVIDEOCALLBACK): BOOL;
  3118. begin
  3119. Result := AVICapSM(hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, LPARAM(@fpProc)) <> 0;
  3120. end;
  3121. function capSetCallbackOnWaveStream(hwnd: HWND; fpProc: TCAPWAVECALLBACK): BOOL;
  3122. begin
  3123. Result := AVICapSM(hwnd, WM_CAP_SET_CALLBACK_WAVESTREAM, 0, LPARAM(@fpProc)) <> 0;
  3124. end;
  3125. function capSetCallbackOnCapControl(hwnd: HWND; fpProc: TCAPCONTROLCALLBACK): BOOL;
  3126. begin
  3127. Result := AVICapSM(hwnd, WM_CAP_SET_CALLBACK_CAPCONTROL, 0, LPARAM(@fpProc)) <> 0;
  3128. end;
  3129. function capSetUserData(hwnd: HWND; lUser: DWORD): BOOL;
  3130. begin
  3131. Result := AVICapSM(hwnd, WM_CAP_SET_USER_DATA, 0, lUser) <> 0;
  3132. end;
  3133. function capGetUserData(hwnd: HWND): DWORD;
  3134. begin
  3135. Result := AVICapSM(hwnd, WM_CAP_GET_USER_DATA, 0, 0);
  3136. end;
  3137. function capDriverConnect(hwnd: HWND; i: INT): BOOL;
  3138. begin
  3139. Result := AVICapSM(hwnd, WM_CAP_DRIVER_CONNECT, i, 0) <> 0;
  3140. end;
  3141. function capDriverDisconnect(hwnd: HWND): BOOL;
  3142. begin
  3143. Result := AVICapSM(hwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0) <> 0;
  3144. end;
  3145. function capDriverGetName(hwnd: HWND; szName: LPSTR; wSize: WORD): BOOL;
  3146. begin
  3147. Result := AVICapSM(hwnd, WM_CAP_DRIVER_GET_NAME, wSize, LPARAM(szName)) <> 0;
  3148. end;
  3149. function capDriverGetVersion(hwnd: HWND; szVer: LPSTR; wSize: WORD): BOOL;
  3150. begin
  3151. Result := AVICapSM(hwnd, WM_CAP_DRIVER_GET_VERSION, wSize, LPARAM(szVer)) <> 0;
  3152. end;
  3153. function capDriverGetCaps(hwnd: HWND; s: PCAPDRIVERCAPS; wSize: WORD): BOOL;
  3154. begin
  3155. Result := AVICapSM(hwnd, WM_CAP_DRIVER_GET_CAPS, wSize, LPARAM(s)) <> 0;
  3156. end;
  3157. function capFileSetCaptureFile(hwnd: HWND; szName: LPCSTR): BOOL;
  3158. begin
  3159. Result := AVICapSM(hwnd, WM_CAP_FILE_SET_CAPTURE_FILE, 0, LPARAM(szName)) <> 0;
  3160. end;
  3161. function capFileGetCaptureFile(hwnd: HWND; szName: LPSTR; wSize: WORD): BOOL;
  3162. begin
  3163. Result := AVICapSM(hwnd, WM_CAP_FILE_GET_CAPTURE_FILE, wSize, LPARAM(szName)) <> 0;
  3164. end;
  3165. function capFileAlloc(hwnd: HWND; dwSize: DWORD): BOOL;
  3166. begin
  3167. Result := AVICapSM(hwnd, WM_CAP_FILE_ALLOCATE, 0, dwSize) <> 0;
  3168. end;
  3169. function capFileSaveAs(hwnd: HWND; szName: LPCSTR): BOOL;
  3170. begin
  3171. Result := AVICapSM(hwnd, WM_CAP_FILE_SAVEAS, 0, LPARAM(szName)) <> 0;
  3172. end;
  3173. function capFileSetInfoChunk(hwnd: HWND; lpInfoChunk: PCAPINFOCHUNK): BOOL;
  3174. begin
  3175. Result := AVICapSM(hwnd, WM_CAP_FILE_SET_INFOCHUNK, 0, LPARAM(lpInfoChunk)) <> 0;
  3176. end;
  3177. function capFileSaveDIB(hwnd: HWND; szName: LPCSTR): BOOL;
  3178. begin
  3179. Result := AVICapSM(hwnd, WM_CAP_FILE_SAVEDIB, 0, LPARAM(szName)) <> 0;
  3180. end;
  3181. function capEditCopy(hwnd: HWND): BOOL;
  3182. begin
  3183. Result := AVICapSM(hwnd, WM_CAP_EDIT_COPY, 0, 0) <> 0;
  3184. end;
  3185. function capSetAudioFormat(hwnd: HWND; s: PWAVEFORMATEX; wSize: WORD): BOOL;
  3186. begin
  3187. Result := AVICapSM(hwnd, WM_CAP_SET_AUDIOFORMAT, wSize, LPARAM(s)) <> 0;
  3188. end;
  3189. function capGetAudioFormat(hwnd: HWND; s: PWAVEFORMATEX; wSize: WORD): DWORD;
  3190. begin
  3191. Result := AVICapSM(hwnd, WM_CAP_GET_AUDIOFORMAT, wSize, LPARAM(s));
  3192. end;
  3193. function capGetAudioFormatSize(hwnd: HWND): DWORD;
  3194. begin
  3195. Result := AVICapSM(hwnd, WM_CAP_GET_AUDIOFORMAT, 0, 0);
  3196. end;
  3197. function capDlgVideoFormat(hwnd: HWND): BOOL;
  3198. begin
  3199. Result := AVICapSM(hwnd, WM_CAP_DLG_VIDEOFORMAT, 0, 0) <> 0;
  3200. end;
  3201. function capDlgVideoSource(hwnd: HWND): BOOL;
  3202. begin
  3203. Result := AVICapSM(hwnd, WM_CAP_DLG_VIDEOSOURCE, 0, 0) <> 0;
  3204. end;
  3205. function capDlgVideoDisplay(hwnd: HWND): BOOL;
  3206. begin
  3207. Result := AVICapSM(hwnd, WM_CAP_DLG_VIDEODISPLAY, 0, 0) <> 0;
  3208. end;
  3209. function capDlgVideoCompression(hwnd: HWND): BOOL;
  3210. begin
  3211. Result := AVICapSM(hwnd, WM_CAP_DLG_VIDEOCOMPRESSION, 0, 0) <> 0;
  3212. end;
  3213. function capGetVideoFormat(hwnd: HWND; s: PVOID; wSize: WORD): DWORD;
  3214. begin
  3215. Result := AVICapSM(hwnd, WM_CAP_GET_VIDEOFORMAT, wSize, LPARAM(s));
  3216. end;
  3217. function capGetVideoFormatSize(hwnd: HWND): DWORD;
  3218. begin
  3219. Result := AVICapSM(hwnd, WM_CAP_GET_VIDEOFORMAT, 0, 0);
  3220. end;
  3221. function capSetVideoFormat(hwnd: HWND; s: PVOID; wSize: WORD): BOOL;
  3222. begin
  3223. Result := AVICapSM(hwnd, WM_CAP_SET_VIDEOFORMAT, wSize, LPARAM(s)) <> 0;
  3224. end;
  3225. function capPreview(hwnd: HWND; f: BOOL): BOOL;
  3226. begin
  3227. Result := AVICapSM(hwnd, WM_CAP_SET_PREVIEW, WPARAM(f), 0) <> 0;
  3228. end;
  3229. function capPreviewRate(hwnd: HWND; wMS: WORD): BOOL;
  3230. begin
  3231. Result := AVICapSM(hwnd, WM_CAP_SET_PREVIEWRATE, wMS, 0) <> 0;
  3232. end;
  3233. function capOverlay(hwnd: HWND; f: BOOL): BOOL;
  3234. begin
  3235. Result := AVICapSM(hwnd, WM_CAP_SET_OVERLAY, WPARAM(f), 0) <> 0;
  3236. end;
  3237. function capPreviewScale(hwnd: HWND; f: BOOL): BOOL;
  3238. begin
  3239. Result := AVICapSM(hwnd, WM_CAP_SET_SCALE, WPARAM(f), 0) <> 0;
  3240. end;
  3241. function capGetStatus(hwnd: HWND; s: PCAPSTATUS; wSize: WORD): BOOL;
  3242. begin
  3243. Result := AVICapSM(hwnd, WM_CAP_GET_STATUS, wSize, LPARAM(s)) <> 0;
  3244. end;
  3245. function capSetScrollPos(hwnd: HWND; lpP: PPOINT): BOOL;
  3246. begin
  3247. Result := AVICapSM(hwnd, WM_CAP_SET_SCROLL, 0, LPARAM(lpP)) <> 0;
  3248. end;
  3249. function capGrabFrame(hwnd: HWND): BOOL;
  3250. begin
  3251. Result := AVICapSM(hwnd, WM_CAP_GRAB_FRAME, 0, 0) <> 0;
  3252. end;
  3253. function capGrabFrameNoStop(hwnd: HWND): BOOL;
  3254. begin
  3255. Result := AVICapSM(hwnd, WM_CAP_GRAB_FRAME_NOSTOP, 0, 0) <> 0;
  3256. end;
  3257. function capCaptureSequence(hwnd: HWND): BOOL;
  3258. begin
  3259. Result := AVICapSM(hwnd, WM_CAP_SEQUENCE, 0, 0) <> 0;
  3260. end;
  3261. function capCaptureSequenceNoFile(hwnd: HWND): BOOL;
  3262. begin
  3263. Result := AVICapSM(hwnd, WM_CAP_SEQUENCE_NOFILE, 0, 0) <> 0;
  3264. end;
  3265. function capCaptureStop(hwnd: HWND): BOOL;
  3266. begin
  3267. Result := AVICapSM(hwnd, WM_CAP_STOP, 0, 0) <> 0;
  3268. end;
  3269. function capCaptureAbort(hwnd: HWND): BOOL;
  3270. begin
  3271. Result := AVICapSM(hwnd, WM_CAP_ABORT, 0, 0) <> 0;
  3272. end;
  3273. function capCaptureSingleFrameOpen(hwnd: HWND): BOOL;
  3274. begin
  3275. Result := AVICapSM(hwnd, WM_CAP_SINGLE_FRAME_OPEN, 0, 0) <> 0;
  3276. end;
  3277. function capCaptureSingleFrameClose(hwnd: HWND): BOOL;
  3278. begin
  3279. Result := AVICapSM(hwnd, WM_CAP_SINGLE_FRAME_CLOSE, 0, 0) <> 0;
  3280. end;
  3281. function capCaptureSingleFrame(hwnd: HWND): BOOL;
  3282. begin
  3283. Result := AVICapSM(hwnd, WM_CAP_SINGLE_FRAME, 0, 0) <> 0;
  3284. end;
  3285. function capCaptureGetSetup(hwnd: HWND; s: PCAPTUREPARMS; wSize: WORD): BOOL;
  3286. begin
  3287. Result := AVICapSM(hwnd, WM_CAP_GET_SEQUENCE_SETUP, wSize, LPARAM(s)) <> 0;
  3288. end;
  3289. function capCaptureSetSetup(hwnd: HWND; s: PCAPTUREPARMS; wSize: WORD): BOOL;
  3290. begin
  3291. Result := AVICapSM(hwnd, WM_CAP_SET_SEQUENCE_SETUP, wSize, LPARAM(s)) <> 0;
  3292. end;
  3293. function capSetMCIDeviceName(hwnd: HWND; szName: LPCSTR): BOOL;
  3294. begin
  3295. Result := AVICapSM(hwnd, WM_CAP_SET_MCI_DEVICE, 0, LPARAM(szName)) <> 0;
  3296. end;
  3297. function capGetMCIDeviceName(hwnd: HWND; szName: LPSTR; wSize: WORD): BOOL;
  3298. begin
  3299. Result := AVICapSM(hwnd, WM_CAP_GET_MCI_DEVICE, wSize, LPARAM(szName)) <> 0;
  3300. end;
  3301. function capPaletteOpen(hwnd: HWND; szName: LPCSTR): BOOL;
  3302. begin
  3303. Result := AVICapSM(hwnd, WM_CAP_PAL_OPEN, 0, LPARAM(szName)) <> 0;
  3304. end;
  3305. function capPaletteSave(hwnd: HWND; szName: LPCSTR): BOOL;
  3306. begin
  3307. Result := AVICapSM(hwnd, WM_CAP_PAL_SAVE, 0, LPARAM(szName)) <> 0;
  3308. end;
  3309. function capPalettePaste(hwnd: HWND): BOOL;
  3310. begin
  3311. Result := AVICapSM(hwnd, WM_CAP_PAL_PASTE, 0, 0) <> 0;
  3312. end;
  3313. function capPaletteAuto(hwnd: HWND; iFrames, iColors: INT): BOOL;
  3314. begin
  3315. Result := AVICapSM(hwnd, WM_CAP_PAL_AUTOCREATE, iFrames, iColors) <> 0;
  3316. end;
  3317. function capPaletteManual(hwnd: HWND; fGrab: BOOL; iColors: INT): BOOL;
  3318. begin
  3319. Result := AVICapSM(hwnd, WM_CAP_PAL_MANUALCREATE, WPARAM(fGrab), iColors) <> 0;
  3320. end;
  3321. {== Externals ================================================================}
  3322. const
  3323. VFWDLL = 'MSVFW32.DLL';
  3324. AVIFILDLL = 'AVIFIL32.DLL';
  3325. AVICAPDLL = 'AVICAP32.DLL';
  3326. {-- Returns version of VFW ---------------------------------------------------}
  3327. function VideoForWindowsVersion: DWord; pascal; external VFWDLL;
  3328. {-- Call these to start stop using VfW from your app -------------------------}
  3329. { TODO: Where are these functions? }
  3330. {
  3331. function InitVFW: LONG; stdcall;
  3332. function TermVFW: LONG; stdcall; }
  3333. {-- ICM function declarations ------------------------------------------------}
  3334. function ICInfo(fccType, fccHandler: DWORD; lpicinfo: PICINFO) : BOOL ; stdcall ; external VFWDLL;
  3335. function ICInstall(fccType, fccHandler: DWORD; lParam: LPARAM; szDesc: LPSTR; wFlags: UINT) : BOOL ; stdcall ; external VFWDLL;
  3336. function ICRemove(fccType, fccHandler: DWORD; wFlags: UINT) : BOOL ; stdcall ; external VFWDLL;
  3337. function ICGetInfo(hic: HIC; picinfo: PICINFO; cb: DWORD) : DWORD ; stdcall ; external VFWDLL;
  3338. function ICOpen(fccType, fccHandler: DWORD; wMode: UINT) : HIC ; stdcall ; external VFWDLL;
  3339. function ICOpenFunction(fccType, fccHandler: DWORD; wMode: UINT; lpfnHandler: TFarProc) : HIC ; stdcall ; external VFWDLL;
  3340. function ICClose(hic: HIC) : DWORD ; stdcall ; external VFWDLL;
  3341. function ICSendMessage(hic: HIC; msg: UINT; dw1, dw2: DWORD) : DWORD ; stdcall ; external VFWDLL;
  3342. {== Compression functions ====================================================}
  3343. {-- ICCompress() - compress a single frame -----------------------------------}
  3344. function ICCompress(
  3345. hic : HIC;
  3346. dwFlags : DWORD; // flags
  3347. lpbiOutput : PBITMAPINFOHEADER; // output format
  3348. lpData : PVOID; // output data
  3349. lpbiInput : PBITMAPINFOHEADER; // format of frame to compress
  3350. lpBits : PVOID; // frame data to compress
  3351. lpckid : PDWORD; // ckid for data in AVI file
  3352. lpdwFlags : PDWORD; // flags in the AVI index.
  3353. lFrameNum : DWORD; // frame number of seq.
  3354. dwFrameSize : DWORD; // reqested size in bytes. (if non zero)
  3355. dwQuality : DWORD; // quality within one frame
  3356. lpbiPrev : PBITMAPINFOHEADER; // format of previous frame
  3357. lpPrev : PVOID // previous frame
  3358. ) : DWORD; cdecl; external VFWDLL;
  3359. {== Decompression functions ==================================================}
  3360. {-- ICDecompress() - decompress a single frame -------------------------------}
  3361. function ICDecompress(
  3362. hic : HIC;
  3363. dwFlags : DWORD; // flags (from AVI index...)
  3364. lpbiFormat : PBITMAPINFOHEADER; // BITMAPINFO of compressed data
  3365. // biSizeImage has the chunk size
  3366. lpData : PVOID; // data
  3367. lpbi : PBITMAPINFOHEADER; // DIB to decompress to
  3368. lpBits : PVOID
  3369. ): DWORD; cdecl; external VFWDLL;
  3370. {== Drawing functions ========================================================}
  3371. {-- ICDrawBegin() - start decompressing data with fmt directly to screen -----}
  3372. // return zero if the decompressor supports drawing.
  3373. function ICDrawBegin(
  3374. hic : HIC;
  3375. dwFlags : DWORD; // flags
  3376. hpal : HPALETTE; // palette to draw with
  3377. hwnd : HWND; // window to draw to
  3378. hdc : HDC; // HDC to draw to
  3379. xDst : int; // destination rectangle
  3380. yDst : int;
  3381. dxDst : int;
  3382. dyDst : int;
  3383. lpbi : PBITMAPINFOHEADER; // format of frame to draw
  3384. xSrc : int; // source rectangle
  3385. ySrc : int;
  3386. dxSrc : int;
  3387. dySrc : int;
  3388. dwRate : DWORD; // frames/second = (dwRate/dwScale)
  3389. dwScale : DWORD
  3390. ): DWORD; cdecl; external VFWDLL;
  3391. {-- ICDraw() - decompress data directly to the screen ------------------------}
  3392. function ICDraw(
  3393. hic : HIC;
  3394. dwFlags : DWORD; // flags
  3395. lpFormat : PVOID; // format of frame to decompress
  3396. lpData : PVOID; // frame data to decompress
  3397. cbData : DWORD; // size of data
  3398. lTime : DWORD // time to draw this frame
  3399. ): DWORD; cdecl; external VFWDLL;
  3400. {== Helper routines for DrawDib and MCIAVI... ================================}
  3401. function ICLocate(fccType, fccHandler: DWORD; lpbiIn, lpbiOut: PBITMAPINFOHEADER; wFlags: WORD): HIC; stdcall; external VFWDLL;
  3402. function ICGetDisplayFormat(hic: HIC; lpbiIn, lpbiOut: PBITMAPINFOHEADER; BitDepth: int; dx, dy: int): HIC; stdcall; external VFWDLL;
  3403. {== Higher level functions ===================================================}
  3404. function ICImageCompress(
  3405. hic : HIC; // compressor to use
  3406. uiFlags : UINT; // flags (none yet)
  3407. lpbiIn : PBITMAPINFO; // format to compress from
  3408. lpBits : PVOID; // data to compress
  3409. lpbiOut : PBITMAPINFO; // compress to this (NULL ==> default)
  3410. lQuality : LONG; // quality to use
  3411. plSize : PDWORD // compress to this size (0=whatever)
  3412. ): THANDLE; stdcall; external VFWDLL;
  3413. function ICImageDecompress(
  3414. hic : HIC; // compressor to use
  3415. uiFlags : UINT; // flags (none yet)
  3416. lpbiIn : PBITMAPINFO; // format to decompress from
  3417. lpBits : PVOID; // data to decompress
  3418. lpbiOut : PBITMAPINFO // decompress to this (NULL ==> default)
  3419. ): THANDLE; stdcall; external VFWDLL;
  3420. {-- ICCompressorChoose() - allows user to choose compressor, quality etc... --}
  3421. function ICCompressorChoose(
  3422. hwnd : HWND; // parent window for dialog
  3423. uiFlags : UINT; // flags
  3424. pvIn : PVOID; // input format (optional)
  3425. lpData : PVOID; // input data (optional)
  3426. pc : PCOMPVARS; // data about the compressor/dlg
  3427. lpszTitle : LPSTR // dialog title (optional)
  3428. ): BOOL; stdcall; external VFWDLL;
  3429. function ICSeqCompressFrameStart(pc: PCOMPVARS; lpbiIn: PBITMAPINFO): BOOL; stdcall; external VFWDLL;
  3430. procedure ICSeqCompressFrameEnd(pc: PCOMPVARS); stdcall; external VFWDLL;
  3431. function ICSeqCompressFrame(
  3432. pc : PCOMPVARS; // set by ICCompressorChoose
  3433. uiFlags : UINT; // flags
  3434. lpBits : PVOID; // input DIB bits
  3435. pfKey : PBOOL; // did it end up being a key frame?
  3436. plSize : PDWORD // size to compress to/of returned image
  3437. ): PVOID; stdcall; external VFWDLL;
  3438. procedure ICCompressorFree(pc: PCOMPVARS); stdcall; external VFWDLL;
  3439. {== DrawDib functions ========================================================}
  3440. {-- DrawDibOpen() ------------------------------------------------------------}
  3441. function DrawDibOpen: HDRAWDIB; stdcall; external VFWDLL;
  3442. {-- DrawDibClose() -----------------------------------------------------------}
  3443. function DrawDibClose(hdd: HDRAWDIB): BOOL; stdcall; external VFWDLL;
  3444. {-- DrawDibGetBuffer() -------------------------------------------------------}
  3445. function DrawDibGetBuffer(hdd: HDRAWDIB; lpbi: PBITMAPINFOHEADER; dwSize: DWORD; dwFlags: DWORD): PVOID; stdcall; external VFWDLL;
  3446. {-- DrawDibGetPalette() - get the palette used for drawing DIBs --------------}
  3447. function DrawDibGetPalette(hdd: HDRAWDIB): HPALETTE; stdcall; external VFWDLL;
  3448. {-- DrawDibSetPalette() - set the palette used for drawing DIBs --------------}
  3449. function DrawDibSetPalette(hdd: HDRAWDIB; hpal: HPALETTE): BOOL; stdcall; external VFWDLL;
  3450. {-- DrawDibChangePalette() ---------------------------------------------------}
  3451. function DrawDibChangePalette(hdd: HDRAWDIB; iStart, iLen: int; lppe: PPALETTEENTRY): BOOL; stdcall; external VFWDLL;
  3452. {-- DrawDibRealize() - realize the palette in a HDD --------------------------}
  3453. function DrawDibRealize(hdd: HDRAWDIB; hdc: HDC; fBackground: BOOL): UINT; stdcall; external VFWDLL;
  3454. {-- DrawDibStart() - start of streaming playback -----------------------------}
  3455. function DrawDibStart(hdd: HDRAWDIB; rate: DWORD): BOOL; stdcall; external VFWDLL;
  3456. {-- DrawDibStop() - start of streaming playback ------------------------------}
  3457. function DrawDibStop(hdd: HDRAWDIB): BOOL; stdcall; external VFWDLL;
  3458. {-- DrawDibBegin() - prepare to draw -----------------------------------------}
  3459. function DrawDibBegin(
  3460. hdd : HDRAWDIB;
  3461. hdc : HDC;
  3462. dxDst : int;
  3463. dyDst : int;
  3464. lpbi : PBITMAPINFOHEADER;
  3465. dxSrc : int;
  3466. dySrc : int;
  3467. wFlags : UINT
  3468. ): BOOL; stdcall; external VFWDLL;
  3469. {-- DrawDibDraw() - actually draw a DIB to the screen ------------------------}
  3470. function DrawDibDraw(
  3471. hdd : HDRAWDIB;
  3472. hdc : HDC;
  3473. xDst : int;
  3474. yDst : int;
  3475. dxDst : int;
  3476. dyDst : int;
  3477. lpbi : PBITMAPINFOHEADER;
  3478. lpBits : PVOID;
  3479. xSrc : int;
  3480. ySrc : int;
  3481. dxSrc : int;
  3482. dySrc : int;
  3483. wFlags : UINT
  3484. ): BOOL; stdcall; external VFWDLL;
  3485. {-- DrawDibEnd() -------------------------------------------------------------}
  3486. function DrawDibEnd(hdd: HDRAWDIB): BOOL; stdcall; external VFWDLL;
  3487. {-- DrawDibTime() - for debugging purposes only ------------------------------}
  3488. function DrawDibTime(hdd: HDRAWDIB; lpddtime: PDRAWDIBTIME): BOOL; stdcall; external VFWDLL;
  3489. {-- Display profiling --------------------------------------------------------}
  3490. function DrawDibProfileDisplay(lpbi: PBITMAPINFOHEADER): DWORD; stdcall; external VFWDLL;
  3491. {-- Functions ----------------------------------------------------------------}
  3492. procedure AVIFileInit; stdcall; external AVIFILDLL; // Call this first!
  3493. procedure AVIFileExit; stdcall; external AVIFILDLL;
  3494. function AVIFileAddRef(pfile: IAVIFILE): ULONG; stdcall; external AVIFILDLL;
  3495. function AVIFileRelease(pfile: IAVIFILE): ULONG; stdcall; external AVIFILDLL;
  3496. function AVIFileOpenA(var ppfile: IAVIFILE; szFile: LPCSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall; external AVIFILDLL;
  3497. function AVIFileOpenW(var ppfile: IAVIFILE; szFile: LPCWSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall; external AVIFILDLL;
  3498. {$IFDEF UNICODE}
  3499. function AVIFileOpen(var ppfile: IAVIFILE; szFile: LPCWSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall; external AVIFILDLL name 'AVIFileOpenW';
  3500. {$ELSE}
  3501. function AVIFileOpen(var ppfile: IAVIFILE; szFile: LPCSTR; uMode: UINT; lpHandler: PCLSID): HResult; stdcall; external AVIFILDLL name 'AVIFileOpenA';
  3502. {$ENDIF}
  3503. function AVIFileInfoW(pfile: IAVIFILE; var pfi: TAVIFILEINFOW; lSize: LONG): HResult; stdcall; external AVIFILDLL;
  3504. function AVIFileInfoA(pfile: IAVIFILE; var pfi: TAVIFILEINFOA; lSize: LONG): HResult; stdcall; external AVIFILDLL;
  3505. {$IFDEF UNICODE}
  3506. function AVIFileInfo(pfile: IAVIFILE; var pfi: TAVIFILEINFO; lSize: LONG): HResult; stdcall; external AVIFILDLL name 'AVIFileInfoW';
  3507. {$ELSE}
  3508. function AVIFileInfo(pfile: IAVIFILE; var pfi: TAVIFILEINFO; lSize: LONG): HResult; stdcall; external AVIFILDLL name 'AVIFileInfoA';
  3509. {$ENDIF}
  3510. function AVIFileGetStream(pfile: IAVIFILE; var ppavi: IAVISTREAM; fccType: DWORD; lParam: LONG): HResult; stdcall; external AVIFILDLL;
  3511. function AVIFileCreateStreamW(pfile: IAVIFILE; var ppavi: IAVISTREAM; var psi: TAVISTREAMINFOW): HResult; stdcall; external AVIFILDLL;
  3512. function AVIFileCreateStreamA(pfile: IAVIFILE; var ppavi: IAVISTREAM; var psi: TAVISTREAMINFOA): HResult; stdcall; external AVIFILDLL;
  3513. {$IFDEF UNICODE}
  3514. function AVIFileCreateStream(pfile: IAVIFILE; var ppavi: IAVISTREAM; var psi: TAVISTREAMINFO): HResult; stdcall; external AVIFILDLL name 'AVIFileCreateStreamW';
  3515. {$ELSE}
  3516. function AVIFileCreateStream(pfile: IAVIFILE; var ppavi: IAVISTREAM; var psi: TAVISTREAMINFO): HResult; stdcall; external AVIFILDLL name 'AVIFileCreateStreamA';
  3517. {$ENDIF}
  3518. function AVIFileWriteData(pfile: IAVIFILE; ckid: DWORD; lpData: PVOID; cbData: LONG): HResult; stdcall; external AVIFILDLL;
  3519. function AVIFileReadData(pfile: IAVIFILE; ckid: DWORD; lpData: PVOID; var lpcbData: LONG): HResult; stdcall; external AVIFILDLL;
  3520. function AVIFileEndRecord(pfile: IAVIFILE): HResult; stdcall; external AVIFILDLL;
  3521. function AVIStreamAddRef(pavi: IAVISTREAM): ULONG; stdcall; external AVIFILDLL;
  3522. function AVIStreamRelease(pavi: IAVISTREAM): ULONG; stdcall; external AVIFILDLL;
  3523. function AVIStreamInfoW (pavi: IAVISTREAM; var psi: TAVISTREAMINFOW; lSize: LONG): HResult; stdcall; external AVIFILDLL;
  3524. function AVIStreamInfoA (pavi: IAVISTREAM; var psi: TAVISTREAMINFOA; lSize: LONG): HResult; stdcall; external AVIFILDLL;
  3525. {$IFDEF UNICODE}
  3526. function AVIStreamInfo(pavi: IAVISTREAM; var psi: TAVISTREAMINFO; lSize: LONG): HResult; stdcall; external AVIFILDLL name 'AVIStreamInfoW';
  3527. {$ELSE}
  3528. function AVIStreamInfo(pavi: IAVISTREAM; var psi: TAVISTREAMINFO; lSize: LONG): HResult; stdcall; external AVIFILDLL name 'AVIStreamInfoA';
  3529. {$ENDIF}
  3530. function AVIStreamFindSample(pavi: IAVISTREAM; lPos: LONG; lFlags: LONG): LONG; stdcall; external AVIFILDLL;
  3531. function AVIStreamReadFormat(pavi: IAVISTREAM; lPos: LONG; lpFormat: PVOID; lpcbFormat: PLONG): HResult; stdcall; external AVIFILDLL;
  3532. function AVIStreamSetFormat(pavi: IAVISTREAM; lPos: LONG; lpFormat: PVOID; cbFormat: LONG): HResult; stdcall; external AVIFILDLL;
  3533. function AVIStreamReadData(pavi: IAVISTREAM; fcc: DWORD; lp: PVOID; lpcb: PLONG): HResult; stdcall; external AVIFILDLL;
  3534. function AVIStreamWriteData(pavi: IAVISTREAM; fcc: DWORD; lp: PVOID; cb: LONG): HResult; stdcall; external AVIFILDLL;
  3535. function AVIStreamRead(
  3536. pavi : IAVISTREAM;
  3537. lStart : LONG;
  3538. lSamples : LONG;
  3539. lpBuffer : PVOID;
  3540. cbBuffer : LONG;
  3541. plBytes : PLONG;
  3542. plSamples : PLONG
  3543. ): HResult; stdcall; external AVIFILDLL;
  3544. function AVIStreamWrite(
  3545. pavi : IAVISTREAM;
  3546. lStart : LONG;
  3547. lSamples : LONG;
  3548. lpBuffer : PVOID;
  3549. cbBuffer : LONG;
  3550. dwFlags : DWORD;
  3551. plSampWritten : PLONG;
  3552. plBytesWritten : PLONG
  3553. ): HResult; stdcall; external AVIFILDLL;
  3554. // Right now, these just use AVIStreamInfo() to get information, then
  3555. // return some of it. Can they be more efficient?
  3556. function AVIStreamStart(pavi: IAVISTREAM): LONG; stdcall; external AVIFILDLL;
  3557. function AVIStreamLength(pavi: IAVISTREAM): LONG; stdcall; external AVIFILDLL;
  3558. function AVIStreamTimeToSample(pavi: IAVISTREAM; lTime: LONG): LONG; stdcall; external AVIFILDLL;
  3559. function AVIStreamSampleToTime(pavi: IAVISTREAM; lSample: LONG): LONG; stdcall; external AVIFILDLL;
  3560. function AVIStreamBeginStreaming(pavi: IAVISTREAM; lStart, lEnd: LONG; lRate: LONG): HResult; stdcall; external AVIFILDLL;
  3561. function AVIStreamEndStreaming(pavi: IAVISTREAM): HResult; stdcall; external AVIFILDLL;
  3562. {-- Helper functions for using IGetFrame -------------------------------------}
  3563. function AVIStreamGetFrameOpen_(pavi: IAVISTREAM; lpbiWanted: PBitmapInfoHeader): pointer; stdcall; external AVIFILDLL name 'AVIStreamGetFrameOpen';
  3564. function AVIStreamGetFrame(pg: IGETFRAME; lPos: LONG): PBitmapInfoHeader; stdcall; external AVIFILDLL;
  3565. function AVIStreamGetFrameClose(pg: IGETFRAME): HResult; stdcall; external AVIFILDLL;
  3566. function AVIStreamGetFrameOpen(pavi: IAVIStream; lpbiWanted: PBitmapInfoHeader): IGetFrame; stdcall;
  3567. begin
  3568. pointer(Result) := AVIStreamGetFrameOpen_(pavi, lpbiWanted);
  3569. end;
  3570. // !!! We need some way to place an advise on a stream....
  3571. // STDAPI AVIStreamHasChanged (PAVISTREAM pavi);
  3572. {-- Shortcut function --------------------------------------------------------}
  3573. function AVIStreamOpenFromFileA(var ppavi: IAVISTREAM; szFile: LPCSTR; fccType: DWORD;
  3574. lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall; external AVIFILDLL;
  3575. function AVIStreamOpenFromFileW(var ppavi: IAVISTREAM; szFile: LPCWSTR; fccType: DWORD;
  3576. lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall; external AVIFILDLL;
  3577. {$IFDEF UNICODE}
  3578. function AVIStreamOpenFromFile(var ppavi: IAVISTREAM; szFile: LPCWSTR; fccType: DWORD;
  3579. lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall; external AVIFILDLL name 'AVIStreamOpenFromFileW';
  3580. {$ELSE}
  3581. function AVIStreamOpenFromFile(var ppavi: IAVISTREAM; szFile: LPCSTR; fccType: DWORD;
  3582. lParam: LONG; mode: UINT; pclsidHandler: PCLSID): HResult; stdcall; external AVIFILDLL name 'AVIStreamOpenFromFileA';
  3583. {$ENDIF}
  3584. {-- Use to create disembodied streams ----------------------------------------}
  3585. function AVIStreamCreate(var ppavi: IAVISTREAM; lParam1, lParam2: LONG;
  3586. pclsidHandler: PCLSID): HResult; stdcall; external AVIFILDLL;
  3587. // PHANDLER AVIAPI AVIGetHandler (PAVISTREAM pavi, PAVISTREAMHANDLER psh);
  3588. // PAVISTREAM AVIAPI AVIGetStream (PHANDLER p);
  3589. {-- Stuff to support backward compat. ----------------------------------------}
  3590. function AVIStreamFindKeyFrame(var pavi: IAVISTREAM; lPos: LONG; lFlags: LONG): DWORD; stdcall; external AVIFILDLL name 'AVIStreamFindSample';
  3591. // Non-portable: this is alias for method name
  3592. // FindKeyFrame FindSample
  3593. function AVIStreamClose(pavi: IAVISTREAM): ULONG; stdcall; external AVIFILDLL name 'AVIStreamRelease';
  3594. function AVIFileClose(pfile: IAVIFILE): ULONG; stdcall; external AVIFILDLL name 'AVIFileRelease';
  3595. procedure AVIStreamInit; stdcall; external AVIFILDLL name 'AVIFileInit';
  3596. procedure AVIStreamExit; stdcall; external AVIFILDLL name 'AVIFileExit';
  3597. {== AVISave routines and structures ==========================================}
  3598. function AVIMakeCompressedStream(
  3599. var ppsCompressed : IAVISTREAM;
  3600. ppsSource : IAVISTREAM;
  3601. lpOptions : PAVICOMPRESSOPTIONS;
  3602. pclsidHandler : PCLSID
  3603. ): HResult; stdcall; external AVIFILDLL;
  3604. // Non-portable: uses variable number of params
  3605. // EXTERN_C HRESULT CDECL AVISaveA (LPCSTR szFile,
  3606. // CLSID FAR *pclsidHandler,
  3607. // AVISAVECALLBACK lpfnCallback,
  3608. // int nStreams,
  3609. // PAVISTREAM pfile,
  3610. // LPAVICOMPRESSOPTIONS lpOptions,
  3611. // ...);
  3612. function AVISaveVA(
  3613. szFile : LPCSTR;
  3614. pclsidHandler : PCLSID;
  3615. lpfnCallback : TAVISAVECALLBACK;
  3616. nStreams : int;
  3617. var ppavi : IAVISTREAM;
  3618. var plpOptions : PAVICOMPRESSOPTIONS
  3619. ): HResult; stdcall; external AVIFILDLL;
  3620. // Non-portable: uses variable number of params
  3621. // EXTERN_C HRESULT CDECL AVISaveW (LPCWSTR szFile,
  3622. // CLSID FAR *pclsidHandler,
  3623. // AVISAVECALLBACK lpfnCallback,
  3624. // int nStreams,
  3625. // PAVISTREAM pfile,
  3626. // LPAVICOMPRESSOPTIONS lpOptions,
  3627. // ...);
  3628. function AVISaveVW(
  3629. szFile : LPCWSTR;
  3630. pclsidHandler : PCLSID;
  3631. lpfnCallback : TAVISAVECALLBACK;
  3632. nStreams : int;
  3633. var ppavi : IAVISTREAM;
  3634. var plpOptions : PAVICOMPRESSOPTIONS
  3635. ): HResult; stdcall; external AVIFILDLL;
  3636. // #define AVISave AVISaveA
  3637. function AVISaveV(
  3638. szFile : LPCSTR;
  3639. pclsidHandler : PCLSID;
  3640. lpfnCallback : TAVISAVECALLBACK;
  3641. nStreams : int;
  3642. var ppavi : IAVISTREAM;
  3643. var plpOptions : PAVICOMPRESSOPTIONS
  3644. ): HResult; stdcall; external AVIFILDLL name 'AVISaveVA';
  3645. function AVISaveOptions(
  3646. hwnd : HWND;
  3647. uiFlags : UINT;
  3648. nStreams : int;
  3649. var ppavi : IAVISTREAM;
  3650. var plpOptions : PAVICOMPRESSOPTIONS
  3651. ): BOOL; stdcall; external AVIFILDLL;
  3652. function AVISaveOptionsFree(nStreams: int; var plpOptions: PAVICOMPRESSOPTIONS): HResult; stdcall; external AVIFILDLL;
  3653. {-----------------------------------------------------------------------------}
  3654. function AVIBuildFilterW(lpszFilter: LPWSTR; cbFilter: LONG; fSaving: BOOL): HResult; stdcall; external AVIFILDLL;
  3655. function AVIBuildFilterA(lpszFilter: LPSTR; cbFilter: LONG; fSaving: BOOL): HResult; stdcall; external AVIFILDLL;
  3656. function AVIBuildFilter(lpszFilter: LPSTR; cbFilter: LONG; fSaving: BOOL): HResult; stdcall; external AVIFILDLL name 'AVIBuildFilterA';
  3657. function AVIMakeFileFromStreams(var ppfile: IAVIFILE; nStreams: int; var papStreams: IAVISTREAM): HResult; stdcall; external AVIFILDLL;
  3658. function AVIMakeStreamFromClipboard(cfFormat: UINT; hGlobal: THANDLE; var ppstream: IAVISTREAM): HResult; stdcall; external AVIFILDLL;
  3659. {-- Clipboard routines -------------------------------------------------------}
  3660. function AVIPutFileOnClipboard(pf: IAVIFILE): HResult; stdcall; external AVIFILDLL;
  3661. function AVIGetFromClipboard(var lppf: IAVIFILE): HResult; stdcall; external AVIFILDLL;
  3662. function AVIClearClipboard: HResult; stdcall; external AVIFILDLL;
  3663. {-- Editing routines ---------------------------------------------------------}
  3664. function CreateEditableStream(var ppsEditable: IAVISTREAM; psSource: IAVISTREAM): HResult; stdcall; external AVIFILDLL;
  3665. function EditStreamCut(pavi: IAVISTREAM; var plStart, plLength: LONG; var ppResult: IAVISTREAM): HResult; stdcall; external AVIFILDLL;
  3666. function EditStreamCopy(pavi: IAVISTREAM; var plStart, plLength: LONG; var ppResult: IAVISTREAM): HResult; stdcall; external AVIFILDLL;
  3667. function EditStreamPaste(pavi: IAVISTREAM; var plPos, plLength: LONG; pstream: IAVISTREAM; lStart, lEnd: LONG): HResult; stdcall; external AVIFILDLL;
  3668. function EditStreamClone(pavi: IAVISTREAM; var ppResult: IAVISTREAM): HResult; stdcall; external AVIFILDLL;
  3669. function EditStreamSetNameA(pavi: IAVISTREAM; lpszName: LPCSTR): HResult; stdcall; external AVIFILDLL;
  3670. function EditStreamSetNameW(pavi: IAVISTREAM; lpszName: LPCWSTR): HResult; stdcall; external AVIFILDLL;
  3671. function EditStreamSetInfoW(pavi: IAVISTREAM; lpInfo: PAVISTREAMINFOW; cbInfo: LONG): HResult; stdcall; external AVIFILDLL;
  3672. function EditStreamSetInfoA(pavi: IAVISTREAM; lpInfo: PAVISTREAMINFOA; cbInfo: LONG): HResult; stdcall; external AVIFILDLL;
  3673. function EditStreamSetInfo(pavi: IAVISTREAM; lpInfo: PAVISTREAMINFOA; cbInfo: LONG): HResult; stdcall; external AVIFILDLL name 'EditStreamSetInfoA';
  3674. function EditStreamSetName(pavi: IAVISTREAM; lpszName: LPCSTR): HResult; stdcall; external AVIFILDLL name 'EditStreamSetNameA';
  3675. {-- MCIWnd -------------------------------------------------------------------}
  3676. function MCIWndCreateA(hwndParent: HWND; hInstance: HINST; dwStyle: DWORd; szFile: LPCSTR): HWND; cdecl; external VFWDLL;
  3677. function MCIWndCreateW(hwndParent: HWND; hInstance: HINST; dwStyle: DWORd; szFile: LPCWSTR): HWND; cdecl; external VFWDLL;
  3678. function MCIWndCreate(hwndParent: HWND; hInstance: HINST; dwStyle: DWORd; szFile: LPCSTR): HWND; cdecl; external VFWDLL name 'MCIWndCreateA';
  3679. function MCIWndRegisterClass: BOOL; cdecl; external VFWDLL;
  3680. {== AVICAP - Window class for AVI capture ====================================}
  3681. {-- The only exported functions from AVICAP.DLL ------------------------------}
  3682. function capCreateCaptureWindowA(
  3683. lpszWindowName : LPCSTR;
  3684. dwStyle : DWORD;
  3685. x, y : int;
  3686. nWidth, nHeight : int;
  3687. hwndParent : HWND;
  3688. nID : int
  3689. ): HWND; stdcall; external AVICAPDLL;
  3690. function capGetDriverDescriptionA(
  3691. wDriverIndex : UINT;
  3692. lpszName : LPSTR;
  3693. cbName : int;
  3694. lpszVer : LPSTR;
  3695. cbVer : int
  3696. ): BOOL; stdcall; external AVICAPDLL;
  3697. function capCreateCaptureWindowW(
  3698. lpszWindowName : LPCWSTR;
  3699. dwStyle : DWORD;
  3700. x, y : int;
  3701. nWidth, nHeight : int;
  3702. hwndParent : HWND;
  3703. nID : int
  3704. ): HWND; stdcall; external AVICAPDLL;
  3705. function capGetDriverDescriptionW(
  3706. wDriverIndex : UINT;
  3707. lpszName : LPWSTR;
  3708. cbName : int;
  3709. lpszVer : LPWSTR;
  3710. cbVer : int
  3711. ): BOOL; stdcall; external AVICAPDLL;
  3712. function capCreateCaptureWindow(
  3713. lpszWindowName : LPCSTR;
  3714. dwStyle : DWORD;
  3715. x, y : int;
  3716. nWidth, nHeight : int;
  3717. hwndParent : HWND;
  3718. nID : int
  3719. ): HWND; stdcall; external AVICAPDLL name 'capCreateCaptureWindowA';
  3720. function capGetDriverDescription(
  3721. wDriverIndex : UINT;
  3722. lpszName : LPSTR;
  3723. cbName : int;
  3724. lpszVer : LPSTR;
  3725. cbVer : int
  3726. ): BOOL; stdcall; external AVICAPDLL name 'capGetDriverDescriptionA';
  3727. {== FilePreview dialog =======================================================}
  3728. function GetOpenFileNamePreviewA(lpofn: POPENFILENAMEA): BOOL; stdcall; external VFWDLL;
  3729. function GetSaveFileNamePreviewA(lpofn: POPENFILENAMEA): BOOL; stdcall; external VFWDLL;
  3730. function GetOpenFileNamePreviewW(lpofn: POPENFILENAMEW): BOOL; stdcall; external VFWDLL;
  3731. function GetSaveFileNamePreviewW(lpofn: POPENFILENAMEW): BOOL; stdcall; external VFWDLL;
  3732. function GetOpenFileNamePreview(lpofn: POPENFILENAMEA): BOOL; stdcall; external VFWDLL name 'GetOpenFileNamePreviewA';
  3733. function GetSaveFileNamePreview(lpofn: POPENFILENAMEA): BOOL; stdcall; external VFWDLL name 'GetSaveFileNamePreviewA';
  3734. end.