Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

708 lines
25 KiB

  1. /******************************************************************************
  2. Copyright (C) Microsoft Corporation 1985-1991. All rights reserved.
  3. Title: graphic.h - Multimedia Systems Media Control Interface
  4. driver for AVI.
  5. *****************************************************************************/
  6. #define NOSHELLDEBUG
  7. #include <windows.h>
  8. #include <windowsx.h>
  9. #define MCI_USE_OFFEXT
  10. #include <mmsystem.h>
  11. #include <win32.h> // This must be included, for both versions
  12. #include <mmddk.h>
  13. #ifndef RC_INVOKED
  14. #include "ntaviprt.h"
  15. #include "common.h"
  16. #include "aviffmt.h"
  17. #include <drawdib.h>
  18. #include <compman.h>
  19. #include "avifilex.h" // include AVIFile stuff.
  20. #include "digitalv.h"
  21. #endif
  22. #include "mciavi.h"
  23. // Define this to make the code expire on a given date....
  24. // #define EXPIRE (1994 * 65536 + 1 * 256 + 1) // expire 1/1/1994
  25. #ifndef DRIVE_CDROM
  26. #define DRIVE_CDROM 5
  27. #endif
  28. #define DRIVE_INTERFACE 42
  29. #ifdef EXPIRE
  30. #define MCIERR_AVI_EXPIRED 9999
  31. #endif
  32. #define MCIAVI_PRODUCTNAME 2
  33. #define MCIAVI_VERSION 3
  34. #define MCIAVI_BADMSVIDEOVERSION 4
  35. #define MCIAVI_MENU_CONFIG 5
  36. #define MCIAVI_MENU_STRETCH 6
  37. #define MCIAVI_MENU_MUTE 7
  38. #define MCIAVI_CANT_DRAW_VIDEO 8
  39. #define MCIAVI_CANT_DRAW_STREAM 9
  40. #define INFO_VIDEOFORMAT 10
  41. #define INFO_MONOFORMAT 11
  42. #define INFO_STEREOFORMAT 12
  43. #define INFO_LENGTH 13
  44. #define INFO_FILE 14
  45. #define INFO_KEYFRAMES 15
  46. #define INFO_AUDIO 16
  47. #define INFO_SKIP 17
  48. #define INFO_ADPCM 18
  49. #define INFO_DATARATE 19
  50. #define INFO_SKIPAUDIO 20
  51. #define INFO_FILETYPE 21
  52. #define INFO_FILETYPE_AVI 22
  53. #define INFO_FILETYPE_INT 23
  54. #define INFO_FILETYPE_ALPHA 24
  55. #define INFO_FRAMERATE 25
  56. #define INFO_STREAM 26
  57. #define INFO_DISABLED 27
  58. #define INFO_ALLKEYFRAMES 28
  59. #define INFO_NOKEYFRAMES 29
  60. #define INFO_COMPRESSED 30
  61. #define INFO_NOTREAD 31
  62. #define MCIAVI_MAXSIGNALS 1
  63. #define MCIAVI_MAXWINDOWS 8
  64. /* Flags for dwFlags in MCIGRAPHIC */
  65. #define MCIAVI_STOP 0x00000001L /* We need to stop */
  66. #define MCIAVI_PAUSE 0x00000002L /* We need to be paused */
  67. #define MCIAVI_CUEING 0x00000004L /* We are in a cue command */
  68. #define MCIAVI_WAITING 0x00000008L /* We are waiting for a command to finish */
  69. #define MCIAVI_PLAYAUDIO 0x00000010L /* Audio enabled */
  70. #define MCIAVI_LOSTAUDIO 0x00000020L /* cant get audio device*/
  71. #define MCIAVI_SHOWVIDEO 0x00000040L /* Video enabled */
  72. #define MCIAVI_USING_AVIFILE 0x00000080L /* RTL to AVIFile */
  73. #define MCIAVI_USINGDISPDIB 0x00000100L /* Now in MCGA mode */
  74. #define MCIAVI_NEEDTOSHOW 0x00000200L /* window needs to be shown */
  75. #define MCIAVI_WANTMOVE 0x00000400L /* call CheckWindowMove alot */
  76. #define MCIAVI_ANIMATEPALETTE 0x00000800L /* Palette animated */
  77. #define MCIAVI_NEEDUPDATE 0x00001000L /* Need to redraw full */
  78. #define MCIAVI_PALCHANGED 0x00002000L /* Need to update palette */
  79. #define MCIAVI_STUPIDMODE 0x00004000L /* dont buffer mode */
  80. #define MCIAVI_CANDRAW 0x00008000L /* display driver can draw format */
  81. #define MCIAVI_FULLSCREEN 0x00010000L /* draw fullscreen. */
  82. #define MCIAVI_NEEDDRAWBEGIN 0x00020000L /* compressor is drawing */
  83. #define MCIAVI_UPDATETOMEMORY 0x00040000L /* drawing to a bitmap */
  84. #define MCIAVI_WAVEPAUSED 0x00080000L /* waveOut is temporarily paused */
  85. #define MCIAVI_NOTINTERLEAVED 0x00100000L /* file is not interleaved. */
  86. #define MCIAVI_USERDRAWPROC 0x00200000L /* user has set draw proc*/
  87. #define MCIAVI_Y 0x00400000L /* */
  88. #define MCIAVI_VOLUMESET 0x00800000L /* Volume has been changed. */
  89. #define MCIAVI_HASINDEX 0x01000000L /* File has index. */
  90. #define MCIAVI_RELEASEDC 0x02000000L /* we got the DC via GetDC */
  91. #define MCIAVI_SEEKING 0x04000000L /* audio disabled for seek. */
  92. #define MCIAVI_UPDATING 0x08000000L /* handling WM_PAINT-don't yield. */
  93. #define MCIAVI_REPEATING 0x10000000L /* repeat when play finishes. */
  94. #define MCIAVI_REVERSE 0x20000000L /* playing backwards.... */
  95. #define MCIAVI_NOBREAK 0x40000000L /* don't allow break out of DISPDIB */
  96. #define MCIAVI_ZOOMBY2 0x80000000L /* fullscreen zoomed by 2 */
  97. /* Flags for dwOptionFlags */
  98. #define MCIAVIO_SEEKEXACT 0x00000001L /* If off, seek goes to
  99. ** previous key frame
  100. ** instead of real
  101. ** target frame. */
  102. #define MCIAVIO_SKIPFRAMES 0x00000002L /* Skip frames to keep
  103. ** synchronized. */
  104. #define MCIAVIO_STRETCHTOWINDOW 0x00000004L /* Resize destination
  105. ** rectangle if window
  106. ** resized. */
  107. #define MCIAVIO_STUPIDMODE 0x00000020L /* Don't do nice updating. */
  108. #define MCIAVIO_ZOOMBY2 0x00000100L
  109. #define MCIAVIO_USEVGABYDEFAULT 0x00000200L
  110. #define MCIAVIO_USEAVIFILE 0x00000400L
  111. #define MCIAVI_ALG_INTERLEAVED 0x0001
  112. #define MCIAVI_ALG_CDROM 0x0002
  113. #define MCIAVI_ALG_HARDDISK 0x0003
  114. #define MCIAVI_ALG_AUDIOONLY 0x0004
  115. #define MCIAVI_ALG_AVIFILE 0x0005
  116. //
  117. // the frame index is indexed by frame number, it is used for
  118. // varible sizeed, fixed rate streams.
  119. //
  120. typedef struct
  121. {
  122. WORD iPrevKey; // prev "key" frame
  123. WORD iNextKey; // next "key" frame
  124. WORD iPalette; // palette frame (this points into index!)
  125. UINT wSmag; //
  126. DWORD dwOffset; // Position of chunk (file offset)
  127. DWORD dwLength; // Length of chunk (in bytes)
  128. } AVIFRAMEINDEX;
  129. #define NOBASED32
  130. #if defined(WIN32) || defined(NOBASED32)
  131. #define BASED32(p) _huge
  132. #define P32(t,p) ((t _huge *)(p))
  133. #define B32(t,p) ((t _huge *)(p))
  134. #else
  135. #define BASED32(p) _based32((_segment)SELECTOROF(p))
  136. #define P32(t,p) ((t BASED32(p) *)OFFSETOF(p))
  137. #define B32(t,p) ((t BASED32(p) *)0)
  138. #endif
  139. #define Frame(n) (P32(AVIFRAMEINDEX,npMCI->hpFrameIndex) + (DWORD)(n))
  140. #define FrameNextKey(n) (LONG)((n) + (DWORD)Frame(n)->iNextKey)
  141. #define FramePrevKey(n) (LONG)((n) - (DWORD)Frame(n)->iPrevKey)
  142. #define FramePalette(n) (LONG)(Frame(n)->iPalette)
  143. #define FrameOffset(n) (DWORD)(Frame(n)->dwOffset)
  144. #define FrameLength(n) (DWORD)(Frame(n)->dwLength)
  145. #define UseIndex(p) SillyGlobal = (p)
  146. #define Index(n) (B32(AVIINDEXENTRY,npMCI->hpIndex) + (long)(n))
  147. #define IndexOffset(n) Index(n)->dwChunkOffset
  148. #define IndexLength(n) Index(n)->dwChunkLength
  149. #define IndexFlags(n) Index(n)->dwFlags
  150. #define IndexID(n) Index(n)->ckid
  151. typedef struct {
  152. DWORD dwFlags; /* flags, STREAM_ENABLED... */
  153. AVIStreamHeader sh; /* AVIStreamHeader...*/
  154. DWORD cbFormat; /* Stream format...*/
  155. LPVOID lpFormat;
  156. DWORD cbData; /* Extra stream data...*/
  157. LPVOID lpData;
  158. HIC hicDraw; /* Draw codec...*/
  159. RECT rcSource; /* rectangles...*/
  160. RECT rcDest;
  161. LONG lStart; /* start */
  162. LONG lEnd; /* end */
  163. LONG lPlayStart; /* play start */
  164. LONG lPlayFrom; /* play from */
  165. LONG lPlayTo; /* play to */
  166. LONG lFrameDrawn; /* we drew this */
  167. LONG lPos; /* current pos */
  168. LONG lNext; /* next pos */
  169. LONG lLastKey; /* key frame */
  170. LONG lNextKey; /* next key frame */
  171. #ifdef USEAVIFILE
  172. PAVISTREAM ps;
  173. ////IAVIStreamVtbl vt; // so we can call direct.
  174. #endif
  175. } STREAMINFO;
  176. #define STREAM_ENABLED 0x0001 // stream is enabled for play
  177. #define STREAM_ACTIVE 0x0002 // stream is active for *current* play
  178. #define STREAM_NEEDUPDATE 0x0004 // stream needs update (paint)
  179. #define STREAM_ERROR 0x0008 // stream did not load
  180. #define STREAM_DIRTY 0x0010 // stream not showing current frame.
  181. #define STREAM_SKIP 0x0100 // can skip data
  182. #define STREAM_PALCHANGES 0x0200 // stream has palette changes
  183. #define STREAM_VIDEO 0x0400 // is a video stream
  184. #define STREAM_AUDIO 0x0800 // is a audio stream
  185. #define STREAM_PALCHANGED 0x1000 // palette has changed
  186. #define STREAM_WANTIDLE 0x2000 // should get idle time
  187. #define STREAM_WANTMOVE 0x4000 // should get ICM_DRAW_WINDOW message
  188. #define SI(stream) (npMCI->paStreamInfo + stream)
  189. #define SH(stream) (SI(stream)->sh)
  190. #define SOURCE(stream) (SI(stream)->rcSource)
  191. #define DEST(stream) (SI(stream)->rcDest)
  192. #define FRAME(stream) (SH(stream).rcFrame)
  193. #define FORMAT(stream) (SI(stream)->lpFormat)
  194. #define VIDFMT(stream) ((LPBITMAPINFOHEADER) FORMAT(stream))
  195. #define AUDFMT(stream) ((LPPCMWAVEFORMAT) FORMAT(stream))
  196. //
  197. // map from "movie" time into stream time.
  198. //
  199. #define TimeToMovie(t) muldiv32(t, npMCI->dwRate, npMCI->dwScale*1000)
  200. #define MovieToTime(l) muldiv32(l, npMCI->dwScale*1000, npMCI->dwRate)
  201. #define TimeToStream(psi, t) muldiv32(t, psi->sh.dwRate, psi->sh.dwScale*1000)
  202. #define StreamToTime(psi, l) muldiv32(l, psi->sh.dwScale*1000, psi->sh.dwRate)
  203. //
  204. // NOTE all dwScale's are equal so we can do this without as many
  205. // multiplies
  206. //
  207. #if 0
  208. #define MovieToStream(psi, l) muldiv32(l, npMCI->dwScale * psi->sh.dwRate, npMCI->dwRate * psi->sh.dwScale)
  209. #define StreamToMovie(psi, l) muldiv32(l, npMCI->dwScale * psi->sh.dwRate, npMCI->dwRate * psi->sh.dwScale)
  210. #else
  211. #define MovieToStream(psi, l) muldiv32(l, psi->sh.dwRate, npMCI->dwRate)
  212. #define StreamToMovie(psi, l) muldiv32(l, psi->sh.dwRate, npMCI->dwRate)
  213. #endif
  214. /*
  215. * RECT macros to get X,Y,Width,Height
  216. */
  217. #define RCX(rc) ((rc).left)
  218. #define RCY(rc) ((rc).top)
  219. #define RCW(rc) ((rc).right - (rc).left)
  220. #define RCH(rc) ((rc).bottom - (rc).top)
  221. /*
  222. * The major control block for an AVI device
  223. * Define markers to more easily identify the control block when dumping
  224. */
  225. #define MCIID (DWORD)(((WORD)('V' | ('F'<<8))) | ((WORD)('W' | ('>'<<8))<<16))
  226. #define MCIIDX (DWORD)(((WORD)('v' | ('.'<<8))) | ((WORD)('w' | ('-'<<8))<<16))
  227. typedef struct _MCIGRAPHIC {
  228. struct _MCIGRAPHIC *npMCINext;
  229. #ifdef DEBUG
  230. DWORD mciid; // visible identifier
  231. #endif
  232. /*
  233. * multiple-thread synchronization. We hold a critical section per device
  234. */
  235. #ifdef WIN32
  236. CRITICAL_SECTION CritSec; // per-device lock
  237. LONG lCritRefCount; // entry count - see ntaviprt.h
  238. #endif
  239. /*
  240. ** Basic MCI information
  241. */
  242. HWND hCallback; /* callback window handle */
  243. UINT wDevID; /* device ID */
  244. /*
  245. ** Internal task operation status and flags
  246. */
  247. #ifndef WIN32
  248. UINT pspTask; /* background task's PSP */
  249. UINT pspParent; /* PSP of the calling app */
  250. #endif
  251. HTASK hTask; /* task id */
  252. HTASK hCallingTask; /* task who opened us */
  253. UINT uErrorMode; /* SetErrorMode value for calling task */
  254. DWORD dwTaskError; /* error return from task */
  255. UINT wMessageCurrent;/* Command in progress, or zero */
  256. UINT wTaskState; /* current task state */
  257. DWORD dwFlags; /* flags */
  258. DWORD dwOptionFlags; /* more flags */
  259. /*
  260. ** Additional information controlled by MCI commands
  261. */
  262. HPALETTE hpal; /* Palette forced with MCI commands */
  263. HWND hwnd; /* window handle for playback */
  264. HWND hwndDefault; /* default window handle */
  265. HWND hwndOldFocus; /* window which had keyboard focus */
  266. BOOL fForceBackground;/* Select palette in foreground or back? */
  267. DWORD dwTimeFormat; /* current time format */
  268. RECT rcMovie; /* main movie rect */
  269. RECT rcSource; /* drawing source rect */
  270. RECT rcDest; /* drawing destination rect */
  271. LONG PlaybackRate; /* 1000 is normal, more is fast.... */
  272. DWORD dwSpeedFactor; /* 1000 is normal, more is fast.... */
  273. /*
  274. ** Information about currently open file
  275. */
  276. UINT uDriveType; /* drive type */
  277. NPTSTR szFilename; /* AVI filename */
  278. LONG lFrames; /* number of frames in movie */
  279. DWORD dwBytesPerSec; /* file attributes */
  280. DWORD dwRate; /* master time base */
  281. DWORD dwScale;
  282. DWORD dwMicroSecPerFrame;
  283. DWORD dwSuggestedBufferSize;
  284. DWORD dwKeyFrameInfo; /* how often key frames occur */
  285. UINT wEarlyAudio; /* more file information */
  286. UINT wEarlyVideo;
  287. UINT wEarlyRecords;
  288. STREAMINFO NEAR *paStreamInfo;
  289. int streams; // total streams
  290. int nAudioStreams; // total audio streams
  291. int nVideoStreams; // total video streams
  292. int nOtherStreams; // total other streams
  293. int nErrorStreams; // total error streams
  294. int nAudioStream; // current audio stream.
  295. int nVideoStream; // "master" video stream
  296. STREAMINFO *psiAudio; // points to video stream
  297. STREAMINFO *psiVideo; // points to audio stream
  298. #ifdef USEAVIFILE
  299. PAVIFILE pf;
  300. ////IAVIFileVtbl vt; // so we can call direct.
  301. #else
  302. LPVOID pf; // Stupid variable to be zero.
  303. #endif
  304. /*
  305. ** video stream junk
  306. */
  307. BOOL fNoDrawing;
  308. LONG lFrameDrawn; /* number of last frame drawn */
  309. /* Drawing information */
  310. HDC hdc; /* DC we're playing into */
  311. /* Video format */
  312. BITMAPINFOHEADER FAR *pbiFormat; /* video format information */
  313. /* BitmapInfo used for drawing */
  314. BITMAPINFOHEADER bih; /* video format information */
  315. RGBQUAD argb[256]; /* current drawing colors */
  316. RGBQUAD argbOriginal[256]; /* original colors */
  317. /*
  318. ** Installable compressor information
  319. */
  320. //!!! move all this into the screen draw function!!!
  321. //!!! all this should be in DrawDIB !!!
  322. HIC hic;
  323. HIC hicDraw;
  324. LONG cbDecompress;
  325. HPSTR hpDecompress; /* pointer to full frame buffer */
  326. /*
  327. ** Holding area for compressors we might use....
  328. */
  329. HIC hicDecompress;
  330. HIC hicDrawDefault;
  331. HIC hicDrawFull;
  332. HIC hicInternal;
  333. HIC hicInternalFull;
  334. LONG lLastPaletteChange;
  335. LONG lNextPaletteChange;
  336. /*
  337. ** wave stream junk
  338. */
  339. /* Wave format stuff */
  340. NPWAVEFORMAT pWF; /* current wave format */
  341. UINT wABs; /* number of audio buffers */
  342. UINT wABOptimal; /* number full if synchronized */
  343. DWORD dwABSize; /* size of one audio buffer */
  344. HMMIO hmmioAudio;
  345. DWORD dwVolume; /* Audio volume, 1000 is full on */
  346. BOOL fEmulatingVolume;/* Are we doing volume by table lookup? */
  347. BYTE * pVolumeTable;
  348. DWORD dwAudioLength;
  349. DWORD dwAudioPos;
  350. /* Wave Output Device */
  351. HWAVEOUT hWave; /* wave device handle */
  352. UINT wABFull; /* number now full */
  353. UINT wNextAB; /* next buffer in line */
  354. UINT nAudioBehind; /* how many audio below full */
  355. HPSTR lpAudio; /* pointer to audio buffers */
  356. DWORD dwUsedThisAB;
  357. /*
  358. ** File index information
  359. */
  360. AVIINDEXENTRY _huge * hpIndex; /* pointer to index */
  361. DWORD macIndex; /* # records in index */
  362. AVIFRAMEINDEX _huge * hpFrameIndex; /* pointer to frame index */
  363. /*
  364. ** play/seek params
  365. */
  366. LONG lTo; /* frame we're playing to */
  367. LONG lFrom; /* frame we're playing from */
  368. LONG lCurrentFrame; /* current frame */
  369. LONG lRepeatFrom; /* Frame to repeat from */
  370. /*
  371. ** Information regarding current play
  372. */
  373. UINT wPlaybackAlg; /* playback algorithm in use */
  374. LONG lRealStart; /* frame playback starts */
  375. LONG lAudioStart; /* first audio frame to play */
  376. LONG lVideoStart; /* first video frame to play */
  377. LONG lLastRead;
  378. /* Timing */
  379. DWORD dwMSecPlayStart;/* Start time */
  380. LONG lFramePlayStart;/* Frame playing started at */
  381. DWORD dwTotalMSec; /* Total time spent playing */
  382. DWORD dwTimingStart;
  383. DWORD dwPauseTime;
  384. DWORD dwPlayMicroSecPerFrame;
  385. DWORD dwAudioPlayed;
  386. /*
  387. ** Timing information
  388. */
  389. DWORD dwLastDrawTime; /* How long did the last draw take? */
  390. DWORD dwLastReadTime;
  391. /* Timing information kept after play completes */
  392. DWORD dwSkippedFrames; /* Frames skipped during current play */
  393. DWORD dwFramesSeekedPast; /* Frames not even read */
  394. DWORD dwAudioBreaks; /* # times audio broke up, approx. */
  395. DWORD dwSpeedPercentage; /* Ratio of ideal time to time taken */
  396. /* Timing information for last play */
  397. LONG lFramesPlayed;
  398. LONG lSkippedFrames; /* Frames skipped during last play */
  399. LONG lFramesSeekedPast; /* Frames not even read */
  400. LONG lAudioBreaks; /* # times audio broke up, approx. */
  401. /*
  402. ** Information for pending 'signal' command
  403. */
  404. DWORD dwSignals;
  405. DWORD dwSignalFlags;
  406. MCI_DGV_SIGNAL_PARMS signal;
  407. /*
  408. ** Information for watching to see if window has moved.
  409. */
  410. UINT wRgnType; /* Region type, empty, simple, complex.... */
  411. #ifdef WIN32
  412. POINT dwOrg; /* Physical DC origin */
  413. #else
  414. DWORD dwOrg; /* Physical DC origin */
  415. #endif
  416. RECT rcClip; /* clip box */
  417. HANDLE hThreadTermination; /* Handle to wait on for thread to
  418. terminate so it's safe to unload DLL
  419. Must be closed by us */
  420. /*
  421. ** Information for hardware drawing devices....
  422. */
  423. DWORD dwBufferedVideo;
  424. /*
  425. ** specific to RIFF files
  426. */
  427. HMMIO hmmio; /* animation file handle */
  428. BOOL fReadMany; /* read more than one record */
  429. DWORD dwFirstRecordPosition;
  430. DWORD dwFirstRecordSize;
  431. DWORD dwFirstRecordType;
  432. DWORD dwNextRecordSize; // used for ReadNextChunk
  433. DWORD dwNextRecordType;
  434. DWORD dwMovieListOffset;
  435. DWORD dwBigListEnd;
  436. /* Read Buffer */
  437. HPSTR lp; /* work pointer */
  438. LPVOID lpMMIOBuffer; /* pointer to MMIO read buffer */
  439. HPSTR lpBuffer; /* pointer to read buffer */
  440. DWORD dwBufferSize; /* Read buffer size */
  441. DWORD dwThisRecordSize; /* size of current record */
  442. /*
  443. ** DEBUG stuff and more timing info.
  444. */
  445. #ifdef DEBUG
  446. HANDLE hdd; //!!!
  447. LONG timePlay; /* total play time */
  448. LONG timePrepare; /* time to prepare for play */
  449. LONG timeCleanup; /* time to clean up play */
  450. LONG timePaused; /* paused time */
  451. LONG timeRead; /* time reading from disk */
  452. LONG timeWait; /* time waiting */
  453. LONG timeYield; /* time yielding to other apps */
  454. LONG timeVideo; /* time "drawing" video stream */
  455. LONG timeAudio; /* time "drawing" audio stream */
  456. LONG timeOther; /* time "drawing" other streams */
  457. LONG timeDraw; /* time drawing frame via DrawDib/DispDib/ICDraw */
  458. LONG timeDecompress; /* time decompressing frame via ICDecompress */
  459. #endif
  460. #ifdef AVIREAD
  461. /*
  462. * handle to current async read object
  463. */
  464. HAVIRD hAviRd;
  465. HPSTR lpOldBuffer;
  466. #endif
  467. } MCIGRAPHIC, *NPMCIGRAPHIC, FAR *LPMCIGRAPHIC;
  468. extern HANDLE ghModule; // in DRVPROC.C
  469. extern TCHAR szClassName[]; // in WINDOW.C
  470. /*
  471. ** Flags to protect ourselves in case we're closed with a dialog up...
  472. */
  473. extern BOOL gfEvil; // in GRAPHIC.C
  474. extern BOOL gfEvilSysMenu; // in GRAPHIC.C
  475. extern HDRVR ghdrvEvil; // in GRAPHIC.C
  476. /*
  477. ** Functions in GRAPHIC.C
  478. */
  479. BOOL FAR PASCAL GraphicInit (void);
  480. BOOL NEAR PASCAL GraphicWindowInit (void);
  481. #ifdef WIN32
  482. BOOL NEAR PASCAL GraphicWindowFree(void);
  483. #endif
  484. void PASCAL GraphicFree (void);
  485. DWORD PASCAL GraphicDrvOpen (LPMCI_OPEN_DRIVER_PARMS lpParms);
  486. void FAR PASCAL GraphicDelayedNotify (NPMCIGRAPHIC npMCI, UINT wStatus);
  487. void FAR PASCAL GraphicImmediateNotify (UINT wDevID,
  488. LPMCI_GENERIC_PARMS lpParms,
  489. DWORD dwFlags, DWORD dwErr);
  490. DWORD PASCAL GraphicClose(NPMCIGRAPHIC npMCI);
  491. DWORD NEAR PASCAL ConvertFromFrames(NPMCIGRAPHIC npMCI, LONG lFrame);
  492. LONG NEAR PASCAL ConvertToFrames(NPMCIGRAPHIC npMCI, DWORD dwTime);
  493. DWORD PASCAL mciDriverEntry(UINT wDeviceID, UINT wMessage, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms);
  494. long FAR PASCAL _loadds GraphicWndProc(HWND, UINT, WPARAM, LPARAM);
  495. void CheckWindowMove(NPMCIGRAPHIC npMCI, BOOL fForce);
  496. /*
  497. ** Functions in DEVICE.C
  498. */
  499. DWORD PASCAL DeviceOpen(NPMCIGRAPHIC npMCI, DWORD dwFlags);
  500. DWORD PASCAL DeviceClose(NPMCIGRAPHIC npMCI);
  501. DWORD PASCAL DevicePlay(NPMCIGRAPHIC npMCI, LONG lPlayTo, DWORD dwFlags);
  502. DWORD PASCAL DeviceResume(NPMCIGRAPHIC npMCI, DWORD dwFlags);
  503. DWORD PASCAL DeviceCue(NPMCIGRAPHIC npMCI, LONG lTo, DWORD dwFlags);
  504. DWORD PASCAL DeviceStop(NPMCIGRAPHIC npMCI, DWORD dwFlags);
  505. DWORD PASCAL DevicePause(NPMCIGRAPHIC npMCI, DWORD dwFlags);
  506. DWORD PASCAL DeviceSeek(NPMCIGRAPHIC npMCI, LONG lTo, DWORD dwFlags);
  507. DWORD PASCAL DeviceRealize(NPMCIGRAPHIC npMCI);
  508. DWORD PASCAL DeviceUpdate(NPMCIGRAPHIC npMCI, DWORD dwFlags, HDC hDC, LPRECT lprc);
  509. UINT PASCAL DeviceMode(NPMCIGRAPHIC npMCI);
  510. DWORD PASCAL DevicePosition(NPMCIGRAPHIC npMCI, LPLONG lpl);
  511. DWORD PASCAL DeviceSetWindow(NPMCIGRAPHIC npMCI, HWND hwnd);
  512. DWORD PASCAL DeviceSetSpeed(NPMCIGRAPHIC npMCI, DWORD dwNewSpeed);
  513. DWORD PASCAL DeviceMute(NPMCIGRAPHIC npMCI, BOOL fMute);
  514. DWORD PASCAL DeviceSetVolume(NPMCIGRAPHIC npMCI, DWORD dwVolume);
  515. DWORD PASCAL DeviceGetVolume(NPMCIGRAPHIC npMCI);
  516. DWORD PASCAL DeviceSetAudioStream(NPMCIGRAPHIC npMCI, UINT uStream);
  517. DWORD PASCAL DeviceSetVideoStream(NPMCIGRAPHIC npMCI, UINT uStream, BOOL fOn);
  518. DWORD PASCAL DeviceSetActive(NPMCIGRAPHIC npMCI, BOOL fActive);
  519. DWORD FAR PASCAL DevicePut(NPMCIGRAPHIC npMCI, LPRECT lprc, DWORD dwFlags);
  520. DWORD FAR PASCAL DeviceSetPalette(NPMCIGRAPHIC npMCI, HPALETTE hpal);
  521. DWORD PASCAL DeviceLoad(NPMCIGRAPHIC npMCI);
  522. typedef struct {
  523. UINT wOldTaskState;
  524. LONG lTo;
  525. LONG lFrom;
  526. DWORD dwFlags;
  527. } TEMPORARYSTATE;
  528. DWORD NEAR PASCAL StopTemporarily(NPMCIGRAPHIC npMCI, TEMPORARYSTATE FAR * pts);
  529. DWORD NEAR PASCAL RestartAgain(NPMCIGRAPHIC npMCI, TEMPORARYSTATE FAR * pts);
  530. #if 0
  531. #ifdef DEBUG
  532. void FAR PASCAL VerifyTaskState(NPMCIGRAPHIC npMCI, UINT wState);
  533. #define DEBUGVERIFYSTATE(npMCI, wState) VerifyTaskState(npMCI, wState)
  534. #else
  535. #define DEBUGVERIFYSTATE(npMCI, wState) 0
  536. #endif
  537. #endif
  538. void FAR PASCAL SetWindowToDefaultSize(NPMCIGRAPHIC npMCI);
  539. void FAR PASCAL ResetDestRect(NPMCIGRAPHIC npMCI);
  540. DWORD FAR PASCAL ReadConfigInfo(void);
  541. void FAR PASCAL WriteConfigInfo(DWORD dwOptions);
  542. BOOL FAR PASCAL ConfigDialog(HWND, NPMCIGRAPHIC);
  543. /*
  544. ** The Enumerate command isn't real: I'm just thinking about it.
  545. */
  546. #define MCI_ENUMERATE 0x0901
  547. #define MCI_ENUMERATE_STREAM 0x00000001L
  548. // constants for dwItem field of MCI_STATUS_PARMS parameter block
  549. #define MCI_AVI_STATUS_STREAMCOUNT 0x10000001L
  550. #define MCI_AVI_STATUS_STREAMTYPE 0x10000002L
  551. #define MCI_AVI_STATUS_STREAMENABLED 0x10000003L
  552. // flags for dwFlags field of MCI_STATUS_PARMS parameter block
  553. #define MCI_AVI_STATUS_STREAM 0x10000000L
  554. // flags for dwFlags field of MCI_SET_PARMS parameter block
  555. #define MCI_AVI_SET_STREAM 0x10000000L
  556. #define MCI_AVI_SET_USERPROC 0x20000000L
  557. /*
  558. ** Internal flag that can be used with SEEK
  559. */
  560. #define MCI_AVI_SEEK_SHOWWINDOW 0x10000000L
  561. extern INT gwSkipTolerance;
  562. extern INT gwHurryTolerance;
  563. /**************************************************************************
  564. **************************************************************************/
  565. #ifdef DEBUG
  566. extern DWORD FAR PASCAL timeGetTime(void);
  567. #define TIMEZERO(time) npMCI->time = 0;
  568. #define TIMESTART(time) npMCI->time -= (LONG)timeGetTime()
  569. #define TIMEEND(time) npMCI->time += (LONG)timeGetTime()
  570. #else
  571. #define TIMEZERO(time)
  572. #define TIMESTART(time)
  573. #define TIMEEND(time)
  574. #endif
  575. /**************************************************************************
  576. **************************************************************************/
  577. #define FOURCC_AVIDraw mmioFOURCC('D','R','A','W')
  578. #define FOURCC_AVIFull mmioFOURCC('F','U','L','L')
  579. LONG FAR PASCAL _loadds ICAVIDrawProc(DWORD id, HDRVR hDriver, UINT uiMessage, LPARAM lParam1, LPARAM lParam2);
  580. LONG FAR PASCAL _loadds ICAVIFullProc(DWORD id, HDRVR hDriver, UINT uiMessage, LPARAM lParam1, LPARAM lParam2);
  581. /**************************************************************************
  582. **************************************************************************/
  583. #ifndef RC_INVOKED
  584. #include "avitask.h"
  585. #endif