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.

209 lines
7.0 KiB

  1. /****************************************************************************
  2. Task State : MCIAVI has a separate background task for every open
  3. instance of mciavi. The task handle and task state are stored in
  4. the per-instance data structure. The task can be in one of four
  5. states.
  6. TASKABORT : Set by the AVI task when it fails to open the requested
  7. file during initialisation.
  8. N.B. TASKINIT is no longer used
  9. TASKINIT : This is the initial task state set when the
  10. instance data structure is initialized in mwOpenDevice()
  11. before the actual task is created by mmTaskCreate().
  12. After the task is created, mwOpenDevice() waits until
  13. the task state changes to TASKIDLE before returning
  14. success so that the background task is definitely initialized
  15. after an open call.
  16. TASKIDLE : The task sets the state to TASKIDLE and blocks whenever
  17. there is nothing to do. When the task wakes, the state is either
  18. TASKCLOSE if the instance is being closed or else TASKBUSY
  19. if the task is to begin recording or playback of the file.
  20. TASKCLOSE : mwCloseDevice() stops playback or recording which forces
  21. the task state to TASKIDLE and then sets the state to TASKCLOSE and
  22. wakes the task so that the task will destroy itself.
  23. TASKSTARTING: The task is in this state when it is initializing for
  24. playback, but hasn't started yet. This is used so that the calling
  25. task can wait for play to start before returning "no error" as the
  26. result of an MCI play command.
  27. TASKCUEING: The task is in this state when it is reading extra
  28. records and buffering up audio before actually starting to play.
  29. TASKPAUSED: The task is in this state while it is paused.
  30. TASKPLAYING: The task is in this state during playback
  31. ****************************************************************************/
  32. #define TASKABORT 0
  33. //#define TASKBEINGCREATED 1
  34. //#define TASKINIT 2
  35. #define TASKIDLE 3
  36. #define TASKSTARTING 4
  37. #define TASKCUEING 5
  38. #define TASKPLAYING 6
  39. #define TASKPAUSED 7
  40. #define TASKCLOSE 8
  41. // 9
  42. // 10
  43. //#define TASKREADINDEX 11
  44. //#define TASKRELOAD 12
  45. // inter-thread requests - from user to worker
  46. #define AVI_CLOSE 1
  47. #define AVI_PLAY 2
  48. #define AVI_STOP 3
  49. #define AVI_REALIZE 4
  50. #define AVI_UPDATE 5
  51. #define AVI_PAUSE 6
  52. #define AVI_CUE 7
  53. #define AVI_SEEK 8
  54. #define AVI_WINDOW 9
  55. #define AVI_SETSPEED 10
  56. #define AVI_MUTE 11
  57. #define AVI_SETVOLUME 12
  58. #define AVI_AUDIOSTREAM 13
  59. #define AVI_VIDEOSTREAM 14
  60. #define AVI_PUT 15
  61. #define AVI_PALETTE 16
  62. #define AVI_RESUME 17
  63. #define AVI_GETVOLUME 18
  64. #define AVI_WAVESTEAL 19
  65. #define AVI_WAVERETURN 20
  66. #define AVI_PALETTECOLOR 21
  67. /* A function back in device.c */
  68. void NEAR PASCAL ShowStage(NPMCIGRAPHIC npMCI);
  69. //
  70. // call this to RTL to AVIFile.
  71. //
  72. BOOL FAR InitAVIFile(NPMCIGRAPHIC npMCI);
  73. BOOL FAR FreeAVIFile(NPMCIGRAPHIC npMCI);
  74. /* Functions in avitask.c */
  75. void FAR PASCAL _LOADDS mciaviTask(DWORD_PTR dwInst);
  76. void FAR PASCAL mciaviTaskCleanup(NPMCIGRAPHIC npMCI);
  77. /* Functions in aviplay.c */
  78. UINT NEAR PASCAL mciaviPlayFile(NPMCIGRAPHIC npMCI, BOOL bSetEvent);
  79. /* Functions in avidraw.c */
  80. /* !!! Should this be externally visible? */
  81. BOOL NEAR PASCAL DoStreamUpdate(NPMCIGRAPHIC npMCI, BOOL fPaint);
  82. void NEAR PASCAL StreamInvalidate(NPMCIGRAPHIC npMCI, LPRECT prc);
  83. UINT NEAR PASCAL PrepareDC(NPMCIGRAPHIC npMCI);
  84. void NEAR PASCAL UnprepareDC(NPMCIGRAPHIC npMCI);
  85. BOOL FAR PASCAL DrawBegin(NPMCIGRAPHIC npMCI, BOOL FAR *fRestart);
  86. void NEAR PASCAL DrawEnd(NPMCIGRAPHIC npMCI);
  87. BOOL NEAR PASCAL DisplayVideoFrame(NPMCIGRAPHIC npMCI, BOOL fHurryUp);
  88. BOOL NEAR PASCAL ProcessPaletteChange(NPMCIGRAPHIC npMCI, DWORD cksize);
  89. /* Functions in avisound.c */
  90. BOOL NEAR PASCAL PlayRecordAudio(NPMCIGRAPHIC npMCI, BOOL FAR *pfHurryUp,
  91. BOOL FAR *pfPlayedAudio);
  92. BOOL NEAR PASCAL KeepPlayingAudio(NPMCIGRAPHIC npMCI);
  93. BOOL NEAR PASCAL HandleAudioChunk(NPMCIGRAPHIC npMCI);
  94. DWORD FAR PASCAL SetUpAudio(NPMCIGRAPHIC npMCI, BOOL fPlaying);
  95. DWORD FAR PASCAL CleanUpAudio(NPMCIGRAPHIC npMCI);
  96. void FAR PASCAL BuildVolumeTable(NPMCIGRAPHIC npMCI);
  97. BOOL FAR PASCAL StealWaveDevice(NPMCIGRAPHIC npMCI);
  98. BOOL FAR PASCAL GiveWaveDevice(NPMCIGRAPHIC npMCI);
  99. /* Functions in aviopen.c */
  100. BOOL FAR PASCAL mciaviCloseFile(NPMCIGRAPHIC npMCI);
  101. // now called on app thread
  102. BOOL FAR PASCAL mciaviOpenFile(NPMCIGRAPHIC npMCI);
  103. // called on worker thread to complete
  104. BOOL NEAR PASCAL OpenFileInit(NPMCIGRAPHIC npMCI);
  105. /* Messages used to control switching of audio between (and within)
  106. * applications. These messages are POSTED, hence audio switching will
  107. * be asynchronous. The timing depends on various factors: machine load,
  108. * video speed, etc.. We should probably do this via RegisterWindowMessage
  109. */
  110. #define WM_AUDIO_ON WM_USER+100
  111. #define WM_AUDIO_OFF WM_USER+101
  112. // messages sent to winproc thread - set up using RegisterWindowMessage
  113. // in drvproc.c
  114. #define AVIM_DESTROY (WM_USER+103)
  115. #define AVIM_SHOWSTAGE (WM_USER+104)
  116. //#define AVIM_DESTROY (mAVIM_DESTROY)
  117. //#define AVIM_SHOWSTAGE (mAVIM_SHOWSTAGE)
  118. //extern UINT mAVIM_DESTROY;
  119. //extern UINT mAVIM_SHOWSTAGE;
  120. // in hmemcpy.asm
  121. #ifndef _WIN32
  122. LPVOID FAR PASCAL MemCopy(LPVOID dest, LPVOID source, LONG count);
  123. #else
  124. #define MemCopy memmove
  125. #endif // WIN16
  126. #define GET_BYTE() (*((BYTE _huge *) (npMCI->lp))++)
  127. #ifdef _WIN32
  128. #define GET_WORD() (*((UNALIGNED WORD _huge *) (npMCI->lp))++)
  129. #define GET_DWORD() (*((UNALIGNED DWORD _huge *) (npMCI->lp))++)
  130. #define PEEK_DWORD() (*((UNALIGNED DWORD _huge *) (npMCI->lp)))
  131. #else
  132. #define GET_WORD() (*((WORD _huge *) (npMCI->lp))++)
  133. #define GET_DWORD() (*((DWORD _huge *) (npMCI->lp))++)
  134. #define PEEK_DWORD() (*((DWORD _huge *) (npMCI->lp)))
  135. #endif
  136. #define SKIP_BYTES(nBytes) ((npMCI->lp) += (nBytes))
  137. #define Now() (timeGetTime())
  138. void NEAR PASCAL aviTaskCheckRequests(NPMCIGRAPHIC npMCI);
  139. BOOL FAR PASCAL ReadIndex(NPMCIGRAPHIC npMCI);
  140. LONG NEAR PASCAL FindPrevKeyFrame(NPMCIGRAPHIC npMCI, STREAMINFO *psi, LONG lFrame);
  141. LONG NEAR PASCAL FindNextKeyFrame(NPMCIGRAPHIC npMCI, STREAMINFO *psi, LONG lFrame);
  142. //
  143. // try to set the dest or source rect without stopping play.
  144. // called both at stop time and at play time
  145. //
  146. // returns TRUE if stop needed, or else FALSE if all handled.
  147. // lpdwErr is set to a non-zero error if any error occured (in which case
  148. // FALSE will be returned.
  149. //
  150. BOOL TryPutRect(NPMCIGRAPHIC npMCI, DWORD dwFlags, LPRECT lprc, LPDWORD lpdwErr);
  151. // called on worker thread only
  152. DWORD InternalSetVolume(NPMCIGRAPHIC npMCI, DWORD dwVolume);
  153. DWORD InternalGetVolume(NPMCIGRAPHIC npMCI);
  154. DWORD Internal_Update(NPMCIGRAPHIC npMCI, DWORD dwFlags, HDC hdc, LPRECT lprc);
  155. // called on winproc or worker thread
  156. DWORD InternalRealize(NPMCIGRAPHIC npMCI);
  157. BOOL TryStreamUpdate(
  158. NPMCIGRAPHIC npMCI,
  159. DWORD dwFlags,
  160. HDC hdc,
  161. LPRECT lprc
  162. );
  163. // called to release the synchronous portion of a command
  164. void TaskReturns(NPMCIGRAPHIC npMCI, DWORD dwErr);