WMHandler.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #ifndef NULLSOFT_WMHANDLERH
  2. #define NULLSOFT_WMHANDLERH
  3. #include <wmsdk.h>
  4. #define NEXT(x) { if (next) next->x; }
  5. enum DRM_INDIVIDUALIZATION_STATUS {
  6. INDI_UNDEFINED = 0x0000,
  7. INDI_BEGIN = 0x0001,
  8. INDI_SUCCEED = 0x0002,
  9. INDI_FAIL = 0x0004,
  10. INDI_CANCEL = 0x0008,
  11. INDI_DOWNLOAD = 0x0010,
  12. INDI_INSTALL = 0x0020
  13. };
  14. enum DRM_HTTP_STATUS {
  15. HTTP_NOTINITIATED = 0,
  16. HTTP_CONNECTING = 1,
  17. HTTP_REQUESTING = 2,
  18. HTTP_RECEIVING = 3,
  19. HTTP_COMPLETED = 4
  20. };
  21. typedef struct _WMGetLicenseData {
  22. DWORD dwSize;
  23. HRESULT hr;
  24. WCHAR* wszURL;
  25. WCHAR* wszLocalFilename;
  26. BYTE* pbPostData;
  27. DWORD dwPostDataSize;
  28. } WM_GET_LICENSE_DATA;
  29. typedef struct _WMIndividualizeStatus {
  30. HRESULT hr;
  31. DRM_INDIVIDUALIZATION_STATUS enIndiStatus;
  32. LPSTR pszIndiRespUrl;
  33. DWORD dwHTTPRequest;
  34. DRM_HTTP_STATUS enHTTPStatus;
  35. DWORD dwHTTPReadProgress;
  36. DWORD dwHTTPReadTotal;
  37. } WM_INDIVIDUALIZE_STATUS;
  38. class WMHandler //: public Chainable<WMHandler>
  39. {
  40. public:
  41. WMHandler();
  42. ~WMHandler();
  43. WMHandler &operator << (WMHandler &chain);
  44. WMHandler &operator >> (WMHandler &chain);
  45. WMHandler&operator << (WMHandler *chain);
  46. WMHandler &operator >> (WMHandler *chain);
  47. WMHandler &First();
  48. virtual void Opened() NEXT(Opened())
  49. virtual void OpenFailed();
  50. virtual void ReOpen();
  51. virtual void SampleReceived(QWORD &timeStamp, QWORD &duration, unsigned long &outputNum, unsigned long &flags, INSSBuffer *&sample)
  52. NEXT(SampleReceived(timeStamp, duration, outputNum, flags, sample))
  53. virtual void AudioDataReceived(void *data, unsigned long sizeBytes, DWORD timestamp)
  54. NEXT(AudioDataReceived(data, sizeBytes, timestamp))
  55. virtual void TimeReached(QWORD &timeReached) NEXT(TimeReached(timeReached))
  56. virtual void NewSourceFlags() NEXT(NewSourceFlags())
  57. virtual void HasVideo(bool &video) NEXT(HasVideo(video))
  58. virtual void Started();
  59. virtual void Stopped();
  60. virtual void Stopping() NEXT(Stopping())
  61. virtual void DRMExpired() NEXT(DRMExpired())
  62. virtual void Error();
  63. virtual void Kill() NEXT(Kill())
  64. virtual void PreRollComplete();
  65. virtual void EndOfFile();
  66. virtual void Closed();
  67. virtual void BufferingStarted();
  68. virtual void BufferingStopped();
  69. virtual void NewMetadata();
  70. virtual void Connecting() NEXT(Connecting())
  71. virtual void Locating() NEXT(Locating())
  72. virtual void Individualize();
  73. virtual void NeedsIndividualization() NEXT(NeedsIndividualization())
  74. virtual void IndividualizeStatus(WM_INDIVIDUALIZE_STATUS *status) NEXT(IndividualizeStatus(status))
  75. virtual void SignatureState(WMT_DRMLA_TRUST *&state);
  76. virtual void NoRights(wchar_t *licenseData);
  77. virtual void NoRightsEx(WM_GET_LICENSE_DATA *&licenseData);
  78. virtual void AcquireLicense(WM_GET_LICENSE_DATA *&licenseData);
  79. virtual void LicenseRequired();
  80. virtual void BrowserClosed() NEXT(BrowserClosed())
  81. virtual void LicenseAcquired() NEXT(LicenseAcquired())
  82. virtual void AllocateOutput(long outputNum, long bufferSize, INSSBuffer *&buffer);
  83. virtual void MonitorCancelled() NEXT(MonitorCancelled())
  84. virtual void SilentCancelled() NEXT(SilentCancelled())
  85. virtual void VideoCatchup(QWORD time);
  86. virtual void TimeToSync(QWORD timeStamp, __int64 &diff);
  87. virtual void OpenCalled() NEXT(OpenCalled())
  88. virtual void InitPlaylistBurn() NEXT(InitPlaylistBurn())
  89. virtual void AccessDenied() NEXT(AccessDenied())
  90. private:
  91. WMHandler *next, *prev;
  92. };
  93. #undef NEXT
  94. #endif