1
0

RawReader.h 981 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include "../Agave/DecodeFile/svc_raw_media_reader.h"
  3. #include "../Agave/DecodeFile/ifc_raw_media_reader.h"
  4. #include "FLACFileCallbacks.h"
  5. #include <FLAC/all.h>
  6. // {E906F4DC-3080-4B9B-951F-85950193ACBF}
  7. static const GUID flac_raw_reader_guid =
  8. { 0xe906f4dc, 0x3080, 0x4b9b, { 0x95, 0x1f, 0x85, 0x95, 0x1, 0x93, 0xac, 0xbf } };
  9. class RawMediaReaderService : public svc_raw_media_reader
  10. {
  11. public:
  12. static const char *getServiceName() { return "FLAC Raw Reader"; }
  13. static GUID getServiceGuid() { return flac_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(nx_file_t );
  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. FLAC__StreamDecoder *decoder;
  30. FLACClientData state;
  31. nx_file_t file;
  32. };