Formats.VFW.pas 182 KB

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