Formatx.VFW.pas 177 KB

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