api_decode.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include "foundation/dispatch.h"
  3. #include "audio/ifc_audio_decoder_callback.h"
  4. #include "audio/parameters.h"
  5. #include "service/types.h"
  6. #include "nx/nxuri.h"
  7. // {AA4404BC-69E7-4898-9296-420F774C3331}
  8. static const GUID decode_api_service_guid =
  9. { 0xaa4404bc, 0x69e7, 0x4898, { 0x92, 0x96, 0x42, 0xf, 0x77, 0x4c, 0x33, 0x31 } };
  10. /* benski> some of this is TODO as of 25-Jan-2012
  11. We want to have several ways to create a decoder
  12. 1) Simple method. Create a decoder of the desired style (callback, pull, packet). api_decode will convert between styles if necessary
  13. 2) Constraint method: Non-zero values for nsaudio::Parameters members are treated as requirements and api_decode will convert. Flags might indicate that sample rate or channels is a "maximum" rather than a strict requirement
  14. 3) Multiple nsaudio::Parameters values. Used if you are a little more flexible in the data format, e.g. if you can handle 16bit audio or floating point
  15. */
  16. class api_decode : public Wasabi2::Dispatchable
  17. {
  18. protected:
  19. api_decode() : Wasabi2::Dispatchable(DISPATCHABLE_VERSION) {}
  20. ~api_decode() {}
  21. public:
  22. static GUID GetServiceType() { return SVC_TYPE_UNIQUE; }
  23. static GUID GetServiceGUID() { return decode_api_service_guid; }
  24. int CreateAudioDecoder_Callback(ifc_audio_decoder_callback **decoder, nx_uri_t filename, nsaudio::Parameters *parameters, int flags) { return DecodeAPI_CreateAudioDecoder_Callback(decoder, filename, parameters, flags); }
  25. enum
  26. {
  27. DISPATCHABLE_VERSION=0,
  28. };
  29. private:
  30. virtual int WASABICALL DecodeAPI_CreateAudioDecoder_Callback(ifc_audio_decoder_callback **decoder, nx_uri_t filename, nsaudio::Parameters *parameters, int flags)=0;
  31. };