ifc_mp4audiodecoder.h 1.9 KB

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include "foundation/dispatch.h"
  3. #include "ifc_mp4file.h"
  4. #include "audio/ifc_audioout.h"
  5. class ifc_mp4audiodecoder : public Wasabi2::Dispatchable
  6. {
  7. protected:
  8. ifc_mp4audiodecoder() : Dispatchable(DISPATCHABLE_VERSION) {}
  9. ~ifc_mp4audiodecoder() {}
  10. public:
  11. int FillAudioParameters(ifc_audioout::Parameters *parameters) { return MP4AudioDecoder_FillAudioParameters(parameters); }
  12. int Decode(const void **output_buffer, size_t *output_buffer_bytes, double *start_position, double *end_position) { return MP4AudioDecoder_Decode(output_buffer, output_buffer_bytes, start_position, end_position); }
  13. int Seek(ifc_mp4file::SampleID sample_number) { return MP4AudioDecoder_Seek(sample_number); }
  14. int SeekSeconds(double *seconds) { return MP4AudioDecoder_SeekSeconds(seconds); }
  15. int ConnectFile(ifc_mp4file *new_file) { return MP4AudioDecoder_ConnectFile(new_file); }
  16. enum
  17. {
  18. DISPATCHABLE_VERSION,
  19. };
  20. private:
  21. /* sizeof_parameters will already be filled out for you */
  22. virtual int WASABICALL MP4AudioDecoder_FillAudioParameters(ifc_audioout::Parameters *parameters)=0;
  23. virtual int WASABICALL MP4AudioDecoder_Decode(const void **output_buffer, size_t *output_buffer_bytes, double *start_position, double *end_position)=0;
  24. virtual int WASABICALL MP4AudioDecoder_Seek(ifc_mp4file::SampleID sample_number) = 0;
  25. /* fill in with the actual seconds you'll resume playback at */
  26. virtual int WASABICALL MP4AudioDecoder_SeekSeconds(double *seconds) = 0;
  27. /* this is an unfortunate wart in the API. In order to support editing metadata on an actively playing file, we have to re-open the file which will generate a new ifc_mp4file object.
  28. do _not_ reset the decoder or change the sample number. You should assume the file is identical from a playback point-of-view, just release your old object and retain/assign the new one */
  29. virtual int WASABICALL MP4AudioDecoder_ConnectFile(ifc_mp4file *new_file)=0;
  30. };