DESIGN.txt 1.7 KB

12345678910111213141516171819202122232425262728293031323334
  1. Windows Media works in an asynchronous manner.
  2. The WM Decompressor (IWMReader) requires that you provide a class
  3. deriving from IWMReader (and, optionally, IWMReaderAdvanced) to receive information
  4. Each delivery of uncompressed media arrives in an OnSample method
  5. Status messages arrive in an OnStatus method.
  6. The main difficulty that arrives from this approach is that ALL messages funnel through
  7. a single function. Audio data and Video data arrive in the same function.
  8. Even worse, status messages for file opened, clock error, http buffering, and DRM requirements all arrive in the same function!
  9. In order to handle this properly, a "chain of event handlers" class was developed (WMHandler)
  10. Any object wishing to receive data or status messages can derive from the WMHandler. All unhandled
  11. messages are automatically passed to the next handler in the chain. Messages that are handled can be
  12. passed or not passed based on programming requirements.
  13. The main object sets up the chain. The >> operator has been convienently defined to faciliate the chaining.
  14. The left side of the >> line must be the source (WMCallback)
  15. (e.g. callback >> clock >> drm >> video >> audio >> wait >> this;)
  16. Handlers may create their own mini-chains (which will get added in-whole) using the WMHandler::Inject() method.
  17. Threading
  18. ------
  19. 7 basic threads
  20. 1. Main (Windows) thread
  21. 2. Callback/OnStatus thread
  22. 3. Audio Decoder thread
  23. 4. Video Decoder thread
  24. 5. Audio buffering thread (ours)
  25. 6. Video buffering thread (ours)
  26. 7. Buffering-percent status thread (ours)
  27. There might be additional threads (created in another module) calling in, for functions like getextendedfileinfo