vfw.pas 182 KB

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