RawReader.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include "../Agave/DecodeFile/svc_raw_media_reader.h"
  3. #include "../Agave/DecodeFile/ifc_raw_media_reader.h"
  4. #include <mmreg.h>
  5. #include <wmsdk.h>
  6. // {9AF5FD89-DC41-4F2A-A156-8D1399FDE57B}
  7. static const GUID wm_raw_reader_guid =
  8. { 0x9af5fd89, 0xdc41, 0x4f2a, { 0xa1, 0x56, 0x8d, 0x13, 0x99, 0xfd, 0xe5, 0x7b } };
  9. class RawMediaReaderService : public svc_raw_media_reader
  10. {
  11. public:
  12. static const char *getServiceName() { return "Windows Media Audio Raw Reader"; }
  13. static GUID getServiceGuid() { return wm_raw_reader_guid; }
  14. int CreateRawMediaReader(const wchar_t *filename, ifc_raw_media_reader **reader);
  15. protected:
  16. RECVS_DISPATCH;
  17. };
  18. class RawMediaReader : public ifc_raw_media_reader
  19. {
  20. public:
  21. RawMediaReader();
  22. ~RawMediaReader();
  23. int Initialize(IWMSyncReader *reader);
  24. int Read(void *buffer, size_t buffer_size, size_t *bytes_read);
  25. size_t Release();
  26. protected:
  27. RECVS_DISPATCH;
  28. private:
  29. IWMSyncReader *reader;
  30. WORD stream_num;
  31. INSSBuffer *buffer;
  32. size_t buffer_used;
  33. bool end_of_file;
  34. QWORD length;
  35. DWORD next_output;
  36. };