MP4Playback.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include "mp4.h"
  3. #include "file/ifc_fileplayback.h"
  4. #include "mp4/ifc_mp4audiodecoder.h"
  5. #include "MP4MetadataBase.h"
  6. #include "MP4FileObject.h"
  7. #include "nswasabi/MetadataChain.h"
  8. class MP4Playback : public ifc_fileplayback
  9. {
  10. public:
  11. MP4Playback();
  12. ~MP4Playback();
  13. int Initialize(nx_uri_t filename, nx_file_t file, ifc_metadata *parent_metadata, ifc_fileplayback_parent *parent);
  14. private:
  15. ifc_mp4audiodecoder *audio_decoder;
  16. MP4FileHandle mp4_file;
  17. ifc_audioout::Parameters audio_parameters;
  18. MetadataChain<MP4FileObject> *mp4_file_object;
  19. bool output_opened;
  20. double samples_per_second;
  21. nx_file_t file;
  22. ifc_fileplayback_parent *parent;
  23. nx_uri_t filename;
  24. private:
  25. int Init(nx_file_t file, ifc_metadata *parent_metadata);
  26. int Configure();
  27. void WASABICALL FilePlayback_Close();
  28. ns_error_t WASABICALL FilePlayback_Seekable();
  29. ns_error_t WASABICALL FilePlayback_GetMetadata(ifc_metadata **metadata);
  30. ns_error_t WASABICALL FilePlayback_GetLength(double *length, ns_error_t *exact);
  31. ns_error_t WASABICALL FilePlayback_GetBitrate(double *bitrate, ns_error_t *exact);
  32. ns_error_t WASABICALL FilePlayback_Seek(const Agave_Seek *seek, ns_error_t *seek_error, double *new_position);
  33. ns_error_t WASABICALL FilePlayback_DecodeStep();
  34. ns_error_t WASABICALL FilePlayback_Interrupt(Agave_Seek *resume_information);
  35. ns_error_t WASABICALL FilePlayback_Resume(Agave_Seek *resume_information, nx_file_t file, ifc_metadata *parent_metadata);
  36. };