FileVFW.pas 186 KB

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