SeekLayer.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef NULLSOFT_SEEKLAYERH
  2. #define NULLSOFT_SEEKLAYERH
  3. #include "WMHandler.h"
  4. #include "../nu/AutoLock.h"
  5. #include "ClockLayer.h"
  6. class SeekLayer : public WMHandler
  7. {
  8. enum PlayState
  9. {
  10. PLAYSTATE_NONE,
  11. PLAYSTATE_OPENING,
  12. PLAYSTATE_OPENED,
  13. PLAYSTATE_BUFFERING,
  14. PLAYSTATE_STARTED,
  15. PLAYSTATE_STOPPED,
  16. PLAYSTATE_CLOSED,
  17. PLAYSTATE_SEEK,
  18. };
  19. public:
  20. SeekLayer(IWMReader *_reader, ClockLayer *_clock);
  21. void SeekTo(long position);
  22. void Pause();
  23. void Unpause();
  24. void Stop();
  25. int Open(const wchar_t *filename, IWMReaderCallback *callback);
  26. private:
  27. void BufferingStarted();
  28. void BufferingStopped();
  29. void Started();
  30. void Stopped();
  31. void Closed();
  32. void Opened();
  33. void OpenCalled();
  34. void Connecting();
  35. void Locating();
  36. void EndOfFile();
  37. void OpenFailed();
  38. void Error();
  39. private:
  40. void DoStop();
  41. bool needPause, paused, needStop;
  42. long seekPos;
  43. Nullsoft::Utility::LockGuard seekGuard;
  44. IWMReader *reader;
  45. IWMReaderAdvanced2 *reader2;
  46. IWMMetadataEditor *metadata;
  47. ClockLayer *clock;
  48. PlayState playState, oldState_buffer;
  49. };
  50. #endif